aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-17 07:02:32 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-17 07:02:32 +0000
commitf4a03cc2b022fab0ffac6c65449555c52036dece (patch)
tree13f71285731ff3a69964e65bd4b15fbcb07a0dbc /lib/AST/DeclBase.cpp
parentc6daf0b29d6c48a99cb1ad707973a7e6dfcafd58 (diff)
De-virtualize Decl::isOutOfLine().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index e16bd22f33..a95ea3f646 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -172,6 +172,15 @@ void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const {
// Out-of-line virtual method providing a home for Decl.
Decl::~Decl() { }
+bool Decl::isOutOfLine() const {
+ if (const VarDecl *VD = dyn_cast<VarDecl>(this))
+ return VD->isOutOfLine();
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
+ return FD->isOutOfLine();
+
+ return getLexicalDeclContext() != getDeclContext();
+}
+
void Decl::setDeclContext(DeclContext *DC) {
if (isOutOfSemaDC())
delete getMultipleDC();