Author: Chandler Carruth
Date: 2026-08-22T23:14:53Z
New Revision: 3ff8254afdb28be14735814be8d66d6bde5fbbb6

URL: 
https://github.com/llvm/llvm-project/commit/3ff8254afdb28be14735814be8d66d6bde5fbbb6
DIFF: 
https://github.com/llvm/llvm-project/commit/3ff8254afdb28be14735814be8d66d6bde5fbbb6.diff

LOG: [clang] Trim large(-ish) includes from common headers (#216946)

Several widely included Clang headers pull in whole subsystems to name
types they only use through pointers, references, or declarations.
Because these headers sit underneath SourceManager.h, Sema.h, and
CompilerInstance.h, nearly every translation unit in Clang pays for
them, as well as many down-stream users of Clang.

Translation units across Clang and clang-tools-extra that were relying
on any of the removed transitive includes now include what they use.

Out-of-tree code that was relying on any of these transitive includes
needs the same treatment. The failure is an incomplete type or an
undeclared identifier at the point of use, and the fix is to include the
header that declares it; llvm/Support/VirtualFileSystem.h and AST/Attr.h
account for most of it, since Basic/FileManager.h and AST/GlobalDecl.h
are reached from so much of Clang.

Measured on a random 90 translation unit sample of clang's 1006 library
translation units, compiling each directly: 280.0s drops to 267.2s of
compiler CPU time, a 4.6% reduction. In isolation, Basic/SourceManager.h
drops from 1.11s to 0.85s and Lex/Preprocessor.h from 1.56s to 1.33s.

Assisted-by: Claude Code

Added: 
    clang/lib/AST/GlobalDecl.cpp

Modified: 
    clang-tools-extra/clang-tidy/ClangTidy.cpp
    clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
    clang-tools-extra/clangd/FindSymbols.cpp
    clang-tools-extra/clangd/ParsedAST.cpp
    clang-tools-extra/clangd/ParsedAST.h
    clang-tools-extra/clangd/Preamble.h
    clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp
    clang-tools-extra/clangd/unittests/ASTTests.cpp
    clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
    clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    clang-tools-extra/clangd/unittests/InsertionPointTests.cpp
    clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
    clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
    clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
    clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
    clang/include/clang/AST/ExprObjC.h
    clang/include/clang/AST/GlobalDecl.h
    clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h
    clang/include/clang/Basic/FileManager.h
    clang/include/clang/Basic/TargetInfo.h
    clang/include/clang/Driver/Driver.h
    clang/include/clang/Frontend/ASTUnit.h
    clang/include/clang/Frontend/CompilerInstance.h
    clang/include/clang/Frontend/CompilerInvocation.h
    clang/include/clang/Frontend/FrontendAction.h
    clang/include/clang/Sema/Sema.h
    clang/lib/AST/CMakeLists.txt
    clang/lib/AST/Decl.cpp
    clang/lib/AST/QualTypeNames.cpp
    clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
    clang/lib/Basic/FileManager.cpp
    clang/lib/Basic/SourceManager.cpp
    clang/lib/Basic/TargetInfo.cpp
    clang/lib/Basic/Targets/RISCV.h
    clang/lib/Basic/Targets/X86.h
    clang/lib/CIR/CodeGen/CIRGenFunction.h
    clang/lib/CIR/CodeGen/CIRGenModule.h
    clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h
    clang/lib/CIR/CodeGen/CIRGenerator.cpp
    clang/lib/CIR/FrontendAction/CIRGenAction.cpp
    clang/lib/CodeGen/CGOpenMPRuntime.cpp
    clang/lib/CodeGen/CGPointerAuth.cpp
    clang/lib/CodeGen/CodeGenFunction.h
    clang/lib/CodeGen/CodeGenModule.cpp
    clang/lib/CrossTU/CrossTranslationUnit.cpp
    clang/lib/Format/Format.cpp
    clang/lib/Frontend/CompilerInstance.cpp
    clang/lib/Frontend/FrontendAction.cpp
    clang/lib/Frontend/FrontendActions.cpp
    clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
    clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
    clang/lib/Frontend/TextDiagnostic.cpp
    clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    clang/lib/Index/IndexingAction.cpp
    clang/lib/InstallAPI/DirectoryScanner.cpp
    clang/lib/InstallAPI/Frontend.cpp
    clang/lib/InstallAPI/HeaderFile.cpp
    clang/lib/Interpreter/IncrementalAction.h
    clang/lib/Lex/PPLexerChange.cpp
    
clang/lib/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.cpp
    
clang/lib/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.cpp
    clang/lib/Sema/SemaCodeComplete.cpp
    clang/lib/Sema/SemaExpr.cpp
    clang/lib/Serialization/ASTReader.cpp
    clang/lib/Serialization/ASTWriter.cpp
    clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
    clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
    clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
    clang/lib/Testing/TestAST.cpp
    clang/lib/Tooling/Syntax/Tokens.cpp
    clang/tools/clang-format/ClangFormat.cpp
    clang/tools/clang-installapi/Options.cpp
    clang/unittests/Analysis/MacroExpansionContextTest.cpp
    clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
    clang/unittests/Frontend/CompilerInstanceTest.cpp
    clang/unittests/Frontend/CompilerInvocationTest.cpp
    clang/unittests/Lex/HeaderSearchTest.cpp
    clang/unittests/Lex/NoTrivialPPDirectiveTracerTest.cpp
    clang/unittests/Lex/PPCallbacksTest.cpp
    clang/unittests/Lex/PPDependencyDirectivesTest.cpp
    clang/unittests/Tooling/ASTSelectionTest.cpp
    clang/unittests/Tooling/RewriterTestContext.h
    clang/unittests/Tooling/Syntax/TreeTestBase.cpp
    clang/unittests/Tooling/Syntax/TreeTestBase.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp 
b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 8135826ef660d..d065bb2c4bcfc 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -42,6 +42,7 @@
 
 #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
 #include "clang/Analysis/PathDiagnostic.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
 #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
 

diff  --git a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp 
b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
index 98709e924a7a1..a710c6ab728c2 100644
--- a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
+++ b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
@@ -23,6 +23,7 @@
 #include "clang/Tooling/FixIt.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Path.h"
 
 using namespace clang::ast_matchers;
 using namespace clang::analyze_printf;

diff  --git a/clang-tools-extra/clangd/FindSymbols.cpp 
b/clang-tools-extra/clangd/FindSymbols.cpp
index eeb6a56023b11..2a674d375b5d9 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -16,6 +16,7 @@
 #include "index/Symbol.h"
 #include "index/SymbolLocation.h"
 #include "support/Logger.h"
+#include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclTemplate.h"

diff  --git a/clang-tools-extra/clangd/ParsedAST.cpp 
b/clang-tools-extra/clangd/ParsedAST.cpp
index df56420cd7f24..d84c577c3842e 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -50,6 +50,7 @@
 #include "clang/Frontend/PrecompiledPreamble.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Sema/HeuristicResolver.h"
 #include "clang/Serialization/ASTWriter.h"

diff  --git a/clang-tools-extra/clangd/ParsedAST.h 
b/clang-tools-extra/clangd/ParsedAST.h
index 6640ccccf5815..353859a3b46d5 100644
--- a/clang-tools-extra/clangd/ParsedAST.h
+++ b/clang-tools-extra/clangd/ParsedAST.h
@@ -27,6 +27,7 @@
 #include "Preamble.h"
 #include "clang-include-cleaner/Record.h"
 #include "support/Path.h"
+#include "clang/AST/DeclCXX.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Tooling/Syntax/Tokens.h"

diff  --git a/clang-tools-extra/clangd/Preamble.h 
b/clang-tools-extra/clangd/Preamble.h
index 8a5edf1fee1af..5513b683748ae 100644
--- a/clang-tools-extra/clangd/Preamble.h
+++ b/clang-tools-extra/clangd/Preamble.h
@@ -31,6 +31,7 @@
 
 #include "clang-include-cleaner/Record.h"
 #include "support/Path.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetOptions.h"
 #include "clang/Frontend/CompilerInvocation.h"
@@ -40,7 +41,6 @@
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-
 #include <cstddef>
 #include <functional>
 #include <memory>

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp
index 52afda56a5028..2c6ab530e6f6c 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp
@@ -8,6 +8,7 @@
 #include "refactor/Tweak.h"
 
 #include "support/Logger.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LLVM.h"

diff  --git a/clang-tools-extra/clangd/unittests/ASTTests.cpp 
b/clang-tools-extra/clangd/unittests/ASTTests.cpp
index 91ae727d8c944..4c4cb16044a0b 100644
--- a/clang-tools-extra/clangd/unittests/ASTTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ASTTests.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclBase.h"
+#include "clang/AST/DeclTemplate.h"
 #include "clang/Basic/AttrKinds.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp 
b/clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
index afefa245f03e7..45292bbeec2e8 100644
--- a/clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
+++ b/clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp
@@ -11,6 +11,7 @@
 #include "TestTU.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "clang/Sema/CodeCompleteConsumer.h"
 #include "llvm/ADT/StringRef.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"

diff  --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index d8c903cfcafeb..3377b017410b5 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -10,6 +10,7 @@
 #include "Selection.h"
 #include "TestTU.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/unittests/InsertionPointTests.cpp 
b/clang-tools-extra/clangd/unittests/InsertionPointTests.cpp
index 3d5365a099f0a..f8a0df5b73dac 100644
--- a/clang-tools-extra/clangd/unittests/InsertionPointTests.cpp
+++ b/clang-tools-extra/clangd/unittests/InsertionPointTests.cpp
@@ -13,6 +13,7 @@
 #include "XRefs.h"
 #include "refactor/InsertionPoint.h"
 #include "clang/AST/DeclBase.h"
+#include "clang/AST/DeclObjC.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"

diff  --git a/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp 
b/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
index b96d9a70728c2..47f3c37501cdc 100644
--- a/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
+++ b/clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
@@ -26,6 +26,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Path.h"
 #include <optional>
 #include <queue>
 #include <set>

diff  --git a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp 
b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
index 5b24008c1b08d..cd739e0ab329b 100644
--- a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
+++ b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
@@ -23,6 +23,7 @@
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Tooling/Inclusions/StandardLibrary.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/raw_ostream.h"
 #include <numeric>

diff  --git a/clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp 
b/clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
index d0549825d4c40..c420af7b41dfe 100644
--- a/clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
+++ b/clang-tools-extra/include-cleaner/lib/IncludeSpeller.cpp
@@ -12,6 +12,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Registry.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include <memory>
 #include <string>
 

diff  --git a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp 
b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
index cbf7bae23b365..cc0fc127af72c 100644
--- a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/FrontendOptions.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Serialization/PCHContainerOperations.h"
 #include "clang/Testing/CommandLineArgs.h"
 #include "clang/Testing/TestAST.h"

diff  --git a/clang/include/clang/AST/ExprObjC.h 
b/clang/include/clang/AST/ExprObjC.h
index 7f7b556f14329..b424530c8447c 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_CLANG_AST_EXPROBJC_H
 #define LLVM_CLANG_AST_EXPROBJC_H
 
-#include "clang/AST/Attr.h"
 #include "clang/AST/ComputeDependence.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclObjC.h"

diff  --git a/clang/include/clang/AST/GlobalDecl.h 
b/clang/include/clang/AST/GlobalDecl.h
index 0f9ff9496ff88..0ae48e030bb3f 100644
--- a/clang/include/clang/AST/GlobalDecl.h
+++ b/clang/include/clang/AST/GlobalDecl.h
@@ -14,14 +14,11 @@
 #ifndef LLVM_CLANG_AST_GLOBALDECL_H
 #define LLVM_CLANG_AST_GLOBALDECL_H
 
-#include "clang/AST/Attr.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
-#include "clang/AST/DeclOpenACC.h"
-#include "clang/AST/DeclOpenMP.h"
-#include "clang/AST/DeclTemplate.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/Support/Casting.h"
@@ -30,6 +27,12 @@
 
 namespace clang {
 
+class FunctionTemplateDecl;
+class OMPDeclareMapperDecl;
+class OMPDeclareReductionDecl;
+class OpenACCDeclareDecl;
+class OpenACCRoutineDecl;
+
 enum class DynamicInitKind : unsigned {
   NoStub = 0,
   Initializer,
@@ -58,10 +61,16 @@ class GlobalDecl {
   llvm::PointerIntPair<const Decl *, 3> Value;
   unsigned MultiVersionIndex = 0;
 
+  CLANG_ABI static bool hasCUDAGlobalAttr(const Decl *D);
+
+  /// Whether \p D is a kernel referred to through a KernelReferenceKind,
+  /// either directly or as a function template.
+  CLANG_ABI static bool isKernelReference(const Decl *D);
+
   void Init(const Decl *D) {
     assert(!isa<CXXConstructorDecl>(D) && "Use other ctor with ctor decls!");
     assert(!isa<CXXDestructorDecl>(D) && "Use other ctor with dtor decls!");
-    assert(!D->hasAttr<CUDAGlobalAttr>() && "Use other ctor with GPU 
kernels!");
+    assert(!hasCUDAGlobalAttr(D) && "Use other ctor with GPU kernels!");
 
     Value.setPointer(D);
   }
@@ -85,10 +94,10 @@ class GlobalDecl {
   GlobalDecl(const BlockDecl *D) { Init(D); }
   GlobalDecl(const CapturedDecl *D) { Init(D); }
   GlobalDecl(const ObjCMethodDecl *D) { Init(D); }
-  GlobalDecl(const OMPDeclareReductionDecl *D) { Init(D); }
-  GlobalDecl(const OMPDeclareMapperDecl *D) { Init(D); }
-  GlobalDecl(const OpenACCRoutineDecl *D) { Init(D); }
-  GlobalDecl(const OpenACCDeclareDecl *D) { Init(D); }
+  GlobalDecl(const OMPDeclareReductionDecl *D);
+  GlobalDecl(const OMPDeclareMapperDecl *D);
+  GlobalDecl(const OpenACCRoutineDecl *D);
+  GlobalDecl(const OpenACCDeclareDecl *D);
   GlobalDecl(const CXXConstructorDecl *D, CXXCtorType Type) : Value(D, Type) {}
   GlobalDecl(const CXXDestructorDecl *D, CXXDtorType Type) : Value(D, Type) {}
   GlobalDecl(const VarDecl *D, DynamicInitKind StubKind)
@@ -123,9 +132,7 @@ class GlobalDecl {
   }
 
   unsigned getMultiVersionIndex() const {
-    assert(isa<FunctionDecl>(
-               getDecl()) &&
-               !cast<FunctionDecl>(getDecl())->hasAttr<CUDAGlobalAttr>() &&
+    assert(isa<FunctionDecl>(getDecl()) && !hasCUDAGlobalAttr(getDecl()) &&
            !isa<CXXConstructorDecl>(getDecl()) &&
            !isa<CXXDestructorDecl>(getDecl()) &&
            "Decl is not a plain FunctionDecl!");
@@ -133,13 +140,7 @@ class GlobalDecl {
   }
 
   KernelReferenceKind getKernelReferenceKind() const {
-    assert(((isa<FunctionDecl>(getDecl()) &&
-             cast<FunctionDecl>(getDecl())->isReferenceableKernel()) ||
-            (isa<FunctionTemplateDecl>(getDecl()) &&
-             cast<FunctionTemplateDecl>(getDecl())
-                 ->getTemplatedDecl()
-                 ->hasAttr<CUDAGlobalAttr>())) &&
-           "Decl is not a GPU kernel!");
+    assert(isKernelReference(getDecl()) && "Decl is not a GPU kernel!");
 
     return static_cast<KernelReferenceKind>(Value.getInt());
   }
@@ -163,11 +164,8 @@ class GlobalDecl {
     return GD;
   }
 
-  static KernelReferenceKind getDefaultKernelReference(const FunctionDecl *D) {
-    return (D->hasAttr<DeviceKernelAttr>() || D->getLangOpts().CUDAIsDevice)
-               ? KernelReferenceKind::Kernel
-               : KernelReferenceKind::Stub;
-  }
+  CLANG_ABI static KernelReferenceKind
+  getDefaultKernelReference(const FunctionDecl *D);
 
   GlobalDecl getWithDecl(const Decl *D) {
     GlobalDecl Result(*this);
@@ -190,8 +188,7 @@ class GlobalDecl {
   }
 
   GlobalDecl getWithMultiVersionIndex(unsigned Index) {
-    assert(isa<FunctionDecl>(getDecl()) &&
-           !cast<FunctionDecl>(getDecl())->hasAttr<CUDAGlobalAttr>() &&
+    assert(isa<FunctionDecl>(getDecl()) && !hasCUDAGlobalAttr(getDecl()) &&
            !isa<CXXConstructorDecl>(getDecl()) &&
            !isa<CXXDestructorDecl>(getDecl()) &&
            "Decl is not a plain FunctionDecl!");

diff  --git 
a/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h 
b/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h
index 6f1259fa867dc..ec2ae64589544 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeAnnotations.h
@@ -10,13 +10,16 @@
 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMEANNOTATIONS_H
 #define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMEANNOTATIONS_H
 
-#include "clang/AST/Attr.h"
 #include "clang/AST/DeclCXX.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
 #include <optional>
 
+namespace clang {
+class LifetimeBoundAttr;
+} // namespace clang
+
 namespace clang ::lifetimes {
 
 // This function is needed because Decl::isInStdNamespace will return false for

diff  --git a/clang/include/clang/Basic/FileManager.h 
b/clang/include/clang/Basic/FileManager.h
index f328969b1033a..04003654bab72 100644
--- a/clang/include/clang/Basic/FileManager.h
+++ b/clang/include/clang/Basic/FileManager.h
@@ -25,9 +25,10 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/VirtualFileSystem.h"
+#include "llvm/Support/FileSystem/UniqueID.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include <ctime>
 #include <map>
 #include <memory>
@@ -36,7 +37,11 @@
 
 namespace llvm {
 
-class MemoryBuffer;
+namespace vfs {
+class File;
+class FileSystem;
+class Status;
+} // end namespace vfs
 
 } // end namespace llvm
 
@@ -151,7 +156,10 @@ class FileManager : public RefCountedBase<FileManager> {
   /// \param FS if non-null, the VFS to use.  Otherwise uses
   /// llvm::vfs::getRealFileSystem().
   FileManager(const FileSystemOptions &FileSystemOpts,
-              IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
+              IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
+  /// Construct a file manager over the real file system. Separate from the
+  /// overload above so that callers do not need a complete FileSystem type.
+  explicit FileManager(const FileSystemOptions &FileSystemOpts);
   ~FileManager();
 
   /// Returns the number of unique real file entries cached by the file 
manager.
@@ -231,17 +239,13 @@ class FileManager : public RefCountedBase<FileManager> {
 
   llvm::vfs::FileSystem &getVirtualFileSystem() const { return *FS; }
   llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
-  getVirtualFileSystemPtr() const {
-    return FS;
-  }
+  getVirtualFileSystemPtr() const;
 
   /// Enable or disable tracking of VFS usage. Used to not track full header
   /// search and implicit modulemap lookup.
   void trackVFSUsage(bool Active);
 
-  void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
-    this->FS = std::move(FS);
-  }
+  void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
 
   /// Retrieve a file entry for a "virtual" file that acts as
   /// if there were a file with the given name on disk.

diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index 6311b6b567a5e..5a541aaf797fe 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -35,7 +35,6 @@
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringTable.h"
 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
-#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VersionTuple.h"
@@ -699,19 +698,7 @@ class TargetInfo : public TransferrableTargetInfo,
 
   // Different targets may support a 
diff erent maximum width for the _BitInt
   // type, depending on what operations are supported.
-  virtual size_t getMaxBitIntWidth() const {
-    // Consider -fexperimental-max-bitint-width= first.
-    if (MaxBitIntWidth)
-      return std::min<size_t>(*MaxBitIntWidth, 
llvm::IntegerType::MAX_INT_BITS);
-
-    // FIXME: this value should be llvm::IntegerType::MAX_INT_BITS, which is
-    // maximum bit width that LLVM claims its IR can support. However, most
-    // backends currently have a bug where they only support float to int
-    // conversion (and vice versa) on types that are <= 128 bits and crash
-    // otherwise. We're setting the max supported value to 128 to be
-    // conservative.
-    return 128;
-  }
+  virtual size_t getMaxBitIntWidth() const;
 
   /// Determine whether the target has fast native support for operations
   /// on half types.

diff  --git a/clang/include/clang/Driver/Driver.h 
b/clang/include/clang/Driver/Driver.h
index eece9ac5293f0..a96d6c535191e 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -28,6 +28,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/StringSaver.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 #include <map>
 #include <set>

diff  --git a/clang/include/clang/Frontend/ASTUnit.h 
b/clang/include/clang/Frontend/ASTUnit.h
index b187494e449f2..fb7a0addcc202 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -39,6 +39,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Bitstream/BitstreamWriter.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include <cassert>
 #include <cstddef>
 #include <cstdint>

diff  --git a/clang/include/clang/Frontend/CompilerInstance.h 
b/clang/include/clang/Frontend/CompilerInstance.h
index 24488e053c628..21b83dfefa842 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -558,10 +558,7 @@ class CompilerInstance : public ModuleLoader {
     return *Context;
   }
 
-  IntrusiveRefCntPtr<ASTContext> getASTContextPtr() const {
-    assert(Context && "Compiler instance has no AST context!");
-    return Context;
-  }
+  IntrusiveRefCntPtr<ASTContext> getASTContextPtr() const;
 
   void resetAndLeakASTContext() {
     llvm::BuryPointer(Context.get());

diff  --git a/clang/include/clang/Frontend/CompilerInvocation.h 
b/clang/include/clang/Frontend/CompilerInvocation.h
index f71969d515be0..de38029596672 100644
--- a/clang/include/clang/Frontend/CompilerInvocation.h
+++ b/clang/include/clang/Frontend/CompilerInvocation.h
@@ -20,7 +20,6 @@
 #include "clang/Frontend/FrontendOptions.h"
 #include "clang/Frontend/MigratorOptions.h"
 #include "clang/Frontend/PreprocessorOutputOptions.h"
-#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/ScopeExit.h"
@@ -48,6 +47,7 @@ class FileSystem;
 
 namespace clang {
 
+class AnalyzerOptions;
 class DiagnosticsEngine;
 class HeaderSearchOptions;
 class PreprocessorOptions;

diff  --git a/clang/include/clang/Frontend/FrontendAction.h 
b/clang/include/clang/Frontend/FrontendAction.h
index 08c5fbc78f8ae..8be732ceb40a0 100644
--- a/clang/include/clang/Frontend/FrontendAction.h
+++ b/clang/include/clang/Frontend/FrontendAction.h
@@ -20,7 +20,6 @@
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendOptions.h"
 #include "llvm/ADT/StringRef.h"
@@ -31,6 +30,7 @@
 
 namespace clang {
 class ASTMergeAction;
+class ASTUnit;
 class CompilerInstance;
 
 /// Abstract base class for actions which can be performed by the frontend.
@@ -83,11 +83,7 @@ class FrontendAction {
   ///
   /// \return True on success; on failure ExecutionAction() and
   /// EndSourceFileAction() will not be called.
-  virtual bool BeginSourceFileAction(CompilerInstance &CI) {
-    if (CurrentInput.isPreprocessed())
-      CI.getPreprocessor().SetMacroExpansionOnlyInDirectives();
-    return true;
-  }
+  virtual bool BeginSourceFileAction(CompilerInstance &CI);
 
   /// Callback to run the program action, using the initialized
   /// compiler instance.
@@ -100,11 +96,7 @@ class FrontendAction {
   ///
   /// This is guaranteed to only be called following a successful call to
   /// BeginSourceFileAction (and BeginSourceFile).
-  virtual void EndSourceFileAction() {
-    if (CurrentInput.isPreprocessed())
-      // Reset the preprocessor macro expansion to the default.
-      getCompilerInstance().getPreprocessor().SetEnableMacroExpansion();
-  }
+  virtual void EndSourceFileAction();
 
   /// Callback at the end of processing a single input, to determine
   /// if the output files should be erased or not.
@@ -167,9 +159,7 @@ class FrontendAction {
 
   Module *getCurrentModule() const;
 
-  std::unique_ptr<ASTUnit> takeCurrentASTUnit() {
-    return std::move(CurrentASTUnit);
-  }
+  std::unique_ptr<ASTUnit> takeCurrentASTUnit();
 
   void setCurrentInput(const FrontendInputFile &CurrentInput,
                        std::unique_ptr<ASTUnit> AST = nullptr);
@@ -192,12 +182,7 @@ class FrontendAction {
   virtual bool usesPreprocessorOnly() const = 0;
 
   /// For AST-based actions, the kind of translation unit we're handling.
-  virtual TranslationUnitKind getTranslationUnitKind() {
-    // The ASTContext, if exists, knows the exact TUKind of the frondend.
-    if (Instance && Instance->hasASTContext())
-      return Instance->getASTContext().TUKind;
-    return TU_Complete;
-  }
+  virtual TranslationUnitKind getTranslationUnitKind();
 
   /// Does this action support use with PCH?
   virtual bool hasPCHSupport() const { return true; }

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 418f9b38fa11f..bad4430f78b55 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -66,7 +66,6 @@
 #include "clang/Sema/Scope.h"
 #include "clang/Sema/SemaBase.h"
 #include "clang/Sema/SemaConcept.h"
-#include "clang/Sema/SemaRISCV.h"
 #include "clang/Sema/TypoCorrection.h"
 #include "clang/Sema/Weak.h"
 #include "llvm/ADT/APInt.h"

diff  --git a/clang/lib/AST/CMakeLists.txt b/clang/lib/AST/CMakeLists.txt
index e3f74d73f21da..9c3c118b22fed 100644
--- a/clang/lib/AST/CMakeLists.txt
+++ b/clang/lib/AST/CMakeLists.txt
@@ -66,6 +66,7 @@ add_clang_library(clangAST
   ExternalASTMerger.cpp
   ExternalASTSource.cpp
   FormatString.cpp
+  GlobalDecl.cpp
   InferAlloc.cpp
   InheritViz.cpp
   ByteCode/BitcastBuffer.cpp

diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 55f34e27ae535..0894097333d73 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -60,6 +60,7 @@
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Triple.h"
 #include <algorithm>

diff  --git a/clang/lib/AST/GlobalDecl.cpp b/clang/lib/AST/GlobalDecl.cpp
new file mode 100644
index 0000000000000..97746b68b2ad7
--- /dev/null
+++ b/clang/lib/AST/GlobalDecl.cpp
@@ -0,0 +1,46 @@
+//===--- GlobalDecl.cpp - Global declaration holder -------------*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// GlobalDecl.h is included very widely, so these members are defined here to
+// keep the OpenMP and OpenACC declaration hierarchies, the generated attribute
+// classes, and the template declaration hierarchy out of it.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/AST/GlobalDecl.h"
+
+#include "clang/AST/Attr.h"
+#include "clang/AST/DeclOpenACC.h"
+#include "clang/AST/DeclOpenMP.h"
+#include "clang/AST/DeclTemplate.h"
+
+using namespace clang;
+
+GlobalDecl::GlobalDecl(const OMPDeclareReductionDecl *D) { Init(D); }
+GlobalDecl::GlobalDecl(const OMPDeclareMapperDecl *D) { Init(D); }
+GlobalDecl::GlobalDecl(const OpenACCRoutineDecl *D) { Init(D); }
+GlobalDecl::GlobalDecl(const OpenACCDeclareDecl *D) { Init(D); }
+
+bool GlobalDecl::hasCUDAGlobalAttr(const Decl *D) {
+  return D->hasAttr<CUDAGlobalAttr>();
+}
+
+bool GlobalDecl::isKernelReference(const Decl *D) {
+  if (const auto *FD = dyn_cast<FunctionDecl>(D))
+    return FD->isReferenceableKernel();
+  if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
+    return FTD->getTemplatedDecl()->hasAttr<CUDAGlobalAttr>();
+  return false;
+}
+
+KernelReferenceKind
+GlobalDecl::getDefaultKernelReference(const FunctionDecl *D) {
+  return (D->hasAttr<DeviceKernelAttr>() || D->getLangOpts().CUDAIsDevice)
+             ? KernelReferenceKind::Kernel
+             : KernelReferenceKind::Stub;
+}

diff  --git a/clang/lib/AST/QualTypeNames.cpp b/clang/lib/AST/QualTypeNames.cpp
index 191841649a86f..806953b18cd0c 100644
--- a/clang/lib/AST/QualTypeNames.cpp
+++ b/clang/lib/AST/QualTypeNames.cpp
@@ -10,6 +10,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/Mangle.h"
+#include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Type.h"
 
 namespace clang {

diff  --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp 
b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
index a1469d690a3a8..cf7f289f0a111 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
@@ -66,6 +66,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/JSON.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/raw_ostream.h"

diff  --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 8fb3ba0a27aad..fe80ffbebd2bf 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Support/IOSandbox.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <climits>
@@ -63,6 +64,9 @@ static void normalizeCacheKey(StringRef &Path,
 // Common logic.
 
//===----------------------------------------------------------------------===//
 
+FileManager::FileManager(const FileSystemOptions &FSO)
+    : FileManager(FSO, nullptr) {}
+
 FileManager::FileManager(const FileSystemOptions &FSO,
                          IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)
     : FS(std::move(FS)), FileSystemOpts(FSO), SeenDirEntries(64),
@@ -73,6 +77,16 @@ FileManager::FileManager(const FileSystemOptions &FSO,
     this->FS = llvm::vfs::getRealFileSystem();
 }
 
+void FileManager::setVirtualFileSystem(
+    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
+  this->FS = std::move(FS);
+}
+
+IntrusiveRefCntPtr<llvm::vfs::FileSystem>
+FileManager::getVirtualFileSystemPtr() const {
+  return FS;
+}
+
 FileManager::~FileManager() = default;
 
 llvm::ErrorOr<DirectoryEntryRef>

diff  --git a/clang/lib/Basic/SourceManager.cpp 
b/clang/lib/Basic/SourceManager.cpp
index 5540aade05ef5..c9567d263c444 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -31,6 +31,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>

diff  --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 1bb0026d8422e..0a6255b6e05d5 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -19,6 +19,7 @@
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/TargetParser/TargetParser.h"
 #include "llvm/TargetParser/Triple.h"
@@ -203,6 +204,20 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
 // Out of line virtual dtor for TargetInfo.
 TargetInfo::~TargetInfo() {}
 
+size_t TargetInfo::getMaxBitIntWidth() const {
+  // Consider -fexperimental-max-bitint-width= first.
+  if (MaxBitIntWidth)
+    return std::min<size_t>(*MaxBitIntWidth, llvm::IntegerType::MAX_INT_BITS);
+
+  // FIXME: this value should be llvm::IntegerType::MAX_INT_BITS, which is
+  // maximum bit width that LLVM claims its IR can support. However, most
+  // backends currently have a bug where they only support float to int
+  // conversion (and vice versa) on types that are <= 128 bits and crash
+  // otherwise. We're setting the max supported value to 128 to be
+  // conservative.
+  return 128;
+}
+
 void TargetInfo::resetDataLayout(StringRef DL) { DataLayoutString = DL.str(); }
 
 void TargetInfo::resetDataLayout() {

diff  --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h
index 73287c5d2d58d..edaac3e74f9d3 100644
--- a/clang/lib/Basic/Targets/RISCV.h
+++ b/clang/lib/Basic/Targets/RISCV.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetOptions.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/RISCVISAInfo.h"
 #include "llvm/TargetParser/Triple.h"

diff  --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 9ed7035ccc230..658730ae88186 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/BitmaskEnum.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/TargetOptions.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/TargetParser/Triple.h"
 #include "llvm/TargetParser/X86TargetParser.h"

diff  --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h 
b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index b6568c9763142..8da7ea2c963c3 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -30,6 +30,7 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/Type.h"
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "clang/CIR/Dialect/IR/CIRDialect.h"

diff  --git a/clang/lib/CIR/CodeGen/CIRGenModule.h 
b/clang/lib/CIR/CodeGen/CIRGenModule.h
index b41a2535991a2..7ea47ba6d5d24 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.h
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.h
@@ -32,6 +32,7 @@
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/MLIRContext.h"
 #include "clang/AST/Decl.h"
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CIR/Dialect/IR/CIROpsEnums.h"
@@ -45,6 +46,9 @@ class CodeGenOptions;
 class Decl;
 class GlobalDecl;
 class LangOptions;
+class OpenACCConstructDecl;
+class OpenACCDeclareDecl;
+class OpenACCRoutineDecl;
 class TargetInfo;
 class VarDecl;
 

diff  --git a/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h 
b/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h
index 745d42446896e..e709380be0d1f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h
+++ b/clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.h
@@ -17,6 +17,7 @@
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/OpenACCClause.h"
 #include "clang/AST/TypeBase.h"
 #include "clang/Basic/OpenACCKinds.h"
 

diff  --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp 
b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
index 312766d66ba7e..8cbee4ea39a4b 100644
--- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
@@ -18,6 +18,7 @@
 #include "mlir/IR/MLIRContext.h"
 
 #include "clang/AST/DeclGroup.h"
+#include "clang/AST/DeclOpenACC.h"
 #include "clang/CIR/CIRDataLayoutSpec.h"
 #include "clang/CIR/CIRGenerator.h"
 #include "clang/CIR/InitAllDialects.h"

diff  --git a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp 
b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
index 78702a64da795..66c2f9b7a8937 100644
--- a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
+++ b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
@@ -10,6 +10,7 @@
 #include "CIRDiagnosticHandler.h"
 #include "mlir/IR/MLIRContext.h"
 #include "mlir/IR/OwningOpRef.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/DiagnosticCodeGen.h"
 #include "clang/CIR/CIRGenerator.h"
 #include "clang/CIR/CIRToCIRPasses.h"

diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 5f85c2d97ad50..26aaef9d331c0 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -39,6 +39,7 @@
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cstdint>

diff  --git a/clang/lib/CodeGen/CGPointerAuth.cpp 
b/clang/lib/CodeGen/CGPointerAuth.cpp
index 6889899107266..438d08b53a742 100644
--- a/clang/lib/CodeGen/CGPointerAuth.cpp
+++ b/clang/lib/CodeGen/CGPointerAuth.cpp
@@ -14,6 +14,7 @@
 #include "CGCXXABI.h"
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
+#include "clang/AST/Attr.h"
 #include "clang/CodeGen/CodeGenABITypes.h"
 #include "clang/CodeGen/ConstantInitBuilder.h"
 #include "llvm/Analysis/ValueTracking.h"

diff  --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index 25606a51b6d71..dfb6f2ff65a7d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -20,6 +20,7 @@
 #include "EHScopeStack.h"
 #include "SanitizerHandler.h"
 #include "VarBypassDetector.h"
+#include "clang/AST/Attr.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/CurrentSourceLocExprScope.h"
 #include "clang/AST/ExprCXX.h"

diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index dfacc438fe433..435f67542268a 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -73,6 +73,7 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/AArch64TargetParser.h"
 #include "llvm/TargetParser/RISCVISAInfo.h"
 #include "llvm/TargetParser/Triple.h"

diff  --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp 
b/clang/lib/CrossTU/CrossTranslationUnit.cpp
index 2239d54d591bf..4ef7a1fc4bf7a 100644
--- a/clang/lib/CrossTU/CrossTranslationUnit.cpp
+++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp
@@ -20,6 +20,7 @@
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/UnifiedSymbolResolution/USRGeneration.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Option/ArgList.h"

diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 2b6e65efbf026..fa308086da5b5 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -25,6 +25,8 @@
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include <functional>
 #include <limits>
 

diff  --git a/clang/lib/Frontend/CompilerInstance.cpp 
b/clang/lib/Frontend/CompilerInstance.cpp
index 83bbdd96d89eb..87abcd38c1a92 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -188,6 +188,11 @@ void 
CompilerInstance::setPreprocessor(std::shared_ptr<Preprocessor> Value) {
   PP = std::move(Value);
 }
 
+IntrusiveRefCntPtr<ASTContext> CompilerInstance::getASTContextPtr() const {
+  assert(Context && "Compiler instance has no AST context!");
+  return Context;
+}
+
 void CompilerInstance::setASTContext(
     llvm::IntrusiveRefCntPtr<ASTContext> Value) {
   Context = std::move(Value);

diff  --git a/clang/lib/Frontend/FrontendAction.cpp 
b/clang/lib/Frontend/FrontendAction.cpp
index c18c702d46cc7..877ef662fe8da 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -370,16 +370,39 @@ FrontendAction::FrontendAction() : Instance(nullptr) {}
 
 FrontendAction::~FrontendAction() {}
 
+TranslationUnitKind FrontendAction::getTranslationUnitKind() {
+  // The ASTContext, if exists, knows the exact TUKind of the frondend.
+  if (Instance && Instance->hasASTContext())
+    return Instance->getASTContext().TUKind;
+  return TU_Complete;
+}
+
+bool FrontendAction::BeginSourceFileAction(CompilerInstance &CI) {
+  if (CurrentInput.isPreprocessed())
+    CI.getPreprocessor().SetMacroExpansionOnlyInDirectives();
+  return true;
+}
+
+void FrontendAction::EndSourceFileAction() {
+  if (CurrentInput.isPreprocessed())
+    // Reset the preprocessor macro expansion to the default.
+    getCompilerInstance().getPreprocessor().SetEnableMacroExpansion();
+}
+
 void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
                                      std::unique_ptr<ASTUnit> AST) {
   this->CurrentInput = CurrentInput;
   CurrentASTUnit = std::move(AST);
 }
 
+std::unique_ptr<ASTUnit> FrontendAction::takeCurrentASTUnit() {
+  return std::move(CurrentASTUnit);
+}
+
 Module *FrontendAction::getCurrentModule() const {
   CompilerInstance &CI = getCompilerInstance();
   return CI.getPreprocessor().getHeaderSearchInfo().lookupModule(
-      CI.getLangOpts().CurrentModule, SourceLocation(), /*AllowSearch*/false);
+      CI.getLangOpts().CurrentModule, SourceLocation(), /*AllowSearch=*/false);
 }
 
 std::unique_ptr<ASTConsumer>

diff  --git a/clang/lib/Frontend/FrontendActions.cpp 
b/clang/lib/Frontend/FrontendActions.cpp
index 4ef94c1991ee2..e7b05740b8376 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -15,6 +15,7 @@
 #include "clang/Basic/Module.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/ASTConsumers.h"
+#include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Frontend/Utils.h"

diff  --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp 
b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index 7142383fc64b3..73ab710af84fc 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -11,6 +11,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
+#include "clang/Sema/Sema.h"
 #include "llvm/BinaryFormat/ELF.h"
 
 using namespace clang;

diff  --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp 
b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
index dd2eb6721eae2..01ba99e8d89db 100644
--- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
+++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
@@ -11,12 +11,13 @@
 //
 
//===----------------------------------------------------------------------===//
 
-#include "clang/Rewrite/Frontend/Rewriters.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/PreprocessorOutputOptions.h"
 #include "clang/Lex/Pragma.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Rewrite/Frontend/Rewriters.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <optional>
 

diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp 
b/clang/lib/Frontend/TextDiagnostic.cpp
index 5221ed4de02ff..57ee3085bae6b 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Locale.h"
+#include "llvm/Support/Path.h"
 #include <algorithm>
 #include <optional>
 

diff  --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp 
b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 560aef43086cb..e872f0823f23e 100644
--- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -27,6 +27,7 @@
 #include 
"clang/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.h"
 #include 
"clang/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.h"
 #include "clang/ScalableStaticAnalysis/SSAFForceLinker.h" // IWYU pragma: keep
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h"
 #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
 #include "llvm/Option/OptTable.h"

diff  --git a/clang/lib/Index/IndexingAction.cpp 
b/clang/lib/Index/IndexingAction.cpp
index 1d98179111e78..1cdb4e14779dc 100644
--- a/clang/lib/Index/IndexingAction.cpp
+++ b/clang/lib/Index/IndexingAction.cpp
@@ -9,6 +9,7 @@
 #include "clang/Index/IndexingAction.h"
 #include "IndexingContext.h"
 #include "clang/AST/DeclGroup.h"
+#include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Index/IndexDataConsumer.h"

diff  --git a/clang/lib/InstallAPI/DirectoryScanner.cpp 
b/clang/lib/InstallAPI/DirectoryScanner.cpp
index f8f708fda4ca4..80fe3938ef21e 100644
--- a/clang/lib/InstallAPI/DirectoryScanner.cpp
+++ b/clang/lib/InstallAPI/DirectoryScanner.cpp
@@ -9,6 +9,7 @@
 #include "clang/InstallAPI/DirectoryScanner.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 using namespace llvm;
 using namespace llvm::MachO;

diff  --git a/clang/lib/InstallAPI/Frontend.cpp 
b/clang/lib/InstallAPI/Frontend.cpp
index cce0b19b50619..b2335e659d677 100644
--- a/clang/lib/InstallAPI/Frontend.cpp
+++ b/clang/lib/InstallAPI/Frontend.cpp
@@ -9,6 +9,7 @@
 #include "clang/InstallAPI/Frontend.h"
 #include "clang/AST/Availability.h"
 #include "clang/InstallAPI/FrontendRecords.h"
+#include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/StringRef.h"
 
 using namespace llvm;

diff  --git a/clang/lib/InstallAPI/HeaderFile.cpp 
b/clang/lib/InstallAPI/HeaderFile.cpp
index d736a0af0dd47..63fad847abe7d 100644
--- a/clang/lib/InstallAPI/HeaderFile.cpp
+++ b/clang/lib/InstallAPI/HeaderFile.cpp
@@ -7,6 +7,7 @@
 
//===----------------------------------------------------------------------===//
 
 #include "clang/InstallAPI/HeaderFile.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TextAPI/Utils.h"
 
 using namespace llvm;

diff  --git a/clang/lib/Interpreter/IncrementalAction.h 
b/clang/lib/Interpreter/IncrementalAction.h
index 725cdd0c27cf4..2893ff7b5baa6 100644
--- a/clang/lib/Interpreter/IncrementalAction.h
+++ b/clang/lib/Interpreter/IncrementalAction.h
@@ -13,6 +13,7 @@
 #include "clang/Frontend/MultiplexConsumer.h"
 
 namespace llvm {
+class LLVMContext;
 class Module;
 }
 

diff  --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp
index b44bf2cd3c253..552902e70f094 100644
--- a/clang/lib/Lex/PPLexerChange.cpp
+++ b/clang/lib/Lex/PPLexerChange.cpp
@@ -21,6 +21,7 @@
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include <optional>
 
 using namespace clang;

diff  --git 
a/clang/lib/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.cpp
 
b/clang/lib/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.cpp
index b7886af72479d..6ae7518e0ed56 100644
--- 
a/clang/lib/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.cpp
+++ 
b/clang/lib/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.cpp
@@ -8,6 +8,7 @@
 
 #include 
"clang/ScalableStaticAnalysis/Frontend/SourceTransformationFrontendAction.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/DiagnosticFrontend.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/MultiplexConsumer.h"

diff  --git 
a/clang/lib/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.cpp
 
b/clang/lib/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.cpp
index bb4caef8f99ab..dc72fa20ee02b 100644
--- 
a/clang/lib/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.cpp
+++ 
b/clang/lib/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.cpp
@@ -8,6 +8,7 @@
 
 #include 
"clang/ScalableStaticAnalysis/Frontend/TUSummaryExtractorFrontendAction.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/DiagnosticFrontend.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/MultiplexConsumer.h"

diff  --git a/clang/lib/Sema/SemaCodeComplete.cpp 
b/clang/lib/Sema/SemaCodeComplete.cpp
index c5250acb6541d..4b9b604d27b16 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -54,7 +54,9 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <list>

diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 99efe330d6749..2b524a956ecc4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -65,6 +65,7 @@
 #include "clang/Sema/Template.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/SaveAndRestore.h"
 #include "llvm/Support/TimeProfiler.h"

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 658e29c7ed578..1dced79c5ba22 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -81,6 +81,7 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaCUDA.h"
 #include "clang/Sema/SemaObjC.h"
+#include "clang/Sema/SemaRISCV.h"
 #include "clang/Sema/Weak.h"
 #include "clang/Serialization/ASTBitCodes.h"
 #include "clang/Serialization/ASTDeserializationListener.h"
@@ -123,6 +124,7 @@
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/VersionTuple.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Triple.h"
 #include <algorithm>

diff  --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index 5d5f3f473fd0d..8f376012da209 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -70,6 +70,7 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaCUDA.h"
 #include "clang/Sema/SemaObjC.h"
+#include "clang/Sema/SemaRISCV.h"
 #include "clang/Sema/Weak.h"
 #include "clang/Serialization/ASTBitCodes.h"
 #include "clang/Serialization/ASTReader.h"
@@ -104,6 +105,7 @@
 #include "llvm/Support/SHA1.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VersionTuple.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>

diff  --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp 
b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
index 3e3fff900cde8..ee6b613e579f1 100644
--- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -25,6 +25,7 @@
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/FileSystem.h"
 #include <memory>
 #include <optional>
 

diff  --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp 
b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
index 1d5139c067c7b..afd2016b0f890 100644
--- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
@@ -24,7 +24,9 @@
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/JSON.h"
+#include "llvm/Support/Path.h"
 #include <memory>
 
 using namespace llvm;

diff  --git a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp 
b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
index 531c642bf4f31..ee59e6a7be939 100644
--- a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Serialization/ASTReader.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/FileSystem.h"

diff  --git a/clang/lib/Testing/TestAST.cpp b/clang/lib/Testing/TestAST.cpp
index f99f649f52e9c..4de02ed2b9042 100644
--- a/clang/lib/Testing/TestAST.cpp
+++ b/clang/lib/Testing/TestAST.cpp
@@ -7,15 +7,16 @@
 
//===----------------------------------------------------------------------===//
 
 #include "clang/Testing/TestAST.h"
+
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/TextDiagnostic.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Testing/CommandLineArgs.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VirtualFileSystem.h"
-
 #include "gtest/gtest.h"
 #include <string>
 

diff  --git a/clang/lib/Tooling/Syntax/Tokens.cpp 
b/clang/lib/Tooling/Syntax/Tokens.cpp
index 6b75c17cab67e..7db02b9a5394c 100644
--- a/clang/lib/Tooling/Syntax/Tokens.cpp
+++ b/clang/lib/Tooling/Syntax/Tokens.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <optional>

diff  --git a/clang/tools/clang-format/ClangFormat.cpp 
b/clang/tools/clang-format/ClangFormat.cpp
index de513d942df1a..3703ea6488df5 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include <fstream>
 
 using namespace llvm;

diff  --git a/clang/tools/clang-installapi/Options.cpp 
b/clang/tools/clang-installapi/Options.cpp
index f484d6f33ad8f..f0ad4501a4593 100644
--- a/clang/tools/clang-installapi/Options.cpp
+++ b/clang/tools/clang-installapi/Options.cpp
@@ -16,6 +16,7 @@
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Program.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/Host.h"
 #include "llvm/TextAPI/DylibReader.h"
 #include "llvm/TextAPI/TextAPIError.h"

diff  --git a/clang/unittests/Analysis/MacroExpansionContextTest.cpp 
b/clang/unittests/Analysis/MacroExpansionContextTest.cpp
index 25a76edbfdc49..2b9d3de70f0f3 100644
--- a/clang/unittests/Analysis/MacroExpansionContextTest.cpp
+++ b/clang/unittests/Analysis/MacroExpansionContextTest.cpp
@@ -22,6 +22,7 @@
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/Parser.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "gtest/gtest.h"
 
 // static bool HACK_EnableDebugInUnitTest = (::llvm::DebugFlag = true);

diff  --git a/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp 
b/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
index 96d0c1954505c..562024ac96556 100644
--- a/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
+++ b/clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
@@ -11,6 +11,7 @@
 #include "clang/AST/ParentMapContext.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"

diff  --git a/clang/unittests/Frontend/CompilerInstanceTest.cpp 
b/clang/unittests/Frontend/CompilerInstanceTest.cpp
index 41908e9c0f254..f4377498d6ff6 100644
--- a/clang/unittests/Frontend/CompilerInstanceTest.cpp
+++ b/clang/unittests/Frontend/CompilerInstanceTest.cpp
@@ -12,6 +12,8 @@
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/FileSystem.h"

diff  --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp 
b/clang/unittests/Frontend/CompilerInvocationTest.cpp
index be537ae88bdf9..8c6c1d58f7e59 100644
--- a/clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -7,14 +7,15 @@
 
//===----------------------------------------------------------------------===//
 
 #include "clang/Frontend/CompilerInvocation.h"
+
 #include "clang/Basic/TargetOptions.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Serialization/ModuleFileExtension.h"
+#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/Host.h"
-
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 

diff  --git a/clang/unittests/Lex/HeaderSearchTest.cpp 
b/clang/unittests/Lex/HeaderSearchTest.cpp
index 0213bfeb8e221..3183b4bc491fd 100644
--- a/clang/unittests/Lex/HeaderSearchTest.cpp
+++ b/clang/unittests/Lex/HeaderSearchTest.cpp
@@ -17,6 +17,7 @@
 #include "clang/Basic/TargetOptions.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "gtest/gtest.h"
 #include <memory>
 #include <string>

diff  --git a/clang/unittests/Lex/NoTrivialPPDirectiveTracerTest.cpp 
b/clang/unittests/Lex/NoTrivialPPDirectiveTracerTest.cpp
index d79c1428e55bb..049bf599b4e23 100644
--- a/clang/unittests/Lex/NoTrivialPPDirectiveTracerTest.cpp
+++ b/clang/unittests/Lex/NoTrivialPPDirectiveTracerTest.cpp
@@ -18,6 +18,7 @@
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "gtest/gtest.h"
 #include <cstddef>
 #include <initializer_list>

diff  --git a/clang/unittests/Lex/PPCallbacksTest.cpp 
b/clang/unittests/Lex/PPCallbacksTest.cpp
index 9533fbc776e6e..169734f80df47 100644
--- a/clang/unittests/Lex/PPCallbacksTest.cpp
+++ b/clang/unittests/Lex/PPCallbacksTest.cpp
@@ -6,7 +6,6 @@
 //
 //===--------------------------------------------------------------===//
 
-#include "clang/Lex/Preprocessor.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/Diagnostic.h"
@@ -19,11 +18,13 @@
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleLoader.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/Parser.h"
 #include "clang/Sema/Sema.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "gtest/gtest.h"
 
 using namespace clang;

diff  --git a/clang/unittests/Lex/PPDependencyDirectivesTest.cpp 
b/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
index 3b369ffc60d27..7b11fc163f6eb 100644
--- a/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
+++ b/clang/unittests/Lex/PPDependencyDirectivesTest.cpp
@@ -19,6 +19,7 @@
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 #include <optional>

diff  --git a/clang/unittests/Tooling/ASTSelectionTest.cpp 
b/clang/unittests/Tooling/ASTSelectionTest.cpp
index 0f60749725cde..b6a56ddba99b8 100644
--- a/clang/unittests/Tooling/ASTSelectionTest.cpp
+++ b/clang/unittests/Tooling/ASTSelectionTest.cpp
@@ -6,9 +6,11 @@
 //
 
//===----------------------------------------------------------------------===//
 
+#include "clang/Tooling/Refactoring/ASTSelection.h"
+
 #include "TestVisitor.h"
+#include "clang/AST/ExprObjC.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Tooling/Refactoring/ASTSelection.h"
 #include <optional>
 
 using namespace clang;

diff  --git a/clang/unittests/Tooling/RewriterTestContext.h 
b/clang/unittests/Tooling/RewriterTestContext.h
index 020ef60aa16ae..46bd3dcbb510a 100644
--- a/clang/unittests/Tooling/RewriterTestContext.h
+++ b/clang/unittests/Tooling/RewriterTestContext.h
@@ -21,6 +21,7 @@
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {

diff  --git a/clang/unittests/Tooling/Syntax/TreeTestBase.cpp 
b/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
index dad75854240ef..471c71c701bc7 100644
--- a/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTestBase.cpp
@@ -12,6 +12,7 @@
 
 #include "TreeTestBase.h"
 #include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/CreateInvocationFromArgs.h"
 #include "clang/Frontend/CompilerInstance.h"

diff  --git a/clang/unittests/Tooling/Syntax/TreeTestBase.h 
b/clang/unittests/Tooling/Syntax/TreeTestBase.h
index e85d76c9efed7..bd9bb49ae7051 100644
--- a/clang/unittests/Tooling/Syntax/TreeTestBase.h
+++ b/clang/unittests/Tooling/Syntax/TreeTestBase.h
@@ -22,6 +22,7 @@
 #include "clang/Tooling/Syntax/Tree.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to