[clangd] Respect clang-tidy SystemHeaders option if specified

(Previous commit assumed it was always off, which is the default)
This commit is contained in:
Sam McCall 2023-01-11 18:03:58 +01:00
parent d32d749b11
commit 9b16c624ed

View File

@ -542,8 +542,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
// NOLINT comments)?
return DiagnosticsEngine::Ignored;
}
// Match behavior for clang-tidy --system-headers=0 (the default).
if (Info.hasSourceManager() &&
if (!CTContext->getOptions().SystemHeaders.value_or(false) &&
Info.hasSourceManager() &&
Info.getSourceManager().isInSystemMacro(Info.getLocation()))
return DiagnosticsEngine::Ignored;