We recently stumbled upon some issues with the DEBUG() macro being redefined in some internal libraries and some external ones, such as LLVM. After trying out a few ideas to avoid the problem we thought that the simplest solution would be to prefix all generic macro names in order to avoid clashes.
A quick search showed that Mesa had a similar issue with DEBUG being used by LLVM and had a couple of proposed patches such as [Mesa-dev] [PATCH] Rename the DEBUG macro to MESA_DEBUG and [Mesa-dev] [PATCH] swr: push/pop DEBUG macro around llvm includes
I noticed that others have left comments in the LLVM source about the same issue, so I decided to try to replace all DEBUG() uses with LLVM_DEBUG() and remove the old macro.
A review for the LLVM side of the patch is here: ⚙ D43624 Change DEBUG() macro to LLVM_DEBUG(), this was generated mostly by a find/replace regex.
This kind of change is quite invasive (~500 files) and might be disruptive to multiple parties. One possible way to avoid some of the disruption would be to keep arond the old macro during a transition period in which it would be "deprecated".