[PATCH] D141000: [clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 14 10:21:56 PST 2023


carlosgalvezp added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp:151-152
   Options.WarningsAsErrors = "";
+  Options.HeaderFileExtensions = {"h", "hh", "hpp", "hxx"};
+  Options.ImplementationFileExtensions = {"c", "cc", "cpp", "cxx"};
   Options.HeaderFilterRegex = "";
----------------
njames93 wrote:
> clang-tidy also works on ObjectiveC, ObjectiveC++ and cuda source files, We shouldn't be ignoring those in the defaults here.
> Also some libraries(including the standard library) make use of extension-less header files, maybe its worth adding an empty entry in the header file extensions.
Fully agree, but I'd like to keep the scope of this patch focused only on moving the options from local to global options - it should be a NFC. I took the defaults that we have today in all checks, which also happen to be the hardcoded defaults in `FileExtensionUtils.h`:

```
inline StringRef defaultHeaderFileExtensions() { return ";h;hh;hpp;hxx"; }
```

Adding more extensions requires changes to those source files as well, increase sizes of `SmallVector`s therein, etc, so I think it'd fit better as a separate patch. Would you agree?

By the way, does the initial semicolon above mean that we consider extension-less headers? I can fix that in this patch.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141000/new/

https://reviews.llvm.org/D141000



More information about the cfe-commits mailing list