ayokunle321 wrote:

@erichkeane thanks a lot for the clarification. I think I have a hang of it 
now- I was kinda confused before. Now, my approach is to look through 
DiagnosticXKinds.td files -> check for a `select` with a significant number of 
items -> check its diagnostic ID -> grep the lib directory with this ID and 
find the uses of the diagnostic -> see if it’s up for replacement (caller has a 
lot of magic numbers/an enum made just for it). 

Now I wanted to ask - what do you consider a lot - 3 or more uses with magic 
numbers? 

For a `select` with a significant number of items, I’m thinking of going with 4 
or more items as it seems reasonable. I was also looking through the codebase 
using this heuristic exposed a lot more for replacement (rather than 5 which I 
had in mind before). 

Also could you just brief me through the process of a change. I know the .td 
files are used to generate header files. So do I have to change the select to 
an enum_select first in the .td files and then build and then reference the 
generated enum option in the caller (e.g. diag::MemClassWork::AliasDecl) and 
then rebuild. The thing about this is that the build would probably fail the 
first time as the callers will still make use of the magic numbers. I also 
found an enum declared just for a select that was already in a header file. For 
this case, I just remove this declaration right? And then replace the select. I 
guess I’m just confused about the whole header generation process - where the 
new enums would live since the relevant header files already exist before a 
build (e.g Sema.h, Decl.h) and since we’re making changes to .td files which 
are the header generators. Kinda new to clang stuff so forgive me for these 
questions 😅

https://github.com/llvm/llvm-project/pull/130868
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to