<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">Hi!</p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">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).</p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">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.</p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">The code is like:</p><p style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="Calibri, Helvetica, sans-serif, serif, EmojiFont"><span style="font-size:16px">DeclarationName ID = Actions.getASTContext().DeclarationNames.getIdentifier(Tok.getIdentifierInfo())</span></font><span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">;</span></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">In other cases, programs do not provide a name, and the name should be the keyword "default" in these cases. <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">No "default" </span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">token is available from the preprocessor in these cases so the previous method does not work</span><span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">.</span></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">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? <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">Any feedback will be much appreciated!</span></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">Thanks a lot,</p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px"><br></p><p style="margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">Lingda Li</p></div></div></div></div>