psigillito added a comment. In D117416#3246838 <https://reviews.llvm.org/D117416#3246838>, @curdeius wrote:
> Thanks for having a try on this. > However, I don't like this approach too much. You add many changes and a > single test. That's not sufficient. > Also, handling C++ keywords in all cases (e.g. `delete` as a function name) > *may* need to distinguish whether we format a C file or a C++ file. It's > probably impossible to do this without user input (.h extension is used in > both languages for example). > We'd maybe need to add C as language option and let the user specify the > language (`-x c`?). > That in turn may be painful (because not automatic). > But, you may have a better solution. > My 2 cents. Thanks, I am just starting to understand some of the code base so my changes should be taken with a grain of salt. The more I think about this, I do not think my change is correct. As you pointed out with the 'delete' keyword, my changes would not correctly handle a struct named 'delete' i.e. struct delete foo = {0}; delete.val; I think adding a cmd line argument specifying you are using C code is more correct. If the user does not specify they are using C, clang-format would format the code as it does now. The only thing I don't like about this is that it might be kind of clumsy to only be able to specify your language is C. I can take a stab at implementing this if this is the route we want to go. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117416/new/ https://reviews.llvm.org/D117416 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits