diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-01-22 19:49:59 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-01-22 19:49:59 +0000 |
| commit | 562c1f9365334335d08eb14357ebc1c68f7307fc (patch) | |
| tree | db8a7571a3f6c2e1162ed320d267a958d12e1c89 /clang/lib/AST/Decl.cpp | |
| parent | 8fa0e35f9775bc562eedf468fde63623b2da18bf (diff) | |
| download | bcm5719-llvm-562c1f9365334335d08eb14357ebc1c68f7307fc.tar.gz bcm5719-llvm-562c1f9365334335d08eb14357ebc1c68f7307fc.zip | |
Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.
Minor other tweaks needed to make this work:
- Extend Preprocessor::getLocForEndOfToken() to accept an offset
from the end, making it easy to move to the last character in the
token (rather than just past the end of the token).
- In Lexer::MeasureTokenLength(), the length of whitespace is zero.
llvm-svn: 94200
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e77661a9fbd..794b14a1f4a 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/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 { |

