Skip to content

CMake: Fix LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING in reentrancy situa… #144331

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

Closed
wants to merge 2 commits into from

Conversation

penguin-wwy
Copy link

In the case of re-entrance, an error will be reported for valid values.

   CMake Error at cmake/modules/HandleLLVMOptions.cmake:210 (message):
    Unknown value for LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING: "0"!

For example, in downstream projects:
llvm/torch-mlir#4230 (comment)

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Jun 16, 2025
endif()
if( NOT ${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING} EQUAL 0
AND NOT ${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING} EQUAL 1 )
string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look like redefinition from line 199.

string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING)

Can you just keep one definition ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!

jeanPerier referenced this pull request Jun 16, 2025
It has been introduced in #107278 but it was passing
"DISABLED" of LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING to cmakedefine01.

cmakadefine01 treats non-false-like strings as 1.
"DISABLED" is replaced with 1.
Copy link
Contributor

@umangyadav umangyadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks for fixing this.

@vzakhari
Copy link
Contributor

@umangyadav please let me know if you are going to merge this after the CI finishes. I can do it myself as well.

@umangyadav
Copy link
Contributor

@umangyadav please let me know if you are going to merge this after the CI finishes. I can do it myself as well.

I don't have commit access. Can you please do it ?

Copy link
Contributor

@chapuni chapuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you proceed this w/o mentioning original author(s)? @SLTozer #107278 #143590

I guess it would just work but nasty. This should be rewritten w/o modifying cache vars, finally.

I also guess this would be tolerant of cmake -DLLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING=0. Is it intented?

If you want it to be a workaround, you may reduce affected lines, e.g.

string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING)

if( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "0" OR uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "1")
  # Do nothing.
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE" )

@vzakhari
Copy link
Contributor

Good point, @chapuni! I did not realize @penguin-wwy was not the original author. Let me try to rework it. It is blocking me as well.

@SLTozer
Copy link
Contributor

SLTozer commented Jun 17, 2025

Issue should be fixed by #144391, should this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants