Fixed FieldDecl source range.

llvm-svn: 136963
This commit is contained in:
Abramo Bagnara 2011-08-05 08:02:55 +00:00
parent 8de11bab76
commit ff371acaa4
2 changed files with 8 additions and 2 deletions

View File

@ -2197,8 +2197,8 @@ unsigned FieldDecl::getFieldIndex() const {
}
SourceRange FieldDecl::getSourceRange() const {
if (isBitField())
return SourceRange(getInnerLocStart(), getBitWidth()->getLocEnd());
if (const Expr *E = InitializerOrBitWidth.getPointer())
return SourceRange(getInnerLocStart(), E->getLocEnd());
return DeclaratorDecl::getSourceRange();
}

View File

@ -0,0 +1,6 @@
struct S {
int field = 2;
};
// RUN: c-index-test -test-load-source all -std=c++0x %s | FileCheck %s
// CHECK: 2:7: FieldDecl=field:2:7 (Definition) Extent=[2:3 - 2:16]