hvdijk wrote:

This approach causes issues when LLVM is built in release mode (with 
`-DNDEBUG`) and external projects build against it in debug mode (with 
`-UNDEBUG`). I appreciate that it does what the comment says should be done, 
but I think what the comment says is wrong. Specifically, I now see in our own 
project:
```
module.cpp:(.text._ZNK4llvm12ScaledNumberImE4dumpEv[_ZNK4llvm12ScaledNumberImE4dumpEv]+0x34):
 undefined reference to `llvm::ScaledNumberBase::dump(unsigned long, short, 
int)'
```
where our `module.cpp` does not call any `dump()` anywhere (in fact our whole 
project does not call `dump()` anywhere), and the linker error does not tell 
where this reference is coming from.

There is a reason `LLVM_ENABLE_ASSERTIONS` can be toggled independently of 
build type (you can have `CMAKE_BUILD_TYPE=Debug LLVM_ENABLE_ASSERTIONS=OFF` if 
you like, or `CMAKE_BUILD_TYPE=Release LLVM_ENABLE_ASSERTIONS=ON`, 
`CMAKE_BUILD_TYPE` only affects the default value for `LLVM_ENABLE_ASSERTIONS`, 
it's never checked afterwards. I think we need to do the same for 
`LLVM_ENABLE_DUMP`.

I'm tracking down where this reference to `dump()` is and whether it can be 
worked around there, but if not, I think this PR should be reverted until we 
figure out how to proceed.

https://github.com/llvm/llvm-project/pull/139938
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to