When determining whether a variable is a file-scoped variable, check
out its lookup context (to see through linkage
specifications). Addresses <rdar://problem/6477142>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61848 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index cf612c2..f14dc3c 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -567,8 +567,8 @@
return const_cast<DeclContext*>(this)->lookup(Context, Name);
}
-DeclContext *DeclContext::getLookupContext() {
- DeclContext *Ctx = this;
+const DeclContext *DeclContext::getLookupContext() const {
+ const DeclContext *Ctx = this;
while (Ctx->isTransparentContext())
Ctx = Ctx->getParent();
return Ctx;