]> granicus.if.org Git - clang/commitdiff
Fix the source range of an anonymous namespace, from Jan Bierbaum
authorDouglas Gregor <dgregor@apple.com>
Thu, 19 Aug 2010 20:55:47 +0000 (20:55 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 19 Aug 2010 20:55:47 +0000 (20:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111561 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp

index fff37d98e08d35a0d977b6b3748cbaa5a44a8427..19580957832a594b2fa84b01fde26742e7e27a4a 100644 (file)
@@ -3283,8 +3283,9 @@ Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
                                              IdentifierInfo *II,
                                              SourceLocation LBrace,
                                              AttributeList *AttrList) {
-  NamespaceDecl *Namespc =
-      NamespaceDecl::Create(Context, CurContext, IdentLoc, II);
+  // anonymous namespace starts at its left brace
+  NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext,
+    (II ? IdentLoc : LBrace) , II);
   Namespc->setLBracLoc(LBrace);
 
   Scope *DeclRegionScope = NamespcScope->getParent();