[llvm] [llvm][Tablegen][llvm-tblgen] Added keyword #undef to llvm-tblgen (PR #69135)

zhao jiangtao via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 01:28:05 PDT 2023


whousemyname wrote:

> > I am so sorry, I don't quite understand what you mean. So is it still necessary to add the ‘#undef’ keyword?
> 
> I actually suspect that what you're trying to enable would be exactly something I don't quite see as desirable right now. I can be wrong though, but the need for doing this hasn't arised in all the TableGen use I've seen, so I'm not able to weigh our conflicting goals against each other right now. I read your Discourse thread, but don't find this very motivated right now: do you have real world use-cases that could be improved by this?


My usage scenario for #undef is this. I am doing some automated compilation work, so I need to inject some code into td. If there is no undef, I need to generate a lot of source code files and continuously include these files.
TDSourceCode:
```
include fileA
include fileB
include fileC
```
If I have undef, I can write the codes related to fileA, B, and C into one file, and then use different define to reference different code segments.
TDSourceCode:
```
#define  INCLUDE_fileA
include fileABC

#define  INCLUDE_fileB
include fileABC

#define  INCLUDE_fileC
include fileABC
```
Without #undef, the difference for me is that I need to create more source code files, for this example it is fileABC/ fileA, fileB, fileC
### Thank for your time


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


More information about the llvm-commits mailing list