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
bool isFileVarDecl() const {
if (getKind() != Decl::Var)
return false;
- if (isa<TranslationUnitDecl>(getDeclContext()) ||
- isa<NamespaceDecl>(getDeclContext()) )
+ const DeclContext *Ctx = getDeclContext()->getLookupContext();
+ if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) )
return true;
return false;
}
/// context of this context, which corresponds to the innermost
/// location from which name lookup can find the entities in this
/// context.
- DeclContext *getLookupContext();
+ DeclContext *getLookupContext() {
+ return const_cast<DeclContext *>(
+ const_cast<const DeclContext *>(this)->getLookupContext());
+ }
+ const DeclContext *getLookupContext() const;
/// getNextContext - If this is a DeclContext that may have other
/// DeclContexts that are semantically connected but syntactically
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;
int& i1 = g(x);
double& d1 = g(d);
}
+
+extern "C" int foo;
+extern "C" int foo;
+
+extern "C" const int bar;
+extern "C" int const bar;