aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-03-06 18:07:25 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-03-06 18:07:25 +0000
commit81e722e2c1195a90825ceaaa90f4a14b7df09b41 (patch)
treea79a583288ddf24c484c89957a5369299610eaa0
parent9a2105bc790b3d0d4d5edb77c617aeccc4187c0e (diff)
NamespaceDecl: Call non-virtual method inside virtual method, not the other way round.
Moves the virtual call out of a hot path during lookup, no other functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152124 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Decl.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 25b6d79804..8715067ce6 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -451,12 +451,18 @@ public:
/// \brief Get the original (first) namespace declaration.
NamespaceDecl *getOriginalNamespace() {
- return getCanonicalDecl();
+ if (isFirstDeclaration())
+ return this;
+
+ return AnonOrFirstNamespaceAndInline.getPointer();
}
/// \brief Get the original (first) namespace declaration.
const NamespaceDecl *getOriginalNamespace() const {
- return getCanonicalDecl();
+ if (isFirstDeclaration())
+ return this;
+
+ return AnonOrFirstNamespaceAndInline.getPointer();
}
/// \brief Return true if this declaration is an original (first) declaration
@@ -478,16 +484,10 @@ public:
/// Retrieves the canonical declaration of this namespace.
NamespaceDecl *getCanonicalDecl() {
- if (isFirstDeclaration())
- return this;
-
- return AnonOrFirstNamespaceAndInline.getPointer();
+ return getOriginalNamespace();
}
const NamespaceDecl *getCanonicalDecl() const {
- if (isFirstDeclaration())
- return this;
-
- return AnonOrFirstNamespaceAndInline.getPointer();
+ return getOriginalNamespace();
}
virtual SourceRange getSourceRange() const {