[cfe-commits] r64805 - /cfe/trunk/lib/AST/DeclBase.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Tue Feb 17 12:24:53 PST 2009


Author: akirtzidis
Date: Tue Feb 17 14:24:53 2009
New Revision: 64805

URL: http://llvm.org/viewvc/llvm-project?rev=64805&view=rev
Log:
Currently all DeclContexts are Decls as well; use cast<Decl> instead of dyn_cast.

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=64805&r1=64804&r2=64805&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Tue Feb 17 14:24:53 2009
@@ -269,17 +269,11 @@
 }
 
 const DeclContext *DeclContext::getParent() const {
-  if (const Decl *D = dyn_cast<Decl>(this))
-    return D->getDeclContext();
-
-  return NULL;
+  return cast<Decl>(this)->getDeclContext();
 }
 
 const DeclContext *DeclContext::getLexicalParent() const {
-  if (const Decl *D = dyn_cast<Decl>(this))
-    return D->getLexicalDeclContext();
-
-  return getParent();
+  return cast<Decl>(this)->getLexicalDeclContext();
 }
 
 // FIXME: We really want to use a DenseSet here to eliminate the





More information about the cfe-commits mailing list