[cfe-commits] r75590 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Mon Jul 13 20:17:27 PDT 2009
Author: akirtzidis
Date: Mon Jul 13 22:17:17 2009
New Revision: 75590
URL: http://llvm.org/viewvc/llvm-project?rev=75590&view=rev
Log:
Add the SourceLocation for the right brace in TagDecl.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=75590&r1=75589&r2=75590&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Jul 13 22:17:17 2009
@@ -1150,7 +1150,9 @@
/// TypedefForAnonDecl - If a TagDecl is anonymous and part of a typedef,
/// this points to the TypedefDecl. Used for mangling.
TypedefDecl *TypedefForAnonDecl;
-
+
+ SourceLocation RBraceLoc;
+
protected:
TagDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id)
@@ -1161,6 +1163,11 @@
}
public:
+ SourceLocation getRBraceLoc() const { return RBraceLoc; }
+ void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
+
+ virtual SourceRange getSourceRange() const;
+
/// isDefinition - Return true if this decl has its body specified.
bool isDefinition() const {
return IsDefinition;
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=75590&r1=75589&r2=75590&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Jul 13 22:17:17 2009
@@ -658,6 +658,11 @@
// TagDecl Implementation
//===----------------------------------------------------------------------===//
+SourceRange TagDecl::getSourceRange() const {
+ SourceLocation E = RBraceLoc.isValid() ? RBraceLoc : getLocation();
+ return SourceRange(getLocation(), E);
+}
+
void TagDecl::startDefinition() {
TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
TagT->decl.setPointer(this);
More information about the cfe-commits
mailing list