diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-03-04 11:03:48 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-03-04 11:03:48 +0000 |
commit | ee4bfd412db491c489fc2ee74916edd73f9c618a (patch) | |
tree | 74b66d12cfe926710843873371007e607f351b6b | |
parent | 8fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5b (diff) |
Fixed end location of NonTypeTemplateParamDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126994 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/DeclTemplate.cpp | 5 | ||||
-rw-r--r-- | test/Index/index-templates.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index a73deeab3a..67eb11d2d0 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -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 { diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp index 3def6001a1..09559cbee4 100644 --- a/test/Index/index-templates.cpp +++ b/test/Index/index-templates.cpp @@ -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] |