summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-06-30 02:34:53 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-06-30 02:34:53 +0000
commit4e1a72b37b2e2e3bce0d07362cc981843799f7cc (patch)
tree979e427f331fc5f34c9360af533e78bdc320e535 /clang
parentb4b64ca752f5c0e5b95ed64a94ddaeb72e0b8f5f (diff)
downloadbcm5719-llvm-4e1a72b37b2e2e3bce0d07362cc981843799f7cc.tar.gz
bcm5719-llvm-4e1a72b37b2e2e3bce0d07362cc981843799f7cc.zip
Decl::getTranslationUnitDecl() should return itself when the Decl is a TranslationUnitDecl.
llvm-svn: 74502
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/DeclBase.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index d872eae0845..3d92331792d 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -158,6 +158,9 @@ void Decl::setLexicalDeclContext(DeclContext *DC) {
}
TranslationUnitDecl *Decl::getTranslationUnitDecl() {
+ if (TranslationUnitDecl *TUD = dyn_cast<TranslationUnitDecl>(this))
+ return TUD;
+
DeclContext *DC = getDeclContext();
assert(DC && "This decl is not contained in a translation unit!");
OpenPOWER on IntegriCloud