summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-22 17:00:09 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-22 17:00:09 +0000
commitbbe1394c9602ab9a939d9b17199d5f538cac9d0c (patch)
tree367163eaed100fc4cc295f02319042dcd8e3597c /clang/lib/AST/Decl.cpp
parent6029d4f3aeb711000bb9c07a6ec806248ca141bf (diff)
downloadbcm5719-llvm-bbe1394c9602ab9a939d9b17199d5f538cac9d0c.tar.gz
bcm5719-llvm-bbe1394c9602ab9a939d9b17199d5f538cac9d0c.zip
Fix a bug in VarDecl::getSourceRange() for static member arrays with an element
type with an implicit initializer expression. Patch from Will Wilson <will@indefiant.com>! llvm-svn: 173170
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index c053b6d17e3..7a518143251 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1206,7 +1206,9 @@ void VarDecl::setStorageClass(StorageClass SC) {
SourceRange VarDecl::getSourceRange() const {
if (const Expr *Init = getInit()) {
SourceLocation InitEnd = Init->getLocEnd();
- if (InitEnd.isValid())
+ // If Init is implicit, ignore its source range and fallback on
+ // DeclaratorDecl::getSourceRange() to handle postfix elements.
+ if (InitEnd.isValid() && InitEnd != getLocation())
return SourceRange(getOuterLocStart(), InitEnd);
}
return DeclaratorDecl::getSourceRange();
OpenPOWER on IntegriCloud