]> granicus.if.org Git - clang/commitdiff
Fixed end location of NonTypeTemplateParamDecl.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Fri, 4 Mar 2011 11:03:48 +0000 (11:03 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Fri, 4 Mar 2011 11:03:48 +0000 (11:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126994 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclTemplate.cpp
test/Index/index-templates.cpp

index a73deeab3a611b0936a9377af9d8bc8bd01763cb..67eb11d2d0ffc7a72bd7c7c60904ed800608753c 100644 (file)
@@ -455,7 +455,10 @@ SourceLocation NonTypeTemplateParmDecl::getInnerLocStart() const {
 }
 
 SourceRange NonTypeTemplateParmDecl::getSourceRange() const {
-  return SourceRange(getOuterLocStart(), getLocation());
+  SourceLocation End = getLocation();
+  if (hasDefaultArgument() && !defaultArgumentWasInherited())
+    End = getDefaultArgument()->getSourceRange().getEnd();
+  return SourceRange(getOuterLocStart(), End);
 }
 
 SourceLocation NonTypeTemplateParmDecl::getDefaultArgumentLoc() const {
index 3def6001a10a11535d19cc027957286ec9ac2fdb..09559cbee4c304f714b9a55f4e0c61290d94062f 100644 (file)
@@ -138,7 +138,7 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { };
 // CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32]
 // CHECK-LOAD: index-templates.cpp:37:8: ClassTemplate=array:37:8 (Definition) Extent=[36:1 - 37:17]
 // CHECK-LOAD: index-templates.cpp:36:19: TemplateTypeParameter=T:36:19 (Definition) Extent=[36:19 - 36:20]
-// CHECK-LOAD: index-templates.cpp:36:31: NonTypeTemplateParameter=Dimensions:36:31 (Definition) Extent=[36:22 - 36:41]
+// CHECK-LOAD: index-templates.cpp:36:31: NonTypeTemplateParameter=Dimensions:36:31 (Definition) Extent=[36:22 - 36:56]
 // CHECK-LOAD: index-templates.cpp:36:44: DeclRefExpr=OneDimension:35:16 Extent=[36:44 - 36:56]
 // CHECK-LOAD: index-templates.cpp:40:8: ClassTemplate=storage:40:8 (Definition) Extent=[39:1 - 40:19]
 // CHECK-LOAD: index-templates.cpp:39:45: TemplateTemplateParameter=DataStructure:39:45 (Definition) Extent=[39:10 - 39:66]