summaryrefslogtreecommitdiffstats
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index e77661a..794b14a 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -629,9 +629,13 @@ VarDecl::~VarDecl() {
}
SourceRange VarDecl::getSourceRange() const {
+ SourceLocation Start = getTypeSpecStartLoc();
+ if (Start.isInvalid())
+ Start = getLocation();
+
if (getInit())
- return SourceRange(getLocation(), getInit()->getLocEnd());
- return SourceRange(getLocation(), getLocation());
+ return SourceRange(Start, getInit()->getLocEnd());
+ return SourceRange(Start, getLocation());
}
bool VarDecl::isOutOfLine() const {
OpenPOWER on IntegriCloud