There're several places in the code base where DEBUG_TYPE definition is defined at the top of the file or around the #includes, which could result in conflicts when you try to define a new DEBUG_TYPE in a related header file.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This fix looks good.
which could result in conflicts when you try to define a new DEBUG_TYPE in a related header file.
And I am wondering the reason you want to define DEBUG_TYPE in a header file. It isn't what we used to do.
And I am wondering the reason you want to define DEBUG_TYPE in a header file. It isn't what we used to do.
I don't think it's true. We can find many header files under llvm/include/ have their own DEBUG_TYPE, and it works well if you carefully undefine it at the end of the file.
Yeah, the codes shows you are right. I find definitions for DEBUG_TYPE in some headers.
lgtm. this seems fine to me, but presumably we would have a compile error if there was ever a conflict in practice with one of these files?
In practice it conflicts with macros defined in header files; if a conflict header file defines one but doesn't undefined it(which is unusual), the compiler throws a redefinition warning; in a general case, there'll be a compile error instead. Thanks for the review!