Skip to content

[build] Fixed LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING handling. #144391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ endif()
string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING)

if( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE" )
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
set( LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE 1 )
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE_AND_ORIGIN" )
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
set( LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING 1 )
set( LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE 1 )
set( LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN 1 )
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "DISABLED" OR NOT DEFINED LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING )
# The DISABLED setting is default.
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 0 )
set( LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE 0 )
else()
message(FATAL_ERROR "Unknown value for LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING: \"${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}\"!")
endif()
# LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING (non-cached) is expected to be
# LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE (non-cached) is expected to be
# 1 or 0 here, assuming referenced in #cmakedefine01.

if(LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS)
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@

/* Define to 1 to enable expensive checks for debug location coverage checking,
and to 0 otherwise. */
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE

/* Define to 1 to enable expensive tracking of the origin of debug location
coverage bugs, and to 0 otherwise. */
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN

#endif
14 changes: 7 additions & 7 deletions llvm/include/llvm/IR/DebugLoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace llvm {
class DILocation;
class Function;

#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
// Used to represent different "kinds" of DebugLoc, expressing that the
// instruction it is part of is either normal and should contain a valid
// DILocation, or otherwise describing the reason why the instruction does
Expand Down Expand Up @@ -90,7 +90,7 @@ namespace llvm {
using DebugLocTrackingRef = DILocAndCoverageTracking;
#else
using DebugLocTrackingRef = TrackingMDNodeRef;
#endif // LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#endif // LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE

/// A debug info location.
///
Expand All @@ -117,12 +117,12 @@ namespace llvm {
/// IR.
LLVM_ABI explicit DebugLoc(const MDNode *N);

#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
DebugLoc(DebugLocKind Kind) : Loc(Kind) {}
DebugLocKind getKind() const { return Loc.Kind; }
#endif

#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
static inline DebugLoc getTemporary() {
return DebugLoc(DebugLocKind::Temporary);
}
Expand All @@ -140,7 +140,7 @@ namespace llvm {
static inline DebugLoc getUnknown() { return DebugLoc(); }
static inline DebugLoc getCompilerGenerated() { return DebugLoc(); }
static inline DebugLoc getDropped() { return DebugLoc(); }
#endif // LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#endif // LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE

/// When two instructions are combined into a single instruction we also
/// need to combine the original locations into a single location.
Expand Down Expand Up @@ -174,7 +174,7 @@ namespace llvm {
DebugLoc orElse(DebugLoc Other) const {
if (*this)
return *this;
#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
if (Other)
return Other;
if (getKind() != DebugLocKind::Normal)
Expand All @@ -184,7 +184,7 @@ namespace llvm {
return *this;
#else
return Other;
#endif // LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#endif // LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
}

/// Get the underlying \a DILocation.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/IR/DebugLoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "llvm/IR/DebugInfo.h"
using namespace llvm;

#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
DILocAndCoverageTracking::DILocAndCoverageTracking(const DILocation *L)
: TrackingMDNodeRef(const_cast<DILocation *>(L)),
Kind(DebugLocKind::Normal) {}
#endif // LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#endif // LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE

//===----------------------------------------------------------------------===//
// DebugLoc Implementation
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/Debugify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ bool llvm::stripDebugifyMetadata(Module &M) {

bool hasLoc(const Instruction &I) {
const DILocation *Loc = I.getDebugLoc().get();
#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
#if LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE
DebugLocKind Kind = I.getDebugLoc().getKind();
return Loc || Kind != DebugLocKind::Normal;
#else
Expand Down
4 changes: 2 additions & 2 deletions llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ write_cmake_config("llvm-config") {
"LLVM_BUILD_SHARED_LIBS=",
"LLVM_ENABLE_TELEMETRY=",
"LLVM_DEFAULT_TARGET_TRIPLE=$llvm_target_triple",
"LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING=",
"LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING=",
"LLVM_ENABLE_DEBUGLOC_TRACKING_COVERAGE=",
"LLVM_ENABLE_DEBUGLOC_TRACKING_ORIGIN=",
"LLVM_ENABLE_DUMP=",
"LLVM_ENABLE_HTTPLIB=",
"LLVM_FORCE_USE_OLD_TOOLCHAIN=",
Expand Down
Loading