[cfe-commits] r136963 - in /cfe/trunk: lib/AST/Decl.cpp test/Index/in-class-init.cpp
Abramo Bagnara
abramo.bagnara at gmail.com
Fri Aug 5 01:02:55 PDT 2011
Author: abramo
Date: Fri Aug 5 03:02:55 2011
New Revision: 136963
URL: http://llvm.org/viewvc/llvm-project?rev=136963&view=rev
Log:
Fixed FieldDecl source range.
Added:
cfe/trunk/test/Index/in-class-init.cpp
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=136963&r1=136962&r2=136963&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Aug 5 03:02:55 2011
@@ -2197,8 +2197,8 @@
}
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();
}
Added: cfe/trunk/test/Index/in-class-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/in-class-init.cpp?rev=136963&view=auto
==============================================================================
--- cfe/trunk/test/Index/in-class-init.cpp (added)
+++ cfe/trunk/test/Index/in-class-init.cpp Fri Aug 5 03:02:55 2011
@@ -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]
More information about the cfe-commits
mailing list