Revert r180263. It's causing failures.
llvm-svn: 180583
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index a431c53..cb375eb 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -476,13 +476,6 @@
return First->getDeclContext()->isExternCContext();
}
-static bool isSingleLineExternC(const Decl &D) {
- if (const LinkageSpecDecl *SD = dyn_cast<LinkageSpecDecl>(D.getDeclContext()))
- if (SD->getLanguage() == LinkageSpecDecl::lang_c && !SD->hasBraces())
- return true;
- return false;
-}
-
static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
LVComputationKind computation) {
assert(D->getDeclContext()->getRedeclContext()->isFileContext() &&
@@ -511,8 +504,7 @@
return PrevVar->getLinkageAndVisibility();
if (Var->getStorageClass() != SC_Extern &&
- Var->getStorageClass() != SC_PrivateExtern &&
- !isSingleLineExternC(*Var))
+ Var->getStorageClass() != SC_PrivateExtern)
return LinkageInfo::internal();
}
@@ -1588,8 +1580,11 @@
// A declaration directly contained in a linkage-specification is treated
// as if it contains the extern specifier for the purpose of determining
// the linkage of the declared name and whether it is a definition.
- if (isSingleLineExternC(*this))
- return DeclarationOnly;
+ const DeclContext *DC = getDeclContext();
+ if (const LinkageSpecDecl *SD = dyn_cast<LinkageSpecDecl>(DC)) {
+ if (SD->getLanguage() == LinkageSpecDecl::lang_c && !SD->hasBraces())
+ return DeclarationOnly;
+ }
// C99 6.9.2p2:
// A declaration of an object that has file scope without an initializer,