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 | e15d55366375794f66f479b248ed56b1aa5be3aa (patch) | |
tree | b37e999b470745306e4c66ae62116ebf5eaa6267 | |
parent | 36a95be4ea5231f13dcfe9a7c08680064fcc5c75 (diff) | |
download | bcm5719-llvm-e15d55366375794f66f479b248ed56b1aa5be3aa.tar.gz bcm5719-llvm-e15d55366375794f66f479b248ed56b1aa5be3aa.zip |
Fixed end location of NonTypeTemplateParamDecl.
llvm-svn: 126994
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 5 | ||||
-rw-r--r-- | clang/test/Index/index-templates.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index a73deeab3a6..67eb11d2d0f 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/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/clang/test/Index/index-templates.cpp b/clang/test/Index/index-templates.cpp index 3def6001a10..09559cbee4c 100644 --- a/clang/test/Index/index-templates.cpp +++ b/clang/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] |