]> granicus.if.org Git - clang/commitdiff
Simple little optimization to Decl::getCanonicalDecl(), eliminating some heavyweight...
authorDouglas Gregor <dgregor@apple.com>
Thu, 17 Feb 2011 08:14:56 +0000 (08:14 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 17 Feb 2011 08:14:56 +0000 (08:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclBase.cpp

index 76bb2d5ddf651639d24da2cde4f33d5796530d4e..5a117ebbf2f803be84ad2539971ff5fe62801a79 100644 (file)
@@ -169,11 +169,11 @@ bool Decl::isDefinedOutsideFunctionOrMethod() const {
 
 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 @@ Decl *Decl::getCanonicalDecl() {
 #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"
   }