[cfe-commits] r91382 - /cfe/trunk/lib/CodeGen/CGExpr.cpp

Mike Stump mrs at apple.com
Mon Dec 14 16:59:41 PST 2009


Author: mrs
Date: Mon Dec 14 18:59:40 2009
New Revision: 91382

URL: http://llvm.org/viewvc/llvm-project?rev=91382&view=rev
Log:
Ensure we preserve line information for each  trap for
-fcatch-undefined-behavior if we aren't optimizing.  WIP.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=91382&r1=91381&r2=91382&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Dec 14 18:59:40 2009
@@ -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 @@
 }
 
 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;





More information about the cfe-commits mailing list