]> granicus.if.org Git - clang/commitdiff
Fixed bitfields source range.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Tue, 8 Mar 2011 11:07:11 +0000 (11:07 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Tue, 8 Mar 2011 11:07:11 +0000 (11:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127237 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index 2d5c1bf09fff81395982743568ab8be37e3458b7..bbfd123e4b2a5af2d5598bd16e458cf78631edf3 100644 (file)
@@ -1834,7 +1834,9 @@ public:
   RecordDecl *getParent() {
     return cast<RecordDecl>(getDeclContext());
   }
-  
+
+  SourceRange getSourceRange() const;
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classof(const FieldDecl *D) { return true; }
index 95f5756402312dbc9da1424239c46524b65f2d79..15f906b16e9d1e1b6d1fc7fcc0c602e556bdd2fd 100644 (file)
@@ -1968,6 +1968,11 @@ unsigned FieldDecl::getFieldIndex() const {
   return index;
 }
 
+SourceRange FieldDecl::getSourceRange() const {
+  return SourceRange(getInnerLocStart(),
+                     isBitField() ? BitWidth->getLocEnd() : getLocation());
+}
+
 //===----------------------------------------------------------------------===//
 // TagDecl Implementation
 //===----------------------------------------------------------------------===//