[PATCH] D140726: lld: CHECK->LLD_CHECK to reduce chance of conflict with other libraries

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 10:48:01 PST 2022


MaskRay added a comment.

In D140726#4018459 <https://reviews.llvm.org/D140726#4018459>, @thakis wrote:

> This is only used in lld cpp files, and lld's header files aren't meant to be used outside it. So halide is doing something unsupported.
>
> Could halide undef this macro after including the lld header and before including absl headers instead?

I think the only header user code can include is `include/lld/Common/Driver.h` (for `lld::elf::link`, etc). Others are just a problem of how llvm-project generally organizes header files: if a file happens to be shared by more than one component, it is typically moved to `include/XXX`, regardless whether it is intended to be used as library code.

In this case `include/lld/Common/Driver.h` transitively included `include/lld/Common/ErrorHandler.h` which defines `CHECK`.
This is a problem of the incomplete global state removal for Common 83d59e05b201760e3f364ff6316301d347cbad95 <https://reviews.llvm.org/rG83d59e05b201760e3f364ff6316301d347cbad95>.
I just fixed it in 6b9a80de4906c79101af3b1cadcb3ef1edc62fbc <https://reviews.llvm.org/rG6b9a80de4906c79101af3b1cadcb3ef1edc62fbc> and avoided `CHECK` macros for user code including `include/lld/Common/Driver.h` .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140726/new/

https://reviews.llvm.org/D140726



More information about the llvm-commits mailing list