diff options
author | Mike Stump <mrs@apple.com> | 2009-12-15 00:59:40 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-12-15 00:59:40 +0000 |
commit | 9a4e0128a80b74718f1480ccd7d1eecbb17ff181 (patch) | |
tree | 76a35c7df084a3c25f082f452b38900e37120ec9 /clang/lib/CodeGen/CGExpr.cpp | |
parent | 0e8b9e32d17ef6bb8c25ffe682e8196bf985daf5 (diff) | |
download | bcm5719-llvm-9a4e0128a80b74718f1480ccd7d1eecbb17ff181.tar.gz bcm5719-llvm-9a4e0128a80b74718f1480ccd7d1eecbb17ff181.zip |
Ensure we preserve line information for each trap for
-fcatch-undefined-behavior if we aren't optimizing. WIP.
llvm-svn: 91382
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 975f7492555..9af79ab70b6 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -18,6 +18,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "llvm/Intrinsics.h" +#include "clang/CodeGen/CodeGenOptions.h" #include "llvm/Target/TargetData.h" using namespace clang; using namespace CodeGen; @@ -1014,7 +1015,14 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) { } llvm::BasicBlock*CodeGenFunction::getTrapBB() { - if (TrapBB) + const CodeGenOptions &GCO = CGM.getCodeGenOpts(); + + // If we are not optimzing, don't collapse all calls to trap in the function + // to the same call, that way, in the debugger they can see which operation + // did in fact fail. If we are optimizing, we collpase all call to trap down + // to just one per function to save on codesize. + if (GCO.OptimizationLevel + && TrapBB) return TrapBB; llvm::BasicBlock *Cont = 0; |