[clang-tools-extra] [clangd] check for synthesized symbols when tracking include locations (PR #75128)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 1 23:18:22 PST 2024


================
@@ -821,7 +821,8 @@ void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc,
 
   // Use the expansion location to get the #include header since this is
   // where the symbol is exposed.
-  IncludeFiles[S.ID] = SM.getDecomposedExpansionLoc(DefLoc).first;
+  if (FileID FID = SM.getDecomposedExpansionLoc(DefLoc).first; FID.isValid())
----------------
kadircet wrote:

i still think it's wasteful to check both in both places, but now that you do a `lookup` instead of `at` below, i'll leave this to you.

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


More information about the cfe-commits mailing list