Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"
This reverts commit cea84ab93aeb079a358ab1c8aeba6d9140ef8b47.
llvm-svn: 352069
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index bebefe5..a650493 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4401,16 +4401,12 @@
if (UnusedReturnSizePtr)
PopCleanupBlock();
- // Replace the noreturn attribute to better diagnose unreachable UB.
+ // Strip away the noreturn attribute to better diagnose unreachable UB.
if (SanOpts.has(SanitizerKind::Unreachable)) {
- // Also remove from function since CS.hasFnAttr(..) also checks attributes
- // of the called function.
if (auto *F = CS.getCalledFunction())
F->removeFnAttr(llvm::Attribute::NoReturn);
CS.removeAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoReturn);
- CS.addAttribute(llvm::AttributeList::FunctionIndex,
- llvm::Attribute::ExpectNoReturn);
}
EmitUnreachable(Loc);