]> granicus.if.org Git - clang/commitdiff
r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
authorCameron Zwarich <zwarich@apple.com>
Thu, 7 Jul 2011 21:03:28 +0000 (21:03 +0000)
committerCameron Zwarich <zwarich@apple.com>
Thu, 7 Jul 2011 21:03:28 +0000 (21:03 +0000)
so roll it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134638 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/ASTContext.cpp
lib/AST/Decl.cpp
lib/CodeGen/CodeGenModule.cpp
test/CodeGen/inline.c

index b7ea7a1be113350eddb38952541f6070942c898f..143915b4b54c263212a49019a419ba57afcbea70 100644 (file)
@@ -1773,8 +1773,6 @@ public:
   bool isInlined() const;
 
   bool isInlineDefinitionExternallyVisible() const;
-
-  bool doesDeclarationForceExternallyVisibleDefinition() const;
                        
   /// isOverloadedOperator - Whether this function declaration
   /// represents an C++ overloaded operator, e.g., "operator+".
index f2bd47dfa5f3e9390e98af46d7c8780d8a99c0ca..e2fa4e504a2123ccf8107873ce341d97f69b439e 100644 (file)
@@ -6376,7 +6376,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     // Forward declarations aren't required.
     if (!FD->doesThisDeclarationHaveABody())
-      return FD->doesDeclarationForceExternallyVisibleDefinition();
+      return false;
 
     // Constructors and destructors are required.
     if (FD->hasAttr<ConstructorAttr>() || FD->hasAttr<DestructorAttr>())
index 9feec9d82aba49048d823997cfeb1dee12476b4b..9b507cfc5e2425a6e1c9f1b96167b9f94ddd6536 100644 (file)
@@ -1762,32 +1762,6 @@ bool FunctionDecl::isInlined() const {
   return false;
 }
 
-/// \brief For a function declaration in C or C++, determine whether this
-/// declaration causes the definition to be externally visible.
-///
-/// Determines whether this is the first non-inline redeclaration of an inline
-/// function in a language where "inline" does not normally require an
-/// externally visible definition.
-bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
-  assert(!doesThisDeclarationHaveABody() &&
-         "Must have a declaration without a body.");
-
-  ASTContext &Context = getASTContext();
-
-  // In C99 mode, a function may have an inline definition (causing it to
-  // be deferred) then redeclared later.  As a special case, "extern inline"
-  // is not required to produce an external symbol.
-  if (Context.getLangOptions().GNUInline || !Context.getLangOptions().C99 ||
-      Context.getLangOptions().CPlusPlus)
-    return false;
-  if (getLinkage() != ExternalLinkage || isInlineSpecified())
-    return false;
-  const FunctionDecl *InlineDefinition = 0;
-  if (hasBody(InlineDefinition))
-    return InlineDefinition->isInlineDefinitionExternallyVisible();
-  return false;
-}
-
 /// \brief For an inline function definition in C or C++, determine whether the 
 /// definition will be externally visible.
 ///
index b2905299e4adbdf46e1813c79bf717aa97831493..ddef39726f7045912e7f196213e07af9dd41be00 100644 (file)
@@ -597,7 +597,7 @@ void CodeGenModule::EmitLLVMUsed() {
 void CodeGenModule::EmitDeferred() {
   // Emit code for any potentially referenced deferred decls.  Since a
   // previously unused static decl may become used during the generation of code
-  // for a static function, iterate until no changes are made.
+  // for a static function, iterate until no  changes are made.
 
   while (!DeferredDeclsToEmit.empty() || !DeferredVTables.empty()) {
     if (!DeferredVTables.empty()) {
@@ -740,21 +740,8 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
     }
 
     // Forward declarations are emitted lazily on first use.
-    if (!FD->doesThisDeclarationHaveABody()) {
-      if (!FD->doesDeclarationForceExternallyVisibleDefinition())
-        return;
-
-      const FunctionDecl *InlineDefinition = 0;
-      FD->getBody(InlineDefinition);
-
-      llvm::StringRef MangledName = getMangledName(GD);
-      llvm::StringMap<GlobalDecl>::iterator DDI =
-          DeferredDecls.find(MangledName);
-      if (DDI != DeferredDecls.end())
-        DeferredDecls.erase(DDI);
-      EmitGlobalDefinition(InlineDefinition);
+    if (!FD->doesThisDeclarationHaveABody())
       return;
-    }
   } else {
     const VarDecl *VD = cast<VarDecl>(Global);
     assert(VD->isFileVarDecl() && "Cannot emit local var decl as global.");
index cbc428cc22ab9137db45a0f465fe16295e4aa164..96f9c5c9d4bbbb19273bdda80d38e061190e024a 100644 (file)
@@ -12,7 +12,6 @@
 // RUN: grep "define void @test3()" %t
 // RUN: grep "define available_externally i32 @test4" %t
 // RUN: grep "define available_externally i32 @test5" %t
-// RUN: grep "define i32 @test6" %t
 
 // RUN: echo "\nC99 tests:"
 // RUN: %clang %s -O1 -emit-llvm -S -o %t -std=c99
@@ -28,7 +27,6 @@
 // RUN: grep "define void @test3" %t
 // RUN: grep "define available_externally i32 @test4" %t
 // RUN: grep "define available_externally i32 @test5" %t
-// RUN: grep "define i32 @test6" %t
 
 // RUN: echo "\nC++ tests:"
 // RUN: %clang -x c++ %s -O1 -emit-llvm -S -o %t -std=c++98
@@ -86,8 +84,3 @@ extern __inline int __attribute__ ((__gnu_inline__)) test5(void)
 }
 
 void test_test5() { test5(); }
-
-// PR10233
-
-__inline int test6() { return 0; }
-extern int test6();