summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-17 08:14:56 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-17 08:14:56 +0000
commit5ee06f02f9d79aa8a183887dc456a1bd6d429025 (patch)
tree173ba64731a0d3603c33282006db1beb1ebbcbf8 /clang
parent00716e8bd3fbcdbbf8bf932db7f0d689e12e1b14 (diff)
downloadbcm5719-llvm-5ee06f02f9d79aa8a183887dc456a1bd6d429025.tar.gz
bcm5719-llvm-5ee06f02f9d79aa8a183887dc456a1bd6d429025.zip
Simple little optimization to Decl::getCanonicalDecl(), eliminating some heavyweight machinery and indirection that we don't need
llvm-svn: 125737
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/DeclBase.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 76bb2d5ddf6..5a117ebbf2f 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -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"
}
OpenPOWER on IntegriCloud