[clang-tools-extra] [include-cleaner] Handle symbols from system headers. (PR #66089)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 03:20:58 PDT 2023


================
@@ -176,6 +180,104 @@ headersForSpecialSymbol(const Symbol &S, const SourceManager &SM,
   return std::nullopt;
 }
 
+// A hand-mainained list of include mappings for system headers.
+// The first element is the suffix of the physical file path for the system
+// header, the second element is the final verbatim header spelling.
+const std::pair<llvm::StringRef, llvm::StringRef> IncludeMappings[] = {
+    {"bits/types/struct_timeval.h", "<sys/time.h>"},
----------------
kadircet wrote:

what about extracting these into a `SystemHeaderSuffixes.inc` with entries like `SYSTEM_HEADER_DETAIL(bits/types/struct_timeval.h, <sys/time.h>)`. that way we can have an easy way to inject more mappings going forward for other libraries in the future.

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


More information about the cfe-commits mailing list