[clang-tools-extra] [clang-tidy][include-cleaner] Fix false positive for stdlib-like macros (PR #173149)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 00:11:59 PST 2026


================
@@ -56,10 +56,11 @@ std::vector<Hinted<SymbolLocation>> locateDecl(const Decl &D) {
 
 std::vector<Hinted<SymbolLocation>> locateMacro(const Macro &M,
                                                 const tooling::stdlib::Lang L) {
-  // FIXME: Should we also provide physical locations?
+  std::vector<Hinted<SymbolLocation>> Result;
+  Result.push_back({M.Definition, Hints::CompleteSymbol});
   if (auto SS = tooling::stdlib::Symbol::named("", M.Name->getName(), L))
-    return {{*SS, Hints::CompleteSymbol}};
-  return {{M.Definition, Hints::CompleteSymbol}};
+    Result.push_back({*SS, Hints::CompleteSymbol});
----------------
kadircet wrote:

can you preserve the ordering here? i.e. make sure the stdlib based provider is pushed first. that way we can preserve the current insertion behavior, while enabling users to pick a "custom" header.

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


More information about the cfe-commits mailing list