Propagate SanitizerKind into CodeGenFunction::EmitCheck() call.
Make sure CodeGenFunction::EmitCheck() knows which sanitizer
it emits check for. Make CheckRecoverableKind enum an
implementation detail and move it away from header.
Currently CheckRecoverableKind is determined by the type of
sanitizer ("unreachable" and "return" are unrecoverable,
"vptr" is always-recoverable, all the rest are recoverable).
This will change in future if we allow to specify which sanitizers
are recoverable, and which are not by -fsanitize-recover= flag.
No functionality change.
llvm-svn: 221635
This commit is contained in:
@@ -900,8 +900,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
|
||||
if (SanOpts.has(SanitizerKind::Return)) {
|
||||
SanitizerScope SanScope(this);
|
||||
EmitCheck(Builder.getFalse(), "missing_return",
|
||||
EmitCheckSourceLocation(FD->getLocation()),
|
||||
None, CRK_Unrecoverable);
|
||||
EmitCheckSourceLocation(FD->getLocation()), None,
|
||||
SanitizerKind::Return);
|
||||
} else if (CGM.getCodeGenOpts().OptimizationLevel == 0)
|
||||
Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::trap));
|
||||
Builder.CreateUnreachable();
|
||||
@@ -1562,7 +1562,7 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
|
||||
};
|
||||
EmitCheck(Builder.CreateICmpSGT(Size, Zero),
|
||||
"vla_bound_not_positive", StaticArgs, Size,
|
||||
CRK_Recoverable);
|
||||
SanitizerKind::VLABound);
|
||||
}
|
||||
|
||||
// Always zexting here would be wrong if it weren't
|
||||
|
||||
Reference in New Issue
Block a user