Add Entity::getInternalDecl() to be used only on Entities that refer to internal
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 29 Jul 2009 23:39:42 +0000 (23:39 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 29 Jul 2009 23:39:42 +0000 (23:39 +0000)
(in translation unit) declarations.

llvm-svn: 77533

clang/include/clang/Index/Entity.h

index 283f552..edbb329 100644 (file)
@@ -57,6 +57,13 @@ public:
   /// \brief Find the Decl that can be referred to by this entity.
   Decl *getDecl(ASTContext &AST) const;
 
+  /// \brief If this Entity represents a declaration that is internal to its
+  /// translation unit, getInternalDecl() returns it.
+  Decl *getInternalDecl() const {
+    assert(isInternalToTU() && "This Entity is not internal!");
+    return Val.get<Decl *>();
+  }
+
   /// \brief Get a printable name for debugging purpose.
   std::string getPrintableName() const;