[clang] Add support for builtin_verbose_trap (PR #79230)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 18 16:03:24 PDT 2024
================
@@ -3452,6 +3452,18 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
case Builtin::BI__builtin_trap:
EmitTrapCall(Intrinsic::trap);
return RValue::get(nullptr);
+ case Builtin::BI__builtin_verbose_trap: {
+ llvm::DILocation *TrapLocation = Builder.getCurrentDebugLocation();
+ if (getDebugInfo()) {
+ std::string Str;
+ E->getArg(0)->tryEvaluateString(Str, getContext());
+ TrapLocation =
+ getDebugInfo()->CreateTrapFailureMessageFor(TrapLocation, Str);
+ }
+ ApplyDebugLocation ApplyTrapDI(*this, TrapLocation);
+ EmitTrapCall(Intrinsic::trap);
----------------
delcypher wrote:
Please leave a comment in the code indicating that currently no attempt is made to prevent traps being merged.
https://github.com/llvm/llvm-project/pull/79230
More information about the cfe-commits
mailing list