diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-14 03:17:17 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-14 03:17:17 +0000 |
| commit | 575fa059912942c1e1880faba7af6b8f44afc353 (patch) | |
| tree | b5820b39466b85f455901715be62881ef13fa750 /clang | |
| parent | d6c256696ba757d733c2be8a345f19f4a88f616b (diff) | |
| download | bcm5719-llvm-575fa059912942c1e1880faba7af6b8f44afc353.tar.gz bcm5719-llvm-575fa059912942c1e1880faba7af6b8f44afc353.zip | |
Add the SourceLocation for the right brace in TagDecl.
llvm-svn: 75590
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 9 | ||||
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 0de85dcefcf..d033c24046d 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/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/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 40aa030ab3a..fe9885ef261 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/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<TagType *>(TypeForDecl->getAsTagType()); TagT->decl.setPointer(this); |

