================ @@ -1245,30 +1245,23 @@ void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound, } llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( - SanitizerKind::SanitizerOrdinal CheckKindOrdinal) { - std::string Label; - switch (CheckKindOrdinal) { -#define SANITIZER(NAME, ID) \ - case SanitizerKind::SO_##ID: \ - Label = "__ubsan_check_" NAME; \ - break; -#include "clang/Basic/Sanitizers.def" - default: - llvm_unreachable("unexpected sanitizer kind"); - } - - // Sanitize label - for (unsigned int i = 0; i < Label.length(); i++) - if (!std::isalpha(Label[i])) - Label[i] = '_'; - + ArrayRef<SanitizerKind::SanitizerOrdinal> Ordinals) { llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation(); - // TODO: deprecate ClArrayBoundsPseudoFn - if (((ClArrayBoundsPseudoFn && - CheckKindOrdinal == SanitizerKind::SO_ArrayBounds) || - CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(CheckKindOrdinal)) && - CheckDI) - CheckDI = getDebugInfo()->CreateSyntheticInlineAt(CheckDI, Label); + + // TODO: the annotation could be more precise: + // 1) use the ordinal name if there is only one ordinal; and/or, + // 2) use the overarching SanitizerHandler if there are multiple ordinals + // (this may be confusing to users) + for (auto Ord : Ordinals) { + // TODO: deprecate ClArrayBoundsPseudoFn + if (((ClArrayBoundsPseudoFn && Ord == SanitizerKind::SO_ArrayBounds) || + CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(Ord)) && + CheckDI) { + CheckDI = getDebugInfo()->CreateSyntheticInlineAt( + CheckDI, "__ubsan_check_singularity"); ---------------- vitalybuka wrote:
Not sure I understand the name. __ubsan_check_singularity -> __ubsan_check_debug_info_{anchor,holder}? https://github.com/llvm/llvm-project/pull/141997 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits