[cfe-commits] r135380 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGen/inline.c
Nick Lewycky
nicholas at mxc.ca
Mon Jul 18 00:11:55 PDT 2011
Author: nicholas
Date: Mon Jul 18 02:11:55 2011
New Revision: 135380
URL: http://llvm.org/viewvc/llvm-project?rev=135380&view=rev
Log:
Don't crash when codegen'ing an empty redecl of a function in C99 mode, when
neither was inline. Fixes bug introduced in r135377.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGen/inline.c
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=135380&r1=135379&r2=135380&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Jul 18 02:11:55 2011
@@ -1782,9 +1782,10 @@
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;
}
Modified: cfe/trunk/test/CodeGen/inline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline.c?rev=135380&r1=135379&r2=135380&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/inline.c (original)
+++ cfe/trunk/test/CodeGen/inline.c Mon Jul 18 02:11:55 2011
@@ -91,3 +91,9 @@
__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();
More information about the cfe-commits
mailing list