diff options
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 79c51aca31..9bf35ee83d 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -205,6 +205,15 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD) const { return this->getKind() == OldD->getKind(); } +bool NamedDecl::hasLinkage() const { + if (const VarDecl *VD = dyn_cast<VarDecl>(this)) + return VD->hasExternalStorage() || VD->isFileVarDecl(); + + if (isa<FunctionDecl>(this) && !isa<CXXMethodDecl>(this)) + return true; + + return false; +} //===----------------------------------------------------------------------===// // VarDecl Implementation |