diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | lib/AST/DeclBase.cpp | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 9aeb04fa44..fded8ff38c 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1159,7 +1159,7 @@ const Expr *VarDecl::getAnyInitializer(const VarDecl *&D) const { } bool VarDecl::isOutOfLine() const { - if (Decl::isOutOfLine()) + if (getLexicalDeclContext() != getDeclContext()) return true; if (!isStaticDataMember()) @@ -1883,7 +1883,7 @@ SourceLocation FunctionDecl::getPointOfInstantiation() const { } bool FunctionDecl::isOutOfLine() const { - if (Decl::isOutOfLine()) + if (getLexicalDeclContext() != getDeclContext()) return true; // If this function was instantiated from a member function of a 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(); |