llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Florian Mayer (fmayer) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/149237.diff 2 Files Affected: - (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+6-3) - (added) clang/test/CodeGen/null-sanitizer-debug-info-regression.cpp (+5) ``````````diff diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 75ee08a2bcfa6..f1a3ae2e057b2 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -6480,20 +6480,23 @@ SanitizerOrdinalToCheckLabel(SanitizerKind::SanitizerOrdinal Ordinal) { llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( ArrayRef<SanitizerKind::SanitizerOrdinal> Ordinals, SanitizerHandler Handler) { + llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation(); + auto *DI = getDebugInfo(); + if (!DI) + return CheckDI; + std::string Label; if (Ordinals.size() == 1) Label = SanitizerOrdinalToCheckLabel(Ordinals[0]); else Label = SanitizerHandlerToCheckLabel(Handler); - llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation(); - for (auto Ord : Ordinals) { // TODO: deprecate ClArrayBoundsPseudoFn if (((ClArrayBoundsPseudoFn && Ord == SanitizerKind::SO_ArrayBounds) || CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(Ord)) && CheckDI) { - return getDebugInfo()->CreateSyntheticInlineAt(CheckDI, Label); + return DI->CreateSyntheticInlineAt(CheckDI, Label); } } diff --git a/clang/test/CodeGen/null-sanitizer-debug-info-regression.cpp b/clang/test/CodeGen/null-sanitizer-debug-info-regression.cpp new file mode 100644 index 0000000000000..0b62f24177bbd --- /dev/null +++ b/clang/test/CodeGen/null-sanitizer-debug-info-regression.cpp @@ -0,0 +1,5 @@ +// RUN: %clangxx -g -fsanitize=null -fsanitize-trap=all -fsanitize-annotate-debug-info=all -O2 -std=c++17 -c -o /dev/null %s + +struct foo { + foo(int, long, const int & = int()); +} foo(0, 0); `````````` </details> https://github.com/llvm/llvm-project/pull/149237 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits