[cfe-dev] Getting a DeclarationName with name "default"

Lingda Li via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 26 08:03:52 PST 2018


Hi!


I just encountered this problem when implementing a new feature in OpenMP
5.0, which is called user defined mapper (the details of this feature are
irrelevant to this question).


I need to build a NamedDecl. In some cases, programs will provide a name.
In these cases, I will use the token of the name to get
the corresponding DeclarationName from ASTContect::DeclarationNames, which
will be used to initiate the NamedDecl I want.

The code is like:

DeclarationName ID
= Actions.getASTContext().DeclarationNames.getIdentifier(Tok.getIdentifierInfo())
;


In other cases, programs do not provide a name, and the name should be the
keyword "default" in these cases. No "default" token is available from the
preprocessor in these cases so the previous method does not work.


My question is, in the later cases, how do I create a DeclarationName with
the name "default", so that I can create the NamedDecl later? Any feedback
will be much appreciated!


Thanks a lot,


Lingda Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181126/cb4dd187/attachment.html>


More information about the cfe-dev mailing list