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
This commit is contained in:
Mike Stump
2009-12-12 01:27:46 +00:00
parent 7cc35b76c3
commit d954638f02
10 changed files with 83 additions and 1 deletions

View File

@@ -32,10 +32,11 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm)
SwitchInsn(0), CaseRangeBlock(0), InvokeDest(0),
CXXThisDecl(0), CXXVTTDecl(0),
ConditionalBranchLevel(0), TerminateHandler(0),
UniqueAggrDestructorCount(0) {
UniqueAggrDestructorCount(0), AbortBB(0) {
LLVMIntTy = ConvertType(getContext().IntTy);
LLVMPointerWidth = Target.getPointerWidth(0);
Exceptions = getContext().getLangOptions().Exceptions;
CatchUndefined = getContext().getLangOptions().CatchUndefined;
}
ASTContext &CodeGenFunction::getContext() const {