]> granicus.if.org Git - clang/commitdiff
Add the SourceLocation for the right brace in TagDecl.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 14 Jul 2009 03:17:17 +0000 (03:17 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 14 Jul 2009 03:17:17 +0000 (03:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75590 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 0de85dcefcf9bcf2ead7dcf0cc48d4920fbf886e..d033c24046d23ba208a4bdf1ba0bb3a6acd9a081 100644 (file)
@@ -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;
index 40aa030ab3a268d211aa7704cf8be058ac770101..fe9885ef261437c8960f778b2227d6b3c3ee22fb 100644 (file)
@@ -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);