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

Douglas Gregor dgregor at apple.com
Thu Feb 17 00:14:56 PST 2011


Author: dgregor
Date: Thu Feb 17 02:14:56 2011
New Revision: 125737

URL: http://llvm.org/viewvc/llvm-project?rev=125737&view=rev
Log:
Simple little optimization to Decl::getCanonicalDecl(), eliminating some heavyweight machinery and indirection that we don't need

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=125737&r1=125736&r2=125737&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Feb 17 02:14:56 2011
@@ -169,11 +169,11 @@
 
 namespace {
   template<typename Class, typename Result>
-  inline Result *getSpecificCanonicalDecl(Decl *D, Result *(Class::*Get)()) {
-    return (llvm::cast<Class>(D)->*Get)();
+  inline Result *getCanonicalDeclImpl(Decl *D, Result *(Class::*)()) {
+    return static_cast<Class *>(D)->getCanonicalDecl();
   }
   
-  inline Decl *getSpecificCanonicalDecl(Decl *D, Decl *(Decl::*)()) {
+  inline Decl *getCanonicalDeclImpl(Decl *D, Decl *(Decl::*)()) {
     // No specific implementation.
     return D;
   }
@@ -184,7 +184,7 @@
 #define ABSTRACT_DECL(Type)
 #define DECL(Type, Base) \
     case Type:           \
-      return getSpecificCanonicalDecl(this, &Type##Decl::getCanonicalDecl);
+      return getCanonicalDeclImpl(this, &Type##Decl::getCanonicalDecl);
 #include "clang/AST/DeclNodes.inc"
   }
   





More information about the cfe-commits mailing list