Don't crash when codegen'ing an empty redecl of a function in C99 mode, when

neither was inline. Fixes bug introduced in r135377.

llvm-svn: 135380
This commit is contained in:
Nick Lewycky 2011-07-18 07:11:55 +00:00
parent d8921f939c
commit ba4cc01a1f
2 changed files with 10 additions and 3 deletions

View File

@ -1782,9 +1782,10 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
return false;
if (getLinkage() != ExternalLinkage || isInlineSpecified())
return false;
const FunctionDecl *InlineDefinition = 0;
if (hasBody(InlineDefinition))
return InlineDefinition->isInlineDefinitionExternallyVisible();
const FunctionDecl *Definition = 0;
if (hasBody(Definition))
return Definition->isInlined() &&
Definition->isInlineDefinitionExternallyVisible();
return false;
}

View File

@ -91,3 +91,9 @@ void test_test5() { test5(); }
__inline int test6() { return 0; }
extern int test6();
// No PR#, but this once crashed clang in C99 mode due to buggy extern inline
// redeclaration detection.
void test7() { }
void test7();