aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-24 20:03:32 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-24 20:03:32 +0000
commitd6f7e9dccd0fa8a5a15d7478324c0ae229fc5e1e (patch)
tree905485f4efead47bee847b4e8f2a36444d7406f3 /lib/AST/Decl.cpp
parent8f30105fda579f8e6db339cb88cdec2bef6350bd (diff)
When we're declaring an object or function with linkage, teach name
lookup to skip over names without linkage. This finishes <rdar://problem/6127293>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp9
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