[LLVMdev] DEBUG
Chris Lattner
sabre at nondot.org
Mon Jul 7 13:36:04 PDT 2008
On Mon, 7 Jul 2008, David Greene wrote:
>>> from our IR to LLVM IR. Those files need to include headers from both
>>> LLVM and our compiler components. That is where the DEBUG conflict
>>> happens.
>>
>> Do you need to use both of the debug mechanisms in the same CPP files?
>
> In some cases, yes.
I have mixed feelings about this. I consider LLVM's debug macro to really
be an internal implementation detail that shouldn't be "exported" as part
of it's API. It is unfortunate that the C preprocessor is so bad at this
sort of thing.
Since I think it really is a part of the LLVM internals, I don't think
that mangling it with a prefix is the right way to go. This would
significantly increase verbosity in the code and would be generally
detrimental.
As a solution for your problem, would something like this work?
#include "llvm/Debug.h"
#define LLVM_DEBUG(X) DEBUG(X)
#undef DEBUG
#include "DavidDebug.h"
...
Or visaversa?
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list