[PATCH] D77814: [flang] Add missing check for unresolved name

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 20:08:26 PDT 2020


jdoerfert added inline comments.


================
Comment at: flang/lib/Semantics/check-io.cpp:300
   }
 }
 
----------------
For a follow up maybe:
Style: What about early exits? At level 5 this really makes a difference:


```
void IoChecker::Enter(const parser::InputItem &spec) {
  flags_.set(Flag::DataList);
  const parser::Variable * var{std::get_if<parser::Variable>(&spec.u)});
  if (!var)
    return;

  const parser::Name &name{GetLastName(*var)};
  if (!name.symbol)
    return;

  auto *details{name.symbol->detailsIf<ObjectEntityDetails>()}; 
  if (!details)
    return;

  // TODO: Determine if this check is needed at all, and if so, replace
  // the false subcondition with a check for a whole array.  Otherwise,
  // the check incorrectly flags array element and section references.
  if (details->IsAssumedSize() && false) {
    // This check may be superseded by C928 or C1002.
    context_.Say(name.source,
     "'%s' must not be a whole assumed size array"_err_en_US,
      name.source); // C1231
  }
}
```


(Notwithstanding the `&& false`...)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77814/new/

https://reviews.llvm.org/D77814





More information about the llvm-commits mailing list