[llvm] [NFC][Lanai][Hexagon] Define DEBUG_TYPE after including Debug.h. (PR #125440)

Jason Eckhardt via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 03:27:51 PST 2025


nvjle wrote:

> > This fixes some warnings/errors that occur with certain compilers.
> 
> Could you elaborate on what kinds of warnings and errors your PR fixes?

Yes, with gcc13 on linux:

```
llvm/include/llvm/Support/Debug.h:106:41: error: ‘DEBUG_TYPE’ was not declared in this scope; did you mean ‘DEBUG_WITH_TYPE’?
  106 | #define LLVM_DEBUG(...) DEBUG_WITH_TYPE(DEBUG_TYPE, __VA_ARGS__)
      |                                         ^~~~~~~~~~
llvm/include/llvm/Support/Debug.h:66:57: note: in definition of macro ‘DEBUG_WITH_TYPE’
   66 |     if (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)) {               \
      |                                                         ^~~~
llvm/lib/Target/Hexagon/HexagonLoopAlign.cpp:115:3: note: in expansion of macro ‘LLVM_DEBUG’
  115 |   LLVM_DEBUG({
      |   ^~~~~~~~~~
```

The change is LLVM-idiomatic (excerpt from  `Debug.h`):

```
// LLVM_DEBUG() requires the DEBUG_TYPE macro to be defined. Set it to "foo"
// specify that your debug code belongs to class "foo". Be careful that you only
// do this after including Debug.h and not around any #include of headers.
```


https://github.com/llvm/llvm-project/pull/125440


More information about the llvm-commits mailing list