<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 2:35 AM, Romanova, Katya <span dir="ltr"><<a href="mailto:Katya_Romanova@playstation.sony.com" target="_blank">Katya_Romanova@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi David,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank you so much for the review.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I copied and pasted the diff file. Let me know if it’s OK to commit.<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">>> Could/should this ^ just be: Opts.DebugExplicitImport = Triple.isPS4CPU(); ?
<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Done.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">>> Extra semicolon here ^<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Done.</span></p></div></div></blockquote><div><br></div><div>Thanks! Feel free to commit those changes. (you're welcome to commit changes like that without review, btw)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">>> And is there any reason not to just use nullptr here and elsewhere? Anything with the substring "PtrTy" in the name seems like it should be pointer-like
 and be convertible from nullptr_t, no? (what is DeclGroupPtrTy?)<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">No, it's not convertible from nullptr_t.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">/home/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:68:12: error: could not cnvert ‘nullptr’ from ‘std::nullptr_t’ to ‘clang::Parser::DeclGroupPtrTy {aka clang::OpaquePtr<clang:DeclGroupRef>}’<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">     return nullptr;</span></p></div></div></blockquote><div><br></div><div>Ah - well, I fixed that and updated every instance of the old code to use nullptr instead.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Index: lib/Frontend/CompilerInvocation.cpp<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">===================================================================<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--- lib/Frontend/CompilerInvocation.cpp (revision 256140)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">+++ lib/Frontend/CompilerInvocation.cpp (working copy)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">@@ -1,4 +1,4 @@<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-//===--- CompilerInvocation.cpp -------------------------------------------===//<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">+//===---<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">//<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">//                     The LLVM Compiler Infrastructure<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">//<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">@@ -417,8 +417,7 @@<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-  if (Triple.isPS4CPU())<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-    Opts.DebugExplicitImport = true;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">+  Opts.DebugExplicitImport = Triple.isPS4CPU();<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">     Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Index: lib/Parse/ParseDeclCXX.cpp<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">===================================================================<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--- lib/Parse/ParseDeclCXX.cpp  (revision 256140)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">+++ lib/Parse/ParseDeclCXX.cpp  (working copy)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">@@ -65,7 +65,7 @@<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   if (Tok.is(tok::code_completion)) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">     Actions.CodeCompleteNamespaceDecl(getCurScope());<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">     cutOffParsing();<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">-    return DeclGroupPtrTy();;<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">+    return DeclGroupPtrTy();<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">   SourceLocation IdentLoc;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank you!<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Katya.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Sunday, December 13, 2015 3:46 PM<br>
<b>To:</b> Romanova, Katya<br>
<b>Cc:</b> cfe-commits<br>
<b>Subject:</b> Re: r255281 - Do not generate DW_TAG_imported_module for anonymous namespaces (even nested) for all the platforms except PS4.<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Thu, Dec 10, 2015 at 10:52 AM, Ekaterina Romanova via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p>
<p class="MsoNormal">Author: kromanova<br>
Date: Thu Dec 10 12:52:50 2015<br>
New Revision: 255281<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=255281&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=255281&view=rev</a><br>
Log:<br>
Do not generate DW_TAG_imported_module for anonymous namespaces (even nested) for all the platforms except PS4.<br>
For PS4, generate explicit import for anonymous namespaces and mark it by DW_AT_artificial attribute.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D12624" target="_blank">http://reviews.llvm.org/D12624</a><br>
<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp<br>
Modified:<br>
    cfe/trunk/include/clang/Frontend/CodeGenOptions.def<br>
    cfe/trunk/include/clang/Parse/Parser.h<br>
    cfe/trunk/include/clang/Sema/Sema.h<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
    cfe/trunk/lib/Parse/ParseDecl.cpp<br>
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)<br>
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Dec 10 12:52:50 2015<br>
@@ -166,6 +166,10 @@ CODEGENOPT(DebugColumnInfo, 1, 0) ///< W<br>
 CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain<br>
                                    ///< external references to a PCH or module.<br>
<br>
+CODEGENOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should<br>
+                                       ///< contain explicit imports for<br>
+                                       ///< anonymous namespaces<br>
+<br>
 CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.<br>
<br>
 /// The user specified number of registers to be used for integral arguments,<br>
<br>
Modified: cfe/trunk/include/clang/Parse/Parser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Parse/Parser.h (original)<br>
+++ cfe/trunk/include/clang/Parse/Parser.h Thu Dec 10 12:52:50 2015<br>
@@ -2337,8 +2337,8 @@ private:<br>
<br>
   void DiagnoseUnexpectedNamespace(NamedDecl *Context);<br>
<br>
-  Decl *ParseNamespace(unsigned Context, SourceLocation &DeclEnd,<br>
-                       SourceLocation InlineLoc = SourceLocation());<br>
+  DeclGroupPtrTy ParseNamespace(unsigned Context, SourceLocation &DeclEnd,<br>
+                                SourceLocation InlineLoc = SourceLocation());<br>
   void ParseInnerNamespace(std::vector<SourceLocation>& IdentLoc,<br>
                            std::vector<IdentifierInfo*>& Ident,<br>
                            std::vector<SourceLocation>& NamespaceLoc,<br>
<br>
Modified: cfe/trunk/include/clang/Sema/Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Sema/Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Dec 10 12:52:50 2015<br>
@@ -4093,7 +4093,8 @@ public:<br>
                                SourceLocation IdentLoc,<br>
                                IdentifierInfo *Ident,<br>
                                SourceLocation LBrace,<br>
-                               AttributeList *AttrList);<br>
+                               AttributeList *AttrList,<br>
+                               UsingDirectiveDecl * &UsingDecl);<br>
   void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);<br>
<br>
   NamespaceDecl *getStdNamespace() const;<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Dec 10 12:52:50 2015<br>
@@ -3408,10 +3408,14 @@ llvm::DIScope *CGDebugInfo::getCurrentCo<br>
 void CGDebugInfo::EmitUsingDirective(const UsingDirectiveDecl &UD) {<br>
   if (CGM.getCodeGenOpts().getDebugInfo() < CodeGenOptions::LimitedDebugInfo)<br>
     return;<br>
-  DBuilder.createImportedModule(<br>
-      getCurrentContextDescriptor(cast<Decl>(UD.getDeclContext())),<br>
-      getOrCreateNameSpace(UD.getNominatedNamespace()),<br>
-      getLineNumber(UD.getLocation()));<br>
+  const NamespaceDecl *NSDecl = UD.getNominatedNamespace();<br>
+  if (!NSDecl->isAnonymousNamespace() ||<br>
+      CGM.getCodeGenOpts().DebugExplicitImport) {<br>
+    DBuilder.createImportedModule(<br>
+        getCurrentContextDescriptor(cast<Decl>(UD.getDeclContext())),<br>
+        getOrCreateNameSpace(NSDecl),<br>
+        getLineNumber(UD.getLocation()));<br>
+  }<br>
 }<br>
<br>
 void CGDebugInfo::EmitUsingDecl(const UsingDecl &UD) {<br>
<br>
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Dec 10 12:52:50 2015<br>
@@ -365,6 +365,7 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
                              const TargetOptions &TargetOpts) {<br>
   using namespace options;<br>
   bool Success = true;<br>
+  llvm::Triple Triple = llvm::Triple(TargetOpts.Triple);<br>
<br>
   unsigned OptimizationLevel = getOptimizationLevel(Args, IK, Diags);<br>
   // TODO: This could be done in Driver<br>
@@ -409,6 +410,8 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);<br>
   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);<br>
   Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);<br>
+  if (Triple.isPS4CPU())<br>
+    Opts.DebugExplicitImport = true;<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Could/should this ^ just be: Opts.DebugExplicitImport = Triple.isPS4CPU(); ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><br>
   for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))<br>
     Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Dec 10 12:52:50 2015<br>
@@ -1465,15 +1465,13 @@ Parser::DeclGroupPtrTy Parser::ParseDecl<br>
     if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_namespace)) {<br>
       ProhibitAttributes(attrs);<br>
       SourceLocation InlineLoc = ConsumeToken();<br>
-      SingleDecl = ParseNamespace(Context, DeclEnd, InlineLoc);<br>
-      break;<br>
+      return ParseNamespace(Context, DeclEnd, InlineLoc);<br>
     }<br>
     return ParseSimpleDeclaration(Context, DeclEnd, attrs,<br>
                                   true);<br>
   case tok::kw_namespace:<br>
     ProhibitAttributes(attrs);<br>
-    SingleDecl = ParseNamespace(Context, DeclEnd);<br>
-    break;<br>
+    return ParseNamespace(Context, DeclEnd);<br>
   case tok::kw_using:<br>
     SingleDecl = ParseUsingDirectiveOrDeclaration(Context, ParsedTemplateInfo(),<br>
                                                   DeclEnd, attrs, &OwnedType);<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu Dec 10 12:52:50 2015<br>
@@ -55,9 +55,9 @@ using namespace clang;<br>
 ///       namespace-alias-definition:  [C++ 7.3.2: namespace.alias]<br>
 ///         'namespace' identifier '=' qualified-namespace-specifier ';'<br>
 ///<br>
-Decl *Parser::ParseNamespace(unsigned Context,<br>
-                             SourceLocation &DeclEnd,<br>
-                             SourceLocation InlineLoc) {<br>
+Parser::DeclGroupPtrTy Parser::ParseNamespace(unsigned Context,<br>
+                                              SourceLocation &DeclEnd,<br>
+                                              SourceLocation InlineLoc) {<br>
   assert(Tok.is(tok::kw_namespace) && "Not a namespace!");<br>
   SourceLocation NamespaceLoc = ConsumeToken();  // eat the 'namespace'.<br>
   ObjCDeclContextSwitch ObjCDC(*this);<br>
@@ -65,7 +65,7 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
   if (Tok.is(tok::code_completion)) {<br>
     Actions.CodeCompleteNamespaceDecl(getCurScope());<br>
     cutOffParsing();<br>
-    return nullptr;<br>
+    return DeclGroupPtrTy();;<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Extra semicolon here ^<br>
<br>
And is there any reason not to just use nullptr here and elsewhere? Anything with the substring "PtrTy" in the name seems like it should be pointer-like and be convertible from nullptr_t, no? (what is DeclGroupPtrTy?)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">   }<br>
<br>
   SourceLocation IdentLoc;<br>
@@ -109,15 +109,16 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
       Diag(Tok, diag::err_expected) << tok::identifier;<br>
       // Skip to end of the definition and eat the ';'.<br>
       SkipUntil(tok::semi);<br>
-      return nullptr;<br>
+      return DeclGroupPtrTy();<br>
     }<br>
     if (attrLoc.isValid())<br>
       Diag(attrLoc, diag::err_unexpected_namespace_attributes_alias);<br>
     if (InlineLoc.isValid())<br>
       Diag(InlineLoc, diag::err_inline_namespace_alias)<br>
           << FixItHint::CreateRemoval(InlineLoc);<br>
-    return ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);<br>
-  }<br>
+    Decl *NSAlias = ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);<br>
+    return Actions.ConvertDeclToDeclGroup(NSAlias);<br>
+}<br>
<br>
   BalancedDelimiterTracker T(*this, tok::l_brace);<br>
   if (T.consumeOpen()) {<br>
@@ -125,7 +126,7 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
       Diag(Tok, diag::err_expected) << tok::l_brace;<br>
     else<br>
       Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;<br>
-    return nullptr;<br>
+    return DeclGroupPtrTy();<br>
   }<br>
<br>
   if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||<br>
@@ -133,7 +134,7 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
       getCurScope()->getFnParent()) {<br>
     Diag(T.getOpenLocation(), diag::err_namespace_nonnamespace_scope);<br>
     SkipUntil(tok::r_brace);<br>
-    return nullptr;<br>
+    return DeclGroupPtrTy();<br>
   }<br>
<br>
   if (ExtraIdent.empty()) {<br>
@@ -180,10 +181,11 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
   // Enter a scope for the namespace.<br>
   ParseScope NamespaceScope(this, Scope::DeclScope);<br>
<br>
+  UsingDirectiveDecl *ImplicitUsingDirectiveDecl = nullptr;<br>
   Decl *NamespcDecl =<br>
     Actions.ActOnStartNamespaceDef(getCurScope(), InlineLoc, NamespaceLoc,<br>
                                    IdentLoc, Ident, T.getOpenLocation(),<br>
-                                   attrs.getList());<br>
+                                   attrs.getList(), ImplicitUsingDirectiveDecl);<br>
<br>
   PrettyDeclStackTraceEntry CrashInfo(Actions, NamespcDecl, NamespaceLoc,<br>
                                       "parsing namespace");<br>
@@ -198,8 +200,9 @@ Decl *Parser::ParseNamespace(unsigned Co<br>
<br>
   DeclEnd = T.getCloseLocation();<br>
   Actions.ActOnFinishNamespaceDef(NamespcDecl, DeclEnd);<br>
-<br>
-  return NamespcDecl;<br>
+<br>
+  return Actions.ConvertDeclToDeclGroup(NamespcDecl,<br>
+                                        ImplicitUsingDirectiveDecl);<br>
 }<br>
<br>
 /// ParseInnerNamespace - Parse the contents of a namespace.<br>
@@ -229,17 +232,19 @@ void Parser::ParseInnerNamespace(std::ve<br>
   // FIXME: Preserve the source information through to the AST rather than<br>
   // desugaring it here.<br>
   ParseScope NamespaceScope(this, Scope::DeclScope);<br>
+  UsingDirectiveDecl *ImplicitUsingDirectiveDecl = nullptr;<br>
   Decl *NamespcDecl =<br>
     Actions.ActOnStartNamespaceDef(getCurScope(), SourceLocation(),<br>
                                    NamespaceLoc[index], IdentLoc[index],<br>
                                    Ident[index], Tracker.getOpenLocation(),<br>
-                                   attrs.getList());<br>
+                                   attrs.getList(), ImplicitUsingDirectiveDecl);<br>
+  assert(!ImplicitUsingDirectiveDecl &&<br>
+         "nested namespace definition cannot define anonymous namespace");<br>
<br>
   ParseInnerNamespace(IdentLoc, Ident, NamespaceLoc, ++index, InlineLoc,<br>
                       attrs, Tracker);<br>
<br>
   NamespaceScope.Exit();<br>
-<br>
   Actions.ActOnFinishNamespaceDef(NamespcDecl, Tracker.getCloseLocation());<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=255281&r1=255280&r2=255281&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=255281&r1=255280&r2=255281&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Dec 10 12:52:50 2015<br>
@@ -7185,7 +7185,8 @@ Decl *Sema::ActOnStartNamespaceDef(Scope<br>
                                    SourceLocation IdentLoc,<br>
                                    IdentifierInfo *II,<br>
                                    SourceLocation LBrace,<br>
-                                   AttributeList *AttrList) {<br>
+                                   AttributeList *AttrList,<br>
+                                   UsingDirectiveDecl *&UD) {<br>
   SourceLocation StartLoc = InlineLoc.isValid() ? InlineLoc : NamespaceLoc;<br>
   // For anonymous namespace, take the location of the left brace.<br>
   SourceLocation Loc = II ? IdentLoc : LBrace;<br>
@@ -7299,14 +7300,13 @@ Decl *Sema::ActOnStartNamespaceDef(Scope<br>
     // namespace internal linkage.<br>
<br>
     if (!PrevNS) {<br>
-      UsingDirectiveDecl* UD<br>
-        = UsingDirectiveDecl::Create(Context, Parent,<br>
-                                     /* 'using' */ LBrace,<br>
-                                     /* 'namespace' */ SourceLocation(),<br>
-                                     /* qualifier */ NestedNameSpecifierLoc(),<br>
-                                     /* identifier */ SourceLocation(),<br>
-                                     Namespc,<br>
-                                     /* Ancestor */ Parent);<br>
+      UD = UsingDirectiveDecl::Create(Context, Parent,<br>
+                                      /* 'using' */ LBrace,<br>
+                                      /* 'namespace' */ SourceLocation(),<br>
+                                      /* qualifier */ NestedNameSpecifierLoc(),<br>
+                                      /* identifier */ SourceLocation(),<br>
+                                      Namespc,<br>
+                                      /* Ancestor */ Parent);<br>
       UD->setImplicit();<br>
       Parent->addDecl(UD);<br>
     }<br>
<br>
Added: cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp?rev=255281&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp?rev=255281&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp (added)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp Thu Dec 10 12:52:50 2015<br>
@@ -0,0 +1,26 @@<br>
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-scei-ps4 -O0 %s -o - | FileCheck --check-prefix=PS4 %s<br>
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-unknown-linux-gnu -O0 %s -o - | FileCheck --check-prefix=NON-PS4 %s<br>
+<br>
+namespace<br>
+{<br>
+  int a = 5;<br>
+}<br>
+int *b = &a;<br>
+<br>
+namespace<br>
+{<br>
+  namespace {<br>
+    int a1 = 5;<br>
+  }<br>
+  int a2 = 7;<br>
+}<br>
+int *b1 = &a1;<br>
+int *b2 = &a2;<br>
+<br>
+<br>
+// PS4:  [[NS:![0-9]+]] = !DINamespace<br>
+// PS4:  [[NS2:![0-9]+]] = !DINamespace<br>
+// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: [[NS]])<br>
+// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], line: {{[0-9]+}})<br>
+// NON-PS4-NOT: !DIImportedEntity<br>
+<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div></div>