[flang-dev] How to check when a Derived type is being defined inside resolve-names.cc

Doerfert, Johannes via flang-dev flang-dev at lists.llvm.org
Fri Dec 20 10:43:24 PST 2019


Hi Carol,

While I cannot help you with any of this, sorry!, I would kindly ask you
and others to write up the things that need clarification afterwards in
code comments and method (doxygen) documentation, if applicable of
course.

Happy holidays!


On 12/20, Caroline Concatto via flang-dev wrote:
> 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
> 
> 

> _______________________________________________
> flang-dev mailing list
> flang-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev


-- 

Johannes Doerfert
Researcher

Argonne National Laboratory
Lemont, IL 60439, USA

jdoerfert at anl.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191220/03fd2b5c/attachment-0001.sig>


More information about the flang-dev mailing list