summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index ccda7f4d1aa..1b99f100de1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2479,16 +2479,12 @@ void CodeGenFunction::EmitCheck(
assert(JointCond);
CheckRecoverableKind RecoverKind = getRecoverableKind(Checked[0].second);
- // In cross-DSO CFI mode this code is used to generate __cfi_check_fail, which
- // includes all checks, even those that are not in SanOpts.
- assert(CGM.getCodeGenOpts().SanitizeCfiCrossDso ||
- SanOpts.has(Checked[0].second));
+ assert(SanOpts.has(Checked[0].second));
#ifndef NDEBUG
for (int i = 1, n = Checked.size(); i < n; ++i) {
assert(RecoverKind == getRecoverableKind(Checked[i].second) &&
"All recoverable kinds in a single check must be same!");
- assert(CGM.getCodeGenOpts().SanitizeCfiCrossDso ||
- SanOpts.has(Checked[i].second));
+ assert(SanOpts.has(Checked[i].second));
}
#endif
@@ -2670,8 +2666,11 @@ void CodeGenFunction::EmitCfiCheckFail() {
SanitizerMask Mask = CheckKindMaskPair.second;
llvm::Value *Cond =
Builder.CreateICmpNE(CheckKind, llvm::ConstantInt::get(Int8Ty, Kind));
- EmitCheck(std::make_pair(Cond, Mask), "cfi_check_fail", {},
- {Data, Addr, ValidVtable});
+ if (CGM.getLangOpts().Sanitize.has(Mask))
+ EmitCheck(std::make_pair(Cond, Mask), "cfi_check_fail", {},
+ {Data, Addr, ValidVtable});
+ else
+ EmitTrapCheck(Cond);
}
FinishFunction();
OpenPOWER on IntegriCloud