From 20c9e24241b8cc42b274919da08dec95264e5edb Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Tue, 8 Mar 2011 11:07:11 +0000 Subject: [PATCH] Fixed bitfields source range. llvm-svn: 127237 --- clang/include/clang/AST/Decl.h | 4 +++- clang/lib/AST/Decl.cpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 2d5c1bf09fff..bbfd123e4b2a 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -1834,7 +1834,9 @@ public: RecordDecl *getParent() { return cast(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; } diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 95f575640231..15f906b16e9d 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -1968,6 +1968,11 @@ unsigned FieldDecl::getFieldIndex() const { return index; } +SourceRange FieldDecl::getSourceRange() const { + return SourceRange(getInnerLocStart(), + isBitField() ? BitWidth->getLocEnd() : getLocation()); +} + //===----------------------------------------------------------------------===// // TagDecl Implementation //===----------------------------------------------------------------------===//