[cfe-commits] r74502 - /cfe/trunk/lib/AST/DeclBase.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Mon Jun 29 19:34:53 PDT 2009
Author: akirtzidis
Date: Mon Jun 29 21:34:53 2009
New Revision: 74502
URL: http://llvm.org/viewvc/llvm-project?rev=74502&view=rev
Log:
Decl::getTranslationUnitDecl() should return itself when the Decl is a TranslationUnitDecl.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=74502&r1=74501&r2=74502&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Mon Jun 29 21:34:53 2009
@@ -158,6 +158,9 @@
}
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!");
More information about the cfe-commits
mailing list