summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-04-25 23:15:02 +0000
committerBill Wendling <isanbard@gmail.com>2013-04-25 23:15:02 +0000
commitd247842acdbded335f03f91ba0153bc36e65eb39 (patch)
treee604853d2150394b2708db538e37e35659251a7a
parent08741a07d40a03b476bf7bbcacdfff10fcad0295 (diff)
downloadclang-d247842acdbded335f03f91ba0153bc36e65eb39.tar.gz
clang-d247842acdbded335f03f91ba0153bc36e65eb39.tar.bz2
clang-d247842acdbded335f03f91ba0153bc36e65eb39.tar.xz
Revert r180263. It's causing failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180583 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/Decl.cpp17
-rw-r--r--test/SemaCXX/undefined-internal.cpp7
2 files changed, 6 insertions, 18 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index a431c5317e..cb375eb4e2 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -476,13 +476,6 @@ template <typename T> static bool isInExternCContext(T *D) {
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 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
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 @@ VarDecl::DefinitionKind VarDecl::isThisDeclarationADefinition(
// 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,
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp
index 1b76a86dcb..839fdafb34 100644
--- a/test/SemaCXX/undefined-internal.cpp
+++ b/test/SemaCXX/undefined-internal.cpp
@@ -323,10 +323,3 @@ namespace test13 {
}
}
-namespace test14 {
- extern "C" const int foo;
-
- int f() {
- return foo;
- }
-}