Skip to content

Commit

Permalink
[flang] address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
klausler committed Aug 9, 2019
1 parent f13f372 commit bc4d468
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions flang/lib/semantics/resolve-names.cc
Expand Up @@ -3429,7 +3429,7 @@ void DeclarationVisitor::Post(

void DeclarationVisitor::CheckBindings(
const parser::TypeBoundProcedureStmt::WithoutInterface &tbps) {
CHECK(currScope().kind() == Scope::Kind::DerivedType);
CHECK(currScope().IsDerivedType());
for (auto &declaration : tbps.declarations) {
auto &bindingName{std::get<parser::Name>(declaration.t)};
if (Symbol * binding{FindInScope(currScope(), bindingName)}) {
Expand Down Expand Up @@ -5511,7 +5511,7 @@ class DeferredCheckVisitor {
const auto &name{std::get<parser::Name>(x.t)};
if (Symbol * symbol{name.symbol}) {
if (Scope * scope{symbol->scope()}) {
if (scope->kind() == Scope::Kind::DerivedType) {
if (scope->IsDerivedType()) {
resolver_.PushScope(*scope);
pushedScope_ = true;
}
Expand Down
4 changes: 3 additions & 1 deletion flang/lib/semantics/symbol.h
Expand Up @@ -204,13 +204,15 @@ class ProcEntityDetails : public EntityDetails, public WithPassArg {
void set_interface(const ProcInterface &interface) { interface_ = interface; }
inline bool HasExplicitInterface() const;

// Be advised: !init().has_value() => uninitialized pointer,
// while *init() == nullptr => explicit NULL() initialization.
std::optional<const Symbol *> init() const { return init_; }
void set_init(const Symbol &symbol) { init_ = &symbol; }
void set_init(std::nullptr_t) { init_ = nullptr; }

private:
ProcInterface interface_;
std::optional<const Symbol *> init_; // if present but null => NULL()
std::optional<const Symbol *> init_;
friend std::ostream &operator<<(std::ostream &, const ProcEntityDetails &);
};

Expand Down
2 changes: 1 addition & 1 deletion flang/test/semantics/resolve20.f90
@@ -1,4 +1,4 @@
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
! Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion flang/test/semantics/resolve32.f90
@@ -1,4 +1,4 @@
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
! Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
Expand Down

0 comments on commit bc4d468

Please sign in to comment.