r224649 - Tweak the assert in ModuleBuilder from r224533 (PR21989)
Hans Wennborg
hans at hanshq.net
Fri Dec 19 15:35:11 PST 2014
Author: hans
Date: Fri Dec 19 17:35:11 2014
New Revision: 224649
URL: http://llvm.org/viewvc/llvm-project?rev=224649&view=rev
Log:
Tweak the assert in ModuleBuilder from r224533 (PR21989)
Turns out there will be left-over deferred inline methods if there have
been errors, because in that case HandleTopLevelDecl bails out early.
Added:
cfe/trunk/test/CodeGenCXX/pr21989.cc
Modified:
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=224649&r1=224648&r2=224649&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Fri Dec 19 17:35:11 2014
@@ -64,8 +64,9 @@ namespace {
M(new llvm::Module(ModuleName, C)) {}
virtual ~CodeGeneratorImpl() {
- assert(DeferredInlineMethodDefinitions.empty() &&
- "Leftover inline method definitions!");
+ // There should normally not be any leftover inline method definitions.
+ assert(DeferredInlineMethodDefinitions.empty() ||
+ Diags.hasErrorOccurred());
}
llvm::Module* GetModule() override {
Added: cfe/trunk/test/CodeGenCXX/pr21989.cc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pr21989.cc?rev=224649&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/pr21989.cc (added)
+++ cfe/trunk/test/CodeGenCXX/pr21989.cc Fri Dec 19 17:35:11 2014
@@ -0,0 +1,9 @@
+// REQUIRES: asserts
+// RUN: not %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s 2>&1 | FileCheck %s
+
+struct {
+ void __attribute__((used)) f() {}
+};
+// CHECK: 2 errors generated.
+
+// Emit the errors, but don't assert.
More information about the cfe-commits
mailing list