]> granicus.if.org Git - clang/commitdiff
[index] Store correct location for namespace nested name qualifiers
authorAlex Lorenz <arphaman@gmail.com>
Mon, 15 May 2017 10:41:04 +0000 (10:41 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Mon, 15 May 2017 10:41:04 +0000 (10:41 +0000)
rdar://32195200

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303046 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Index/IndexTypeSourceInfo.cpp
test/Index/Core/index-source.cpp

index e9ca651e002f18f2050cbfaaa9ec9a2e253e7edd..ae27ebe6ea4c0831883dd9ff9bc56dadaafddb52 100644 (file)
@@ -212,7 +212,7 @@ void IndexingContext::indexNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
 
   if (!DC)
     DC = Parent->getLexicalDeclContext();
-  SourceLocation Loc = NNS.getSourceRange().getBegin();
+  SourceLocation Loc = NNS.getLocalBeginLoc();
 
   switch (NNS.getNestedNameSpecifier()->getKind()) {
   case NestedNameSpecifier::Identifier:
index cae7508c5f11f7ae209bed84e09e5fd52132a495..48ca3a9b573b07fcf19f81c72b4210f04640d160 100644 (file)
@@ -314,3 +314,21 @@ class ClassWithCorrectSpecialization<SpecializationDecl<Cls>, Record::C> { };
 // CHECK: [[@LINE-2]]:57 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0
 // CHECK: [[@LINE-3]]:71 | static-property/C++ | C | c:@S@Record@C | __ZN6Record1CE | Ref,Read | rel: 0
 // CHECK: [[@LINE-4]]:63 | struct/C++ | Record | c:@S@Record | <no-cgname> | Ref | rel: 0
+
+namespace ns {
+// CHECK: [[@LINE-1]]:11 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Decl | rel: 0
+namespace inner {
+// CHECK: [[@LINE-1]]:11 | namespace/C++ | inner | c:@N@ns@N@inner | <no-cgname> | Decl,RelChild | rel: 1
+void func();
+
+}
+namespace innerAlias = inner;
+}
+
+void ::ns::inner::func() {
+// CHECK: [[@LINE-1]]:8 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK: [[@LINE-2]]:12 | namespace/C++ | inner | c:@N@ns@N@inner | <no-cgname> | Ref,RelCont | rel: 1
+  ns::innerAlias::func();
+// CHECK: [[@LINE-1]]:3 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK: [[@LINE-2]]:7 | namespace-alias/C++ | innerAlias | c:@N@ns@NA@innerAlias | <no-cgname> | Ref,RelCont | rel: 1
+}