Implement runtime checks for undefined behavior. WIP.
This implements a new flag -fcatch-undefined-behavior. The flag turns
on additional runtime checks for:
T a[I];
a[i] abort when i < 0 or i >= I.
Future stuff includes shifts by >= bitwidth amounts.
llvm-svn: 91198
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 1ddfa6d..8820e6e 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -108,6 +108,7 @@
uint32_t LLVMPointerWidth;
bool Exceptions;
+ bool CatchUndefined;
public:
/// ObjCEHValueStack - Stack of Objective-C exception values, used for
/// rethrows.
@@ -1266,6 +1267,11 @@
ArgType));
}
}
+
+ llvm::BasicBlock *AbortBB;
+ /// getAbortBB - Create a basic block that will call abort. We'll generate
+ /// a branch around the created basic block as necessary.
+ llvm::BasicBlock* getAbortBB();
};