[flang-dev] How to check when a Derived type is being defined inside resolve-names.cc
Caroline Concatto via flang-dev
flang-dev at lists.llvm.org
Fri Dec 20 03:22:41 PST 2019
Hey you all,
Me again, this time I have problem to check when a derived type is being defined.
I would like to check when inside BlockData if a symbol is a derived type being defined.
The function CheckDerivedTypeDefinition should check if a new declaration type is being defined.
void ResolveNamesVisitor::CheckDerivedTypeDefinition() {
for (auto &pair : currScope()) {
auto &symbol{*pair.second};
if (currScope().kind() == Scope::Kind::BlockData){
if (symbol.has<AssocEntityDetails>() || GetDeclTypeSpec()){
Say(symbol.name(),
"'%s' is declaration type definition"_err_en_US);
}
}
}
}
I image these ones only check if the type is a derived type or if it has a type defined
currScope().IsDerivedType() || symbol.GetType()
but not a derived type declaration
I can see there is a method:
void ConstructVisitor::Post(const parser::TypeGuardStmt::Guard &x)
Is this one checking when a derived type is being defined?
I believe this is allowed inside BlockData:
block data bdderivedtype
type mytype
integer:: i
end type mytype
type (mytype) var
end block data
PS.: I’ve created the Scope::Kind::BlockData, as it was not defined yet and I needed to make the semantic checks.
Thank you,
Carol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191220/c825feb8/attachment.html>
More information about the flang-dev
mailing list