[llvm-commits] [127324] fix a crash on invalid code.
clattner at apple.com
clattner at apple.com
Wed May 16 15:40:24 PDT 2007
Revision: 127324
Author: clattner
Date: 2007-05-16 15:40:23 -0700 (Wed, 16 May 2007)
Log Message:
-----------
fix a crash on invalid code.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-backend.cpp
Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-16 21:39:35 UTC (rev 127323)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-05-16 22:40:23 UTC (rev 127324)
@@ -1028,7 +1028,10 @@
//
void llvm_emit_ctor_dtor(tree FnDecl, int InitPrio, int isCtor) {
mark_decl_referenced(FnDecl); // Inform cgraph that we used the global.
- Function *F = cast<Function>(DECL_LLVM(FnDecl));
+
+ if (errorcount || sorrycount) return;
+
+ Function *F = cast_or_null<Function>(DECL_LLVM(FnDecl));
(isCtor ? &StaticCtors:&StaticDtors)->push_back(std::make_pair(F, InitPrio));
}
More information about the llvm-commits
mailing list