From: Argyrios Kyrtzidis Date: Tue, 14 Jul 2009 03:17:17 +0000 (+0000) Subject: Add the SourceLocation for the right brace in TagDecl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f602c8b6ce1a269c0bf8b3f049e923f4ea5c18e2;p=clang Add the SourceLocation for the right brace in TagDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75590 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 0de85dcefc..d033c24046 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1150,7 +1150,9 @@ private: /// 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 @@ protected: } 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; diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 40aa030ab3..fe9885ef26 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -658,6 +658,11 @@ void FunctionDecl::setExplicitSpecialization(bool ES) { // TagDecl Implementation //===----------------------------------------------------------------------===// +SourceRange TagDecl::getSourceRange() const { + SourceLocation E = RBraceLoc.isValid() ? RBraceLoc : getLocation(); + return SourceRange(getLocation(), E); +} + void TagDecl::startDefinition() { TagType *TagT = const_cast(TypeForDecl->getAsTagType()); TagT->decl.setPointer(this);