<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 10, 2015 at 10:52 AM, Ekaterina Romanova via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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;<br></blockquote><div><br></div><div>Could/should this ^ just be: Opts.DebugExplicitImport = Triple.isPS4CPU(); ?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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" rel="noreferrer" 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" rel="noreferrer" 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();;<br></blockquote><div><br></div><div>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?)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  Â }<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" rel="noreferrer" 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" rel="noreferrer" 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">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>