[clang] Clang tooling generated visibility macros for Clang (PR #109702)

Thomas Fransham via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 11:47:43 PDT 2024


https://github.com/fsfod updated https://github.com/llvm/llvm-project/pull/109702

>From 408d4ca2a2614466e3a61d9852fc7163b7c84c55 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 23 Sep 2024 17:49:55 +0100
Subject: [PATCH 1/5] Export config file used by the clang tool used to
 generate the visibility macros

---
 clang/include/export_options.json | 67 +++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 clang/include/export_options.json

diff --git a/clang/include/export_options.json b/clang/include/export_options.json
new file mode 100644
index 00000000000000..de98886a8259da
--- /dev/null
+++ b/clang/include/export_options.json
@@ -0,0 +1,67 @@
+{
+  "version": "1",
+  "groups": [
+    {
+      "name": "public_headers",
+      "pathRoot": "clang",
+      "headerDirectories": [
+        "*"
+      ],
+      "excludedDirectories": [
+        "Testing",
+        "DirectoryWatcher"
+      ],
+      "ignoredFiles": [
+        "AST/TypeLoc.h"
+      ]
+    },
+    {
+      "name": "typeloc_members",
+      "headerFiles": [ "clang/AST/TypeLoc.h" ],
+      "exportMembers": true,
+      "comment":  "Its simpler to export individual members than solve the complex template errors from MSVC instantiating all members when the class is dll exported",
+      "ignoredTypes": [
+      ]
+    },
+    {
+      "name": "internal_headers",
+      "pathRoot": "../lib",
+      "headerFiles": [
+        "Format/MatchFilePath.h",
+        "AST/ByteCode/Program.h",
+        "AST/ByteCode/Pointer.h",
+        "AST/ByteCode/MemberPointer.h",
+        "AST/ByteCode/FunctionPointer.h",
+        "Format/FormatTokenLexer.h",
+        "Format/TokenAnnotator.h",
+        "Format/Macros.h",
+        "Format/QualifierAlignmentFixer.h",
+        "Format/UnwrappedLineParser.h",
+        "Format/FormatToken.h",
+        "ASTMatchers/ASTMatchersInternal.cpp"
+      ]
+    },
+    {
+      "name": "source_files",
+      "pathRoot": "../lib",
+      "sourceDirectories": [
+        "*"
+      ],
+      "excludedDirectories": [
+        "Testing"
+      ],
+      "exportGlobalVariableDefs": true
+    }
+  ],
+  "exportMacroHeader": "clang/Support/Compiler.h",
+  "exportMacro": "CLANG_ABI",
+  "externTemplateMacro": "CLANG_TEMPLATE_ABI",
+  "exportTemplateMacro": "CLANG_EXPORT_TEMPLATE",
+  "externCMacro": "CLANG_C_ABI",
+  "otherExportMacros": [
+    "CLANG_ABI_EXPORT",
+    "CLANG_ABI_NOT_EXPORTED"
+  ],
+  "isGeneratingMacro": "CLANG_ABI_GENERATING_ANNOTATIONS",
+  "clangFormatFile": "../.clang-format"
+}
\ No newline at end of file

>From 7f1829684fea396ec62add6d2564f15eb0c01054 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 14 Oct 2024 18:11:44 +0100
Subject: [PATCH 2/5] Auto generated visibility macros for clang public headers

---
 .../include/clang/APINotes/APINotesManager.h  |   3 +-
 clang/include/clang/APINotes/APINotesReader.h |   3 +-
 clang/include/clang/APINotes/APINotesWriter.h |   3 +-
 .../clang/APINotes/APINotesYAMLCompiler.h     |   5 +-
 clang/include/clang/APINotes/Types.h          |  21 +-
 clang/include/clang/ARCMigrate/ARCMT.h        |  17 +-
 clang/include/clang/ARCMigrate/ARCMTActions.h |  11 +-
 clang/include/clang/ARCMigrate/FileRemapper.h |   3 +-
 clang/include/clang/AST/APNumericStorage.h    |   3 +-
 clang/include/clang/AST/APValue.h             |  23 +-
 clang/include/clang/AST/ASTConcept.h          |   7 +-
 clang/include/clang/AST/ASTConsumer.h         |   3 +-
 clang/include/clang/AST/ASTContext.h          |   9 +-
 clang/include/clang/AST/ASTContextAllocate.h  |   9 +-
 clang/include/clang/AST/ASTDiagnostic.h       |   5 +-
 clang/include/clang/AST/ASTDumper.h           |   3 +-
 clang/include/clang/AST/ASTImportError.h      |   3 +-
 clang/include/clang/AST/ASTImporter.h         |   5 +-
 .../clang/AST/ASTImporterLookupTable.h        |   3 +-
 clang/include/clang/AST/ASTMutationListener.h |   3 +-
 .../clang/AST/ASTStructuralEquivalence.h      |   3 +-
 clang/include/clang/AST/ASTTypeTraits.h       |   5 +-
 clang/include/clang/AST/ASTUnresolvedSet.h    |   3 +-
 clang/include/clang/AST/Attr.h                |   3 +-
 clang/include/clang/AST/Availability.h        |   3 +-
 clang/include/clang/AST/CXXInheritance.h      |   5 +-
 clang/include/clang/AST/Comment.h             |  13 +-
 clang/include/clang/AST/CommentBriefParser.h  |   3 +-
 .../include/clang/AST/CommentCommandTraits.h  |   3 +-
 clang/include/clang/AST/CommentLexer.h        |   5 +-
 clang/include/clang/AST/CommentParser.h       |   3 +-
 clang/include/clang/AST/CommentSema.h         |   3 +-
 .../include/clang/AST/ComparisonCategories.h  |   9 +-
 clang/include/clang/AST/ComputeDependence.h   | 173 +++----
 clang/include/clang/AST/DataCollection.h      |   3 +-
 clang/include/clang/AST/Decl.h                |  69 +--
 clang/include/clang/AST/DeclBase.h            |   9 +-
 clang/include/clang/AST/DeclCXX.h             |  65 +--
 .../include/clang/AST/DeclContextInternals.h  |   3 +-
 clang/include/clang/AST/DeclFriend.h          |   3 +-
 clang/include/clang/AST/DeclGroup.h           |   3 +-
 clang/include/clang/AST/DeclID.h              |   5 +-
 clang/include/clang/AST/DeclObjC.h            |  39 +-
 clang/include/clang/AST/DeclOpenMP.h          |  13 +-
 clang/include/clang/AST/DeclTemplate.h        |  49 +-
 clang/include/clang/AST/DeclarationName.h     |  13 +-
 clang/include/clang/AST/DependentDiagnostic.h |   3 +-
 clang/include/clang/AST/Expr.h                |  81 +--
 clang/include/clang/AST/ExprCXX.h             |  87 ++--
 clang/include/clang/AST/ExprConcepts.h        |  13 +-
 clang/include/clang/AST/ExprObjC.h            |  11 +-
 clang/include/clang/AST/ExprOpenMP.h          |   5 +-
 clang/include/clang/AST/ExternalASTMerger.h   |   3 +-
 clang/include/clang/AST/ExternalASTSource.h   |   3 +-
 clang/include/clang/AST/FormatString.h        |  25 +-
 clang/include/clang/AST/JSONNodeDumper.h      |   5 +-
 clang/include/clang/AST/LambdaCapture.h       |   3 +-
 clang/include/clang/AST/LocInfoType.h         |   3 +-
 clang/include/clang/AST/Mangle.h              |   9 +-
 .../clang/AST/MangleNumberingContext.h        |   3 +-
 clang/include/clang/AST/NSAPI.h               |   3 +-
 clang/include/clang/AST/NestedNameSpecifier.h |   7 +-
 clang/include/clang/AST/ODRDiagsEmitter.h     |   3 +-
 clang/include/clang/AST/ODRHash.h             |   5 +-
 clang/include/clang/AST/OSLog.h               |   3 +-
 clang/include/clang/AST/OpenACCClause.h       |  71 +--
 clang/include/clang/AST/OpenMPClause.h        | 117 ++---
 clang/include/clang/AST/ParentMap.h           |   3 +-
 clang/include/clang/AST/ParentMapContext.h    |   3 +-
 .../include/clang/AST/PrettyDeclStackTrace.h  |   3 +-
 clang/include/clang/AST/PrettyPrinter.h       |   3 +-
 clang/include/clang/AST/QualTypeNames.h       |   5 +-
 clang/include/clang/AST/Randstruct.h          |   3 +-
 clang/include/clang/AST/RawCommentList.h      |   5 +-
 clang/include/clang/AST/RecordLayout.h        |   3 +-
 clang/include/clang/AST/Redeclarable.h        |   3 +-
 .../include/clang/AST/SelectorLocationsKind.h |   9 +-
 clang/include/clang/AST/Stmt.h                |  43 +-
 clang/include/clang/AST/StmtCXX.h             |   9 +-
 clang/include/clang/AST/StmtIterator.h        |   3 +-
 clang/include/clang/AST/StmtObjC.h            |   5 +-
 clang/include/clang/AST/StmtOpenACC.h         |   5 +-
 clang/include/clang/AST/StmtOpenMP.h          | 159 +++---
 clang/include/clang/AST/TemplateBase.h        |  13 +-
 clang/include/clang/AST/TemplateName.h        |  11 +-
 clang/include/clang/AST/TextNodeDumper.h      |   5 +-
 clang/include/clang/AST/Type.h                | 147 +++---
 clang/include/clang/AST/VTTBuilder.h          |   3 +-
 clang/include/clang/AST/VTableBuilder.h       |   9 +-
 .../clang/ASTMatchers/ASTMatchFinder.h        |   9 +-
 clang/include/clang/ASTMatchers/ASTMatchers.h | 461 +++++++++---------
 .../clang/ASTMatchers/ASTMatchersInternal.h   |  27 +-
 .../clang/ASTMatchers/Dynamic/Diagnostics.h   |   9 +-
 .../clang/ASTMatchers/Dynamic/Parser.h        |   7 +-
 .../clang/ASTMatchers/Dynamic/Registry.h      |   5 +-
 .../clang/ASTMatchers/Dynamic/VariantValue.h  |  11 +-
 .../include/clang/ASTMatchers/GtestMatchers.h |  17 +-
 .../Analyses/CFGReachabilityAnalysis.h        |   3 +-
 .../clang/Analysis/Analyses/CalledOnceCheck.h |   3 +-
 .../clang/Analysis/Analyses/Consumed.h        |   9 +-
 .../clang/Analysis/Analyses/Dominators.h      |   7 +-
 .../Analysis/Analyses/ExprMutationAnalyzer.h  |   5 +-
 .../Analysis/Analyses/IntervalPartition.h     |  11 +-
 .../clang/Analysis/Analyses/LiveVariables.h   |   9 +-
 .../Analysis/Analyses/PostOrderCFGView.h      |   5 +-
 .../clang/Analysis/Analyses/ReachableCode.h   |   7 +-
 .../clang/Analysis/Analyses/ThreadSafety.h    |   9 +-
 .../Analysis/Analyses/ThreadSafetyCommon.h    |   3 +-
 .../Analysis/Analyses/ThreadSafetyLogical.h   |   3 +-
 .../clang/Analysis/Analyses/ThreadSafetyTIL.h |  17 +-
 .../Analysis/Analyses/ThreadSafetyUtil.h      |   3 +-
 .../Analysis/Analyses/UninitializedValues.h   |   5 +-
 .../Analysis/Analyses/UnsafeBufferUsage.h     |   9 +-
 .../clang/Analysis/AnalysisDeclContext.h      |  15 +-
 clang/include/clang/Analysis/BodyFarm.h       |   3 +-
 clang/include/clang/Analysis/CFG.h            |  13 +-
 clang/include/clang/Analysis/CFGStmtMap.h     |   3 +-
 clang/include/clang/Analysis/CallGraph.h      |   5 +-
 clang/include/clang/Analysis/CloneDetection.h |  21 +-
 clang/include/clang/Analysis/CodeInjector.h   |   3 +-
 .../clang/Analysis/ConstructionContext.h      |   7 +-
 .../DomainSpecific/CocoaConventions.h         |   9 +-
 .../Analysis/DomainSpecific/ObjCNoReturn.h    |   3 +-
 .../clang/Analysis/FlowSensitive/ASTOps.h     |  15 +-
 .../clang/Analysis/FlowSensitive/AdornedCFG.h |   5 +-
 .../clang/Analysis/FlowSensitive/Arena.h      |   3 +-
 .../clang/Analysis/FlowSensitive/CNFFormula.h |   5 +-
 .../Analysis/FlowSensitive/DataflowAnalysis.h |   3 +-
 .../FlowSensitive/DataflowAnalysisContext.h   |   3 +-
 .../FlowSensitive/DataflowEnvironment.h       |   7 +-
 .../Analysis/FlowSensitive/DebugSupport.h     |   5 +-
 .../clang/Analysis/FlowSensitive/Formula.h    |   3 +-
 .../clang/Analysis/FlowSensitive/Logger.h     |   3 +-
 .../FlowSensitive/Models/ChromiumCheckModel.h |   3 +-
 .../Models/UncheckedOptionalAccessModel.h     |   5 +-
 .../clang/Analysis/FlowSensitive/RecordOps.h  |   5 +-
 .../FlowSensitive/SimplifyConstraints.h       |   3 +-
 .../clang/Analysis/FlowSensitive/Solver.h     |   7 +-
 .../clang/Analysis/FlowSensitive/Transfer.h   |   5 +-
 .../TypeErasedDataflowAnalysis.h              |   5 +-
 .../clang/Analysis/FlowSensitive/Value.h      |   5 +-
 .../FlowSensitive/WatchedLiteralsSolver.h     |   3 +-
 clang/include/clang/Analysis/IssueHash.h      |   5 +-
 .../clang/Analysis/MacroExpansionContext.h    |   3 +-
 clang/include/clang/Analysis/PathDiagnostic.h |  27 +-
 clang/include/clang/Analysis/ProgramPoint.h   |   7 +-
 .../clang/Analysis/RetainSummaryManager.h     |   9 +-
 .../include/clang/Basic/ASTSourceDescriptor.h |   3 +-
 .../clang/Basic/AttrSubjectMatchRules.h       |   3 +-
 .../include/clang/Basic/AttributeCommonInfo.h |   3 +-
 clang/include/clang/Basic/Attributes.h        |   3 +-
 clang/include/clang/Basic/Builtins.h          |   7 +-
 clang/include/clang/Basic/CLWarnings.h        |   3 +-
 clang/include/clang/Basic/CharInfo.h          |   3 +-
 clang/include/clang/Basic/CodeGenOptions.h    |   3 +-
 clang/include/clang/Basic/Cuda.h              |  21 +-
 clang/include/clang/Basic/DarwinSDKInfo.h     |   7 +-
 clang/include/clang/Basic/Diagnostic.h        |  35 +-
 clang/include/clang/Basic/DiagnosticError.h   |   3 +-
 clang/include/clang/Basic/DiagnosticIDs.h     |   3 +-
 clang/include/clang/Basic/DiagnosticOptions.h |   5 +-
 clang/include/clang/Basic/ExpressionTraits.h  |   5 +-
 clang/include/clang/Basic/FileEntry.h         |   3 +-
 clang/include/clang/Basic/FileManager.h       |   3 +-
 .../include/clang/Basic/FileSystemStatCache.h |   5 +-
 clang/include/clang/Basic/IdentifierTable.h   |  17 +-
 clang/include/clang/Basic/LangOptions.h       |   7 +-
 clang/include/clang/Basic/LangStandard.h      |   7 +-
 clang/include/clang/Basic/MakeSupport.h       |   3 +-
 clang/include/clang/Basic/Module.h            |   5 +-
 clang/include/clang/Basic/NoSanitizeList.h    |   3 +-
 clang/include/clang/Basic/ObjCRuntime.h       |   5 +-
 clang/include/clang/Basic/OpenCLOptions.h     |   3 +-
 clang/include/clang/Basic/OpenMPKinds.h       |  53 +-
 clang/include/clang/Basic/OperatorKinds.h     |   3 +-
 .../include/clang/Basic/OperatorPrecedence.h  |   3 +-
 clang/include/clang/Basic/ParsedAttrInfo.h    |   5 +-
 clang/include/clang/Basic/PrettyStackTrace.h  |   3 +-
 clang/include/clang/Basic/ProfileList.h       |   3 +-
 .../clang/Basic/SanitizerSpecialCaseList.h    |   3 +-
 clang/include/clang/Basic/Sanitizers.h        |  19 +-
 clang/include/clang/Basic/Sarif.h             |   3 +-
 clang/include/clang/Basic/SourceLocation.h    |   9 +-
 clang/include/clang/Basic/SourceManager.h     |  11 +-
 .../clang/Basic/SourceManagerInternals.h      |   3 +-
 clang/include/clang/Basic/SourceMgrAdapter.h  |   3 +-
 clang/include/clang/Basic/Specifiers.h        |   7 +-
 clang/include/clang/Basic/Stack.h             |   7 +-
 clang/include/clang/Basic/SyncScope.h         |   3 +-
 clang/include/clang/Basic/TargetID.h          |  13 +-
 clang/include/clang/Basic/TargetInfo.h        |   3 +-
 clang/include/clang/Basic/TokenKinds.h        |  13 +-
 clang/include/clang/Basic/TypeTraits.h        |  15 +-
 clang/include/clang/Basic/Version.h           |  19 +-
 clang/include/clang/Basic/XRayInstr.h         |   5 +-
 clang/include/clang/Basic/XRayLists.h         |   3 +-
 clang/include/clang/CIR/CIRGenerator.h        |   3 +-
 .../clang/CIR/FrontendAction/CIRGenAction.h   |   5 +-
 clang/include/clang/CodeGen/BackendUtil.h     |   7 +-
 clang/include/clang/CodeGen/CGFunctionInfo.h  |   7 +-
 clang/include/clang/CodeGen/CodeGenABITypes.h |  41 +-
 clang/include/clang/CodeGen/CodeGenAction.h   |  15 +-
 .../clang/CodeGen/ConstantInitBuilder.h       |   9 +-
 .../clang/CodeGen/ConstantInitFuture.h        |   3 +-
 clang/include/clang/CodeGen/ModuleBuilder.h   |   5 +-
 .../CodeGen/ObjectFilePCHContainerWriter.h    |   3 +-
 .../include/clang/CodeGen/SwiftCallingConv.h  |  29 +-
 .../clang/CrossTU/CrossTranslationUnit.h      |  17 +-
 clang/include/clang/Driver/Action.h           |  57 +--
 clang/include/clang/Driver/Compilation.h      |   3 +-
 clang/include/clang/Driver/Distro.h           |   3 +-
 clang/include/clang/Driver/Driver.h           |  15 +-
 clang/include/clang/Driver/Job.h              |   7 +-
 clang/include/clang/Driver/Multilib.h         |   9 +-
 clang/include/clang/Driver/MultilibBuilder.h  |   5 +-
 clang/include/clang/Driver/OffloadBundler.h   |   9 +-
 clang/include/clang/Driver/OptionUtils.h      |   5 +-
 clang/include/clang/Driver/Options.h          |   3 +-
 clang/include/clang/Driver/Phases.h           |   3 +-
 clang/include/clang/Driver/SanitizerArgs.h    |   3 +-
 clang/include/clang/Driver/Tool.h             |   3 +-
 clang/include/clang/Driver/ToolChain.h        |   3 +-
 clang/include/clang/Driver/Types.h            |  51 +-
 clang/include/clang/Driver/XRayArgs.h         |   3 +-
 clang/include/clang/Edit/Commit.h             |   5 +-
 clang/include/clang/Edit/EditedSource.h       |   3 +-
 clang/include/clang/Edit/EditsReceiver.h      |   3 +-
 clang/include/clang/Edit/Rewriters.h          |   7 +-
 clang/include/clang/ExtractAPI/API.h          |  71 +--
 .../include/clang/ExtractAPI/APIIgnoresList.h |   5 +-
 .../clang/ExtractAPI/DeclarationFragments.h   |   5 +-
 .../clang/ExtractAPI/ExtractAPIActionBase.h   |   3 +-
 .../clang/ExtractAPI/FrontendActions.h        |   5 +-
 .../Serialization/SymbolGraphSerializer.h     |   5 +-
 .../TypedefUnderlyingTypeResolver.h           |   3 +-
 clang/include/clang/Format/Format.h           |  71 +--
 clang/include/clang/Frontend/ASTConsumers.h   |   9 +-
 clang/include/clang/Frontend/ASTUnit.h        |   7 +-
 .../Frontend/ChainedDiagnosticConsumer.h      |   3 +-
 .../include/clang/Frontend/CompilerInstance.h |   3 +-
 .../clang/Frontend/CompilerInvocation.h       |  19 +-
 .../clang/Frontend/DiagnosticRenderer.h       |   5 +-
 clang/include/clang/Frontend/FrontendAction.h |  11 +-
 .../include/clang/Frontend/FrontendActions.h  |  53 +-
 .../include/clang/Frontend/FrontendOptions.h  |   3 +-
 .../clang/Frontend/LayoutOverrideSource.h     |   3 +-
 .../clang/Frontend/LogDiagnosticPrinter.h     |   3 +-
 .../clang/Frontend/MultiplexConsumer.h        |   5 +-
 .../clang/Frontend/PrecompiledPreamble.h      |  13 +-
 .../include/clang/Frontend/SARIFDiagnostic.h  |   3 +-
 .../clang/Frontend/SARIFDiagnosticPrinter.h   |   3 +-
 .../Frontend/SerializedDiagnosticPrinter.h    |   3 +-
 .../Frontend/SerializedDiagnosticReader.h     |   7 +-
 clang/include/clang/Frontend/TextDiagnostic.h |   3 +-
 .../clang/Frontend/TextDiagnosticBuffer.h     |   3 +-
 .../clang/Frontend/TextDiagnosticPrinter.h    |   3 +-
 clang/include/clang/Frontend/Utils.h          |  19 +-
 .../clang/Frontend/VerifyDiagnosticConsumer.h |   5 +-
 clang/include/clang/FrontendTool/Utils.h      |   5 +-
 clang/include/clang/Index/CommentToXML.h      |   3 +-
 clang/include/clang/Index/IndexSymbol.h       |  25 +-
 clang/include/clang/Index/IndexingAction.h    |  15 +-
 clang/include/clang/Index/USRGeneration.h     |  33 +-
 .../SerializablePathCollection.h              |   7 +-
 clang/include/clang/InstallAPI/Context.h      |   5 +-
 .../clang/InstallAPI/DirectoryScanner.h       |   3 +-
 .../include/clang/InstallAPI/DylibVerifier.h  |   5 +-
 clang/include/clang/InstallAPI/FileList.h     |   3 +-
 clang/include/clang/InstallAPI/Frontend.h     |   3 +-
 .../clang/InstallAPI/FrontendRecords.h        |   3 +-
 clang/include/clang/InstallAPI/HeaderFile.h   |  11 +-
 clang/include/clang/InstallAPI/Library.h      |   3 +-
 clang/include/clang/InstallAPI/Visitor.h      |   3 +-
 .../clang/Interpreter/CodeCompletion.h        |   3 +-
 clang/include/clang/Interpreter/Interpreter.h |   5 +-
 .../include/clang/Lex/CodeCompletionHandler.h |   3 +-
 .../clang/Lex/DependencyDirectivesScanner.h   |   5 +-
 clang/include/clang/Lex/DirectoryLookup.h     |   5 +-
 .../clang/Lex/ExternalPreprocessorSource.h    |   3 +-
 clang/include/clang/Lex/HeaderMap.h           |   5 +-
 clang/include/clang/Lex/HeaderSearch.h        |   9 +-
 clang/include/clang/Lex/Lexer.h               |   3 +-
 clang/include/clang/Lex/LiteralSupport.h      |  13 +-
 clang/include/clang/Lex/MacroArgs.h           |   3 +-
 clang/include/clang/Lex/MacroInfo.h           |   9 +-
 clang/include/clang/Lex/ModuleLoader.h        |   3 +-
 clang/include/clang/Lex/ModuleMap.h           |   5 +-
 clang/include/clang/Lex/PPCallbacks.h         |   5 +-
 .../clang/Lex/PPConditionalDirectiveRecord.h  |   3 +-
 clang/include/clang/Lex/Pragma.h              |   9 +-
 clang/include/clang/Lex/PreprocessingRecord.h |   9 +-
 clang/include/clang/Lex/Preprocessor.h        |   7 +-
 clang/include/clang/Lex/PreprocessorLexer.h   |   3 +-
 clang/include/clang/Lex/ScratchBuffer.h       |   3 +-
 clang/include/clang/Lex/Token.h               |   3 +-
 clang/include/clang/Lex/TokenConcatenation.h  |   3 +-
 clang/include/clang/Lex/TokenLexer.h          |   3 +-
 clang/include/clang/Parse/ParseAST.h          |   5 +-
 clang/include/clang/Parse/Parser.h            |  25 +-
 .../clang/Parse/RAIIObjectsForParser.h        |   3 +-
 .../include/clang/Rewrite/Core/HTMLRewrite.h  |  19 +-
 clang/include/clang/Rewrite/Core/Rewriter.h   |   3 +-
 .../clang/Rewrite/Core/TokenRewriter.h        |   3 +-
 .../clang/Rewrite/Frontend/ASTConsumers.h     |   7 +-
 .../clang/Rewrite/Frontend/FixItRewriter.h    |   5 +-
 .../clang/Rewrite/Frontend/FrontendActions.h  |  15 +-
 .../clang/Rewrite/Frontend/Rewriters.h        |   7 +-
 .../clang/Sema/AnalysisBasedWarnings.h        |   5 +-
 .../include/clang/Sema/CodeCompleteConsumer.h |  39 +-
 clang/include/clang/Sema/DeclSpec.h           |  13 +-
 clang/include/clang/Sema/DelayedDiagnostic.h  |   3 +-
 clang/include/clang/Sema/ExternalSemaSource.h |   3 +-
 .../clang/Sema/HLSLExternalSemaSource.h       |   3 +-
 clang/include/clang/Sema/IdentifierResolver.h |   7 +-
 clang/include/clang/Sema/Initialization.h     |   7 +-
 clang/include/clang/Sema/Lookup.h             |   7 +-
 .../clang/Sema/MultiplexExternalSemaSource.h  |   3 +-
 clang/include/clang/Sema/Overload.h           |  23 +-
 clang/include/clang/Sema/ParsedAttr.h         |  11 +-
 clang/include/clang/Sema/ParsedTemplate.h     |   5 +-
 .../clang/Sema/RISCVIntrinsicManager.h        |   3 +-
 clang/include/clang/Sema/Scope.h              |   3 +-
 clang/include/clang/Sema/ScopeInfo.h          |  15 +-
 clang/include/clang/Sema/Sema.h               |  43 +-
 clang/include/clang/Sema/SemaAMDGPU.h         |   3 +-
 clang/include/clang/Sema/SemaARM.h            |   5 +-
 clang/include/clang/Sema/SemaAVR.h            |   3 +-
 clang/include/clang/Sema/SemaBPF.h            |   3 +-
 clang/include/clang/Sema/SemaBase.h           |   9 +-
 clang/include/clang/Sema/SemaCUDA.h           |   5 +-
 clang/include/clang/Sema/SemaCodeCompletion.h |   3 +-
 clang/include/clang/Sema/SemaConcept.h        |  13 +-
 clang/include/clang/Sema/SemaConsumer.h       |   3 +-
 clang/include/clang/Sema/SemaFixItUtils.h     |   3 +-
 clang/include/clang/Sema/SemaHLSL.h           |   5 +-
 clang/include/clang/Sema/SemaHexagon.h        |   3 +-
 clang/include/clang/Sema/SemaInternal.h       |   5 +-
 clang/include/clang/Sema/SemaLambda.h         |   3 +-
 clang/include/clang/Sema/SemaLoongArch.h      |   3 +-
 clang/include/clang/Sema/SemaM68k.h           |   3 +-
 clang/include/clang/Sema/SemaMIPS.h           |   3 +-
 clang/include/clang/Sema/SemaMSP430.h         |   3 +-
 clang/include/clang/Sema/SemaNVPTX.h          |   3 +-
 clang/include/clang/Sema/SemaObjC.h           |   3 +-
 clang/include/clang/Sema/SemaOpenACC.h        |   5 +-
 clang/include/clang/Sema/SemaOpenCL.h         |   3 +-
 clang/include/clang/Sema/SemaOpenMP.h         |   5 +-
 clang/include/clang/Sema/SemaPPC.h            |   3 +-
 clang/include/clang/Sema/SemaPseudoObject.h   |   3 +-
 clang/include/clang/Sema/SemaRISCV.h          |   5 +-
 clang/include/clang/Sema/SemaSYCL.h           |   3 +-
 clang/include/clang/Sema/SemaSwift.h          |   3 +-
 clang/include/clang/Sema/SemaSystemZ.h        |   3 +-
 clang/include/clang/Sema/SemaWasm.h           |   3 +-
 clang/include/clang/Sema/SemaX86.h            |   3 +-
 clang/include/clang/Sema/Template.h           |   5 +-
 clang/include/clang/Sema/TemplateDeduction.h  |  11 +-
 .../include/clang/Sema/TemplateInstCallback.h |   3 +-
 clang/include/clang/Sema/TypoCorrection.h     |   7 +-
 .../include/clang/Serialization/ASTBitCodes.h |   3 +-
 .../ASTDeserializationListener.h              |   3 +-
 clang/include/clang/Serialization/ASTReader.h |  11 +-
 .../clang/Serialization/ASTRecordReader.h     |   3 +-
 .../clang/Serialization/ASTRecordWriter.h     |   3 +-
 clang/include/clang/Serialization/ASTWriter.h |  11 +-
 .../clang/Serialization/GlobalModuleIndex.h   |   3 +-
 .../clang/Serialization/InMemoryModuleCache.h |   3 +-
 .../include/clang/Serialization/ModuleFile.h  |   3 +-
 .../clang/Serialization/ModuleFileExtension.h |   7 +-
 .../clang/Serialization/ModuleManager.h       |   3 +-
 .../ObjectFilePCHContainerReader.h            |   3 +-
 .../Serialization/PCHContainerOperations.h    |  11 +-
 .../Checkers/MPIFunctionClassifier.h          |   3 +-
 .../clang/StaticAnalyzer/Checkers/Taint.h     |  45 +-
 .../StaticAnalyzer/Core/AnalyzerOptions.h     |   3 +-
 .../Core/BugReporter/BugReporter.h            |  21 +-
 .../Core/BugReporter/BugReporterVisitors.h    |  35 +-
 .../Core/BugReporter/BugSuppression.h         |   3 +-
 .../StaticAnalyzer/Core/BugReporter/BugType.h |   3 +-
 .../Core/BugReporter/CommonBugCategories.h    |  23 +-
 .../Core/BugReporter/Z3CrosscheckVisitor.h    |   5 +-
 .../clang/StaticAnalyzer/Core/Checker.h       |   9 +-
 .../StaticAnalyzer/Core/CheckerManager.h      |   3 +-
 .../StaticAnalyzer/Core/CheckerRegistryData.h |   9 +-
 .../Core/PathSensitive/APSIntType.h           |   3 +-
 .../Core/PathSensitive/AnalysisManager.h      |   3 +-
 .../Core/PathSensitive/BasicValueFactory.h    |  11 +-
 .../Core/PathSensitive/BlockCounter.h         |   5 +-
 .../Core/PathSensitive/CallDescription.h      |   5 +-
 .../Core/PathSensitive/CallEvent.h            |  25 +-
 .../Core/PathSensitive/CheckerContext.h       |   3 +-
 .../Core/PathSensitive/CheckerHelpers.h       |  21 +-
 .../Core/PathSensitive/ConstraintManager.h    |   7 +-
 .../Core/PathSensitive/CoreEngine.h           |  15 +-
 .../Core/PathSensitive/DynamicExtent.h        |  13 +-
 .../Core/PathSensitive/DynamicType.h          |  27 +-
 .../Core/PathSensitive/Environment.h          |   7 +-
 .../Core/PathSensitive/ExplodedGraph.h        |   7 +-
 .../Core/PathSensitive/ExprEngine.h           |   9 +-
 .../Core/PathSensitive/FunctionSummary.h      |   3 +-
 .../Core/PathSensitive/LoopUnrolling.h        |   9 +-
 .../Core/PathSensitive/LoopWidening.h         |   3 +-
 .../Core/PathSensitive/MemRegion.h            |  83 ++--
 .../Core/PathSensitive/ProgramState.h         |  13 +-
 .../Core/PathSensitive/ProgramState_Fwd.h     |   5 +-
 .../PathSensitive/RangedConstraintManager.h   |  15 +-
 .../Core/PathSensitive/SValBuilder.h          |   5 +-
 .../StaticAnalyzer/Core/PathSensitive/SVals.h |  15 +-
 .../PathSensitive/SimpleConstraintManager.h   |   3 +-
 .../StaticAnalyzer/Core/PathSensitive/Store.h |  11 +-
 .../Core/PathSensitive/StoreRef.h             |   3 +-
 .../Core/PathSensitive/SymExpr.h              |   7 +-
 .../Core/PathSensitive/SymbolManager.h        |  23 +-
 .../Core/PathSensitive/WorkList.h             |   3 +-
 .../Frontend/AnalysisConsumer.h               |   5 +-
 .../Frontend/AnalyzerHelpFlags.h              |   9 +-
 .../StaticAnalyzer/Frontend/CheckerRegistry.h |   3 +-
 .../StaticAnalyzer/Frontend/FrontendActions.h |   5 +-
 .../StaticAnalyzer/Frontend/ModelConsumer.h   |   3 +-
 .../clang/Support/RISCVVIntrinsicUtils.h      |  15 +-
 clang/include/clang/Tooling/ASTDiff/ASTDiff.h |   7 +-
 clang/include/clang/Tooling/AllTUsExecution.h |   7 +-
 .../clang/Tooling/ArgumentsAdjusters.h        |  15 +-
 .../clang/Tooling/CommonOptionsParser.h       |   5 +-
 .../clang/Tooling/CompilationDatabase.h       |  15 +-
 .../CompilationDatabasePluginRegistry.h       |   3 +-
 clang/include/clang/Tooling/Core/Diagnostic.h |   9 +-
 .../include/clang/Tooling/Core/Replacement.h  |  19 +-
 .../DependencyScanningFilesystem.h            |   7 +-
 .../DependencyScanningService.h               |   3 +-
 .../DependencyScanningTool.h                  |   7 +-
 .../DependencyScanningWorker.h                |   7 +-
 .../DependencyScanning/ModuleDepCollector.h   |   9 +-
 clang/include/clang/Tooling/Execution.h       |  17 +-
 clang/include/clang/Tooling/FileMatchTrie.h   |   5 +-
 clang/include/clang/Tooling/FixIt.h           |   3 +-
 .../clang/Tooling/Inclusions/HeaderAnalysis.h |   7 +-
 .../clang/Tooling/Inclusions/HeaderIncludes.h |   5 +-
 .../clang/Tooling/Inclusions/IncludeStyle.h   |   7 +-
 .../Tooling/Inclusions/StandardLibrary.h      |   7 +-
 .../clang/Tooling/JSONCompilationDatabase.h   |   3 +-
 clang/include/clang/Tooling/Refactoring.h     |   5 +-
 .../clang/Tooling/Refactoring/ASTSelection.h  |   7 +-
 .../clang/Tooling/Refactoring/AtomicChange.h  |   5 +-
 .../Tooling/Refactoring/Extract/Extract.h     |   3 +-
 .../Refactoring/Extract/SourceExtraction.h    |   3 +-
 .../clang/Tooling/Refactoring/Lookup.h        |   3 +-
 .../Tooling/Refactoring/RefactoringAction.h   |   5 +-
 .../Refactoring/RefactoringActionRule.h       |   5 +-
 .../RefactoringActionRuleRequirements.h       |   7 +-
 .../Refactoring/RefactoringActionRules.h      |   5 +-
 .../Tooling/Refactoring/RefactoringOption.h   |   3 +-
 .../Refactoring/RefactoringOptionVisitor.h    |   3 +-
 .../Refactoring/RefactoringResultConsumer.h   |   3 +-
 .../Refactoring/Rename/RenamingAction.h       |  11 +-
 .../Refactoring/Rename/SymbolOccurrences.h    |   3 +-
 .../Tooling/Refactoring/Rename/USRFinder.h    |   7 +-
 .../Refactoring/Rename/USRFindingAction.h     |   7 +-
 .../Tooling/Refactoring/Rename/USRLocFinder.h |   5 +-
 .../clang/Tooling/RefactoringCallbacks.h      |  13 +-
 .../clang/Tooling/StandaloneExecution.h       |   3 +-
 .../include/clang/Tooling/Syntax/BuildTree.h  |  13 +-
 .../include/clang/Tooling/Syntax/Mutations.h  |   5 +-
 clang/include/clang/Tooling/Syntax/Nodes.h    |  57 +--
 .../Tooling/Syntax/TokenBufferTokenManager.h  |   3 +-
 .../clang/Tooling/Syntax/TokenManager.h       |   3 +-
 clang/include/clang/Tooling/Syntax/Tokens.h   |  27 +-
 clang/include/clang/Tooling/Syntax/Tree.h     |   9 +-
 clang/include/clang/Tooling/Tooling.h         |  31 +-
 .../clang/Tooling/Transformer/Parsing.h       |   3 +-
 .../clang/Tooling/Transformer/RangeSelector.h |  29 +-
 .../clang/Tooling/Transformer/RewriteRule.h   |  49 +-
 .../clang/Tooling/Transformer/SourceCode.h    |  15 +-
 .../Tooling/Transformer/SourceCodeBuilders.h  |  21 +-
 .../clang/Tooling/Transformer/Stencil.h       |  29 +-
 .../clang/Tooling/Transformer/Transformer.h   |   5 +-
 476 files changed, 2941 insertions(+), 2465 deletions(-)

diff --git a/clang/include/clang/APINotes/APINotesManager.h b/clang/include/clang/APINotes/APINotesManager.h
index 98592438e90eab..05d7930d3a2e7f 100644
--- a/clang/include/clang/APINotes/APINotesManager.h
+++ b/clang/include/clang/APINotes/APINotesManager.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_APINOTES_APINOTESMANAGER_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -41,7 +42,7 @@ class APINotesReader;
 /// external API notes files that correspond to a given header. Its primary
 /// operation is \c findAPINotes(), which finds the API notes reader that
 /// provides information about the declarations at that location.
-class APINotesManager {
+class CLANG_ABI APINotesManager {
   using ReaderEntry = llvm::PointerUnion<DirectoryEntryRef, APINotesReader *>;
 
   SourceManager &SM;
diff --git a/clang/include/clang/APINotes/APINotesReader.h b/clang/include/clang/APINotes/APINotesReader.h
index baf63340640242..58ee2857c7930f 100644
--- a/clang/include/clang/APINotes/APINotesReader.h
+++ b/clang/include/clang/APINotes/APINotesReader.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_APINOTES_READER_H
 
 #include "clang/APINotes/Types.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/VersionTuple.h"
 #include <memory>
@@ -25,7 +26,7 @@ namespace api_notes {
 
 /// A class that reads API notes data from a binary file that was written by
 /// the \c APINotesWriter.
-class APINotesReader {
+class CLANG_ABI APINotesReader {
   class Implementation;
   std::unique_ptr<Implementation> Implementation;
 
diff --git a/clang/include/clang/APINotes/APINotesWriter.h b/clang/include/clang/APINotes/APINotesWriter.h
index 3cc16c3d959faf..b8b45a89dcfc8b 100644
--- a/clang/include/clang/APINotes/APINotesWriter.h
+++ b/clang/include/clang/APINotes/APINotesWriter.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_APINOTES_WRITER_H
 
 #include "clang/APINotes/Types.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/raw_ostream.h"
@@ -29,7 +30,7 @@ namespace api_notes {
 
 /// A class that writes API notes data to a binary representation that can be
 /// read by the \c APINotesReader.
-class APINotesWriter {
+class CLANG_ABI APINotesWriter {
   class Implementation;
   std::unique_ptr<Implementation> Implementation;
 
diff --git a/clang/include/clang/APINotes/APINotesYAMLCompiler.h b/clang/include/clang/APINotes/APINotesYAMLCompiler.h
index 9c24ed85b6a124..3954cf347e8244 100644
--- a/clang/include/clang/APINotes/APINotesYAMLCompiler.h
+++ b/clang/include/clang/APINotes/APINotesYAMLCompiler.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H
 #define LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/raw_ostream.h"
@@ -22,10 +23,10 @@ namespace api_notes {
 /// Parses the APINotes YAML content and writes the representation back to the
 /// specified stream.  This provides a means of testing the YAML processing of
 /// the APINotes format.
-bool parseAndDumpAPINotes(llvm::StringRef YI, llvm::raw_ostream &OS);
+CLANG_ABI bool parseAndDumpAPINotes(llvm::StringRef YI, llvm::raw_ostream &OS);
 
 /// Converts API notes from YAML format to binary format.
-bool compileAPINotes(llvm::StringRef YAMLInput, const FileEntry *SourceFile,
+CLANG_ABI bool compileAPINotes(llvm::StringRef YAMLInput, const FileEntry *SourceFile,
                      llvm::raw_ostream &OS,
                      llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
                      void *DiagHandlerCtxt = nullptr);
diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h
index 89889910d1a073..574406586c4674 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_APINOTES_TYPES_H
 
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <climits>
@@ -49,7 +50,7 @@ enum class SwiftNewTypeKind {
 /// Describes API notes data for any entity.
 ///
 /// This is used as the base of all API notes.
-class CommonEntityInfo {
+class CLANG_ABI CommonEntityInfo {
 public:
   /// Message to use when this entity is unavailable.
   std::string UnavailableMsg;
@@ -132,7 +133,7 @@ inline bool operator!=(const CommonEntityInfo &LHS,
 }
 
 /// Describes API notes for types.
-class CommonTypeInfo : public CommonEntityInfo {
+class CLANG_ABI CommonTypeInfo : public CommonEntityInfo {
   /// The Swift type to which a given type is bridged.
   ///
   /// Reflects the swift_bridge attribute.
@@ -194,7 +195,7 @@ inline bool operator!=(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
 
 /// Describes API notes data for an Objective-C class or protocol or a C++
 /// namespace.
-class ContextInfo : public CommonTypeInfo {
+class CLANG_ABI ContextInfo : public CommonTypeInfo {
   /// Whether this class has a default nullability.
   LLVM_PREFERRED_TYPE(bool)
   unsigned HasDefaultNullability : 1;
@@ -301,7 +302,7 @@ inline bool operator!=(const ContextInfo &LHS, const ContextInfo &RHS) {
 }
 
 /// API notes for a variable/property.
-class VariableInfo : public CommonEntityInfo {
+class CLANG_ABI VariableInfo : public CommonEntityInfo {
   /// Whether this property has been audited for nullability.
   LLVM_PREFERRED_TYPE(bool)
   unsigned NullabilityAudited : 1;
@@ -358,7 +359,7 @@ inline bool operator!=(const VariableInfo &LHS, const VariableInfo &RHS) {
 }
 
 /// Describes API notes data for an Objective-C property.
-class ObjCPropertyInfo : public VariableInfo {
+class CLANG_ABI ObjCPropertyInfo : public VariableInfo {
   LLVM_PREFERRED_TYPE(bool)
   unsigned SwiftImportAsAccessorsSpecified : 1;
   LLVM_PREFERRED_TYPE(bool)
@@ -416,7 +417,7 @@ inline bool operator!=(const ObjCPropertyInfo &LHS,
 }
 
 /// Describes a function or method parameter.
-class ParamInfo : public VariableInfo {
+class CLANG_ABI ParamInfo : public VariableInfo {
   /// Whether noescape was specified.
   LLVM_PREFERRED_TYPE(bool)
   unsigned NoEscapeSpecified : 1;
@@ -486,7 +487,7 @@ inline bool operator!=(const ParamInfo &LHS, const ParamInfo &RHS) {
 }
 
 /// API notes for a function or method.
-class FunctionInfo : public CommonEntityInfo {
+class CLANG_ABI FunctionInfo : public CommonEntityInfo {
 private:
   static constexpr const uint64_t NullabilityKindMask = 0x3;
   static constexpr const unsigned NullabilityKindSize = 2;
@@ -606,7 +607,7 @@ inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {
 }
 
 /// Describes API notes data for an Objective-C method.
-class ObjCMethodInfo : public FunctionInfo {
+class CLANG_ABI ObjCMethodInfo : public FunctionInfo {
 public:
   /// Whether this is a designated initializer of its class.
   LLVM_PREFERRED_TYPE(bool)
@@ -675,7 +676,7 @@ class EnumConstantInfo : public CommonEntityInfo {
 };
 
 /// Describes API notes data for a tag.
-class TagInfo : public CommonTypeInfo {
+class CLANG_ABI TagInfo : public CommonTypeInfo {
   LLVM_PREFERRED_TYPE(bool)
   unsigned HasFlagEnum : 1;
   LLVM_PREFERRED_TYPE(bool)
@@ -765,7 +766,7 @@ inline bool operator!=(const TagInfo &LHS, const TagInfo &RHS) {
 }
 
 /// Describes API notes data for a typedef.
-class TypedefInfo : public CommonTypeInfo {
+class CLANG_ABI TypedefInfo : public CommonTypeInfo {
 public:
   std::optional<SwiftNewTypeKind> SwiftWrapper;
 
diff --git a/clang/include/clang/ARCMigrate/ARCMT.h b/clang/include/clang/ARCMigrate/ARCMT.h
index 2b950e3d2cc2bf..dc078101e371ff 100644
--- a/clang/include/clang/ARCMigrate/ARCMT.h
+++ b/clang/include/clang/ARCMigrate/ARCMT.h
@@ -12,6 +12,7 @@
 #include "clang/ARCMigrate/FileRemapper.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class ASTContext;
@@ -37,7 +38,7 @@ namespace arcmt {
 /// the pre-migration ARC diagnostics.
 ///
 /// \returns false if no error is produced, true otherwise.
-bool
+CLANG_ABI bool
 checkForManualIssues(CompilerInvocation &CI, const FrontendInputFile &Input,
                      std::shared_ptr<PCHContainerOperations> PCHContainerOps,
                      DiagnosticConsumer *DiagClient,
@@ -48,7 +49,7 @@ checkForManualIssues(CompilerInvocation &CI, const FrontendInputFile &Input,
 /// applies automatic modifications to source files to conform to ARC.
 ///
 /// \returns false if no error is produced, true otherwise.
-bool
+CLANG_ABI bool
 applyTransformations(CompilerInvocation &origCI,
                      const FrontendInputFile &Input,
                      std::shared_ptr<PCHContainerOperations> PCHContainerOps,
@@ -65,7 +66,7 @@ applyTransformations(CompilerInvocation &origCI,
 /// the pre-migration ARC diagnostics.
 ///
 /// \returns false if no error is produced, true otherwise.
-bool migrateWithTemporaryFiles(
+CLANG_ABI bool migrateWithTemporaryFiles(
     CompilerInvocation &origCI, const FrontendInputFile &Input,
     std::shared_ptr<PCHContainerOperations> PCHContainerOps,
     DiagnosticConsumer *DiagClient, StringRef outputDir,
@@ -75,7 +76,7 @@ bool migrateWithTemporaryFiles(
 /// migrateWithTemporaryFiles produced.
 ///
 /// \returns false if no error is produced, true otherwise.
-bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap,
+CLANG_ABI bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap,
                        StringRef outputDir,
                        DiagnosticConsumer *DiagClient);
 
@@ -83,17 +84,17 @@ bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap,
 /// info.
 ///
 /// \returns false if no error is produced, true otherwise.
-bool getFileRemappingsFromFileList(
+CLANG_ABI bool getFileRemappingsFromFileList(
                         std::vector<std::pair<std::string,std::string> > &remap,
                         ArrayRef<StringRef> remapFiles,
                         DiagnosticConsumer *DiagClient);
 
 typedef void (*TransformFn)(MigrationPass &pass);
 
-std::vector<TransformFn> getAllTransformations(LangOptions::GCMode OrigGCMode,
+CLANG_ABI std::vector<TransformFn> getAllTransformations(LangOptions::GCMode OrigGCMode,
                                                bool NoFinalizeRemoval);
 
-class MigrationProcess {
+class CLANG_ABI MigrationProcess {
   CompilerInvocation OrigCI;
   std::shared_ptr<PCHContainerOperations> PCHContainerOps;
   DiagnosticConsumer *DiagClient;
@@ -107,7 +108,7 @@ class MigrationProcess {
                    DiagnosticConsumer *diagClient,
                    StringRef outputDir = StringRef());
 
-  class RewriteListener {
+  class CLANG_ABI RewriteListener {
   public:
     virtual ~RewriteListener();
 
diff --git a/clang/include/clang/ARCMigrate/ARCMTActions.h b/clang/include/clang/ARCMigrate/ARCMTActions.h
index 714f4b33db446b..50c6142078f5c8 100644
--- a/clang/include/clang/ARCMigrate/ARCMTActions.h
+++ b/clang/include/clang/ARCMigrate/ARCMTActions.h
@@ -11,12 +11,13 @@
 
 #include "clang/ARCMigrate/FileRemapper.h"
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace clang {
 namespace arcmt {
 
-class CheckAction : public WrapperFrontendAction {
+class CLANG_ABI CheckAction : public WrapperFrontendAction {
 protected:
   bool BeginInvocation(CompilerInstance &CI) override;
 
@@ -24,7 +25,7 @@ class CheckAction : public WrapperFrontendAction {
   CheckAction(std::unique_ptr<FrontendAction> WrappedAction);
 };
 
-class ModifyAction : public WrapperFrontendAction {
+class CLANG_ABI ModifyAction : public WrapperFrontendAction {
 protected:
   bool BeginInvocation(CompilerInstance &CI) override;
 
@@ -32,7 +33,7 @@ class ModifyAction : public WrapperFrontendAction {
   ModifyAction(std::unique_ptr<FrontendAction> WrappedAction);
 };
 
-class MigrateSourceAction : public ASTFrontendAction {
+class CLANG_ABI MigrateSourceAction : public ASTFrontendAction {
   FileRemapper Remapper;
 protected:
   bool BeginInvocation(CompilerInstance &CI) override;
@@ -40,7 +41,7 @@ class MigrateSourceAction : public ASTFrontendAction {
                                                  StringRef InFile) override;
 };
 
-class MigrateAction : public WrapperFrontendAction {
+class CLANG_ABI MigrateAction : public WrapperFrontendAction {
   std::string MigrateDir;
   std::string PlistOut;
   bool EmitPremigrationARCErrors;
@@ -55,7 +56,7 @@ class MigrateAction : public WrapperFrontendAction {
 };
 
 /// Migrates to modern ObjC syntax.
-class ObjCMigrateAction : public WrapperFrontendAction {
+class CLANG_ABI ObjCMigrateAction : public WrapperFrontendAction {
   std::string MigrateDir;
   unsigned    ObjCMigAction;
   FileRemapper Remapper;
diff --git a/clang/include/clang/ARCMigrate/FileRemapper.h b/clang/include/clang/ARCMigrate/FileRemapper.h
index afcee363516a21..3c9f706a75cf38 100644
--- a/clang/include/clang/ARCMigrate/FileRemapper.h
+++ b/clang/include/clang/ARCMigrate/FileRemapper.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/FileEntry.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -29,7 +30,7 @@ namespace clang {
 
 namespace arcmt {
 
-class FileRemapper {
+class CLANG_ABI FileRemapper {
   // FIXME: Reuse the same FileManager for multiple ASTContexts.
   std::unique_ptr<FileManager> FileMgr;
 
diff --git a/clang/include/clang/AST/APNumericStorage.h b/clang/include/clang/AST/APNumericStorage.h
index 95eddbcd86e839..ae634d46dfea2b 100644
--- a/clang/include/clang/AST/APNumericStorage.h
+++ b/clang/include/clang/AST/APNumericStorage.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_AST_APNUMERICSTORAGE_H
 #define LLVM_CLANG_AST_APNUMERICSTORAGE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 
@@ -23,7 +24,7 @@ class ASTContext;
 /// to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
 /// the APFloat/APInt values will never get freed. APNumericStorage uses
 /// ASTContext's allocator for memory allocation.
-class APNumericStorage {
+class CLANG_ABI APNumericStorage {
   union {
     uint64_t VAL;   ///< Used to store the <= 64 bits integer value.
     uint64_t *pVal; ///< Used to store the >64 bits integer value.
diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index 7869ee386689d7..4d475923b118ba 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_AST_APVALUE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APSInt.h"
@@ -41,7 +42,7 @@ template <typename T> class BasicReaderBase;
   class QualType;
 
 /// Symbolic representation of typeid(T) for some type T.
-class TypeInfoLValue {
+class CLANG_ABI TypeInfoLValue {
   const Type *T;
 
 public:
@@ -119,7 +120,7 @@ namespace clang {
 /// APValue - This class implements a discriminated union of [uninitialized]
 /// [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset],
 /// [Vector: N * APValue], [Array: N * APValue]
-class APValue {
+class CLANG_ABI APValue {
   typedef llvm::APFixedPoint APFixedPoint;
   typedef llvm::APSInt APSInt;
   typedef llvm::APFloat APFloat;
@@ -143,7 +144,7 @@ class APValue {
     AddrLabelDiff
   };
 
-  class LValueBase {
+  class CLANG_ABI LValueBase {
     typedef llvm::PointerUnion<const ValueDecl *, const Expr *, TypeInfoLValue,
                                DynamicAllocLValue>
         PtrTy;
@@ -179,11 +180,11 @@ class APValue {
 
     QualType getType() const;
 
-    friend bool operator==(const LValueBase &LHS, const LValueBase &RHS);
+    friend CLANG_ABI bool operator==(const LValueBase &LHS, const LValueBase &RHS);
     friend bool operator!=(const LValueBase &LHS, const LValueBase &RHS) {
       return !(LHS == RHS);
     }
-    friend llvm::hash_code hash_value(const LValueBase &Base);
+    friend CLANG_ABI llvm::hash_code hash_value(const LValueBase &Base);
     friend struct llvm::DenseMapInfo<LValueBase>;
 
   private:
@@ -205,7 +206,7 @@ class APValue {
   typedef llvm::PointerIntPair<const Decl *, 1, bool> BaseOrMemberType;
 
   /// A non-discriminated union of a base, field, or array index.
-  class LValuePathEntry {
+  class CLANG_ABI LValuePathEntry {
     static_assert(sizeof(uintptr_t) <= sizeof(uint64_t),
                   "pointer doesn't fit in 64 bits?");
     uint64_t Value;
@@ -237,7 +238,7 @@ class APValue {
       return llvm::hash_value(A.Value);
     }
   };
-  class LValuePathSerializationHelper {
+  class CLANG_ABI LValuePathSerializationHelper {
     const void *Ty;
 
   public:
@@ -274,7 +275,7 @@ class APValue {
     Vec &operator=(const Vec &) = delete;
     ~Vec() { delete[] Elts; }
   };
-  struct Arr {
+  struct CLANG_ABI Arr {
     APValue *Elts;
     unsigned NumElts, ArrSize;
     Arr(unsigned NumElts, unsigned ArrSize);
@@ -282,7 +283,7 @@ class APValue {
     Arr &operator=(const Arr &) = delete;
     ~Arr();
   };
-  struct StructData {
+  struct CLANG_ABI StructData {
     APValue *Elts;
     unsigned NumBases;
     unsigned NumFields;
@@ -291,7 +292,7 @@ class APValue {
     StructData &operator=(const StructData &) = delete;
     ~StructData();
   };
-  struct UnionData {
+  struct CLANG_ABI UnionData {
     const FieldDecl *Field;
     APValue *Value;
     UnionData();
@@ -746,7 +747,7 @@ class APValue {
 } // end namespace clang.
 
 namespace llvm {
-template<> struct DenseMapInfo<clang::APValue::LValueBase> {
+template<> struct CLANG_ABI DenseMapInfo<clang::APValue::LValueBase> {
   static clang::APValue::LValueBase getEmptyKey();
   static clang::APValue::LValueBase getTombstoneKey();
   static unsigned getHashValue(const clang::APValue::LValueBase &Base);
diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h
index 00500e214f4ce6..59b0a8e9d96a9d 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -18,6 +18,7 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
@@ -32,7 +33,7 @@ struct PrintingPolicy;
 
 /// The result of a constraint satisfaction check, containing the necessary
 /// information to diagnose an unsatisfied constraint.
-class ConstraintSatisfaction : public llvm::FoldingSetNode {
+class CLANG_ABI ConstraintSatisfaction : public llvm::FoldingSetNode {
   // The template-like entity that 'owns' the constraint checked here (can be a
   // constrained entity or a concept).
   const NamedDecl *ConstraintOwner = nullptr;
@@ -84,7 +85,7 @@ using UnsatisfiedConstraintRecord =
 /// necessary information to diagnose an unsatisfied constraint.
 ///
 /// This is safe to store in an AST node, as opposed to ConstraintSatisfaction.
-struct ASTConstraintSatisfaction final :
+struct CLANG_ABI ASTConstraintSatisfaction final :
     llvm::TrailingObjects<ASTConstraintSatisfaction,
                           UnsatisfiedConstraintRecord> {
   std::size_t NumRecords;
@@ -121,7 +122,7 @@ struct ASTConstraintSatisfaction final :
 ///
 ///   template <std::derives_from<Expr> T> void dump();
 ///             ~~~~~~~~~~~~~~~~~~~~~~~ (in TemplateTypeParmDecl)
-class ConceptReference {
+class CLANG_ABI ConceptReference {
   // \brief The optional nested name specifier used when naming the concept.
   NestedNameSpecifierLoc NestedNameSpec;
 
diff --git a/clang/include/clang/AST/ASTConsumer.h b/clang/include/clang/AST/ASTConsumer.h
index 447f2592d23595..735c7e549f5cac 100644
--- a/clang/include/clang/AST/ASTConsumer.h
+++ b/clang/include/clang/AST/ASTConsumer.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_AST_ASTCONSUMER_H
 #define LLVM_CLANG_AST_ASTCONSUMER_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
   class ASTContext;
   class CXXMethodDecl;
@@ -31,7 +32,7 @@ namespace clang {
 /// ASTConsumer - This is an abstract interface that should be implemented by
 /// clients that read ASTs.  This abstraction layer allows the client to be
 /// independent of the AST producer (e.g. parser vs AST dump file reader, etc).
-class ASTConsumer {
+class CLANG_ABI ASTConsumer {
   /// Whether this AST consumer also requires information about
   /// semantic analysis.
   bool SemaConsumer = false;
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index a4d36f2eacd5d1..ebd7431a328aee 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -27,6 +27,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -184,7 +185,7 @@ struct TypeInfoChars {
 
 /// Holds long-lived AST nodes (such as types and decls) that can be
 /// referred to throughout the semantic analysis of a file.
-class ASTContext : public RefCountedBase<ASTContext> {
+class CLANG_ABI ASTContext : public RefCountedBase<ASTContext> {
   friend class NestedNameSpecifier;
 
   mutable SmallVector<Type *, 0> Types;
@@ -338,7 +339,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
 
   /// Representation of a "canonical" template template parameter that
   /// is used in canonical template names.
-  class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
+  class CLANG_ABI CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
     TemplateTemplateParmDecl *Parm;
 
   public:
@@ -472,7 +473,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   /// something that has a semantic effect on startup (such as a variable with
   /// a non-constant initializer), or an ImportDecl (which recursively triggers
   /// initialization of another module).
-  struct PerModuleInitializers {
+  struct CLANG_ABI PerModuleInitializers {
     llvm::SmallVector<Decl*, 4> Initializers;
     llvm::SmallVector<GlobalDeclID, 4> LazyInitializers;
 
@@ -3561,7 +3562,7 @@ OPT_LIST(V)
 };
 
 /// Insertion operator for diagnostics.
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       const ASTContext::SectionInfo &Section);
 
 /// Utility function for constructing a nullary selector.
diff --git a/clang/include/clang/AST/ASTContextAllocate.h b/clang/include/clang/AST/ASTContextAllocate.h
index 70c8e24f9185bf..7e7bb5d6f9438a 100644
--- a/clang/include/clang/AST/ASTContextAllocate.h
+++ b/clang/include/clang/AST/ASTContextAllocate.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H
 #define LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H
 
+#include "clang/Support/Compiler.h"
 #include <cstddef>
 
 namespace clang {
@@ -23,15 +24,15 @@ class ASTContext;
 } // namespace clang
 
 // Defined in ASTContext.h
-void *operator new(size_t Bytes, const clang::ASTContext &C,
+CLANG_ABI void *operator new(size_t Bytes, const clang::ASTContext &C,
                    size_t Alignment = 8);
-void *operator new[](size_t Bytes, const clang::ASTContext &C,
+CLANG_ABI void *operator new[](size_t Bytes, const clang::ASTContext &C,
                      size_t Alignment = 8);
 
 // It is good practice to pair new/delete operators.  Also, MSVC gives many
 // warnings if a matching delete overload is not declared, even though the
 // throw() spec guarantees it will not be implicitly called.
-void operator delete(void *Ptr, const clang::ASTContext &C, size_t);
-void operator delete[](void *Ptr, const clang::ASTContext &C, size_t);
+CLANG_ABI void operator delete(void *Ptr, const clang::ASTContext &C, size_t);
+CLANG_ABI void operator delete[](void *Ptr, const clang::ASTContext &C, size_t);
 
 #endif // LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H
diff --git a/clang/include/clang/AST/ASTDiagnostic.h b/clang/include/clang/AST/ASTDiagnostic.h
index ef22249828629b..4b8120862e5c40 100644
--- a/clang/include/clang/AST/ASTDiagnostic.h
+++ b/clang/include/clang/AST/ASTDiagnostic.h
@@ -12,6 +12,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticAST.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   /// DiagnosticsEngine argument formatting function for diagnostics that
@@ -23,7 +24,7 @@ namespace clang {
   /// diagnostics. It is meant to be used as the argument to
   /// \c DiagnosticsEngine::SetArgToStringFn(), where the cookie is an \c
   /// ASTContext pointer.
-  void FormatASTNodeDiagnosticArgument(
+  CLANG_ABI void FormatASTNodeDiagnosticArgument(
       DiagnosticsEngine::ArgumentKind Kind,
       intptr_t Val,
       StringRef Modifier,
@@ -36,7 +37,7 @@ namespace clang {
   /// Returns a desugared version of the QualType, and marks ShouldAKA as true
   /// whenever we remove significant sugar from the type. Make sure ShouldAKA
   /// is initialized before passing it in.
-  QualType desugarForDiagnostic(ASTContext &Context, QualType QT,
+  CLANG_ABI QualType desugarForDiagnostic(ASTContext &Context, QualType QT,
                                 bool &ShouldAKA);
 }  // end namespace clang
 
diff --git a/clang/include/clang/AST/ASTDumper.h b/clang/include/clang/AST/ASTDumper.h
index 71ac467e5104b5..fa0963e749b001 100644
--- a/clang/include/clang/AST/ASTDumper.h
+++ b/clang/include/clang/AST/ASTDumper.h
@@ -12,10 +12,11 @@
 #include "clang/AST/ASTNodeTraverser.h"
 #include "clang/AST/TextNodeDumper.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
-class ASTDumper : public ASTNodeTraverser<ASTDumper, TextNodeDumper> {
+class CLANG_ABI ASTDumper : public ASTNodeTraverser<ASTDumper, TextNodeDumper> {
 
   TextNodeDumper NodeDumper;
 
diff --git a/clang/include/clang/AST/ASTImportError.h b/clang/include/clang/AST/ASTImportError.h
index 728314ca0936e7..e1e7ef143f4c18 100644
--- a/clang/include/clang/AST/ASTImportError.h
+++ b/clang/include/clang/AST/ASTImportError.h
@@ -14,11 +14,12 @@
 #ifndef LLVM_CLANG_AST_ASTIMPORTERROR_H
 #define LLVM_CLANG_AST_ASTIMPORTERROR_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 
 namespace clang {
 
-class ASTImportError : public llvm::ErrorInfo<ASTImportError> {
+class CLANG_ABI ASTImportError : public llvm::ErrorInfo<ASTImportError> {
 public:
   /// \brief Kind of error when importing an AST component.
   enum ErrorKind {
diff --git a/clang/include/clang/AST/ASTImporter.h b/clang/include/clang/AST/ASTImporter.h
index 088a2bd0fdd407..ef3881aea691ff 100644
--- a/clang/include/clang/AST/ASTImporter.h
+++ b/clang/include/clang/AST/ASTImporter.h
@@ -25,6 +25,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -55,11 +56,11 @@ class TypeSourceInfo;
   // previous decl and the next item is actually the previous item in the order
   // of source locations.  Thus, `Decl::redecls()` gives different lists for
   // the different entries in a given redecl chain.
-  llvm::SmallVector<Decl*, 2> getCanonicalForwardRedeclChain(Decl* D);
+  CLANG_ABI llvm::SmallVector<Decl*, 2> getCanonicalForwardRedeclChain(Decl* D);
 
   /// Imports selected nodes from one AST context into another context,
   /// merging AST nodes where appropriate.
-  class ASTImporter {
+  class CLANG_ABI ASTImporter {
     friend class ASTNodeImporter;
   public:
     using NonEquivalentDeclSet = llvm::DenseSet<std::pair<Decl *, Decl *>>;
diff --git a/clang/include/clang/AST/ASTImporterLookupTable.h b/clang/include/clang/AST/ASTImporterLookupTable.h
index 2dbc44c5dcd443..efb91697b373b5 100644
--- a/clang/include/clang/AST/ASTImporterLookupTable.h
+++ b/clang/include/clang/AST/ASTImporterLookupTable.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/DeclBase.h" // lookup_result
 #include "clang/AST/DeclarationName.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SetVector.h"
 
@@ -43,7 +44,7 @@ class DeclContext;
 // holds every node and we are not interested in any C/C++ specific visibility
 // considerations. Simply, we must know if there is an existing Decl in a
 // given DC. Once we found it then we can handle any visibility related tasks.
-class ASTImporterLookupTable {
+class CLANG_ABI ASTImporterLookupTable {
 
   // We store a list of declarations for each name.
   // And we collect these lists for each DeclContext.
diff --git a/clang/include/clang/AST/ASTMutationListener.h b/clang/include/clang/AST/ASTMutationListener.h
index 2c4ec2ce67f36b..fcc011ee72d09e 100644
--- a/clang/include/clang/AST/ASTMutationListener.h
+++ b/clang/include/clang/AST/ASTMutationListener.h
@@ -12,6 +12,7 @@
 #ifndef LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
 #define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
   class Attr;
   class ClassTemplateDecl;
@@ -45,7 +46,7 @@ namespace clang {
 /// An abstract interface that should be implemented by listeners
 /// that want to be notified when an AST entity gets modified after its
 /// initial creation.
-class ASTMutationListener {
+class CLANG_ABI ASTMutationListener {
 public:
   virtual ~ASTMutationListener();
 
diff --git a/clang/include/clang/AST/ASTStructuralEquivalence.h b/clang/include/clang/AST/ASTStructuralEquivalence.h
index 029439c8e9a3ac..c6702b66e5ae51 100644
--- a/clang/include/clang/AST/ASTStructuralEquivalence.h
+++ b/clang/include/clang/AST/ASTStructuralEquivalence.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_ASTSTRUCTURALEQUIVALENCE_H
 
 #include "clang/AST/DeclBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include <optional>
@@ -38,7 +39,7 @@ enum class StructuralEquivalenceKind {
   Minimal,
 };
 
-struct StructuralEquivalenceContext {
+struct CLANG_ABI StructuralEquivalenceContext {
   /// AST contexts for which we are checking structural equivalence.
   ASTContext &FromCtx, &ToCtx;
 
diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h
index 3988a15971db5d..cb1956af7795a2 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -22,6 +22,7 @@
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Support/AlignOf.h"
 
@@ -48,7 +49,7 @@ enum TraversalKind {
 /// It can be constructed from any node kind and allows for runtime type
 /// hierarchy checks.
 /// Use getFromNodeKind<T>() to construct them.
-class ASTNodeKind {
+class CLANG_ABI ASTNodeKind {
 public:
   /// Empty identifier. It matches nothing.
   constexpr ASTNodeKind() : KindId(NKI_None) {}
@@ -254,7 +255,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {
 /// See \c ASTNodeKind for which node base types are currently supported;
 /// You can create DynTypedNodes for all nodes in the inheritance hierarchy of
 /// the supported base types.
-class DynTypedNode {
+class CLANG_ABI DynTypedNode {
 public:
   /// Creates a \c DynTypedNode from \c Node.
   template <typename T>
diff --git a/clang/include/clang/AST/ASTUnresolvedSet.h b/clang/include/clang/AST/ASTUnresolvedSet.h
index 3838dcb61ee0e5..39b1a78b58d9e7 100644
--- a/clang/include/clang/AST/ASTUnresolvedSet.h
+++ b/clang/include/clang/AST/ASTUnresolvedSet.h
@@ -19,6 +19,7 @@
 #include "clang/AST/DeclID.h"
 #include "clang/AST/UnresolvedSet.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
 
@@ -100,7 +101,7 @@ class ASTUnresolvedSet {
 
 /// An UnresolvedSet-like class that might not have been loaded from the
 /// external AST source yet.
-class LazyASTUnresolvedSet {
+class CLANG_ABI LazyASTUnresolvedSet {
   mutable ASTUnresolvedSet Impl;
 
   void getFromExternalSource(ASTContext &C) const;
diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 725498e132fc28..e49346b7a50ae7 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -24,6 +24,7 @@
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Frontend/HLSL/HLSLResource.h"
 #include "llvm/Support/CodeGen.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -39,7 +40,7 @@ class FunctionDecl;
 class OMPTraitInfo;
 
 /// Attr - This represents one attribute.
-class Attr : public AttributeCommonInfo {
+class CLANG_ABI Attr : public AttributeCommonInfo {
 private:
   LLVM_PREFERRED_TYPE(attr::Kind)
   unsigned AttrKind : 16;
diff --git a/clang/include/clang/AST/Availability.h b/clang/include/clang/AST/Availability.h
index 60ca1383f0a44e..efb2309a30cba9 100644
--- a/clang/include/clang/AST/Availability.h
+++ b/clang/include/clang/AST/Availability.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_AST_AVAILABILITY_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/VersionTuple.h"
@@ -61,7 +62,7 @@ class AvailabilitySpec {
 class Decl;
 
 /// Storage of availability attributes for a declaration.
-struct AvailabilityInfo {
+struct CLANG_ABI AvailabilityInfo {
   /// The domain is the platform for which this availability info applies to.
   llvm::SmallString<32> Domain;
   VersionTuple Introduced;
diff --git a/clang/include/clang/AST/CXXInheritance.h b/clang/include/clang/AST/CXXInheritance.h
index bbef01843e0b0a..1b934c678948c6 100644
--- a/clang/include/clang/AST/CXXInheritance.h
+++ b/clang/include/clang/AST/CXXInheritance.h
@@ -19,6 +19,7 @@
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallSet.h"
@@ -113,7 +114,7 @@ class CXXBasePath : public SmallVector<CXXBasePathElement, 4> {
 /// -> (A,v) and (D, 0) -> (C, 0) -> (A, v), but since both of them
 /// refer to the same base class subobject of type A (the virtual
 /// one), there is no ambiguity.
-class CXXBasePaths {
+class CLANG_ABI CXXBasePaths {
   friend class CXXRecordDecl;
 
   /// The type from which this search originated.
@@ -266,7 +267,7 @@ struct UniqueVirtualMethod {
 /// overridden virtual function occurs, while the second part of the
 /// pair is the virtual method that overrides it (including the
 /// subobject in which that virtual function occurs).
-class OverridingMethods {
+class CLANG_ABI OverridingMethods {
   using ValuesT = SmallVector<UniqueVirtualMethod, 4>;
   using MapType = llvm::MapVector<unsigned, ValuesT>;
 
diff --git a/clang/include/clang/AST/Comment.h b/clang/include/clang/AST/Comment.h
index dd9906727293fc..d64e081fbf092c 100644
--- a/clang/include/clang/AST/Comment.h
+++ b/clang/include/clang/AST/Comment.h
@@ -17,6 +17,7 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -62,7 +63,7 @@ enum class CommentKind {
 
 /// Any part of the comment.
 /// Abstract class.
-class Comment {
+class CLANG_ABI Comment {
 protected:
   /// Preferred location to show caret.
   SourceLocation Loc;
@@ -288,7 +289,7 @@ class InlineContentComment : public Comment {
 };
 
 /// Plain text.
-class TextComment : public InlineContentComment {
+class CLANG_ABI TextComment : public InlineContentComment {
   StringRef Text;
 
 public:
@@ -552,7 +553,7 @@ class BlockContentComment : public Comment {
 };
 
 /// A single paragraph that contains inline content.
-class ParagraphComment : public BlockContentComment {
+class CLANG_ABI ParagraphComment : public BlockContentComment {
   ArrayRef<InlineContentComment *> Content;
 
 public:
@@ -708,7 +709,7 @@ class BlockCommandComment : public BlockContentComment {
 enum class ParamCommandPassDirection { In, Out, InOut };
 
 /// Doxygen \\param command.
-class ParamCommandComment : public BlockCommandComment {
+class CLANG_ABI ParamCommandComment : public BlockCommandComment {
 private:
   /// Parameter index in the function declaration.
   unsigned ParamIndex;
@@ -790,7 +791,7 @@ class ParamCommandComment : public BlockCommandComment {
 };
 
 /// Doxygen \\tparam command, describes a template parameter.
-class TParamCommandComment : public BlockCommandComment {
+class CLANG_ABI TParamCommandComment : public BlockCommandComment {
 private:
   /// If this template parameter name was resolved (found in template parameter
   /// list), then this stores a list of position indexes in all template
@@ -959,7 +960,7 @@ class VerbatimLineComment : public BlockCommandComment {
 };
 
 /// Information about the declaration, useful to clients of FullComment.
-struct DeclInfo {
+struct CLANG_ABI DeclInfo {
   /// Declaration the comment is actually attached to (in the source).
   /// Should not be NULL.
   const Decl *CommentDecl;
diff --git a/clang/include/clang/AST/CommentBriefParser.h b/clang/include/clang/AST/CommentBriefParser.h
index cfd2137bd68c1d..961e2566304f18 100644
--- a/clang/include/clang/AST/CommentBriefParser.h
+++ b/clang/include/clang/AST/CommentBriefParser.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_COMMENTBRIEFPARSER_H
 
 #include "clang/AST/CommentLexer.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace comments {
@@ -26,7 +27,7 @@ namespace comments {
 /// \li a \or \\short command,
 /// \li the first paragraph,
 /// \li a \\result or \\return or \\returns paragraph.
-class BriefParser {
+class CLANG_ABI BriefParser {
   Lexer &L;
 
   const CommandTraits &Traits;
diff --git a/clang/include/clang/AST/CommentCommandTraits.h b/clang/include/clang/AST/CommentCommandTraits.h
index 78c484fff3aede..6ce4748b6c85fb 100644
--- a/clang/include/clang/AST/CommentCommandTraits.h
+++ b/clang/include/clang/AST/CommentCommandTraits.h
@@ -17,6 +17,7 @@
 
 #include "clang/Basic/CommentOptions.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
@@ -146,7 +147,7 @@ struct CommandInfo {
 
 /// This class provides information about commands that can be used
 /// in comments.
-class CommandTraits {
+class CLANG_ABI CommandTraits {
 public:
   enum KnownCommandIDs {
 #define COMMENT_COMMAND(NAME) KCI_##NAME,
diff --git a/clang/include/clang/AST/CommentLexer.h b/clang/include/clang/AST/CommentLexer.h
index 9aa1681cb2c5c0..39a1027e7a16e2 100644
--- a/clang/include/clang/AST/CommentLexer.h
+++ b/clang/include/clang/AST/CommentLexer.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
@@ -52,7 +53,7 @@ enum TokenKind {
 } // end namespace tok
 
 /// Comment token.
-class Token {
+class CLANG_ABI Token {
   friend class Lexer;
   friend class TextTokenRetokenizer;
 
@@ -217,7 +218,7 @@ class Token {
 };
 
 /// Comment lexer.
-class Lexer {
+class CLANG_ABI Lexer {
 private:
   Lexer(const Lexer &) = delete;
   void operator=(const Lexer &) = delete;
diff --git a/clang/include/clang/AST/CommentParser.h b/clang/include/clang/AST/CommentParser.h
index 289f0b2c066b92..0ae04ea7cf610b 100644
--- a/clang/include/clang/AST/CommentParser.h
+++ b/clang/include/clang/AST/CommentParser.h
@@ -17,6 +17,7 @@
 #include "clang/AST/CommentLexer.h"
 #include "clang/AST/CommentSema.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Allocator.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ namespace comments {
 class CommandTraits;
 
 /// Doxygen comment parser.
-class Parser {
+class CLANG_ABI Parser {
   Parser(const Parser &) = delete;
   void operator=(const Parser &) = delete;
 
diff --git a/clang/include/clang/AST/CommentSema.h b/clang/include/clang/AST/CommentSema.h
index 03f13283ac0d97..558255f8e5a083 100644
--- a/clang/include/clang/AST/CommentSema.h
+++ b/clang/include/clang/AST/CommentSema.h
@@ -16,6 +16,7 @@
 #include "clang/AST/Comment.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -29,7 +30,7 @@ class Preprocessor;
 namespace comments {
 class CommandTraits;
 
-class Sema {
+class CLANG_ABI Sema {
   Sema(const Sema &) = delete;
   void operator=(const Sema &) = delete;
 
diff --git a/clang/include/clang/AST/ComparisonCategories.h b/clang/include/clang/AST/ComparisonCategories.h
index 5a6aef80843cf1..ef1bda87c0b222 100644
--- a/clang/include/clang/AST/ComparisonCategories.h
+++ b/clang/include/clang/AST/ComparisonCategories.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_COMPARISONCATEGORIES_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/DenseMap.h"
 #include <array>
@@ -58,7 +59,7 @@ inline ComparisonCategoryType commonComparisonType(ComparisonCategoryType A,
 
 /// Get the comparison category that should be used when comparing values of
 /// type \c T.
-std::optional<ComparisonCategoryType>
+CLANG_ABI std::optional<ComparisonCategoryType>
 getComparisonCategoryForBuiltinCmp(QualType T);
 
 /// An enumeration representing the possible results of a three-way
@@ -73,7 +74,7 @@ enum class ComparisonCategoryResult : unsigned char {
   Last = Unordered
 };
 
-class ComparisonCategoryInfo {
+class CLANG_ABI ComparisonCategoryInfo {
   friend class ComparisonCategories;
   friend class Sema;
 
@@ -82,7 +83,7 @@ class ComparisonCategoryInfo {
                          ComparisonCategoryType Kind)
       : Ctx(Ctx), Record(RD), Kind(Kind) {}
 
-  struct ValueInfo {
+  struct CLANG_ABI ValueInfo {
     ComparisonCategoryResult Kind;
     VarDecl *VD;
 
@@ -171,7 +172,7 @@ class ComparisonCategoryInfo {
   }
 };
 
-class ComparisonCategories {
+class CLANG_ABI ComparisonCategories {
 public:
   static StringRef getCategoryString(ComparisonCategoryType Kind);
   static StringRef getResultString(ComparisonCategoryResult Kind);
diff --git a/clang/include/clang/AST/ComputeDependence.h b/clang/include/clang/AST/ComputeDependence.h
index e96275e5f2e073..065e3a3c97573a 100644
--- a/clang/include/clang/AST/ComputeDependence.h
+++ b/clang/include/clang/AST/ComputeDependence.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/DependenceFlags.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 
 namespace clang {
@@ -111,101 +112,101 @@ class OpenACCAsteriskSizeExpr;
 
 // The following functions are called from constructors of `Expr`, so they
 // should not access anything beyond basic
-ExprDependence computeDependence(FullExpr *E);
-ExprDependence computeDependence(OpaqueValueExpr *E);
-ExprDependence computeDependence(ParenExpr *E);
-ExprDependence computeDependence(UnaryOperator *E, const ASTContext &Ctx);
-ExprDependence computeDependence(UnaryExprOrTypeTraitExpr *E);
-ExprDependence computeDependence(ArraySubscriptExpr *E);
-ExprDependence computeDependence(MatrixSubscriptExpr *E);
-ExprDependence computeDependence(CompoundLiteralExpr *E);
-ExprDependence computeDependence(ImplicitCastExpr *E);
-ExprDependence computeDependence(ExplicitCastExpr *E);
-ExprDependence computeDependence(BinaryOperator *E);
-ExprDependence computeDependence(ConditionalOperator *E);
-ExprDependence computeDependence(BinaryConditionalOperator *E);
-ExprDependence computeDependence(StmtExpr *E, unsigned TemplateDepth);
-ExprDependence computeDependence(ConvertVectorExpr *E);
-ExprDependence computeDependence(VAArgExpr *E);
-ExprDependence computeDependence(ChooseExpr *E);
-ExprDependence computeDependence(NoInitExpr *E);
-ExprDependence computeDependence(ArrayInitLoopExpr *E);
-ExprDependence computeDependence(ImplicitValueInitExpr *E);
-ExprDependence computeDependence(InitListExpr *E);
-ExprDependence computeDependence(ExtVectorElementExpr *E);
-ExprDependence computeDependence(BlockExpr *E,
+CLANG_ABI ExprDependence computeDependence(FullExpr *E);
+CLANG_ABI ExprDependence computeDependence(OpaqueValueExpr *E);
+CLANG_ABI ExprDependence computeDependence(ParenExpr *E);
+CLANG_ABI ExprDependence computeDependence(UnaryOperator *E, const ASTContext &Ctx);
+CLANG_ABI ExprDependence computeDependence(UnaryExprOrTypeTraitExpr *E);
+CLANG_ABI ExprDependence computeDependence(ArraySubscriptExpr *E);
+CLANG_ABI ExprDependence computeDependence(MatrixSubscriptExpr *E);
+CLANG_ABI ExprDependence computeDependence(CompoundLiteralExpr *E);
+CLANG_ABI ExprDependence computeDependence(ImplicitCastExpr *E);
+CLANG_ABI ExprDependence computeDependence(ExplicitCastExpr *E);
+CLANG_ABI ExprDependence computeDependence(BinaryOperator *E);
+CLANG_ABI ExprDependence computeDependence(ConditionalOperator *E);
+CLANG_ABI ExprDependence computeDependence(BinaryConditionalOperator *E);
+CLANG_ABI ExprDependence computeDependence(StmtExpr *E, unsigned TemplateDepth);
+CLANG_ABI ExprDependence computeDependence(ConvertVectorExpr *E);
+CLANG_ABI ExprDependence computeDependence(VAArgExpr *E);
+CLANG_ABI ExprDependence computeDependence(ChooseExpr *E);
+CLANG_ABI ExprDependence computeDependence(NoInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(ArrayInitLoopExpr *E);
+CLANG_ABI ExprDependence computeDependence(ImplicitValueInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(InitListExpr *E);
+CLANG_ABI ExprDependence computeDependence(ExtVectorElementExpr *E);
+CLANG_ABI ExprDependence computeDependence(BlockExpr *E,
                                  bool ContainsUnexpandedParameterPack);
-ExprDependence computeDependence(AsTypeExpr *E);
-ExprDependence computeDependence(DeclRefExpr *E, const ASTContext &Ctx);
-ExprDependence computeDependence(RecoveryExpr *E);
-ExprDependence computeDependence(CXXRewrittenBinaryOperator *E);
-ExprDependence computeDependence(CXXStdInitializerListExpr *E);
-ExprDependence computeDependence(CXXTypeidExpr *E);
-ExprDependence computeDependence(MSPropertyRefExpr *E);
-ExprDependence computeDependence(MSPropertySubscriptExpr *E);
-ExprDependence computeDependence(CXXUuidofExpr *E);
-ExprDependence computeDependence(CXXThisExpr *E);
-ExprDependence computeDependence(CXXThrowExpr *E);
-ExprDependence computeDependence(CXXBindTemporaryExpr *E);
-ExprDependence computeDependence(CXXScalarValueInitExpr *E);
-ExprDependence computeDependence(CXXDeleteExpr *E);
-ExprDependence computeDependence(ArrayTypeTraitExpr *E);
-ExprDependence computeDependence(ExpressionTraitExpr *E);
-ExprDependence computeDependence(CXXNoexceptExpr *E, CanThrowResult CT);
-ExprDependence computeDependence(PackExpansionExpr *E);
-ExprDependence computeDependence(PackIndexingExpr *E);
-ExprDependence computeDependence(SubstNonTypeTemplateParmExpr *E);
-ExprDependence computeDependence(CoroutineSuspendExpr *E);
-ExprDependence computeDependence(DependentCoawaitExpr *E);
-ExprDependence computeDependence(CXXNewExpr *E);
-ExprDependence computeDependence(CXXPseudoDestructorExpr *E);
-ExprDependence computeDependence(OverloadExpr *E, bool KnownDependent,
+CLANG_ABI ExprDependence computeDependence(AsTypeExpr *E);
+CLANG_ABI ExprDependence computeDependence(DeclRefExpr *E, const ASTContext &Ctx);
+CLANG_ABI ExprDependence computeDependence(RecoveryExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXRewrittenBinaryOperator *E);
+CLANG_ABI ExprDependence computeDependence(CXXStdInitializerListExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXTypeidExpr *E);
+CLANG_ABI ExprDependence computeDependence(MSPropertyRefExpr *E);
+CLANG_ABI ExprDependence computeDependence(MSPropertySubscriptExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXUuidofExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXThisExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXThrowExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXBindTemporaryExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXScalarValueInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXDeleteExpr *E);
+CLANG_ABI ExprDependence computeDependence(ArrayTypeTraitExpr *E);
+CLANG_ABI ExprDependence computeDependence(ExpressionTraitExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXNoexceptExpr *E, CanThrowResult CT);
+CLANG_ABI ExprDependence computeDependence(PackExpansionExpr *E);
+CLANG_ABI ExprDependence computeDependence(PackIndexingExpr *E);
+CLANG_ABI ExprDependence computeDependence(SubstNonTypeTemplateParmExpr *E);
+CLANG_ABI ExprDependence computeDependence(CoroutineSuspendExpr *E);
+CLANG_ABI ExprDependence computeDependence(DependentCoawaitExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXNewExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXPseudoDestructorExpr *E);
+CLANG_ABI ExprDependence computeDependence(OverloadExpr *E, bool KnownDependent,
                                  bool KnownInstantiationDependent,
                                  bool KnownContainsUnexpandedParameterPack);
-ExprDependence computeDependence(DependentScopeDeclRefExpr *E);
-ExprDependence computeDependence(CXXConstructExpr *E);
-ExprDependence computeDependence(CXXTemporaryObjectExpr *E);
-ExprDependence computeDependence(CXXDefaultInitExpr *E);
-ExprDependence computeDependence(CXXDefaultArgExpr *E);
-ExprDependence computeDependence(LambdaExpr *E,
+CLANG_ABI ExprDependence computeDependence(DependentScopeDeclRefExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXConstructExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXTemporaryObjectExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXDefaultInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXDefaultArgExpr *E);
+CLANG_ABI ExprDependence computeDependence(LambdaExpr *E,
                                  bool ContainsUnexpandedParameterPack);
-ExprDependence computeDependence(CXXUnresolvedConstructExpr *E);
-ExprDependence computeDependence(CXXDependentScopeMemberExpr *E);
-ExprDependence computeDependence(MaterializeTemporaryExpr *E);
-ExprDependence computeDependence(CXXFoldExpr *E);
-ExprDependence computeDependence(CXXParenListInitExpr *E);
-ExprDependence computeDependence(TypeTraitExpr *E);
-ExprDependence computeDependence(ConceptSpecializationExpr *E,
+CLANG_ABI ExprDependence computeDependence(CXXUnresolvedConstructExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXDependentScopeMemberExpr *E);
+CLANG_ABI ExprDependence computeDependence(MaterializeTemporaryExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXFoldExpr *E);
+CLANG_ABI ExprDependence computeDependence(CXXParenListInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(TypeTraitExpr *E);
+CLANG_ABI ExprDependence computeDependence(ConceptSpecializationExpr *E,
                                  bool ValueDependent);
 
-ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
-ExprDependence computeDependence(PredefinedExpr *E);
-ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
-ExprDependence computeDependence(OffsetOfExpr *E);
-ExprDependence computeDependence(MemberExpr *E);
-ExprDependence computeDependence(ShuffleVectorExpr *E);
-ExprDependence computeDependence(GenericSelectionExpr *E,
+CLANG_ABI ExprDependence computeDependence(SYCLUniqueStableNameExpr *E);
+CLANG_ABI ExprDependence computeDependence(PredefinedExpr *E);
+CLANG_ABI ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef<Expr *> PreArgs);
+CLANG_ABI ExprDependence computeDependence(OffsetOfExpr *E);
+CLANG_ABI ExprDependence computeDependence(MemberExpr *E);
+CLANG_ABI ExprDependence computeDependence(ShuffleVectorExpr *E);
+CLANG_ABI ExprDependence computeDependence(GenericSelectionExpr *E,
                                  bool ContainsUnexpandedPack);
-ExprDependence computeDependence(DesignatedInitExpr *E);
-ExprDependence computeDependence(ParenListExpr *E);
-ExprDependence computeDependence(PseudoObjectExpr *E);
-ExprDependence computeDependence(AtomicExpr *E);
+CLANG_ABI ExprDependence computeDependence(DesignatedInitExpr *E);
+CLANG_ABI ExprDependence computeDependence(ParenListExpr *E);
+CLANG_ABI ExprDependence computeDependence(PseudoObjectExpr *E);
+CLANG_ABI ExprDependence computeDependence(AtomicExpr *E);
 
-ExprDependence computeDependence(ArraySectionExpr *E);
-ExprDependence computeDependence(OMPArrayShapingExpr *E);
-ExprDependence computeDependence(OMPIteratorExpr *E);
+CLANG_ABI ExprDependence computeDependence(ArraySectionExpr *E);
+CLANG_ABI ExprDependence computeDependence(OMPArrayShapingExpr *E);
+CLANG_ABI ExprDependence computeDependence(OMPIteratorExpr *E);
 
-ExprDependence computeDependence(ObjCArrayLiteral *E);
-ExprDependence computeDependence(ObjCDictionaryLiteral *E);
-ExprDependence computeDependence(ObjCBoxedExpr *E);
-ExprDependence computeDependence(ObjCEncodeExpr *E);
-ExprDependence computeDependence(ObjCIvarRefExpr *E);
-ExprDependence computeDependence(ObjCPropertyRefExpr *E);
-ExprDependence computeDependence(ObjCSubscriptRefExpr *E);
-ExprDependence computeDependence(ObjCIsaExpr *E);
-ExprDependence computeDependence(ObjCIndirectCopyRestoreExpr *E);
-ExprDependence computeDependence(ObjCMessageExpr *E);
-ExprDependence computeDependence(OpenACCAsteriskSizeExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCArrayLiteral *E);
+CLANG_ABI ExprDependence computeDependence(ObjCDictionaryLiteral *E);
+CLANG_ABI ExprDependence computeDependence(ObjCBoxedExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCEncodeExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCIvarRefExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCPropertyRefExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCSubscriptRefExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCIsaExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCIndirectCopyRestoreExpr *E);
+CLANG_ABI ExprDependence computeDependence(ObjCMessageExpr *E);
+CLANG_ABI ExprDependence computeDependence(OpenACCAsteriskSizeExpr *E);
 
 } // namespace clang
 #endif
diff --git a/clang/include/clang/AST/DataCollection.h b/clang/include/clang/AST/DataCollection.h
index 14d1bc188623a9..433b4a6d6f6c18 100644
--- a/clang/include/clang/AST/DataCollection.h
+++ b/clang/include/clang/AST/DataCollection.h
@@ -27,6 +27,7 @@
 #define LLVM_CLANG_AST_DATACOLLECTION_H
 
 #include "clang/AST/ASTContext.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace data_collection {
@@ -36,7 +37,7 @@ namespace data_collection {
 ///
 /// If 'getMacroStack(A) == getMacroStack(B)' is true, then the SourceLocations
 /// A and B are expanded from the same macros in the same order.
-std::string getMacroStack(SourceLocation Loc, ASTContext &Context);
+CLANG_ABI std::string getMacroStack(SourceLocation Loc, ASTContext &Context);
 
 /// Utility functions for implementing addData() for a consumer that has a
 /// method update(StringRef)
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 7ff35d73df5997..396999e087e3c7 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -34,6 +34,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Visibility.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -79,7 +80,7 @@ class VarTemplateDecl;
 enum class ImplicitParamKind;
 
 /// The top declaration context.
-class TranslationUnitDecl : public Decl,
+class CLANG_ABI TranslationUnitDecl : public Decl,
                             public DeclContext,
                             public Redeclarable<TranslationUnitDecl> {
   using redeclarable_base = Redeclarable<TranslationUnitDecl>;
@@ -141,7 +142,7 @@ class TranslationUnitDecl : public Decl,
 
 /// Represents a `#pragma comment` line. Always a child of
 /// TranslationUnitDecl.
-class PragmaCommentDecl final
+class CLANG_ABI PragmaCommentDecl final
     : public Decl,
       private llvm::TrailingObjects<PragmaCommentDecl, char> {
   friend class ASTDeclReader;
@@ -175,7 +176,7 @@ class PragmaCommentDecl final
 
 /// Represents a `#pragma detect_mismatch` line. Always a child of
 /// TranslationUnitDecl.
-class PragmaDetectMismatchDecl final
+class CLANG_ABI PragmaDetectMismatchDecl final
     : public Decl,
       private llvm::TrailingObjects<PragmaDetectMismatchDecl, char> {
   friend class ASTDeclReader;
@@ -223,7 +224,7 @@ class PragmaDetectMismatchDecl final
 ///
 /// The declaration at #3 finds it is a redeclaration of \c N::f through
 /// lookup in the extern "C" context.
-class ExternCContextDecl : public Decl, public DeclContext {
+class CLANG_ABI ExternCContextDecl : public Decl, public DeclContext {
   explicit ExternCContextDecl(TranslationUnitDecl *TU)
     : Decl(ExternCContext, TU, SourceLocation()),
       DeclContext(ExternCContext) {}
@@ -250,7 +251,7 @@ class ExternCContextDecl : public Decl, public DeclContext {
 ///
 /// Note that not every NamedDecl is actually named (e.g., a struct might
 /// be anonymous), and not every name is an identifier.
-class NamedDecl : public Decl {
+class CLANG_ABI NamedDecl : public Decl {
   /// The name of this declaration, which is typically a normal
   /// identifier but may also be a special kind of name (C++
   /// constructor, Objective-C selector, etc.)
@@ -500,7 +501,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const NamedDecl &ND) {
 /// defined at.  For normal labels, the location of the decl is the same as the
 /// location of the statement.  For GNU local labels (__label__), the decl
 /// location is where the __label__ is.
-class LabelDecl : public NamedDecl {
+class CLANG_ABI LabelDecl : public NamedDecl {
   LabelStmt *TheStmt;
   StringRef MSAsmName;
   bool MSAsmNameResolved = false;
@@ -546,7 +547,7 @@ class LabelDecl : public NamedDecl {
 };
 
 /// Represent a C++ namespace.
-class NamespaceDecl : public NamedDecl,
+class CLANG_ABI NamespaceDecl : public NamedDecl,
                       public DeclContext,
                       public Redeclarable<NamespaceDecl> {
   /// The starting location of the source range, pointing
@@ -668,7 +669,7 @@ class VarDecl;
 /// Represent the declaration of a variable (in which case it is
 /// an lvalue) a function (in which case it is a function designator) or
 /// an enum constant.
-class ValueDecl : public NamedDecl {
+class CLANG_ABI ValueDecl : public NamedDecl {
   QualType DeclType;
 
   void anchor() override;
@@ -705,7 +706,7 @@ class ValueDecl : public NamedDecl {
 
 /// A struct with extended info about a syntactic
 /// name qualifier, to be used for the case of out-of-line declarations.
-struct QualifierInfo {
+struct CLANG_ABI QualifierInfo {
   NestedNameSpecifierLoc QualifierLoc;
 
   /// The number of "outer" template parameter lists.
@@ -732,7 +733,7 @@ struct QualifierInfo {
 
 /// Represents a ValueDecl that came out of a declarator.
 /// Contains type source information through TypeSourceInfo.
-class DeclaratorDecl : public ValueDecl {
+class CLANG_ABI DeclaratorDecl : public ValueDecl {
   // A struct representing a TInfo, a trailing requires-clause and a syntactic
   // qualifier, to be used for the (uncommon) case of out-of-line declarations
   // and constrained function decls.
@@ -880,7 +881,7 @@ struct EvaluatedStmt {
 };
 
 /// Represents a variable declaration or definition.
-class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
+class CLANG_ABI VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
 public:
   /// Initialization styles.
   enum InitializationStyle {
@@ -1682,7 +1683,7 @@ enum class ImplicitParamKind {
   Other,
 };
 
-class ImplicitParamDecl : public VarDecl {
+class CLANG_ABI ImplicitParamDecl : public VarDecl {
   void anchor() override;
 
 public:
@@ -1723,7 +1724,7 @@ class ImplicitParamDecl : public VarDecl {
 };
 
 /// Represents a parameter to a function.
-class ParmVarDecl : public VarDecl {
+class CLANG_ABI ParmVarDecl : public VarDecl {
 public:
   enum { MaxFunctionScopeDepth = 255 };
   enum { MaxFunctionScopeIndex = 255 };
@@ -1931,7 +1932,7 @@ enum class MultiVersionKind {
 /// contains all of the information known about the function. Other,
 /// previous declarations of the function are available via the
 /// getPreviousDecl() chain.
-class FunctionDecl : public DeclaratorDecl,
+class CLANG_ABI FunctionDecl : public DeclaratorDecl,
                      public DeclContext,
                      public Redeclarable<FunctionDecl> {
   // This class stores some data in DeclContext::FunctionDeclBits
@@ -1959,7 +1960,7 @@ class FunctionDecl : public DeclaratorDecl,
   };
 
   /// Stashed information about a defaulted/deleted function body.
-  class DefaultedOrDeletedFunctionInfo final
+  class CLANG_ABI DefaultedOrDeletedFunctionInfo final
       : llvm::TrailingObjects<DefaultedOrDeletedFunctionInfo, DeclAccessPair,
                               StringLiteral *> {
     friend TrailingObjects;
@@ -3031,7 +3032,7 @@ class FunctionDecl : public DeclaratorDecl,
 };
 
 /// Represents a member of a struct/union/class.
-class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
+class CLANG_ABI FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
   /// The kinds of value we can store in StorageKind.
   ///
   /// Note that this is compatible with InClassInitStyle except for
@@ -3273,7 +3274,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
 /// that is defined.  For example, in "enum X {a,b}", each of a/b are
 /// EnumConstantDecl's, X is an instance of EnumDecl, and the type of a/b is a
 /// TagType for the X EnumDecl.
-class EnumConstantDecl : public ValueDecl,
+class CLANG_ABI EnumConstantDecl : public ValueDecl,
                          public Mergeable<EnumConstantDecl>,
                          public APIntStorage {
   Stmt *Init; // an integer constant expression
@@ -3318,7 +3319,7 @@ class EnumConstantDecl : public ValueDecl,
 
 /// Represents a field injected from an anonymous union/struct into the parent
 /// scope. These are always implicit.
-class IndirectFieldDecl : public ValueDecl,
+class CLANG_ABI IndirectFieldDecl : public ValueDecl,
                           public Mergeable<IndirectFieldDecl> {
   NamedDecl **Chaining;
   unsigned ChainingSize;
@@ -3368,7 +3369,7 @@ class IndirectFieldDecl : public ValueDecl,
 };
 
 /// Represents a declaration of a type.
-class TypeDecl : public NamedDecl {
+class CLANG_ABI TypeDecl : public NamedDecl {
   friend class ASTContext;
   friend class ASTReader;
 
@@ -3411,7 +3412,7 @@ class TypeDecl : public NamedDecl {
 };
 
 /// Base class for declarations which introduce a typedef-name.
-class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
+class CLANG_ABI TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
   struct alignas(8) ModedTInfo {
     TypeSourceInfo *first;
     QualType second;
@@ -3513,7 +3514,7 @@ class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
 
 /// Represents the declaration of a typedef-name via the 'typedef'
 /// type specifier.
-class TypedefDecl : public TypedefNameDecl {
+class CLANG_ABI TypedefDecl : public TypedefNameDecl {
   TypedefDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
               SourceLocation IdLoc, const IdentifierInfo *Id,
               TypeSourceInfo *TInfo)
@@ -3534,7 +3535,7 @@ class TypedefDecl : public TypedefNameDecl {
 
 /// Represents the declaration of a typedef-name via a C++11
 /// alias-declaration.
-class TypeAliasDecl : public TypedefNameDecl {
+class CLANG_ABI TypeAliasDecl : public TypedefNameDecl {
   /// The template for which this is the pattern, if any.
   TypeAliasTemplateDecl *Template;
 
@@ -3561,7 +3562,7 @@ class TypeAliasDecl : public TypedefNameDecl {
 };
 
 /// Represents the declaration of a struct/union/class/enum.
-class TagDecl : public TypeDecl,
+class CLANG_ABI TagDecl : public TypeDecl,
                 public DeclContext,
                 public Redeclarable<TagDecl> {
   // This class stores some data in DeclContext::TagDeclBits
@@ -3846,7 +3847,7 @@ class TagDecl : public TypeDecl,
 /// Represents an enum.  In C++11, enums can be forward-declared
 /// with a fixed underlying type, and in C we allow them to be forward-declared
 /// with no underlying type as an extension.
-class EnumDecl : public TagDecl {
+class CLANG_ABI EnumDecl : public TagDecl {
   // This class stores some data in DeclContext::EnumDeclBits
   // to save some space. Use the provided accessors to access it.
 
@@ -4147,7 +4148,7 @@ enum class RecordArgPassingKind {
 ///   struct X;                  // Forward declaration, no "body".
 ///   union Y { int A, B; };     // Has body with members A and B (FieldDecls).
 /// This decl will be marked invalid if *any* members are invalid.
-class RecordDecl : public TagDecl {
+class CLANG_ABI RecordDecl : public TagDecl {
   // This class stores some data in DeclContext::RecordDeclBits
   // to save some space. Use the provided accessors to access it.
 public:
@@ -4399,7 +4400,7 @@ class RecordDecl : public TagDecl {
   void setODRHash(unsigned Hash) { RecordDeclBits.ODRHash = Hash; }
 };
 
-class FileScopeAsmDecl : public Decl {
+class CLANG_ABI FileScopeAsmDecl : public Decl {
   StringLiteral *AsmString;
   SourceLocation RParenLoc;
 
@@ -4436,7 +4437,7 @@ class FileScopeAsmDecl : public Decl {
 ///
 /// \note This is used in libInterpreter, clang -cc1 -fincremental-extensions
 /// and in tools such as clang-repl.
-class TopLevelStmtDecl : public Decl, public DeclContext {
+class CLANG_ABI TopLevelStmtDecl : public Decl, public DeclContext {
   friend class ASTDeclReader;
   friend class ASTDeclWriter;
 
@@ -4473,7 +4474,7 @@ class TopLevelStmtDecl : public Decl, public DeclContext {
 /// Represents a block literal declaration, which is like an
 /// unnamed FunctionDecl.  For example:
 /// ^{ statement-body }   or   ^(int arg1, float arg2){ statement-body }
-class BlockDecl : public Decl, public DeclContext {
+class CLANG_ABI BlockDecl : public Decl, public DeclContext {
   // This class stores some data in DeclContext::BlockDeclBits
   // to save some space. Use the provided accessors to access it.
 public:
@@ -4669,7 +4670,7 @@ class BlockDecl : public Decl, public DeclContext {
 };
 
 /// Represents the body of a CapturedStmt, and serves as its DeclContext.
-class CapturedDecl final
+class CLANG_ABI CapturedDecl final
     : public Decl,
       public DeclContext,
       private llvm::TrailingObjects<CapturedDecl, ImplicitParamDecl *> {
@@ -4784,7 +4785,7 @@ class CapturedDecl final
 ///
 /// Import declarations can also be implicitly generated from
 /// \#include/\#import directives.
-class ImportDecl final : public Decl,
+class CLANG_ABI ImportDecl final : public Decl,
                          llvm::TrailingObjects<ImportDecl, SourceLocation> {
   friend class ASTContext;
   friend class ASTDeclReader;
@@ -4864,7 +4865,7 @@ class ImportDecl final : public Decl,
 /// \code
 ///   export void foo();
 /// \endcode
-class ExportDecl final : public Decl, public DeclContext {
+class CLANG_ABI ExportDecl final : public Decl, public DeclContext {
   virtual void anchor();
 
 private:
@@ -4911,7 +4912,7 @@ class ExportDecl final : public Decl, public DeclContext {
 };
 
 /// Represents an empty-declaration.
-class EmptyDecl : public Decl {
+class CLANG_ABI EmptyDecl : public Decl {
   EmptyDecl(DeclContext *DC, SourceLocation L) : Decl(Empty, DC, L) {}
 
   virtual void anchor();
@@ -4926,7 +4927,7 @@ class EmptyDecl : public Decl {
 };
 
 /// HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
-class HLSLBufferDecl final : public NamedDecl, public DeclContext {
+class CLANG_ABI HLSLBufferDecl final : public NamedDecl, public DeclContext {
   /// LBraceLoc - The ending location of the source range.
   SourceLocation LBraceLoc;
   /// RBraceLoc - The ending location of the source range.
@@ -5039,7 +5040,7 @@ static constexpr StringRef getOpenMPVariantManglingSeparatorStr() {
 
 /// Returns whether the given FunctionDecl has an __arm[_locally]_streaming
 /// attribute.
-bool IsArmStreamingFunction(const FunctionDecl *FD,
+CLANG_ABI bool IsArmStreamingFunction(const FunctionDecl *FD,
                             bool IncludeLocallyStreaming);
 
 } // namespace clang
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index a3447d19909752..d9bd957dc30cec 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -23,6 +23,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -83,7 +84,7 @@ enum AvailabilityResult {
 /// (and its subclasses) in its Decl::operator new(). Proper alignment
 /// of all subclasses (not requiring more than the alignment of Decl) is
 /// asserted in DeclBase.cpp.
-class alignas(8) Decl {
+class CLANG_ABI alignas(8) Decl {
 public:
   /// Lists the kind of concrete classes of Decl.
   enum Kind {
@@ -1287,7 +1288,7 @@ inline bool declaresSameEntity(const Decl *D1, const Decl *D2) {
 
 /// PrettyStackTraceDecl - If a crash occurs, indicate that it happened when
 /// doing something to a specific decl.
-class PrettyStackTraceDecl : public llvm::PrettyStackTraceEntry {
+class CLANG_ABI PrettyStackTraceDecl : public llvm::PrettyStackTraceEntry {
   const Decl *TheDecl;
   SourceLocation Loc;
   SourceManager &SM;
@@ -1436,7 +1437,7 @@ enum class LinkageSpecLanguageIDs;
 ///   ExportDecl
 ///   BlockDecl
 ///   CapturedDecl
-class DeclContext {
+class CLANG_ABI DeclContext {
   /// For makeDeclVisibleInContextImpl
   friend class ASTDeclReader;
   /// For checking the new bits in the Serialization part.
@@ -2625,7 +2626,7 @@ class DeclContext {
                                   typename lookup_iterator::iterator_category,
                                   UsingDirectiveDecl *>;
 
-  struct udir_iterator : udir_iterator_base {
+  struct CLANG_ABI udir_iterator : udir_iterator_base {
     udir_iterator(lookup_iterator I) : udir_iterator_base(I) {}
 
     UsingDirectiveDecl *operator*() const;
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 2693cc0e95b4b2..a87a751c435aeb 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -34,6 +34,7 @@
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -83,7 +84,7 @@ class UsingDecl;
 /// such as those occurring in a list of base specifiers.
 /// Also note that this class has nothing to do with so-called
 /// "access declarations" (C++98 11.3 [class.access.dcl]).
-class AccessSpecDecl : public Decl {
+class CLANG_ABI AccessSpecDecl : public Decl {
   /// The location of the ':'.
   SourceLocation ColonLoc;
 
@@ -255,7 +256,7 @@ class CXXBaseSpecifier {
 };
 
 /// Represents a C++ struct/union/class.
-class CXXRecordDecl : public RecordDecl {
+class CLANG_ABI CXXRecordDecl : public RecordDecl {
   friend class ASTDeclMerger;
   friend class ASTDeclReader;
   friend class ASTDeclWriter;
@@ -289,7 +290,7 @@ class CXXRecordDecl : public RecordDecl {
   };
 
 private:
-  struct DefinitionData {
+  struct CLANG_ABI DefinitionData {
     #define FIELD(Name, Width, Merge) \
     unsigned Name : Width;
     #include "CXXRecordDeclDefinitionBits.def"
@@ -381,7 +382,7 @@ class CXXRecordDecl : public RecordDecl {
   struct DefinitionData *DefinitionData;
 
   /// Describes a C++ closure type (generated by a lambda expression).
-  struct LambdaDefinitionData : public DefinitionData {
+  struct CLANG_ABI LambdaDefinitionData : public DefinitionData {
     using Capture = LambdaCapture;
 
     /// Whether this lambda is known to be dependent, even if its
@@ -1902,7 +1903,7 @@ class CXXRecordDecl : public RecordDecl {
 
 /// Store information needed for an explicit specifier.
 /// Used by CXXDeductionGuideDecl, CXXConstructorDecl and CXXConversionDecl.
-class ExplicitSpecifier {
+class CLANG_ABI ExplicitSpecifier {
   llvm::PointerIntPair<Expr *, 2, ExplicitSpecKind> ExplicitSpec{
       nullptr, ExplicitSpecKind::ResolvedFalse};
 
@@ -1957,7 +1958,7 @@ class ExplicitSpecifier {
 /// In this example, there will be an explicit deduction guide from the
 /// second line, and implicit deduction guide templates synthesized from
 /// the constructors of \c A.
-class CXXDeductionGuideDecl : public FunctionDecl {
+class CLANG_ABI CXXDeductionGuideDecl : public FunctionDecl {
   void anchor() override;
 
 private:
@@ -2037,7 +2038,7 @@ class CXXDeductionGuideDecl : public FunctionDecl {
 /// In this example, a RequiresExpr object will be generated for the expression,
 /// and a RequiresExprBodyDecl will be created to hold the parameter t and the
 /// template argument list imposed by the compound requirement.
-class RequiresExprBodyDecl : public Decl, public DeclContext {
+class CLANG_ABI RequiresExprBodyDecl : public Decl, public DeclContext {
   RequiresExprBodyDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
       : Decl(RequiresExprBody, DC, StartLoc), DeclContext(RequiresExprBody) {}
 
@@ -2068,7 +2069,7 @@ class RequiresExprBodyDecl : public Decl, public DeclContext {
 ///
 /// In the terminology of the C++ Standard, these are the (static and
 /// non-static) member functions, whether virtual or not.
-class CXXMethodDecl : public FunctionDecl {
+class CLANG_ABI CXXMethodDecl : public FunctionDecl {
   void anchor() override;
 
 protected:
@@ -2308,7 +2309,7 @@ class CXXMethodDecl : public FunctionDecl {
 ///   B(A& a) : A(a), f(3.14159) { }
 /// };
 /// \endcode
-class CXXCtorInitializer final {
+class CLANG_ABI CXXCtorInitializer final {
   /// Either the base class name/delegating constructor type (stored as
   /// a TypeSourceInfo*), an normal field (FieldDecl), or an anonymous field
   /// (IndirectFieldDecl*) being initialized.
@@ -2540,7 +2541,7 @@ class InheritedConstructor {
 ///   explicit X(int); // represented by a CXXConstructorDecl.
 /// };
 /// \endcode
-class CXXConstructorDecl final
+class CLANG_ABI CXXConstructorDecl final
     : public CXXMethodDecl,
       private llvm::TrailingObjects<CXXConstructorDecl, InheritedConstructor,
                                     ExplicitSpecifier> {
@@ -2807,7 +2808,7 @@ class CXXConstructorDecl final
 ///   ~X(); // represented by a CXXDestructorDecl.
 /// };
 /// \endcode
-class CXXDestructorDecl : public CXXMethodDecl {
+class CLANG_ABI CXXDestructorDecl : public CXXMethodDecl {
   friend class ASTDeclReader;
   friend class ASTDeclWriter;
 
@@ -2870,7 +2871,7 @@ class CXXDestructorDecl : public CXXMethodDecl {
 ///   operator bool();
 /// };
 /// \endcode
-class CXXConversionDecl : public CXXMethodDecl {
+class CLANG_ABI CXXConversionDecl : public CXXMethodDecl {
   CXXConversionDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
                     const DeclarationNameInfo &NameInfo, QualType T,
                     TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline,
@@ -2942,7 +2943,7 @@ enum class LinkageSpecLanguageIDs { C = 1, CXX = 2 };
 /// \code
 ///   extern "C" void foo();
 /// \endcode
-class LinkageSpecDecl : public Decl, public DeclContext {
+class CLANG_ABI LinkageSpecDecl : public Decl, public DeclContext {
   virtual void anchor();
   // This class stores some data in DeclContext::LinkageSpecDeclBits to save
   // some space. Use the provided accessors to access it.
@@ -3023,7 +3024,7 @@ class LinkageSpecDecl : public Decl, public DeclContext {
 /// \note UsingDirectiveDecl should be Decl not NamedDecl, but we provide
 /// artificial names for all using-directives in order to store
 /// them in DeclContext effectively.
-class UsingDirectiveDecl : public NamedDecl {
+class CLANG_ABI UsingDirectiveDecl : public NamedDecl {
   /// The location of the \c using keyword.
   SourceLocation UsingLoc;
 
@@ -3127,7 +3128,7 @@ class UsingDirectiveDecl : public NamedDecl {
 /// \code
 /// namespace Foo = Bar;
 /// \endcode
-class NamespaceAliasDecl : public NamedDecl,
+class CLANG_ABI NamespaceAliasDecl : public NamedDecl,
                            public Redeclarable<NamespaceAliasDecl> {
   friend class ASTDeclReader;
 
@@ -3235,7 +3236,7 @@ class NamespaceAliasDecl : public NamedDecl,
 
 /// Implicit declaration of a temporary that was materialized by
 /// a MaterializeTemporaryExpr and lifetime-extended by a declaration
-class LifetimeExtendedTemporaryDecl final
+class CLANG_ABI LifetimeExtendedTemporaryDecl final
     : public Decl,
       public Mergeable<LifetimeExtendedTemporaryDecl> {
   friend class MaterializeTemporaryExpr;
@@ -3328,7 +3329,7 @@ class LifetimeExtendedTemporaryDecl final
 ///   using enum A::bar;
 /// }
 /// \endcode
-class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
+class CLANG_ABI UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
   friend class BaseUsingDecl;
 
   /// The referenced declaration.
@@ -3425,7 +3426,7 @@ class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
 /// Represents a C++ declaration that introduces decls from somewhere else. It
 /// provides a set of the shadow decls so introduced.
 
-class BaseUsingDecl : public NamedDecl {
+class CLANG_ABI BaseUsingDecl : public NamedDecl {
   /// The first shadow declaration of the shadow decl chain associated
   /// with this using declaration.
   ///
@@ -3520,7 +3521,7 @@ class BaseUsingDecl : public NamedDecl {
 /// \code
 ///    using someNameSpace::someIdentifier;
 /// \endcode
-class UsingDecl : public BaseUsingDecl, public Mergeable<UsingDecl> {
+class CLANG_ABI UsingDecl : public BaseUsingDecl, public Mergeable<UsingDecl> {
   /// The source location of the 'using' keyword itself.
   SourceLocation UsingLocation;
 
@@ -3606,7 +3607,7 @@ class UsingDecl : public BaseUsingDecl, public Mergeable<UsingDecl> {
 ///    using Base::Base; // creates a UsingDecl and a ConstructorUsingShadowDecl
 /// };
 /// \endcode
-class ConstructorUsingShadowDecl final : public UsingShadowDecl {
+class CLANG_ABI ConstructorUsingShadowDecl final : public UsingShadowDecl {
   /// If this constructor using declaration inherted the constructor
   /// from an indirect base class, this is the ConstructorUsingShadowDecl
   /// in the named direct base class from which the declaration was inherited.
@@ -3721,7 +3722,7 @@ class ConstructorUsingShadowDecl final : public UsingShadowDecl {
 ///    using enum SomeEnumTag ;
 /// \endcode
 
-class UsingEnumDecl : public BaseUsingDecl, public Mergeable<UsingEnumDecl> {
+class CLANG_ABI UsingEnumDecl : public BaseUsingDecl, public Mergeable<UsingEnumDecl> {
   /// The source location of the 'using' keyword itself.
   SourceLocation UsingLocation;
   /// The source location of the 'enum' keyword.
@@ -3800,7 +3801,7 @@ class UsingEnumDecl : public BaseUsingDecl, public Mergeable<UsingEnumDecl> {
 /// In the second case above, the UsingPackDecl will have the name
 /// 'operator T' (which contains an unexpanded pack), but the individual
 /// UsingDecls and UsingShadowDecls will have more reasonable names.
-class UsingPackDecl final
+class CLANG_ABI UsingPackDecl final
     : public NamedDecl, public Mergeable<UsingPackDecl>,
       private llvm::TrailingObjects<UsingPackDecl, NamedDecl *> {
   /// The UnresolvedUsingValueDecl or UnresolvedUsingTypenameDecl from
@@ -3869,7 +3870,7 @@ class UsingPackDecl final
 ///   using Base<T>::foo;
 /// };
 /// \endcode
-class UnresolvedUsingValueDecl : public ValueDecl,
+class CLANG_ABI UnresolvedUsingValueDecl : public ValueDecl,
                                  public Mergeable<UnresolvedUsingValueDecl> {
   /// The source location of the 'using' keyword
   SourceLocation UsingLocation;
@@ -3965,7 +3966,7 @@ class UnresolvedUsingValueDecl : public ValueDecl,
 ///
 /// The type associated with an unresolved using typename decl is
 /// currently always a typename type.
-class UnresolvedUsingTypenameDecl
+class CLANG_ABI UnresolvedUsingTypenameDecl
     : public TypeDecl,
       public Mergeable<UnresolvedUsingTypenameDecl> {
   friend class ASTDeclReader;
@@ -4048,7 +4049,7 @@ class UnresolvedUsingTypenameDecl
 /// In that case, Sema builds a UsingShadowDecl whose target is an instance of
 /// this declaration, adding it to the current scope. Referring to this
 /// declaration in any way is an error.
-class UnresolvedUsingIfExistsDecl final : public NamedDecl {
+class CLANG_ABI UnresolvedUsingIfExistsDecl final : public NamedDecl {
   UnresolvedUsingIfExistsDecl(DeclContext *DC, SourceLocation Loc,
                               DeclarationName Name);
 
@@ -4066,7 +4067,7 @@ class UnresolvedUsingIfExistsDecl final : public NamedDecl {
 };
 
 /// Represents a C++11 static_assert declaration.
-class StaticAssertDecl : public Decl {
+class CLANG_ABI StaticAssertDecl : public Decl {
   llvm::PointerIntPair<Expr *, 1, bool> AssertExprAndFailed;
   Expr *Message;
   SourceLocation RParenLoc;
@@ -4115,7 +4116,7 @@ class StaticAssertDecl : public Decl {
 /// a, b, and c are BindingDecls, whose bindings are the expressions
 /// x[0], x[1], and x[2] respectively, where x is the implicit
 /// DecompositionDecl of type 'int (&)[3]'.
-class BindingDecl : public ValueDecl {
+class CLANG_ABI BindingDecl : public ValueDecl {
   /// The declaration that this binding binds to part of.
   ValueDecl *Decomp;
   /// The binding represented by this declaration. References to this
@@ -4172,7 +4173,7 @@ class BindingDecl : public ValueDecl {
 /// the second line declares a DecompositionDecl of type 'int (&)[3]', and
 /// three BindingDecls (named a, b, and c). An instance of this class is always
 /// unnamed, but behaves in almost all other respects like a VarDecl.
-class DecompositionDecl final
+class CLANG_ABI DecompositionDecl final
     : public VarDecl,
       private llvm::TrailingObjects<DecompositionDecl, BindingDecl *> {
   /// The number of BindingDecl*s following this object.
@@ -4243,7 +4244,7 @@ class DecompositionDecl final
 /// A property declared using an incomplete array type may
 /// additionally be subscripted, adding extra parameters to the getter
 /// and putter methods.
-class MSPropertyDecl : public DeclaratorDecl {
+class CLANG_ABI MSPropertyDecl : public DeclaratorDecl {
   IdentifierInfo *GetterId, *SetterId;
 
   MSPropertyDecl(DeclContext *DC, SourceLocation L, DeclarationName N,
@@ -4295,7 +4296,7 @@ struct MSGuidDeclParts {
 ///
 /// X is a CXXRecordDecl that contains a UuidAttr that references the (unique)
 /// MSGuidDecl for the specified UUID.
-class MSGuidDecl : public ValueDecl,
+class CLANG_ABI MSGuidDecl : public ValueDecl,
                    public Mergeable<MSGuidDecl>,
                    public llvm::FoldingSetNode {
 public:
@@ -4352,7 +4353,7 @@ class MSGuidDecl : public ValueDecl,
 /// These is currently only used to back the LValue returned by
 /// __builtin_source_location, but could potentially be used for other similar
 /// situations in the future.
-class UnnamedGlobalConstantDecl : public ValueDecl,
+class CLANG_ABI UnnamedGlobalConstantDecl : public ValueDecl,
                                   public Mergeable<UnnamedGlobalConstantDecl>,
                                   public llvm::FoldingSetNode {
 
@@ -4397,7 +4398,7 @@ class UnnamedGlobalConstantDecl : public ValueDecl,
 
 /// Insertion operator for diagnostics.  This allows sending an AccessSpecifier
 /// into a diagnostic with <<.
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       AccessSpecifier AS);
 
 } // namespace clang
diff --git a/clang/include/clang/AST/DeclContextInternals.h b/clang/include/clang/AST/DeclContextInternals.h
index e169c485921929..b81d25ed210cd2 100644
--- a/clang/include/clang/AST/DeclContextInternals.h
+++ b/clang/include/clang/AST/DeclContextInternals.h
@@ -19,6 +19,7 @@
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclarationName.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -300,7 +301,7 @@ class StoredDeclsList {
   }
 };
 
-class StoredDeclsMap
+class CLANG_ABI StoredDeclsMap
     : public llvm::SmallDenseMap<DeclarationName, StoredDeclsList, 4> {
   friend class ASTContext; // walks the chain deleting these
   friend class DeclContext;
diff --git a/clang/include/clang/AST/DeclFriend.h b/clang/include/clang/AST/DeclFriend.h
index 095f14a81fd574..12aede217cb397 100644
--- a/clang/include/clang/AST/DeclFriend.h
+++ b/clang/include/clang/AST/DeclFriend.h
@@ -22,6 +22,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/Support/Casting.h"
@@ -49,7 +50,7 @@ class ASTContext;
 /// @endcode
 ///
 /// The semantic context of a friend decl is its declaring class.
-class FriendDecl final
+class CLANG_ABI FriendDecl final
     : public Decl,
       private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> {
   virtual void anchor();
diff --git a/clang/include/clang/AST/DeclGroup.h b/clang/include/clang/AST/DeclGroup.h
index 672b7b0a9fe225..c9f057dbf1053f 100644
--- a/clang/include/clang/AST/DeclGroup.h
+++ b/clang/include/clang/AST/DeclGroup.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_AST_DECLGROUP_H
 #define LLVM_CLANG_AST_DECLGROUP_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/TrailingObjects.h"
 #include <cassert>
 #include <cstdint>
@@ -22,7 +23,7 @@ namespace clang {
 class ASTContext;
 class Decl;
 
-class DeclGroup final : private llvm::TrailingObjects<DeclGroup, Decl *> {
+class CLANG_ABI DeclGroup final : private llvm::TrailingObjects<DeclGroup, Decl *> {
   // FIXME: Include a TypeSpecifier object.
   unsigned NumDecls = 0;
 
diff --git a/clang/include/clang/AST/DeclID.h b/clang/include/clang/AST/DeclID.h
index 49964b43c7d1d8..81a30266f31259 100644
--- a/clang/include/clang/AST/DeclID.h
+++ b/clang/include/clang/AST/DeclID.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_AST_DECLID_H
 #define LLVM_CLANG_AST_DECLID_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/iterator.h"
@@ -97,7 +98,7 @@ enum PredefinedDeclIDs {
 /// We can translate a LocalDeclID to the GlobalDeclID by
 /// `ASTReader::getGlobalDeclID()`.
 
-class DeclIDBase {
+class CLANG_ABI DeclIDBase {
 public:
   /// An ID number that refers to a declaration in an AST file.
   ///
@@ -180,7 +181,7 @@ namespace serialization {
 class ModuleFile;
 } // namespace serialization
 
-class LocalDeclID : public DeclIDBase {
+class CLANG_ABI LocalDeclID : public DeclIDBase {
   using Base = DeclIDBase;
 
   LocalDeclID(PredefinedDeclIDs ID) : Base(ID) {}
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 1cda70530d7d83..ceeed272da70a8 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -24,6 +24,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/MapVector.h"
@@ -56,7 +57,7 @@ class ObjCPropertyImplDecl;
 class ObjCProtocolDecl;
 class Stmt;
 
-class ObjCListBase {
+class CLANG_ABI ObjCListBase {
 protected:
   /// List is an array of pointers to objects that are not owned by this object.
   void **List = nullptr;
@@ -98,7 +99,7 @@ class ObjCList : public ObjCListBase {
 
 /// A list of Objective-C protocols, along with the source
 /// locations at which they were referenced.
-class ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
+class CLANG_ABI ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
   SourceLocation *Locations = nullptr;
 
   using ObjCList<ObjCProtocolDecl>::set;
@@ -137,7 +138,7 @@ enum class ObjCImplementationControl { None, Required, Optional };
 /// A selector represents a unique name for a method. The selector names for
 /// the above methods are setMenu:, menu, replaceSubview:with:, and defaultMenu.
 ///
-class ObjCMethodDecl : public NamedDecl, public DeclContext {
+class CLANG_ABI ObjCMethodDecl : public NamedDecl, public DeclContext {
   // This class stores some data in DeclContext::ObjCMethodDeclBits
   // to save some space. Use the provided accessors to access it.
 
@@ -575,7 +576,7 @@ enum class ObjCTypeParamVariance : uint8_t {
 /// while \c Value gets an implicit bound of \c id.
 ///
 /// Objective-C type parameters are typedef-names in the grammar,
-class ObjCTypeParamDecl : public TypedefNameDecl {
+class CLANG_ABI ObjCTypeParamDecl : public TypedefNameDecl {
   /// Index of this type parameter in the type parameter list.
   unsigned Index : 14;
 
@@ -655,7 +656,7 @@ class ObjCTypeParamDecl : public TypedefNameDecl {
 /// @interface NSArray<T> // stores the <T>
 /// @end
 /// \endcode
-class ObjCTypeParamList final
+class CLANG_ABI ObjCTypeParamList final
     : private llvm::TrailingObjects<ObjCTypeParamList, ObjCTypeParamDecl *> {
   /// Location of the left and right angle brackets.
   SourceRange Brackets;
@@ -727,7 +728,7 @@ enum class ObjCPropertyQueryKind : uint8_t {
 /// \code{.mm}
 /// \@property (assign, readwrite) int MyProperty;
 /// \endcode
-class ObjCPropertyDecl : public NamedDecl {
+class CLANG_ABI ObjCPropertyDecl : public NamedDecl {
   void anchor() override;
 
 public:
@@ -944,7 +945,7 @@ class ObjCPropertyDecl : public NamedDecl {
 /// Current sub-classes are ObjCInterfaceDecl, ObjCCategoryDecl,
 /// ObjCProtocolDecl, and ObjCImplDecl.
 ///
-class ObjCContainerDecl : public NamedDecl, public DeclContext {
+class CLANG_ABI ObjCContainerDecl : public NamedDecl, public DeclContext {
   // This class stores some data in DeclContext::ObjCContainerDeclBits
   // to save some space. Use the provided accessors to access it.
 
@@ -1149,7 +1150,7 @@ class ObjCContainerDecl : public NamedDecl, public DeclContext {
 ///   Unlike C++, ObjC is a single-rooted class model. In Cocoa, classes
 ///   typically inherit from NSObject (an exception is NSProxy).
 ///
-class ObjCInterfaceDecl : public ObjCContainerDecl
+class CLANG_ABI ObjCInterfaceDecl : public ObjCContainerDecl
                         , public Redeclarable<ObjCInterfaceDecl> {
   friend class ASTContext;
   friend class ODRDiagsEmitter;
@@ -1948,7 +1949,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
 ///     id canBePackage; // framework visibility (not available in C++).
 ///   }
 ///
-class ObjCIvarDecl : public FieldDecl {
+class CLANG_ABI ObjCIvarDecl : public FieldDecl {
   void anchor() override;
 
 public:
@@ -2026,7 +2027,7 @@ class ObjCIvarDecl : public FieldDecl {
 };
 
 /// Represents a field declaration created by an \@defs(...).
-class ObjCAtDefsFieldDecl : public FieldDecl {
+class CLANG_ABI ObjCAtDefsFieldDecl : public FieldDecl {
   ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation StartLoc,
                       SourceLocation IdLoc, IdentifierInfo *Id,
                       QualType T, Expr *BW)
@@ -2079,7 +2080,7 @@ class ObjCAtDefsFieldDecl : public FieldDecl {
 /// protocols are referenced using angle brackets as follows:
 ///
 /// id \<NSDraggingInfo> anyObjectThatImplementsNSDraggingInfo;
-class ObjCProtocolDecl : public ObjCContainerDecl,
+class CLANG_ABI ObjCProtocolDecl : public ObjCContainerDecl,
                          public Redeclarable<ObjCProtocolDecl> {
   struct DefinitionData {
     // The declaration that defines this protocol.
@@ -2325,7 +2326,7 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
 /// Categories were originally inspired by dynamic languages such as Common
 /// Lisp and Smalltalk.  More traditional class-based languages (C++, Java)
 /// don't support this level of dynamism, which is both powerful and dangerous.
-class ObjCCategoryDecl : public ObjCContainerDecl {
+class CLANG_ABI ObjCCategoryDecl : public ObjCContainerDecl {
   /// Interface belonging to this category
   ObjCInterfaceDecl *ClassInterface;
 
@@ -2468,7 +2469,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl {
   static bool classofKind(Kind K) { return K == ObjCCategory; }
 };
 
-class ObjCImplDecl : public ObjCContainerDecl {
+class CLANG_ABI ObjCImplDecl : public ObjCContainerDecl {
   /// Class interface for this class/category implementation
   ObjCInterfaceDecl *ClassInterface;
 
@@ -2541,7 +2542,7 @@ class ObjCImplDecl : public ObjCContainerDecl {
 /// \@end
 ///
 /// ObjCCategoryImplDecl
-class ObjCCategoryImplDecl : public ObjCImplDecl {
+class CLANG_ABI ObjCCategoryImplDecl : public ObjCImplDecl {
   // Category name location
   SourceLocation CategoryNameLoc;
 
@@ -2574,7 +2575,7 @@ class ObjCCategoryImplDecl : public ObjCImplDecl {
   static bool classofKind(Kind K) { return K == ObjCCategoryImpl;}
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const ObjCCategoryImplDecl &CID);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, const ObjCCategoryImplDecl &CID);
 
 /// ObjCImplementationDecl - Represents a class definition - this is where
 /// method definitions are specified. For example:
@@ -2593,7 +2594,7 @@ raw_ostream &operator<<(raw_ostream &OS, const ObjCCategoryImplDecl &CID);
 /// interface, \em not in the implementation. Nevertheless (for legacy reasons),
 /// we allow instance variables to be specified in the implementation. When
 /// specified, they need to be \em identical to the interface.
-class ObjCImplementationDecl : public ObjCImplDecl {
+class CLANG_ABI ObjCImplementationDecl : public ObjCImplDecl {
   /// Implementation Class's super class.
   ObjCInterfaceDecl *SuperClass;
   SourceLocation SuperLoc;
@@ -2767,11 +2768,11 @@ class ObjCImplementationDecl : public ObjCImplDecl {
   static bool classofKind(Kind K) { return K == ObjCImplementation; }
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const ObjCImplementationDecl &ID);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, const ObjCImplementationDecl &ID);
 
 /// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is
 /// declared as \@compatibility_alias alias class.
-class ObjCCompatibleAliasDecl : public NamedDecl {
+class CLANG_ABI ObjCCompatibleAliasDecl : public NamedDecl {
   /// Class that this is an alias of.
   ObjCInterfaceDecl *AliasedClass;
 
@@ -2801,7 +2802,7 @@ class ObjCCompatibleAliasDecl : public NamedDecl {
 /// in a class or category implementation block. For example:
 /// \@synthesize prop1 = ivar1;
 ///
-class ObjCPropertyImplDecl : public Decl {
+class CLANG_ABI ObjCPropertyImplDecl : public Decl {
 public:
   enum Kind {
     Synthesize,
diff --git a/clang/include/clang/AST/DeclOpenMP.h b/clang/include/clang/AST/DeclOpenMP.h
index 868662208efa1f..e8d717f2adeaf2 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -20,6 +20,7 @@
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/OpenMPClause.h"
 #include "clang/AST/Type.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/TrailingObjects.h"
 
@@ -107,7 +108,7 @@ template <typename U> class OMPDeclarativeDirective : public U {
 /// };
 /// \endcode
 ///
-class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
+class CLANG_ABI OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
   friend class OMPDeclarativeDirective<Decl>;
 
   virtual void anchor();
@@ -174,7 +175,7 @@ enum class OMPDeclareReductionInitKind {
 /// \endcode
 ///
 /// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
-class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
+class CLANG_ABI OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
   // This class stores some data in DeclContext::OMPDeclareReductionDeclBits
   // to save some space. Use the provided accessors to access it.
 
@@ -283,7 +284,7 @@ class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
 /// \code
 /// #pragma omp declare mapper(mid: struct vec v) map(v.len, v.data[0:N])
 /// \endcode
-class OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>,
+class CLANG_ABI OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>,
                                    public DeclContext {
   friend class OMPDeclarativeDirective<ValueDecl>;
   friend class ASTDeclReader;
@@ -380,7 +381,7 @@ class OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>,
 /// privatize non-static members of current class in non-static member
 /// functions. This pseudo-declaration allows properly handle this kind of
 /// capture by wrapping captured expression into a variable-like declaration.
-class OMPCapturedExprDecl final : public VarDecl {
+class CLANG_ABI OMPCapturedExprDecl final : public VarDecl {
   friend class ASTDeclReader;
   void anchor() override;
 
@@ -414,7 +415,7 @@ class OMPCapturedExprDecl final : public VarDecl {
 /// #pragma omp requires unified_address
 /// \endcode
 ///
-class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
+class CLANG_ABI OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
   friend class OMPDeclarativeDirective<Decl>;
   friend class ASTDeclReader;
 
@@ -471,7 +472,7 @@ class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
 /// };
 /// \endcode
 ///
-class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
+class CLANG_ABI OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
   friend class OMPDeclarativeDirective<Decl>;
   friend class ASTDeclReader;
 
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 141f58c4600af0..b2ff534860cf16 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -26,6 +26,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -68,7 +69,7 @@ NamedDecl *getAsNamedDecl(TemplateParameter P);
 
 /// Stores a list of template parameters for a TemplateDecl and its
 /// derived classes.
-class TemplateParameterList final
+class CLANG_ABI TemplateParameterList final
     : private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
                                     Expr *> {
   /// The location of the 'template' keyword.
@@ -240,7 +241,7 @@ class FixedSizeTemplateParameterListStorage
 };
 
 /// A template argument list.
-class TemplateArgumentList final
+class CLANG_ABI TemplateArgumentList final
     : private llvm::TrailingObjects<TemplateArgumentList, TemplateArgument> {
   /// The number of template arguments in this template
   /// argument list.
@@ -285,7 +286,7 @@ class TemplateArgumentList final
   }
 };
 
-void *allocateDefaultArgStorageChain(const ASTContext &C);
+CLANG_ABI void *allocateDefaultArgStorageChain(const ASTContext &C);
 
 /// Storage for a default argument. This is conceptually either empty, or an
 /// argument value, or a pointer to a previous declaration that had a default
@@ -391,7 +392,7 @@ class DefaultArgStorage {
 ///
 /// The TemplateDecl class stores the list of template parameters and a
 /// reference to the templated scoped declaration: the underlying AST node.
-class TemplateDecl : public NamedDecl {
+class CLANG_ABI TemplateDecl : public NamedDecl {
   void anchor() override;
 
 protected:
@@ -461,7 +462,7 @@ class TemplateDecl : public NamedDecl {
 /// Provides information about a function template specialization,
 /// which is a FunctionDecl that has been explicitly specialization or
 /// instantiated from a function template.
-class FunctionTemplateSpecializationInfo final
+class CLANG_ABI FunctionTemplateSpecializationInfo final
     : public llvm::FoldingSetNode,
       private llvm::TrailingObjects<FunctionTemplateSpecializationInfo,
                                     MemberSpecializationInfo *> {
@@ -684,7 +685,7 @@ class MemberSpecializationInfo {
 ///     friend void foo<>(T); // DependentFunctionTemplateSpecializationInfo
 ///   };
 /// \endcode
-class DependentFunctionTemplateSpecializationInfo final
+class CLANG_ABI DependentFunctionTemplateSpecializationInfo final
     : private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,
                                     FunctionTemplateDecl *> {
   friend TrailingObjects;
@@ -711,7 +712,7 @@ class DependentFunctionTemplateSpecializationInfo final
 };
 
 /// Declaration of a redeclarable template.
-class RedeclarableTemplateDecl : public TemplateDecl,
+class CLANG_ABI RedeclarableTemplateDecl : public TemplateDecl,
                                  public Redeclarable<RedeclarableTemplateDecl>
 {
   using redeclarable_base = Redeclarable<RedeclarableTemplateDecl>;
@@ -962,7 +963,7 @@ SpecEntryTraits<FunctionTemplateSpecializationInfo> {
 };
 
 /// Declaration of a template function.
-class FunctionTemplateDecl : public RedeclarableTemplateDecl {
+class CLANG_ABI FunctionTemplateDecl : public RedeclarableTemplateDecl {
 protected:
   friend class FunctionDecl;
 
@@ -1162,7 +1163,7 @@ class TemplateParmPosition {
 /// \code
 /// template<typename T> class vector;
 /// \endcode
-class TemplateTypeParmDecl final : public TypeDecl,
+class CLANG_ABI TemplateTypeParmDecl final : public TypeDecl,
     private llvm::TrailingObjects<TemplateTypeParmDecl, TypeConstraint> {
   /// Sema creates these on the stack during auto type deduction.
   friend class Sema;
@@ -1357,7 +1358,7 @@ class TemplateTypeParmDecl final : public TypeDecl,
 /// @code
 /// template<int Size> class array { };
 /// @endcode
-class NonTypeTemplateParmDecl final
+class CLANG_ABI NonTypeTemplateParmDecl final
     : public DeclaratorDecl,
       protected TemplateParmPosition,
       private llvm::TrailingObjects<NonTypeTemplateParmDecl,
@@ -1578,7 +1579,7 @@ class NonTypeTemplateParmDecl final
 /// @endcode
 /// A template template parameter is a TemplateDecl because it defines the
 /// name of a template and the template parameters allowable for substitution.
-class TemplateTemplateParmDecl final
+class CLANG_ABI TemplateTemplateParmDecl final
     : public TemplateDecl,
       protected TemplateParmPosition,
       private llvm::TrailingObjects<TemplateTemplateParmDecl,
@@ -1757,7 +1758,7 @@ class TemplateTemplateParmDecl final
 /// Represents the builtin template declaration which is used to
 /// implement __make_integer_seq and other builtin templates.  It serves
 /// no real purpose beyond existing as a place to hold template parameters.
-class BuiltinTemplateDecl : public TemplateDecl {
+class CLANG_ABI BuiltinTemplateDecl : public TemplateDecl {
   BuiltinTemplateKind BTK;
 
   BuiltinTemplateDecl(const ASTContext &C, DeclContext *DC,
@@ -1815,7 +1816,7 @@ using SpecializationOrInstantiationInfo =
 /// template<>
 /// class array<bool> { }; // class template specialization array<bool>
 /// \endcode
-class ClassTemplateSpecializationDecl : public CXXRecordDecl,
+class CLANG_ABI ClassTemplateSpecializationDecl : public CXXRecordDecl,
                                         public llvm::FoldingSetNode {
   /// Structure that stores information about a class template
   /// specialization that was instantiated from a class template partial
@@ -2082,7 +2083,7 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
   }
 };
 
-class ClassTemplatePartialSpecializationDecl
+class CLANG_ABI ClassTemplatePartialSpecializationDecl
   : public ClassTemplateSpecializationDecl {
   /// The list of template parameters
   TemplateParameterList* TemplateParams = nullptr;
@@ -2244,7 +2245,7 @@ class ClassTemplatePartialSpecializationDecl
 };
 
 /// Declaration of a class template.
-class ClassTemplateDecl : public RedeclarableTemplateDecl {
+class CLANG_ABI ClassTemplateDecl : public RedeclarableTemplateDecl {
 protected:
   /// Data that is common to all of the declarations of a given
   /// class template.
@@ -2443,7 +2444,7 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
 ///
 /// \note This class is not currently in use.  All of the above
 /// will yield a FriendDecl, not a FriendTemplateDecl.
-class FriendTemplateDecl : public Decl {
+class CLANG_ABI FriendTemplateDecl : public Decl {
   virtual void anchor();
 
 public:
@@ -2519,7 +2520,7 @@ class FriendTemplateDecl : public Decl {
 /// \code
 /// template \<typename T> using V = std::map<T*, int, MyCompare<T>>;
 /// \endcode
-class TypeAliasTemplateDecl : public RedeclarableTemplateDecl {
+class CLANG_ABI TypeAliasTemplateDecl : public RedeclarableTemplateDecl {
 protected:
   using Common = CommonBase;
 
@@ -2600,7 +2601,7 @@ class TypeAliasTemplateDecl : public RedeclarableTemplateDecl {
 /// template<>
 /// constexpr float pi<float>; // variable template specialization pi<float>
 /// \endcode
-class VarTemplateSpecializationDecl : public VarDecl,
+class CLANG_ABI VarTemplateSpecializationDecl : public VarDecl,
                                       public llvm::FoldingSetNode {
 
   /// Structure that stores information about a variable template
@@ -2851,7 +2852,7 @@ class VarTemplateSpecializationDecl : public VarDecl,
   }
 };
 
-class VarTemplatePartialSpecializationDecl
+class CLANG_ABI VarTemplatePartialSpecializationDecl
     : public VarTemplateSpecializationDecl {
   /// The list of template parameters
   TemplateParameterList *TemplateParams = nullptr;
@@ -3002,7 +3003,7 @@ class VarTemplatePartialSpecializationDecl
 };
 
 /// Declaration of a variable template.
-class VarTemplateDecl : public RedeclarableTemplateDecl {
+class CLANG_ABI VarTemplateDecl : public RedeclarableTemplateDecl {
 protected:
   /// Data that is common to all of the declarations of a given
   /// variable template.
@@ -3158,7 +3159,7 @@ class VarTemplateDecl : public RedeclarableTemplateDecl {
 };
 
 /// Declaration of a C++20 concept.
-class ConceptDecl : public TemplateDecl, public Mergeable<ConceptDecl> {
+class CLANG_ABI ConceptDecl : public TemplateDecl, public Mergeable<ConceptDecl> {
 protected:
   Expr *ConstraintExpr;
 
@@ -3210,7 +3211,7 @@ class ConceptDecl : public TemplateDecl, public Mergeable<ConceptDecl> {
 // An implementation detail of ConceptSpecialicationExpr that holds the template
 // arguments, so we can later use this to reconstitute the template arguments
 // during constraint checking.
-class ImplicitConceptSpecializationDecl final
+class CLANG_ABI ImplicitConceptSpecializationDecl final
     : public Decl,
       private llvm::TrailingObjects<ImplicitConceptSpecializationDecl,
                                     TemplateArgument> {
@@ -3253,7 +3254,7 @@ class ImplicitConceptSpecializationDecl final
 /// S<A{1, 2}> s1;
 /// S<A{1, 2}> s2; // same type, argument is same TemplateParamObjectDecl.
 /// \endcode
-class TemplateParamObjectDecl : public ValueDecl,
+class CLANG_ABI TemplateParamObjectDecl : public ValueDecl,
                                 public Mergeable<TemplateParamObjectDecl>,
                                 public llvm::FoldingSetNode {
 private:
@@ -3362,7 +3363,7 @@ inline std::optional<unsigned> getExpandedPackSize(const NamedDecl *Param) {
 
 /// Internal helper used by Subst* nodes to retrieve the parameter list
 /// for their AssociatedDecl.
-TemplateParameterList *getReplacedTemplateParameterList(Decl *D);
+CLANG_ABI TemplateParameterList *getReplacedTemplateParameterList(Decl *D);
 
 } // namespace clang
 
diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h
index c9b01dc53964bd..79deda90e9c2c3 100644
--- a/clang/include/clang/AST/DeclarationName.h
+++ b/clang/include/clang/AST/DeclarationName.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/STLExtras.h"
@@ -141,7 +142,7 @@ class alignas(IdentifierInfoAlignment) CXXLiteralOperatorIdName
 /// selectors, which make up 78% percent of all selectors in Cocoa.h),
 /// special C++ names for constructors, destructors, and conversion functions,
 /// and C++ overloaded operators.
-class DeclarationName {
+class CLANG_ABI DeclarationName {
   friend class DeclarationNameTable;
   friend class NamedDecl;
 
@@ -543,7 +544,7 @@ class DeclarationName {
   void dump() const;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, DeclarationName N);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, DeclarationName N);
 
 /// Ordering on two declaration names. If both names are identifiers,
 /// this provides a lexicographical ordering.
@@ -574,7 +575,7 @@ inline bool operator>=(DeclarationName LHS, DeclarationName RHS) {
 /// identifiers, C++ constructor names, etc. This class contains
 /// uniqued versions of each of the C++ special names, which can be
 /// retrieved using its member functions (e.g., getCXXConstructorName).
-class DeclarationNameTable {
+class CLANG_ABI DeclarationNameTable {
   /// Used to allocate elements in the FoldingSets below.
   const ASTContext &Ctx;
 
@@ -657,7 +658,7 @@ class DeclarationNameTable {
 /// DeclarationNameLoc - Additional source/type location info
 /// for a declaration name. Needs a DeclarationName in order
 /// to be interpreted correctly.
-class DeclarationNameLoc {
+class CLANG_ABI DeclarationNameLoc {
   // The source location for identifier stored elsewhere.
   // struct {} Identifier;
 
@@ -765,7 +766,7 @@ class DeclarationNameLoc {
 
 /// DeclarationNameInfo - A collector data type for bundling together
 /// a DeclarationName and the corresponding source/type location info.
-struct DeclarationNameInfo {
+struct CLANG_ABI DeclarationNameInfo {
 private:
   /// Name - The declaration name, also encoding name kind.
   DeclarationName Name;
@@ -892,7 +893,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
   return PD;
 }
 
-raw_ostream &operator<<(raw_ostream &OS, DeclarationNameInfo DNInfo);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, DeclarationNameInfo DNInfo);
 
 } // namespace clang
 
diff --git a/clang/include/clang/AST/DependentDiagnostic.h b/clang/include/clang/AST/DependentDiagnostic.h
index cadf970620041e..f9b1710a755c83 100644
--- a/clang/include/clang/AST/DependentDiagnostic.h
+++ b/clang/include/clang/AST/DependentDiagnostic.h
@@ -23,6 +23,7 @@
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include <cassert>
 #include <iterator>
 
@@ -33,7 +34,7 @@ class CXXRecordDecl;
 class NamedDecl;
 
 /// A dependently-generated diagnostic.
-class DependentDiagnostic {
+class CLANG_ABI DependentDiagnostic {
 public:
   enum AccessNonce { Access = 0 };
 
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index cbe62411d11bff..547250da5a4bec 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -28,6 +28,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SyncScope.h"
 #include "clang/Basic/TypeTraits.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/SmallVector.h"
@@ -107,7 +108,7 @@ struct SubobjectAdjustment {
 /// This represents one expression.  Note that Expr's are subclasses of Stmt.
 /// This allows an expression to be transparently used any place a Stmt is
 /// required.
-class Expr : public ValueStmt {
+class CLANG_ABI Expr : public ValueStmt {
   QualType TR;
 
 public:
@@ -639,7 +640,7 @@ class Expr : public ValueStmt {
   };
 
   /// EvalResult is a struct with detailed info about an evaluated expression.
-  struct EvalResult : EvalStatus {
+  struct CLANG_ABI EvalResult : EvalStatus {
     /// Val - This is the value the expression can be folded to.
     APValue Val;
 
@@ -1072,7 +1073,7 @@ enum class ConstantResultStorageKind { None, Int64, APValue };
 
 /// ConstantExpr - An expression that occurs in a constant context and
 /// optionally the result of evaluating the expression.
-class ConstantExpr final
+class CLANG_ABI ConstantExpr final
     : public FullExpr,
       private llvm::TrailingObjects<ConstantExpr, APValue, uint64_t> {
   static_assert(std::is_same<uint64_t, llvm::APInt::WordType>::value,
@@ -1170,7 +1171,7 @@ class ConstantExpr final
 /// syntax; instead they're used to express operations (usually copy
 /// operations) on values whose source is generally obvious from
 /// context.
-class OpaqueValueExpr : public Expr {
+class CLANG_ABI OpaqueValueExpr : public Expr {
   friend class ASTStmtReader;
   Expr *SourceExpr;
 
@@ -1258,7 +1259,7 @@ class OpaqueValueExpr : public Expr {
 ///   DeclRefExprBits.RefersToEnclosingVariableOrCapture
 ///       Specifies when this declaration reference expression (validly)
 ///       refers to an enclosed local or a captured variable.
-class DeclRefExpr final
+class CLANG_ABI DeclRefExpr final
     : public Expr,
       private llvm::TrailingObjects<DeclRefExpr, NestedNameSpecifierLoc,
                                     NamedDecl *, ASTTemplateKWAndArgsInfo,
@@ -1496,7 +1497,7 @@ class DeclRefExpr final
   }
 };
 
-class IntegerLiteral : public Expr, public APIntStorage {
+class CLANG_ABI IntegerLiteral : public Expr, public APIntStorage {
   SourceLocation Loc;
 
   /// Construct an empty integer literal.
@@ -1539,7 +1540,7 @@ class IntegerLiteral : public Expr, public APIntStorage {
   }
 };
 
-class FixedPointLiteral : public Expr, public APIntStorage {
+class CLANG_ABI FixedPointLiteral : public Expr, public APIntStorage {
   SourceLocation Loc;
   unsigned Scale;
 
@@ -1588,7 +1589,7 @@ class FixedPointLiteral : public Expr, public APIntStorage {
 
 enum class CharacterLiteralKind { Ascii, Wide, UTF8, UTF16, UTF32 };
 
-class CharacterLiteral : public Expr {
+class CLANG_ABI CharacterLiteral : public Expr {
   unsigned Value;
   SourceLocation Loc;
 public:
@@ -1635,7 +1636,7 @@ class CharacterLiteral : public Expr {
   }
 };
 
-class FloatingLiteral : public Expr, private APFloatStorage {
+class CLANG_ABI FloatingLiteral : public Expr, private APFloatStorage {
   SourceLocation Loc;
 
   FloatingLiteral(const ASTContext &C, const llvm::APFloat &V, bool isexact,
@@ -1772,7 +1773,7 @@ enum class StringLiteralKind {
 ///   char X[2] = "foobar";
 /// In this case, getByteLength() will return 6, but the string literal will
 /// have type "char[2]".
-class StringLiteral final
+class CLANG_ABI StringLiteral final
     : public Expr,
       private llvm::TrailingObjects<StringLiteral, unsigned, SourceLocation,
                                     char> {
@@ -1986,7 +1987,7 @@ enum class PredefinedIdentKind {
 };
 
 /// [C99 6.4.2.2] - A predefined identifier such as __func__.
-class PredefinedExpr final
+class CLANG_ABI PredefinedExpr final
     : public Expr,
       private llvm::TrailingObjects<PredefinedExpr, Stmt *> {
   friend class ASTStmtReader;
@@ -2075,7 +2076,7 @@ class PredefinedExpr final
 /// This expression type represents an asterisk in an OpenACC Size-Expr, used in
 /// the 'tile' and 'gang' clauses. It is of 'int' type, but should not be
 /// evaluated.
-class OpenACCAsteriskSizeExpr final : public Expr {
+class CLANG_ABI OpenACCAsteriskSizeExpr final : public Expr {
   friend class ASTStmtReader;
   SourceLocation AsteriskLoc;
 
@@ -2111,7 +2112,7 @@ class OpenACCAsteriskSizeExpr final : public Expr {
 // type-id, and at CodeGen time emits a unique string representation of the
 // type in a way that permits us to properly encode information about the SYCL
 // kernels.
-class SYCLUniqueStableNameExpr final : public Expr {
+class CLANG_ABI SYCLUniqueStableNameExpr final : public Expr {
   friend class ASTStmtReader;
   SourceLocation OpLoc, LParen, RParen;
   TypeSourceInfo *TypeInfo;
@@ -2227,7 +2228,7 @@ class ParenExpr : public Expr {
 ///   applied to a non-complex value, the former returns its operand and the
 ///   later returns zero in the type of the operand.
 ///
-class UnaryOperator final
+class CLANG_ABI UnaryOperator final
     : public Expr,
       private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride> {
   Stmt *Val;
@@ -2410,7 +2411,7 @@ class UnaryOperator final
 /// Helper class for OffsetOfExpr.
 
 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
-class OffsetOfNode {
+class CLANG_ABI OffsetOfNode {
 public:
   /// The kind of offsetof node we have.
   enum Kind {
@@ -2514,7 +2515,7 @@ class OffsetOfNode {
 /// @endcode
 /// we can represent and evaluate the expression @c offsetof(struct T, s[2].d).
 
-class OffsetOfExpr final
+class CLANG_ABI OffsetOfExpr final
     : public Expr,
       private llvm::TrailingObjects<OffsetOfExpr, OffsetOfNode, Expr *> {
   SourceLocation OperatorLoc, RParenLoc;
@@ -2619,7 +2620,7 @@ class OffsetOfExpr final
 /// UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated)
 /// expression operand.  Used for sizeof/alignof (C99 6.5.3.4) and
 /// vec_step (OpenCL 1.1 6.11.12).
-class UnaryExprOrTypeTraitExpr : public Expr {
+class CLANG_ABI UnaryExprOrTypeTraitExpr : public Expr {
   union {
     TypeSourceInfo *Ty;
     Stmt *Ex;
@@ -2871,7 +2872,7 @@ class MatrixSubscriptExpr : public Expr {
 /// results in a function call. For example, CXXOperatorCallExpr is
 /// a subclass for overloaded operator calls that use operator syntax, e.g.,
 /// "str1 + str2" to resolve to a function call.
-class CallExpr : public Expr {
+class CLANG_ABI CallExpr : public Expr {
   enum { FN = 0, PREARGS_START = 1 };
 
   /// The number of arguments in the call expression.
@@ -3227,7 +3228,7 @@ class CallExpr : public Expr {
 
 /// MemberExpr - [C99 6.5.2.3] Structure and Union Members.  X->F and X.F.
 ///
-class MemberExpr final
+class CLANG_ABI MemberExpr final
     : public Expr,
       private llvm::TrailingObjects<MemberExpr, NestedNameSpecifierLoc,
                                     DeclAccessPair, ASTTemplateKWAndArgsInfo,
@@ -3542,7 +3543,7 @@ class CompoundLiteralExpr : public Expr {
 /// casts (ImplicitCastExpr) and explicit casts that have some
 /// representation in the source code (ExplicitCastExpr's derived
 /// classes).
-class CastExpr : public Expr {
+class CLANG_ABI CastExpr : public Expr {
   Stmt *Op;
 
   bool CastConsistency() const;
@@ -3716,7 +3717,7 @@ class CastExpr : public Expr {
 ///                     // to an xvalue of type Base
 /// }
 /// @endcode
-class ImplicitCastExpr final
+class CLANG_ABI ImplicitCastExpr final
     : public CastExpr,
       private llvm::TrailingObjects<ImplicitCastExpr, CXXBaseSpecifier *,
                                     FPOptionsOverride> {
@@ -3832,7 +3833,7 @@ class ExplicitCastExpr : public CastExpr {
 /// CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style
 /// cast in C++ (C++ [expr.cast]), which uses the syntax
 /// (Type)expr. For example: @c (int)f.
-class CStyleCastExpr final
+class CLANG_ABI CStyleCastExpr final
     : public ExplicitCastExpr,
       private llvm::TrailingObjects<CStyleCastExpr, CXXBaseSpecifier *,
                                     FPOptionsOverride> {
@@ -3904,7 +3905,7 @@ class CStyleCastExpr final
 /// value-dependent). If either x or y is type-dependent, or if the
 /// "+" resolves to an overloaded operator, CXXOperatorCallExpr will
 /// be used to express the computation.
-class BinaryOperator : public Expr {
+class CLANG_ABI BinaryOperator : public Expr {
   enum { LHS, RHS, END_EXPR };
   Stmt *SubExprs[END_EXPR];
 
@@ -4166,7 +4167,7 @@ class BinaryOperator : public Expr {
 /// implicit conversion back to the result type done, then the assignment takes
 /// place.  This captures the intermediate type which the computation is done
 /// in.
-class CompoundAssignOperator : public BinaryOperator {
+class CLANG_ABI CompoundAssignOperator : public BinaryOperator {
   QualType ComputationLHSType;
   QualType ComputationResultType;
 
@@ -4509,7 +4510,7 @@ class StmtExpr : public Expr {
 /// shuffle, similar to LLVM's shufflevector instruction. It takes
 /// two vectors and a variable number of constant indices,
 /// and returns the appropriately shuffled vector.
-class ShuffleVectorExpr : public Expr {
+class CLANG_ABI ShuffleVectorExpr : public Expr {
   SourceLocation BuiltinLoc, RParenLoc;
 
   // SubExprs - the list of values passed to the __builtin_shufflevector
@@ -4805,7 +4806,7 @@ enum class SourceLocIdentKind {
 /// Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(),
 /// __builtin_FUNCTION(), __builtin_FUNCSIG(), __builtin_FILE(),
 /// __builtin_FILE_NAME() or __builtin_source_location().
-class SourceLocExpr final : public Expr {
+class CLANG_ABI SourceLocExpr final : public Expr {
   SourceLocation BuiltinLoc, RParenLoc;
   DeclContext *ParentContext;
 
@@ -4911,7 +4912,7 @@ struct EmbedDataStorage {
 ///
 /// EmbedExpr inside of a semantic initializer list and referencing more than
 /// one element can only appear for arrays of scalars.
-class EmbedExpr final : public Expr {
+class CLANG_ABI EmbedExpr final : public Expr {
   SourceLocation EmbedKeywordLoc;
   IntegerLiteral *FakeChildNode = nullptr;
   const ASTContext *Ctx = nullptr;
@@ -5083,7 +5084,7 @@ class EmbedExpr final : public Expr {
 /// Since many initializer lists have the same syntactic and semantic forms,
 /// getSyntacticForm() may return NULL, indicating that the current
 /// semantic initializer list also serves as its syntactic form.
-class InitListExpr : public Expr {
+class CLANG_ABI InitListExpr : public Expr {
   // FIXME: Eliminate this vector in favor of ASTContext allocation
   typedef ASTVector<Stmt *> InitExprsTy;
   InitExprsTy InitExprs;
@@ -5326,7 +5327,7 @@ class InitListExpr : public Expr {
 /// which covers @c [2].y=1.0. This DesignatedInitExpr will have two
 /// designators, one array designator for @c [2] followed by one field
 /// designator for @c .y. The initialization expression will be 1.0.
-class DesignatedInitExpr final
+class CLANG_ABI DesignatedInitExpr final
     : public Expr,
       private llvm::TrailingObjects<DesignatedInitExpr, Stmt *> {
 public:
@@ -5371,7 +5372,7 @@ class DesignatedInitExpr final
   /// but minor differences (storing indices vs. storing pointers)
   /// keep us from reusing it. Try harder, later, to rectify these
   /// differences.
-  class Designator {
+  class CLANG_ABI Designator {
     /// A field designator, e.g., ".x".
     struct FieldDesignatorInfo {
       /// Refers to the field that is being initialized. The low bit
@@ -5693,7 +5694,7 @@ class NoInitExpr : public Expr {
 // DesignatedInitUpdateExpr for "a.q" with type Q. The "base" for this DIUE
 // is the call expression *getQ(); the "updater" for the DIUE is ".q.b = 3"
 //
-class DesignatedInitUpdateExpr : public Expr {
+class CLANG_ABI DesignatedInitUpdateExpr : public Expr {
   // BaseAndUpdaterExprs[0] is the base expression;
   // BaseAndUpdaterExprs[1] is an InitListExpr overwriting part of the base.
   Stmt *BaseAndUpdaterExprs[2];
@@ -5863,7 +5864,7 @@ class ImplicitValueInitExpr : public Expr {
   }
 };
 
-class ParenListExpr final
+class CLANG_ABI ParenListExpr final
     : public Expr,
       private llvm::TrailingObjects<ParenListExpr, Stmt *> {
   friend class ASTStmtReader;
@@ -5958,7 +5959,7 @@ class ParenListExpr final
 /// This type argument form does not perform any conversions for the
 /// controlling type, which makes it suitable for use with qualified type
 /// associations, which is not possible with the expression form.
-class GenericSelectionExpr final
+class CLANG_ABI GenericSelectionExpr final
     : public Expr,
       private llvm::TrailingObjects<GenericSelectionExpr, Stmt *,
                                     TypeSourceInfo *> {
@@ -6349,7 +6350,7 @@ class GenericSelectionExpr final
 /// Note that the base may have either vector or pointer to vector type, just
 /// like a struct field reference.
 ///
-class ExtVectorElementExpr : public Expr {
+class CLANG_ABI ExtVectorElementExpr : public Expr {
   Stmt *Base;
   IdentifierInfo *Accessor;
   SourceLocation AccessorLoc;
@@ -6409,7 +6410,7 @@ class ExtVectorElementExpr : public Expr {
 
 /// BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
 /// ^{ statement-body }   or   ^(int arg1, float arg2){ statement-body }
-class BlockExpr : public Expr {
+class CLANG_ABI BlockExpr : public Expr {
 protected:
   BlockDecl *TheBlock;
 public:
@@ -6539,7 +6540,7 @@ class AsTypeExpr : public Expr {
 /// equivalent to a particular message send, and this is very much
 /// part of the user model.  The name of this class encourages this
 /// modelling design.
-class PseudoObjectExpr final
+class CLANG_ABI PseudoObjectExpr final
     : public Expr,
       private llvm::TrailingObjects<PseudoObjectExpr, Expr *> {
   // PseudoObjectExprBits.NumSubExprs - The number of sub-expressions.
@@ -6673,7 +6674,7 @@ class PseudoObjectExpr final
 /// All of these instructions take one primary pointer, at least one memory
 /// order. The instructions for which getScopeModel returns non-null value
 /// take one synch scope.
-class AtomicExpr : public Expr {
+class CLANG_ABI AtomicExpr : public Expr {
 public:
   enum AtomicOp {
 #define BUILTIN(ID, TYPE, ATTRS)
@@ -6970,7 +6971,7 @@ class TypoExpr : public Expr {
 /// on a data construct, the same value is used when copying data at the end of
 /// the data region, even if the values of variables in the expression change
 /// during the data region.
-class ArraySectionExpr : public Expr {
+class CLANG_ABI ArraySectionExpr : public Expr {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -7136,7 +7137,7 @@ class ArraySectionExpr : public Expr {
 ///    sequence from the source lvalue to the argument type.
 ///  - An expression that assigns the second expression into the first,
 ///    performing any necessary conversions.
-class HLSLOutArgExpr : public Expr {
+class CLANG_ABI HLSLOutArgExpr : public Expr {
   friend class ASTStmtReader;
 
   enum {
@@ -7241,7 +7242,7 @@ class HLSLOutArgExpr : public Expr {
 ///
 /// One can also reliably suppress all bogus errors on expressions containing
 /// recovery expressions by examining results of Expr::containsErrors().
-class RecoveryExpr final : public Expr,
+class CLANG_ABI RecoveryExpr final : public Expr,
                            private llvm::TrailingObjects<RecoveryExpr, Expr *> {
 public:
   static RecoveryExpr *Create(ASTContext &Ctx, QualType T,
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 975bcdac5069b9..f08bc61830a3b7 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -39,6 +39,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TypeTraits.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
@@ -78,7 +79,7 @@ class TemplateParameterList;
 /// function itself will be a (possibly empty) set of functions and
 /// function templates that were found by name lookup at template
 /// definition time.
-class CXXOperatorCallExpr final : public CallExpr {
+class CLANG_ABI CXXOperatorCallExpr final : public CallExpr {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -173,7 +174,7 @@ class CXXOperatorCallExpr final : public CallExpr {
 /// both the object argument and the member function, while the
 /// arguments are the arguments within the parentheses (not including
 /// the object argument).
-class CXXMemberCallExpr final : public CallExpr {
+class CLANG_ABI CXXMemberCallExpr final : public CallExpr {
   // CXXMemberCallExpr has some trailing objects belonging
   // to CallExpr. See CallExpr for the details.
 
@@ -228,7 +229,7 @@ class CXXMemberCallExpr final : public CallExpr {
 };
 
 /// Represents a call to a CUDA kernel function.
-class CUDAKernelCallExpr final : public CallExpr {
+class CLANG_ABI CUDAKernelCallExpr final : public CallExpr {
   friend class ASTStmtReader;
 
   enum { CONFIG, END_PREARG };
@@ -280,7 +281,7 @@ class CUDAKernelCallExpr final : public CallExpr {
 ///
 /// Note that the rewritten calls to \c ==, \c <=>, and \c \@ are typically
 /// \c CXXOperatorCallExprs, but could theoretically be \c BinaryOperators.
-class CXXRewrittenBinaryOperator : public Expr {
+class CLANG_ABI CXXRewrittenBinaryOperator : public Expr {
   friend class ASTStmtReader;
 
   /// The rewritten semantic form.
@@ -369,7 +370,7 @@ class CXXRewrittenBinaryOperator : public Expr {
 /// CXXDynamicCastExpr for \c dynamic_cast, CXXReinterpretCastExpr for
 /// reinterpret_cast, CXXConstCastExpr for \c const_cast and
 /// CXXAddrspaceCastExpr for addrspace_cast (in OpenCL).
-class CXXNamedCastExpr : public ExplicitCastExpr {
+class CLANG_ABI CXXNamedCastExpr : public ExplicitCastExpr {
 private:
   // the location of the casting op
   SourceLocation Loc;
@@ -427,7 +428,7 @@ class CXXNamedCastExpr : public ExplicitCastExpr {
 ///
 /// This expression node represents a C++ static cast, e.g.,
 /// \c static_cast<int>(1.0).
-class CXXStaticCastExpr final
+class CLANG_ABI CXXStaticCastExpr final
     : public CXXNamedCastExpr,
       private llvm::TrailingObjects<CXXStaticCastExpr, CXXBaseSpecifier *,
                                     FPOptionsOverride> {
@@ -473,7 +474,7 @@ class CXXStaticCastExpr final
 /// This expression node represents a dynamic cast, e.g.,
 /// \c dynamic_cast<Derived*>(BasePtr). Such a cast may perform a run-time
 /// check to determine how to perform the type conversion.
-class CXXDynamicCastExpr final
+class CLANG_ABI CXXDynamicCastExpr final
     : public CXXNamedCastExpr,
       private llvm::TrailingObjects<CXXDynamicCastExpr, CXXBaseSpecifier *> {
   CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind, Expr *op,
@@ -517,7 +518,7 @@ class CXXDynamicCastExpr final
 /// A reinterpret_cast provides a differently-typed view of a value but
 /// (in Clang, as in most C++ implementations) performs no actual work at
 /// run time.
-class CXXReinterpretCastExpr final
+class CLANG_ABI CXXReinterpretCastExpr final
     : public CXXNamedCastExpr,
       private llvm::TrailingObjects<CXXReinterpretCastExpr,
                                     CXXBaseSpecifier *> {
@@ -558,7 +559,7 @@ class CXXReinterpretCastExpr final
 ///
 /// A const_cast can remove type qualifiers but does not change the underlying
 /// value.
-class CXXConstCastExpr final
+class CLANG_ABI CXXConstCastExpr final
     : public CXXNamedCastExpr,
       private llvm::TrailingObjects<CXXConstCastExpr, CXXBaseSpecifier *> {
   CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op,
@@ -596,7 +597,7 @@ class CXXConstCastExpr final
 ///
 /// A addrspace_cast can cast address space type qualifiers but does not change
 /// the underlying value.
-class CXXAddrspaceCastExpr final
+class CLANG_ABI CXXAddrspaceCastExpr final
     : public CXXNamedCastExpr,
       private llvm::TrailingObjects<CXXAddrspaceCastExpr, CXXBaseSpecifier *> {
   CXXAddrspaceCastExpr(QualType ty, ExprValueKind VK, CastKind Kind, Expr *op,
@@ -634,7 +635,7 @@ class CXXAddrspaceCastExpr final
 ///
 /// Since literal operators are never found by ADL and can only be declared at
 /// namespace scope, a user-defined literal is never dependent.
-class UserDefinedLiteral final : public CallExpr {
+class CLANG_ABI UserDefinedLiteral final : public CallExpr {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -842,7 +843,7 @@ class CXXStdInitializerListExpr : public Expr {
 /// dynamic) type of the supplied expression.
 ///
 /// This represents code like \c typeid(int) or \c typeid(*objPtr)
-class CXXTypeidExpr : public Expr {
+class CLANG_ABI CXXTypeidExpr : public Expr {
   friend class ASTStmtReader;
 
 private:
@@ -1063,7 +1064,7 @@ class MSPropertySubscriptExpr : public Expr {
 /// the _GUID that corresponds to the supplied type or expression.
 ///
 /// This represents code like @c __uuidof(COMTYPE) or @c __uuidof(*comPtr)
-class CXXUuidofExpr : public Expr {
+class CLANG_ABI CXXUuidofExpr : public Expr {
   friend class ASTStmtReader;
 
 private:
@@ -1149,7 +1150,7 @@ class CXXUuidofExpr : public Expr {
 ///   void test() { this->bar(); }
 /// };
 /// \endcode
-class CXXThisExpr : public Expr {
+class CLANG_ABI CXXThisExpr : public Expr {
   CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit, ExprValueKind VK)
       : Expr(CXXThisExprClass, Ty, VK, OK_Ordinary) {
     CXXThisExprBits.IsImplicit = IsImplicit;
@@ -1263,7 +1264,7 @@ class CXXThrowExpr : public Expr {
 /// This wraps up a function call argument that was created from the
 /// corresponding parameter's default argument, when the call did not
 /// explicitly supply arguments for all of the parameters.
-class CXXDefaultArgExpr final
+class CLANG_ABI CXXDefaultArgExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXDefaultArgExpr, Expr *> {
   friend class ASTStmtReader;
@@ -1370,7 +1371,7 @@ class CXXDefaultArgExpr final
 /// is implicitly used in a mem-initializer-list in a constructor
 /// (C++11 [class.base.init]p8) or in aggregate initialization
 /// (C++1y [dcl.init.aggr]p7).
-class CXXDefaultInitExpr final
+class CLANG_ABI CXXDefaultInitExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXDefaultInitExpr, Expr *> {
 
@@ -1454,7 +1455,7 @@ class CXXDefaultInitExpr final
 };
 
 /// Represents a C++ temporary.
-class CXXTemporary {
+class CLANG_ABI CXXTemporary {
   /// The destructor that needs to be called.
   const CXXDestructorDecl *Destructor;
 
@@ -1488,7 +1489,7 @@ class CXXTemporary {
 /// \endcode
 ///
 /// Destructor might be null if destructor declaration is not valid.
-class CXXBindTemporaryExpr : public Expr {
+class CLANG_ABI CXXBindTemporaryExpr : public Expr {
   CXXTemporary *Temp = nullptr;
   Stmt *SubExpr = nullptr;
 
@@ -1543,7 +1544,7 @@ enum class CXXConstructionKind {
 };
 
 /// Represents a call to a C++ constructor.
-class CXXConstructExpr : public Expr {
+class CLANG_ABI CXXConstructExpr : public Expr {
   friend class ASTStmtReader;
 
   /// A pointer to the constructor which will be ultimately called.
@@ -1811,7 +1812,7 @@ class CXXInheritedCtorInitExpr : public Expr {
 /// \code
 ///   x = int(0.5);
 /// \endcode
-class CXXFunctionalCastExpr final
+class CLANG_ABI CXXFunctionalCastExpr final
     : public ExplicitCastExpr,
       private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *,
                                     FPOptionsOverride> {
@@ -1882,7 +1883,7 @@ class CXXFunctionalCastExpr final
 ///   return X(1, 3.14f); // creates a CXXTemporaryObjectExpr
 /// };
 /// \endcode
-class CXXTemporaryObjectExpr final : public CXXConstructExpr {
+class CLANG_ABI CXXTemporaryObjectExpr final : public CXXConstructExpr {
   friend class ASTStmtReader;
 
   // CXXTemporaryObjectExpr has some trailing objects belonging
@@ -1950,7 +1951,7 @@ Stmt **CXXConstructExpr::getTrailingArgs() {
 /// C++1y introduces a new form of "capture" called an init-capture that
 /// includes an initializing expression (rather than capturing a variable),
 /// and which can never occur implicitly.
-class LambdaExpr final : public Expr,
+class CLANG_ABI LambdaExpr final : public Expr,
                          private llvm::TrailingObjects<LambdaExpr, Stmt *> {
   // LambdaExpr has some data stored in LambdaExprBits.
 
@@ -2179,7 +2180,7 @@ class LambdaExpr final : public Expr,
 /// An expression "T()" which creates an rvalue of a non-class type T.
 /// For non-void T, the rvalue is value-initialized.
 /// See (C++98 [5.2.3p2]).
-class CXXScalarValueInitExpr : public Expr {
+class CLANG_ABI CXXScalarValueInitExpr : public Expr {
   friend class ASTStmtReader;
 
   TypeSourceInfo *TypeInfo;
@@ -2236,7 +2237,7 @@ enum class CXXNewInitializationStyle {
 
 /// Represents a new-expression for memory allocation and constructor
 /// calls, e.g: "new CXXNewExpr(foo)".
-class CXXNewExpr final
+class CLANG_ABI CXXNewExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXNewExpr, Stmt *, SourceRange> {
   friend class ASTStmtReader;
@@ -2495,7 +2496,7 @@ class CXXNewExpr final
 
 /// Represents a \c delete expression for memory deallocation and
 /// destructor calls, e.g. "delete[] pArray".
-class CXXDeleteExpr : public Expr {
+class CLANG_ABI CXXDeleteExpr : public Expr {
   friend class ASTStmtReader;
 
   /// Points to the operator delete overload that is used. Could be a member.
@@ -2563,7 +2564,7 @@ class CXXDeleteExpr : public Expr {
 };
 
 /// Stores the type being destroyed by a pseudo-destructor expression.
-class PseudoDestructorTypeStorage {
+class CLANG_ABI PseudoDestructorTypeStorage {
   /// Either the type source information or the name of the type, if
   /// it couldn't be resolved due to type-dependence.
   llvm::PointerUnion<TypeSourceInfo *, const IdentifierInfo *> Type;
@@ -2614,7 +2615,7 @@ class PseudoDestructorTypeStorage {
 ///
 /// for scalar types. A pseudo-destructor expression has no run-time semantics
 /// beyond evaluating the base expression.
-class CXXPseudoDestructorExpr : public Expr {
+class CLANG_ABI CXXPseudoDestructorExpr : public Expr {
   friend class ASTStmtReader;
 
   /// The base expression (that is being destroyed).
@@ -2763,7 +2764,7 @@ class CXXPseudoDestructorExpr : public Expr {
 ///   __is_enum(std::string) == false
 ///   __is_trivially_constructible(vector<int>, int*, int*)
 /// \endcode
-class TypeTraitExpr final
+class CLANG_ABI TypeTraitExpr final
     : public Expr,
       private llvm::TrailingObjects<TypeTraitExpr, TypeSourceInfo *> {
   /// The location of the type trait keyword.
@@ -2980,7 +2981,7 @@ class ExpressionTraitExpr : public Expr {
 
 /// A reference to an overloaded function set, either an
 /// \c UnresolvedLookupExpr or an \c UnresolvedMemberExpr.
-class OverloadExpr : public Expr {
+class CLANG_ABI OverloadExpr : public Expr {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -3196,7 +3197,7 @@ class OverloadExpr : public Expr {
 ///
 /// These never include UnresolvedUsingValueDecls, which are always class
 /// members and therefore appear only in UnresolvedMemberLookupExprs.
-class UnresolvedLookupExpr final
+class CLANG_ABI UnresolvedLookupExpr final
     : public OverloadExpr,
       private llvm::TrailingObjects<UnresolvedLookupExpr, DeclAccessPair,
                                     ASTTemplateKWAndArgsInfo,
@@ -3316,7 +3317,7 @@ class UnresolvedLookupExpr final
 /// qualifier (X<T>::) and the name of the entity being referenced
 /// ("value"). Such expressions will instantiate to a DeclRefExpr once the
 /// declaration can be found.
-class DependentScopeDeclRefExpr final
+class CLANG_ABI DependentScopeDeclRefExpr final
     : public Expr,
       private llvm::TrailingObjects<DependentScopeDeclRefExpr,
                                     ASTTemplateKWAndArgsInfo,
@@ -3467,7 +3468,7 @@ class DependentScopeDeclRefExpr final
 /// This expression also tracks whether the sub-expression contains a
 /// potentially-evaluated block literal.  The lifetime of a block
 /// literal is the extent of the enclosing scope.
-class ExprWithCleanups final
+class CLANG_ABI ExprWithCleanups final
     : public FullExpr,
       private llvm::TrailingObjects<
           ExprWithCleanups,
@@ -3552,7 +3553,7 @@ class ExprWithCleanups final
 /// When the returned expression is instantiated, it may resolve to a
 /// constructor call, conversion function call, or some kind of type
 /// conversion.
-class CXXUnresolvedConstructExpr final
+class CLANG_ABI CXXUnresolvedConstructExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXUnresolvedConstructExpr, Expr *> {
   friend class ASTStmtReader;
@@ -3676,7 +3677,7 @@ class CXXUnresolvedConstructExpr final
 /// Like UnresolvedMemberExprs, these can be either implicit or
 /// explicit accesses.  It is only possible to get one of these with
 /// an implicit access if a qualifier is provided.
-class CXXDependentScopeMemberExpr final
+class CLANG_ABI CXXDependentScopeMemberExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXDependentScopeMemberExpr,
                                     ASTTemplateKWAndArgsInfo,
@@ -3936,7 +3937,7 @@ class CXXDependentScopeMemberExpr final
 /// In the final AST, an explicit access always becomes a MemberExpr.
 /// An implicit access may become either a MemberExpr or a
 /// DeclRefExpr, depending on whether the member is static.
-class UnresolvedMemberExpr final
+class CLANG_ABI UnresolvedMemberExpr final
     : public OverloadExpr,
       private llvm::TrailingObjects<UnresolvedMemberExpr, DeclAccessPair,
                                     ASTTemplateKWAndArgsInfo,
@@ -4253,7 +4254,7 @@ class PackExpansionExpr : public Expr {
 ///   static const unsigned value = sizeof...(Types);
 /// };
 /// \endcode
-class SizeOfPackExpr final
+class CLANG_ABI SizeOfPackExpr final
     : public Expr,
       private llvm::TrailingObjects<SizeOfPackExpr, TemplateArgument> {
   friend class ASTStmtReader;
@@ -4369,7 +4370,7 @@ class SizeOfPackExpr final
   }
 };
 
-class PackIndexingExpr final
+class CLANG_ABI PackIndexingExpr final
     : public Expr,
       private llvm::TrailingObjects<PackIndexingExpr, Expr *> {
   friend class ASTStmtReader;
@@ -4481,7 +4482,7 @@ class PackIndexingExpr final
 
 /// Represents a reference to a non-type template parameter
 /// that has been substituted with a template argument.
-class SubstNonTypeTemplateParmExpr : public Expr {
+class CLANG_ABI SubstNonTypeTemplateParmExpr : public Expr {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -4566,7 +4567,7 @@ class SubstNonTypeTemplateParmExpr : public Expr {
 /// that pack expansion (e.g., when all template parameters have corresponding
 /// arguments), this type will be replaced with the appropriate underlying
 /// expression at the current pack substitution index.
-class SubstNonTypeTemplateParmPackExpr : public Expr {
+class CLANG_ABI SubstNonTypeTemplateParmPackExpr : public Expr {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -4643,7 +4644,7 @@ class SubstNonTypeTemplateParmPackExpr : public Expr {
 /// };
 /// template struct S<int, int>;
 /// \endcode
-class FunctionParmPackExpr final
+class CLANG_ABI FunctionParmPackExpr final
     : public Expr,
       private llvm::TrailingObjects<FunctionParmPackExpr, VarDecl *> {
   friend class ASTReader;
@@ -4725,7 +4726,7 @@ class FunctionParmPackExpr final
 /// Reference binding and copy-elision can both extend the lifetime of a
 /// temporary. When either happens, the expression will also track the
 /// declaration which is responsible for the lifetime extension.
-class MaterializeTemporaryExpr : public Expr {
+class CLANG_ABI MaterializeTemporaryExpr : public Expr {
 private:
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
@@ -4837,7 +4838,7 @@ class MaterializeTemporaryExpr : public Expr {
 ///    ( expr op ... )
 ///    ( ... op expr )
 ///    ( expr op ... op expr )
-class CXXFoldExpr : public Expr {
+class CLANG_ABI CXXFoldExpr : public Expr {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -4949,7 +4950,7 @@ class CXXFoldExpr : public Expr {
 ///   A b{1.5}; // Ill-formed !
 /// }
 /// ```
-class CXXParenListInitExpr final
+class CLANG_ABI CXXParenListInitExpr final
     : public Expr,
       private llvm::TrailingObjects<CXXParenListInitExpr, Expr *> {
   friend class TrailingObjects;
diff --git a/clang/include/clang/AST/ExprConcepts.h b/clang/include/clang/AST/ExprConcepts.h
index 29913fd84c58b4..77317f5c48f162 100644
--- a/clang/include/clang/AST/ExprConcepts.h
+++ b/clang/include/clang/AST/ExprConcepts.h
@@ -24,6 +24,7 @@
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TrailingObjects.h"
@@ -39,7 +40,7 @@ class ASTStmtWriter;
 ///
 /// According to C++2a [expr.prim.id]p3 an id-expression that denotes the
 /// specialization of a concept results in a prvalue of type bool.
-class ConceptSpecializationExpr final : public Expr {
+class CLANG_ABI ConceptSpecializationExpr final : public Expr {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -222,7 +223,7 @@ class Requirement {
 
 /// \brief A requires-expression requirement which queries the existence of a
 /// type name or type template specialization ('type' requirements).
-class TypeRequirement : public Requirement {
+class CLANG_ABI TypeRequirement : public Requirement {
 public:
   enum SatisfactionStatus {
       SS_Dependent,
@@ -277,7 +278,7 @@ class TypeRequirement : public Requirement {
 
 /// \brief A requires-expression requirement which queries the validity and
 /// properties of an expression ('simple' and 'compound' requirements).
-class ExprRequirement : public Requirement {
+class CLANG_ABI ExprRequirement : public Requirement {
 public:
   enum SatisfactionStatus {
       SS_Dependent,
@@ -287,7 +288,7 @@ class ExprRequirement : public Requirement {
       SS_ConstraintsNotSatisfied,
       SS_Satisfied
   };
-  class ReturnTypeRequirement {
+  class CLANG_ABI ReturnTypeRequirement {
       llvm::PointerIntPair<
           llvm::PointerUnion<TemplateParameterList *, SubstitutionDiagnostic *>,
           1, bool>
@@ -494,7 +495,7 @@ using EntityPrinter = llvm::function_ref<void(llvm::raw_ostream &)>;
 
 /// \brief create a Requirement::SubstitutionDiagnostic with only a
 /// SubstitutedEntity and DiagLoc using Sema's allocator.
-Requirement::SubstitutionDiagnostic *
+CLANG_ABI Requirement::SubstitutionDiagnostic *
 createSubstDiagAt(Sema &S, SourceLocation Location, EntityPrinter Printer);
 
 } // namespace concepts
@@ -505,7 +506,7 @@ createSubstDiagAt(Sema &S, SourceLocation Location, EntityPrinter Printer);
 ///     lookup (6.4) or by checking properties of types and expressions.
 ///     [...]
 ///     A requires-expression is a prvalue of type bool [...]
-class RequiresExpr final : public Expr,
+class CLANG_ABI RequiresExpr final : public Expr,
     llvm::TrailingObjects<RequiresExpr, ParmVarDecl *,
                           concepts::Requirement *> {
   friend TrailingObjects;
diff --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index f833916c91aa54..ed06b9267773a4 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -26,6 +26,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -186,7 +187,7 @@ class ObjCBoxedExpr : public Expr {
 
 /// ObjCArrayLiteral - used for objective-c array containers; as in:
 /// @[@"Hello", NSApp, [NSNumber numberWithInt:42]];
-class ObjCArrayLiteral final
+class CLANG_ABI ObjCArrayLiteral final
     : public Expr,
       private llvm::TrailingObjects<ObjCArrayLiteral, Expr *> {
   unsigned NumElements;
@@ -302,7 +303,7 @@ struct ObjCDictionaryLiteral_ExpansionData {
 
 /// ObjCDictionaryLiteral - AST node to represent objective-c dictionary
 /// literals; as in:  @{@"name" : NSUserName(), @"date" : [NSDate date] };
-class ObjCDictionaryLiteral final
+class CLANG_ABI ObjCDictionaryLiteral final
     : public Expr,
       private llvm::TrailingObjects<ObjCDictionaryLiteral,
                                     ObjCDictionaryLiteral_KeyValuePair,
@@ -614,7 +615,7 @@ class ObjCIvarRefExpr : public Expr {
 
 /// ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC
 /// property.
-class ObjCPropertyRefExpr : public Expr {
+class CLANG_ABI ObjCPropertyRefExpr : public Expr {
 private:
   /// If the bool is true, this is an implicit property reference; the
   /// pointer is an (optional) ObjCMethodDecl and Setter may be set.
@@ -940,7 +941,7 @@ class ObjCSubscriptRefExpr : public Expr {
 /// The "void *" trailing objects are actually ONE void * (the
 /// receiver pointer), and NumArgs Expr *. But due to the
 /// implementation of children(), these must be together contiguously.
-class ObjCMessageExpr final
+class CLANG_ABI ObjCMessageExpr final
     : public Expr,
       private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> {
 public:
@@ -1631,7 +1632,7 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
 /// \code
 /// NSString *str = (__bridge_transfer NSString *)CFCreateString();
 /// \endcode
-class ObjCBridgedCastExpr final
+class CLANG_ABI ObjCBridgedCastExpr final
     : public ExplicitCastExpr,
       private llvm::TrailingObjects<ObjCBridgedCastExpr, CXXBaseSpecifier *> {
   friend class ASTStmtReader;
diff --git a/clang/include/clang/AST/ExprOpenMP.h b/clang/include/clang/AST/ExprOpenMP.h
index 54a0c203f656c3..9b4024bacd92ee 100644
--- a/clang/include/clang/AST/ExprOpenMP.h
+++ b/clang/include/clang/AST/ExprOpenMP.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ComputeDependence.h"
 #include "clang/AST/Expr.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 /// An explicit cast in C or a C-style cast in C++, which uses the syntax
 /// ([s1][s2]...[sn])expr. For example: @c ([3][3])f.
-class OMPArrayShapingExpr final
+class CLANG_ABI OMPArrayShapingExpr final
     : public Expr,
       private llvm::TrailingObjects<OMPArrayShapingExpr, Expr *, SourceRange> {
   friend TrailingObjects;
@@ -145,7 +146,7 @@ struct OMPIteratorHelperData {
 /// type of that iterator is of int type.
 /// The iterator-type must be an integral or pointer type.
 /// The iterator-type must not be const qualified.
-class OMPIteratorExpr final
+class CLANG_ABI OMPIteratorExpr final
     : public Expr,
       private llvm::TrailingObjects<OMPIteratorExpr, Decl *, Expr *,
                                     SourceLocation, OMPIteratorHelperData> {
diff --git a/clang/include/clang/AST/ExternalASTMerger.h b/clang/include/clang/AST/ExternalASTMerger.h
index ec4cfbe2175c02..fec336b1d242c6 100644
--- a/clang/include/clang/AST/ExternalASTMerger.h
+++ b/clang/include/clang/AST/ExternalASTMerger.h
@@ -16,6 +16,7 @@
 #include "clang/AST/ASTImporter.h"
 #include "clang/AST/ASTImporterSharedState.h"
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -45,7 +46,7 @@ namespace clang {
 /// ExternalASTMerger's job is to maintain the data structures necessary to
 /// allow this.  The data structures themselves can be extracted (read-only) and
 /// copied for re-use.
-class ExternalASTMerger : public ExternalASTSource {
+class CLANG_ABI ExternalASTMerger : public ExternalASTSource {
 public:
   /// A single origin for a DeclContext.  Unlike Decls, DeclContexts do
   /// not allow their containing ASTContext to be determined in all cases.
diff --git a/clang/include/clang/AST/ExternalASTSource.h b/clang/include/clang/AST/ExternalASTSource.h
index 385c32edbae0fd..e722ce6c6bfce5 100644
--- a/clang/include/clang/AST/ExternalASTSource.h
+++ b/clang/include/clang/AST/ExternalASTSource.h
@@ -17,6 +17,7 @@
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -57,7 +58,7 @@ class TagDecl;
 /// sources can resolve types and declarations from abstract IDs into
 /// actual type and declaration nodes, and read parts of declaration
 /// contexts.
-class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
+class CLANG_ABI ExternalASTSource : public RefCountedBase<ExternalASTSource> {
   friend class ExternalSemaSource;
 
   /// Generation number for this external AST source. Must be increased
diff --git a/clang/include/clang/AST/FormatString.h b/clang/include/clang/AST/FormatString.h
index a074dd23e2ad4c..6dd272d2665205 100644
--- a/clang/include/clang/AST/FormatString.h
+++ b/clang/include/clang/AST/FormatString.h
@@ -19,6 +19,7 @@
 #define LLVM_CLANG_AST_FORMATSTRING_H
 
 #include "clang/AST/CanonicalType.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
@@ -62,7 +63,7 @@ class OptionalFlag {
 };
 
 /// Represents the length modifier in a format string in scanf/printf.
-class LengthModifier {
+class CLANG_ABI LengthModifier {
 public:
   enum Kind {
     None,
@@ -119,7 +120,7 @@ class LengthModifier {
   Kind kind;
 };
 
-class ConversionSpecifier {
+class CLANG_ABI ConversionSpecifier {
 public:
   enum Kind {
     InvalidSpecifier = 0,
@@ -262,7 +263,7 @@ class ConversionSpecifier {
   Kind kind;
 };
 
-class ArgType {
+class CLANG_ABI ArgType {
 public:
   enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CPointerTy,
               AnyCharTy, CStrTy, WCStrTy, WIntTy };
@@ -346,7 +347,7 @@ class ArgType {
   std::string getRepresentativeTypeName(ASTContext &C) const;
 };
 
-class OptionalAmount {
+class CLANG_ABI OptionalAmount {
 public:
   enum HowSpecified { NotSpecified, Constant, Arg, Invalid };
 
@@ -418,7 +419,7 @@ class OptionalAmount {
 };
 
 
-class FormatSpecifier {
+class CLANG_ABI FormatSpecifier {
 protected:
   LengthModifier LM;
   OptionalAmount FieldWidth;
@@ -521,7 +522,7 @@ using analyze_format_string::LengthModifier;
 using analyze_format_string::OptionalAmount;
 using analyze_format_string::OptionalFlag;
 
-class PrintfSpecifier : public analyze_format_string::FormatSpecifier {
+class CLANG_ABI PrintfSpecifier : public analyze_format_string::FormatSpecifier {
   OptionalFlag HasThousandsGrouping; // ''', POSIX extension.
   OptionalFlag IsLeftJustified; // '-'
   OptionalFlag HasPlusPrefix; // '+'
@@ -667,7 +668,7 @@ using analyze_format_string::LengthModifier;
 using analyze_format_string::OptionalAmount;
 using analyze_format_string::OptionalFlag;
 
-class ScanfSpecifier : public analyze_format_string::FormatSpecifier {
+class CLANG_ABI ScanfSpecifier : public analyze_format_string::FormatSpecifier {
   OptionalFlag SuppressAssignment; // '*'
 public:
   ScanfSpecifier() :
@@ -713,7 +714,7 @@ namespace analyze_format_string {
 
 enum PositionContext { FieldWidthPos = 0, PrecisionPos = 1 };
 
-class FormatStringHandler {
+class CLANG_ABI FormatStringHandler {
 public:
   FormatStringHandler() {}
   virtual ~FormatStringHandler();
@@ -776,19 +777,19 @@ class FormatStringHandler {
   virtual void HandleIncompleteScanList(const char *start, const char *end) {}
 };
 
-bool ParsePrintfString(FormatStringHandler &H,
+CLANG_ABI bool ParsePrintfString(FormatStringHandler &H,
                        const char *beg, const char *end, const LangOptions &LO,
                        const TargetInfo &Target, bool isFreeBSDKPrintf);
 
-bool ParseFormatStringHasSArg(const char *beg, const char *end,
+CLANG_ABI bool ParseFormatStringHasSArg(const char *beg, const char *end,
                               const LangOptions &LO, const TargetInfo &Target);
 
-bool ParseScanfString(FormatStringHandler &H,
+CLANG_ABI bool ParseScanfString(FormatStringHandler &H,
                       const char *beg, const char *end, const LangOptions &LO,
                       const TargetInfo &Target);
 
 /// Return true if the given string has at least one formatting specifier.
-bool parseFormatStringHasFormattingSpecifiers(const char *Begin,
+CLANG_ABI bool parseFormatStringHasFormattingSpecifiers(const char *Begin,
                                               const char *End,
                                               const LangOptions &LO,
                                               const TargetInfo &Target);
diff --git a/clang/include/clang/AST/JSONNodeDumper.h b/clang/include/clang/AST/JSONNodeDumper.h
index 9422c8fceccfbd..f4e902e23721e8 100644
--- a/clang/include/clang/AST/JSONNodeDumper.h
+++ b/clang/include/clang/AST/JSONNodeDumper.h
@@ -20,10 +20,11 @@
 #include "clang/AST/AttrVisitor.h"
 #include "clang/AST/CommentCommandTraits.h"
 #include "clang/AST/CommentVisitor.h"
-#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/Mangle.h"
 #include "clang/AST/Type.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/JSON.h"
 
 namespace clang {
@@ -113,7 +114,7 @@ class NodeStreamer {
 // being valid JSON output. Further, there is no requirement that the
 // information dumped is a complete representation of the AST, only that the
 // information presented is correct.
-class JSONNodeDumper
+class CLANG_ABI JSONNodeDumper
     : public ConstAttrVisitor<JSONNodeDumper>,
       public comments::ConstCommentVisitor<JSONNodeDumper, void,
                                            const comments::FullComment *>,
diff --git a/clang/include/clang/AST/LambdaCapture.h b/clang/include/clang/AST/LambdaCapture.h
index 62e7716ed3699d..ea61e253b2f5b5 100644
--- a/clang/include/clang/AST/LambdaCapture.h
+++ b/clang/include/clang/AST/LambdaCapture.h
@@ -16,13 +16,14 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Basic/Lambda.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/PointerIntPair.h"
 
 namespace clang {
 
 /// Describes the capture of a variable or of \c this, or of a
 /// C++1y init-capture.
-class LambdaCapture {
+class CLANG_ABI LambdaCapture {
   enum {
     /// Flag used by the Capture class to indicate that the given
     /// capture was implicit.
diff --git a/clang/include/clang/AST/LocInfoType.h b/clang/include/clang/AST/LocInfoType.h
index 876c7deeceb9a4..b7bcc006f141cf 100644
--- a/clang/include/clang/AST/LocInfoType.h
+++ b/clang/include/clang/AST/LocInfoType.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_AST_LOCINFOTYPE_H
 
 #include "clang/AST/Type.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -25,7 +26,7 @@ class TypeSourceInfo;
 /// LocInfoType is a "transient" type, only needed for passing to/from Parser
 /// and Sema, when we want to preserve type source info for a parsed type.
 /// It will not participate in the type system semantics in any way.
-class LocInfoType : public Type {
+class CLANG_ABI LocInfoType : public Type {
   enum {
     // The last number that can fit in Type's TC.
     // Avoids conflict with an existing Type class.
diff --git a/clang/include/clang/AST/Mangle.h b/clang/include/clang/AST/Mangle.h
index d5f6c0f6cc67df..701f98108c8689 100644
--- a/clang/include/clang/AST/Mangle.h
+++ b/clang/include/clang/AST/Mangle.h
@@ -17,6 +17,7 @@
 #include "clang/AST/GlobalDecl.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/ABI.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Casting.h"
 #include <optional>
@@ -42,7 +43,7 @@ namespace clang {
 
 /// MangleContext - Context for tracking state which persists across multiple
 /// calls to the C++ name mangler.
-class MangleContext {
+class CLANG_ABI MangleContext {
 public:
   enum ManglerKind {
     MK_Itanium,
@@ -184,7 +185,7 @@ class MangleContext {
   /// @}
 };
 
-class ItaniumMangleContext : public MangleContext {
+class CLANG_ABI ItaniumMangleContext : public MangleContext {
 public:
   using DiscriminatorOverrideTy =
       std::optional<unsigned> (*)(ASTContext &, const NamedDecl *);
@@ -227,7 +228,7 @@ class ItaniumMangleContext : public MangleContext {
                                       bool IsAux = false);
 };
 
-class MicrosoftMangleContext : public MangleContext {
+class CLANG_ABI MicrosoftMangleContext : public MangleContext {
 public:
   explicit MicrosoftMangleContext(ASTContext &C, DiagnosticsEngine &D,
                                   bool IsAux = false)
@@ -294,7 +295,7 @@ class MicrosoftMangleContext : public MangleContext {
   create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux = false);
 };
 
-class ASTNameGenerator {
+class CLANG_ABI ASTNameGenerator {
 public:
   explicit ASTNameGenerator(ASTContext &Ctx);
   ~ASTNameGenerator();
diff --git a/clang/include/clang/AST/MangleNumberingContext.h b/clang/include/clang/AST/MangleNumberingContext.h
index 1313c94eb1224d..2b7b695f28fd49 100644
--- a/clang/include/clang/AST/MangleNumberingContext.h
+++ b/clang/include/clang/AST/MangleNumberingContext.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_MANGLENUMBERINGCONTEXT_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ class VarDecl;
 
 /// Keeps track of the mangled names of lambda expressions and block
 /// literals within a particular context.
-class MangleNumberingContext {
+class CLANG_ABI MangleNumberingContext {
   // The index of the next lambda we encounter in this context.
   unsigned LambdaIndex = 0;
 
diff --git a/clang/include/clang/AST/NSAPI.h b/clang/include/clang/AST/NSAPI.h
index d411c34191ed1a..2c66dc7a6d0179 100644
--- a/clang/include/clang/AST/NSAPI.h
+++ b/clang/include/clang/AST/NSAPI.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_AST_NSAPI_H
 
 #include "clang/Basic/IdentifierTable.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include <optional>
 
@@ -20,7 +21,7 @@ namespace clang {
   class Expr;
 
 // Provides info and caches identifiers/selectors for NSFoundation API.
-class NSAPI {
+class CLANG_ABI NSAPI {
 public:
   explicit NSAPI(ASTContext &Ctx);
 
diff --git a/clang/include/clang/AST/NestedNameSpecifier.h b/clang/include/clang/AST/NestedNameSpecifier.h
index a1d9e30e660d14..60589e27eb5068 100644
--- a/clang/include/clang/AST/NestedNameSpecifier.h
+++ b/clang/include/clang/AST/NestedNameSpecifier.h
@@ -17,6 +17,7 @@
 #include "clang/AST/DependenceFlags.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -47,7 +48,7 @@ class TypeLoc;
 /// (for dependent names), decltype specifier, or the global specifier ('::').
 /// The last two specifiers can only appear at the start of a
 /// nested-namespace-specifier.
-class NestedNameSpecifier : public llvm::FoldingSetNode {
+class CLANG_ABI NestedNameSpecifier : public llvm::FoldingSetNode {
   /// Enumeration describing
   enum StoredSpecifierKind {
     StoredIdentifier = 0,
@@ -240,7 +241,7 @@ class NestedNameSpecifier : public llvm::FoldingSetNode {
 
 /// A C++ nested-name-specifier augmented with source location
 /// information.
-class NestedNameSpecifierLoc {
+class CLANG_ABI NestedNameSpecifierLoc {
   NestedNameSpecifier *Qualifier = nullptr;
   void *Data = nullptr;
 
@@ -353,7 +354,7 @@ class NestedNameSpecifierLoc {
 /// Class that aids in the construction of nested-name-specifiers along
 /// with source-location information for all of the components of the
 /// nested-name-specifier.
-class NestedNameSpecifierLocBuilder {
+class CLANG_ABI NestedNameSpecifierLocBuilder {
   /// The current representation of the nested-name-specifier we're
   /// building.
   NestedNameSpecifier *Representation = nullptr;
diff --git a/clang/include/clang/AST/ODRDiagsEmitter.h b/clang/include/clang/AST/ODRDiagsEmitter.h
index 1f7faaa06e5404..8b09cd0433d6b0 100644
--- a/clang/include/clang/AST/ODRDiagsEmitter.h
+++ b/clang/include/clang/AST/ODRDiagsEmitter.h
@@ -14,10 +14,11 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
-class ODRDiagsEmitter {
+class CLANG_ABI ODRDiagsEmitter {
 public:
   ODRDiagsEmitter(DiagnosticsEngine &Diags, const ASTContext &Context,
                   const LangOptions &LangOpts)
diff --git a/clang/include/clang/AST/ODRHash.h b/clang/include/clang/AST/ODRHash.h
index a1caa6d39a87c3..ff78868828666e 100644
--- a/clang/include/clang/AST/ODRHash.h
+++ b/clang/include/clang/AST/ODRHash.h
@@ -16,8 +16,9 @@
 #define LLVM_CLANG_AST_ODRHASH_H
 
 #include "clang/AST/DeclarationName.h"
-#include "clang/AST/Type.h"
 #include "clang/AST/TemplateBase.h"
+#include "clang/AST/Type.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -39,7 +40,7 @@ class TemplateParameterList;
 // need to be hashed.  Then call CalculateHash to get the hash value.
 // Typically, only one Add* call is needed.  clear can be called to reuse the
 // object.
-class ODRHash {
+class CLANG_ABI ODRHash {
   // Use DenseMaps to convert from DeclarationName and Type pointers
   // to an index value.
   llvm::DenseMap<DeclarationName, unsigned> DeclNameMap;
diff --git a/clang/include/clang/AST/OSLog.h b/clang/include/clang/AST/OSLog.h
index 3772597e26167a..33f7b9b48624f9 100644
--- a/clang/include/clang/AST/OSLog.h
+++ b/clang/include/clang/AST/OSLog.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace analyze_os_log {
@@ -152,7 +153,7 @@ class OSLogBufferLayout {
 // __builtin_os_log_format_buffer_size(), compute the layout of the buffer that
 // the call will write into and store it in 'layout'. Returns 'false' if there
 // was some error encountered while computing the layout, and 'true' otherwise.
-bool computeOSLogBufferLayout(clang::ASTContext &Ctx, const clang::CallExpr *E,
+CLANG_ABI bool computeOSLogBufferLayout(clang::ASTContext &Ctx, const clang::CallExpr *E,
                               OSLogBufferLayout &layout);
 
 } // namespace analyze_os_log
diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index e8b8f477f91ae7..5a3f97948c1e25 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -16,12 +16,13 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/StmtIterator.h"
 #include "clang/Basic/OpenACCKinds.h"
+#include "clang/Support/Compiler.h"
 
 #include <utility>
 
 namespace clang {
 /// This is the base type for all OpenACC Clauses.
-class OpenACCClause {
+class CLANG_ABI OpenACCClause {
   OpenACCClauseKind Kind;
   SourceRange Location;
 
@@ -55,7 +56,7 @@ class OpenACCClause {
 };
 
 // Represents the 'auto' clause.
-class OpenACCAutoClause : public OpenACCClause {
+class CLANG_ABI OpenACCAutoClause : public OpenACCClause {
 protected:
   OpenACCAutoClause(SourceLocation BeginLoc, SourceLocation EndLoc)
       : OpenACCClause(OpenACCClauseKind::Auto, BeginLoc, EndLoc) {}
@@ -77,7 +78,7 @@ class OpenACCAutoClause : public OpenACCClause {
 };
 
 // Represents the 'independent' clause.
-class OpenACCIndependentClause : public OpenACCClause {
+class CLANG_ABI OpenACCIndependentClause : public OpenACCClause {
 protected:
   OpenACCIndependentClause(SourceLocation BeginLoc, SourceLocation EndLoc)
       : OpenACCClause(OpenACCClauseKind::Independent, BeginLoc, EndLoc) {}
@@ -98,7 +99,7 @@ class OpenACCIndependentClause : public OpenACCClause {
   }
 };
 // Represents the 'seq' clause.
-class OpenACCSeqClause : public OpenACCClause {
+class CLANG_ABI OpenACCSeqClause : public OpenACCClause {
 protected:
   OpenACCSeqClause(SourceLocation BeginLoc, SourceLocation EndLoc)
       : OpenACCClause(OpenACCClauseKind::Seq, BeginLoc, EndLoc) {}
@@ -122,7 +123,7 @@ class OpenACCSeqClause : public OpenACCClause {
 // Not yet implemented, but the type name is necessary for 'seq' diagnostics, so
 // this provides a basic, do-nothing implementation. We still need to add this
 // type to the visitors/etc, as well as get it to take its proper arguments.
-class OpenACCVectorClause : public OpenACCClause {
+class CLANG_ABI OpenACCVectorClause : public OpenACCClause {
 protected:
   OpenACCVectorClause(SourceLocation BeginLoc, SourceLocation EndLoc)
       : OpenACCClause(OpenACCClauseKind::Vector, BeginLoc, EndLoc) {
@@ -146,7 +147,7 @@ class OpenACCVectorClause : public OpenACCClause {
 };
 
 /// Represents a clause that has a list of parameters.
-class OpenACCClauseWithParams : public OpenACCClause {
+class CLANG_ABI OpenACCClauseWithParams : public OpenACCClause {
   /// Location of the '('.
   SourceLocation LParenLoc;
 
@@ -171,7 +172,7 @@ class OpenACCClauseWithParams : public OpenACCClause {
 using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
 /// A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or
 /// an identifier. The 'asterisk' means 'the rest'.
-class OpenACCDeviceTypeClause final
+class CLANG_ABI OpenACCDeviceTypeClause final
     : public OpenACCClauseWithParams,
       public llvm::TrailingObjects<OpenACCDeviceTypeClause,
                                    DeviceTypeArgument> {
@@ -226,7 +227,7 @@ class OpenACCDeviceTypeClause final
 };
 
 /// A 'default' clause, has the optional 'none' or 'present' argument.
-class OpenACCDefaultClause : public OpenACCClauseWithParams {
+class CLANG_ABI OpenACCDefaultClause : public OpenACCClauseWithParams {
   friend class ASTReaderStmt;
   friend class ASTWriterStmt;
 
@@ -260,7 +261,7 @@ class OpenACCDefaultClause : public OpenACCClauseWithParams {
 
 /// Represents one of the handful of classes that has an optional/required
 /// 'condition' expression as an argument.
-class OpenACCClauseWithCondition : public OpenACCClauseWithParams {
+class CLANG_ABI OpenACCClauseWithCondition : public OpenACCClauseWithParams {
   Expr *ConditionExpr = nullptr;
 
 protected:
@@ -294,7 +295,7 @@ class OpenACCClauseWithCondition : public OpenACCClauseWithParams {
 };
 
 /// An 'if' clause, which has a required condition expression.
-class OpenACCIfClause : public OpenACCClauseWithCondition {
+class CLANG_ABI OpenACCIfClause : public OpenACCClauseWithCondition {
 protected:
   OpenACCIfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                   Expr *ConditionExpr, SourceLocation EndLoc);
@@ -309,7 +310,7 @@ class OpenACCIfClause : public OpenACCClauseWithCondition {
 };
 
 /// A 'self' clause, which has an optional condition expression.
-class OpenACCSelfClause : public OpenACCClauseWithCondition {
+class CLANG_ABI OpenACCSelfClause : public OpenACCClauseWithCondition {
   OpenACCSelfClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                     Expr *ConditionExpr, SourceLocation EndLoc);
 
@@ -323,7 +324,7 @@ class OpenACCSelfClause : public OpenACCClauseWithCondition {
 };
 
 /// Represents a clause that has one or more expressions associated with it.
-class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
+class CLANG_ABI OpenACCClauseWithExprs : public OpenACCClauseWithParams {
   MutableArrayRef<Expr *> Exprs;
 
 protected:
@@ -357,7 +358,7 @@ class OpenACCClauseWithExprs : public OpenACCClauseWithParams {
 };
 
 // Represents the 'devnum' and expressions lists for the 'wait' clause.
-class OpenACCWaitClause final
+class CLANG_ABI OpenACCWaitClause final
     : public OpenACCClauseWithExprs,
       public llvm::TrailingObjects<OpenACCWaitClause, Expr *> {
   SourceLocation QueuesLoc;
@@ -399,7 +400,7 @@ class OpenACCWaitClause final
   }
 };
 
-class OpenACCNumGangsClause final
+class CLANG_ABI OpenACCNumGangsClause final
     : public OpenACCClauseWithExprs,
       public llvm::TrailingObjects<OpenACCNumGangsClause, Expr *> {
 
@@ -429,7 +430,7 @@ class OpenACCNumGangsClause final
   }
 };
 
-class OpenACCTileClause final
+class CLANG_ABI OpenACCTileClause final
     : public OpenACCClauseWithExprs,
       public llvm::TrailingObjects<OpenACCTileClause, Expr *> {
   OpenACCTileClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
@@ -460,7 +461,7 @@ class OpenACCTileClause final
 
 /// Represents one of a handful of clauses that have a single integer
 /// expression.
-class OpenACCClauseWithSingleIntExpr : public OpenACCClauseWithExprs {
+class CLANG_ABI OpenACCClauseWithSingleIntExpr : public OpenACCClauseWithExprs {
   Expr *IntExpr;
 
 protected:
@@ -483,7 +484,7 @@ class OpenACCClauseWithSingleIntExpr : public OpenACCClauseWithExprs {
   Expr *getIntExpr() { return hasIntExpr() ? getExprs()[0] : nullptr; };
 };
 
-class OpenACCGangClause final
+class CLANG_ABI OpenACCGangClause final
     : public OpenACCClauseWithExprs,
       public llvm::TrailingObjects<OpenACCGangClause, Expr *, OpenACCGangKind> {
 protected:
@@ -515,7 +516,7 @@ class OpenACCGangClause final
          ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);
 };
 
-class OpenACCWorkerClause : public OpenACCClauseWithSingleIntExpr {
+class CLANG_ABI OpenACCWorkerClause : public OpenACCClauseWithSingleIntExpr {
 protected:
   OpenACCWorkerClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                       Expr *IntExpr, SourceLocation EndLoc);
@@ -531,7 +532,7 @@ class OpenACCWorkerClause : public OpenACCClauseWithSingleIntExpr {
                                      SourceLocation EndLoc);
 };
 
-class OpenACCNumWorkersClause : public OpenACCClauseWithSingleIntExpr {
+class CLANG_ABI OpenACCNumWorkersClause : public OpenACCClauseWithSingleIntExpr {
   OpenACCNumWorkersClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                           Expr *IntExpr, SourceLocation EndLoc);
 
@@ -545,7 +546,7 @@ class OpenACCNumWorkersClause : public OpenACCClauseWithSingleIntExpr {
                                          Expr *IntExpr, SourceLocation EndLoc);
 };
 
-class OpenACCVectorLengthClause : public OpenACCClauseWithSingleIntExpr {
+class CLANG_ABI OpenACCVectorLengthClause : public OpenACCClauseWithSingleIntExpr {
   OpenACCVectorLengthClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                             Expr *IntExpr, SourceLocation EndLoc);
 
@@ -558,7 +559,7 @@ class OpenACCVectorLengthClause : public OpenACCClauseWithSingleIntExpr {
          Expr *IntExpr, SourceLocation EndLoc);
 };
 
-class OpenACCAsyncClause : public OpenACCClauseWithSingleIntExpr {
+class CLANG_ABI OpenACCAsyncClause : public OpenACCClauseWithSingleIntExpr {
   OpenACCAsyncClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
                      Expr *IntExpr, SourceLocation EndLoc);
 
@@ -576,7 +577,7 @@ class OpenACCAsyncClause : public OpenACCClauseWithSingleIntExpr {
 /// integer constant expression 'N' that represents how deep to collapse the
 /// construct. It also takes an optional 'force' tag that permits intervening
 /// code in the loops.
-class OpenACCCollapseClause : public OpenACCClauseWithSingleIntExpr {
+class CLANG_ABI OpenACCCollapseClause : public OpenACCClauseWithSingleIntExpr {
   bool HasForce = false;
 
   OpenACCCollapseClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
@@ -602,7 +603,7 @@ class OpenACCCollapseClause : public OpenACCClauseWithSingleIntExpr {
 /// as its arguments. Var-list is expected to be stored in trailing storage.
 /// For now, we're just storing the original expression in its entirety, unlike
 /// OMP which has to do a bunch of work to create a private.
-class OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
+class CLANG_ABI OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
 protected:
   OpenACCClauseWithVarList(OpenACCClauseKind K, SourceLocation BeginLoc,
                            SourceLocation LParenLoc, SourceLocation EndLoc)
@@ -614,7 +615,7 @@ class OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
   ArrayRef<Expr *> getVarList() const { return getExprs(); }
 };
 
-class OpenACCPrivateClause final
+class CLANG_ABI OpenACCPrivateClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCPrivateClause, Expr *> {
 
@@ -636,7 +637,7 @@ class OpenACCPrivateClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCFirstPrivateClause final
+class CLANG_ABI OpenACCFirstPrivateClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCFirstPrivateClause, Expr *> {
 
@@ -658,7 +659,7 @@ class OpenACCFirstPrivateClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCDevicePtrClause final
+class CLANG_ABI OpenACCDevicePtrClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCDevicePtrClause, Expr *> {
 
@@ -680,7 +681,7 @@ class OpenACCDevicePtrClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCAttachClause final
+class CLANG_ABI OpenACCAttachClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCAttachClause, Expr *> {
 
@@ -702,7 +703,7 @@ class OpenACCAttachClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCNoCreateClause final
+class CLANG_ABI OpenACCNoCreateClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCNoCreateClause, Expr *> {
 
@@ -724,7 +725,7 @@ class OpenACCNoCreateClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCPresentClause final
+class CLANG_ABI OpenACCPresentClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCPresentClause, Expr *> {
 
@@ -746,7 +747,7 @@ class OpenACCPresentClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCCopyClause final
+class CLANG_ABI OpenACCCopyClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCCopyClause, Expr *> {
 
@@ -775,7 +776,7 @@ class OpenACCCopyClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCCopyInClause final
+class CLANG_ABI OpenACCCopyInClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCCopyInClause, Expr *> {
   bool IsReadOnly;
@@ -807,7 +808,7 @@ class OpenACCCopyInClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCCopyOutClause final
+class CLANG_ABI OpenACCCopyOutClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCCopyOutClause, Expr *> {
   bool IsZero;
@@ -839,7 +840,7 @@ class OpenACCCopyOutClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCCreateClause final
+class CLANG_ABI OpenACCCreateClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCCreateClause, Expr *> {
   bool IsZero;
@@ -871,7 +872,7 @@ class OpenACCCreateClause final
          ArrayRef<Expr *> VarList, SourceLocation EndLoc);
 };
 
-class OpenACCReductionClause final
+class CLANG_ABI OpenACCReductionClause final
     : public OpenACCClauseWithVarList,
       public llvm::TrailingObjects<OpenACCReductionClause, Expr *> {
   OpenACCReductionOperator Op;
@@ -939,7 +940,7 @@ template <class Impl> class OpenACCClauseVisitor {
 #include "clang/Basic/OpenACCClauses.def"
 };
 
-class OpenACCClausePrinter final
+class CLANG_ABI OpenACCClausePrinter final
     : public OpenACCClauseVisitor<OpenACCClausePrinter> {
   raw_ostream &OS;
   const PrintingPolicy &Policy;
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 2e48c1c3c72c8e..e1cd05014b1c9b 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -26,6 +26,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -52,7 +53,7 @@ class ASTContext;
 //===----------------------------------------------------------------------===//
 
 /// This is a basic class for representing single OpenMP clause.
-class OMPClause {
+class CLANG_ABI OMPClause {
   /// Starting location of the clause (the clause keyword).
   SourceLocation StartLoc;
 
@@ -192,7 +193,7 @@ class OMPOneStmtClause : public Base {
 
 /// Class that handles pre-initialization statement for some clauses, like
 /// 'schedule', 'firstprivate' etc.
-class OMPClauseWithPreInit {
+class CLANG_ABI OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Pre-initialization statement for the clause.
@@ -230,7 +231,7 @@ class OMPClauseWithPreInit {
 
 /// Class that handles post-update expression for some clauses, like
 /// 'lastprivate', 'reduction' etc.
-class OMPClauseWithPostUpdate : public OMPClauseWithPreInit {
+class CLANG_ABI OMPClauseWithPostUpdate : public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Post-update expression for the clause.
@@ -444,7 +445,7 @@ class OMPAllocatorClause final
 /// In this example directive '#pragma omp allocate' has simple 'allocator'
 /// clause with the allocator 'omp_default_mem_alloc' and align clause with
 /// value of 8.
-class OMPAlignClause final
+class CLANG_ABI OMPAlignClause final
     : public OMPOneStmtClause<llvm::omp::OMPC_align, OMPClause> {
   friend class OMPClauseReader;
 
@@ -487,7 +488,7 @@ class OMPAlignClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'private'
 /// and clause 'allocate' for the variable 'a'.
-class OMPAllocateClause final
+class CLANG_ABI OMPAllocateClause final
     : public OMPVarListClause<OMPAllocateClause>,
       private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
   friend class OMPClauseReader;
@@ -584,7 +585,7 @@ class OMPAllocateClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has simple 'if' clause with
 /// condition 'a > 5' and directive name modifier 'parallel'.
-class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
+class CLANG_ABI OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -685,7 +686,7 @@ class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
 /// \endcode
 /// In this example directive '#pragma omp task' has simple 'final'
 /// clause with condition 'a > 5'.
-class OMPFinalClause final
+class CLANG_ABI OMPFinalClause final
     : public OMPOneStmtClause<llvm::omp::OMPC_final, OMPClause>,
       public OMPClauseWithPreInit {
   friend class OMPClauseReader;
@@ -843,7 +844,7 @@ class OMPSimdlenClause final
 /// for (int i = 0; i < 64; ++i)
 ///   for (int j = 0; j < 64; ++j)
 /// \endcode
-class OMPSizesClause final
+class CLANG_ABI OMPSizesClause final
     : public OMPClause,
       private llvm::TrailingObjects<OMPSizesClause, Expr *> {
   friend class OMPClauseReader;
@@ -938,7 +939,7 @@ class OMPSizesClause final
 ///   for (int i = 0; i < 64; ++i)
 ///     for (int j = 0; j < 64; ++j)
 /// \endcode
-class OMPPermutationClause final
+class CLANG_ABI OMPPermutationClause final
     : public OMPClause,
       private llvm::TrailingObjects<OMPSizesClause, Expr *> {
   friend class OMPClauseReader;
@@ -1035,7 +1036,7 @@ class OMPPermutationClause final
 /// #pragma omp unroll full
 /// for (int i = 0; i < 64; ++i)
 /// \endcode
-class OMPFullClause final : public OMPNoChildClause<llvm::omp::OMPC_full> {
+class CLANG_ABI OMPFullClause final : public OMPNoChildClause<llvm::omp::OMPC_full> {
   friend class OMPClauseReader;
 
   /// Build an empty clause.
@@ -1063,7 +1064,7 @@ class OMPFullClause final : public OMPNoChildClause<llvm::omp::OMPC_full> {
 /// #pragma omp unroll partial(4)
 /// for (int i = start; i < end; ++i)
 /// \endcode
-class OMPPartialClause final : public OMPClause {
+class CLANG_ABI OMPPartialClause final : public OMPClause {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -1986,7 +1987,7 @@ class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
 /// \endcode
 /// In this example directive '#pragma omp for' has 'ordered' clause with
 /// parameter 2.
-class OMPOrderedClause final
+class CLANG_ABI OMPOrderedClause final
     : public OMPClause,
       private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
   friend class OMPClauseReader;
@@ -2179,7 +2180,7 @@ class OMPMergeableClause : public OMPClause {
 /// #pragma omp assume absent(<directive-name list>)
 /// \endcode
 /// In this example directive '#pragma omp assume' has an 'absent' clause.
-class OMPAbsentClause final
+class CLANG_ABI OMPAbsentClause final
     : public OMPDirectiveListClause<OMPAbsentClause>,
       private llvm::TrailingObjects<OMPAbsentClause, OpenMPDirectiveKind> {
   friend OMPDirectiveListClause;
@@ -2222,7 +2223,7 @@ class OMPAbsentClause final
 /// #pragma omp assume contains(<directive-name list>)
 /// \endcode
 /// In this example directive '#pragma omp assume' has a 'contains' clause.
-class OMPContainsClause final
+class CLANG_ABI OMPContainsClause final
     : public OMPDirectiveListClause<OMPContainsClause>,
       private llvm::TrailingObjects<OMPContainsClause, OpenMPDirectiveKind> {
   friend OMPDirectiveListClause;
@@ -2443,7 +2444,7 @@ class OMPWriteClause : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp depobj' has 'update' clause with 'in'
 /// dependence kind.
-class OMPUpdateClause final
+class CLANG_ABI OMPUpdateClause final
     : public OMPClause,
       private llvm::TrailingObjects<OMPUpdateClause, SourceLocation,
                                     OpenMPDependClauseKind> {
@@ -2980,7 +2981,7 @@ class OMPFailClause final : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'private'
 /// with the variables 'a' and 'b'.
-class OMPPrivateClause final
+class CLANG_ABI OMPPrivateClause final
     : public OMPVarListClause<OMPPrivateClause>,
       private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
   friend class OMPClauseReader;
@@ -3086,7 +3087,7 @@ class OMPPrivateClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'firstprivate'
 /// with the variables 'a' and 'b'.
-class OMPFirstprivateClause final
+class CLANG_ABI OMPFirstprivateClause final
     : public OMPVarListClause<OMPFirstprivateClause>,
       public OMPClauseWithPreInit,
       private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
@@ -3227,7 +3228,7 @@ class OMPFirstprivateClause final
 /// \endcode
 /// In this example directive '#pragma omp simd' has clause 'lastprivate'
 /// with the variables 'a' and 'b'.
-class OMPLastprivateClause final
+class CLANG_ABI OMPLastprivateClause final
     : public OMPVarListClause<OMPLastprivateClause>,
       public OMPClauseWithPostUpdate,
       private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
@@ -3465,7 +3466,7 @@ class OMPLastprivateClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'shared'
 /// with the variables 'a' and 'b'.
-class OMPSharedClause final
+class CLANG_ABI OMPSharedClause final
     : public OMPVarListClause<OMPSharedClause>,
       private llvm::TrailingObjects<OMPSharedClause, Expr *> {
   friend OMPVarListClause;
@@ -3538,7 +3539,7 @@ class OMPSharedClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'reduction'
 /// with operator '+' and the variables 'a' and 'b'.
-class OMPReductionClause final
+class CLANG_ABI OMPReductionClause final
     : public OMPVarListClause<OMPReductionClause>,
       public OMPClauseWithPostUpdate,
       private llvm::TrailingObjects<OMPReductionClause, Expr *> {
@@ -3874,7 +3875,7 @@ class OMPReductionClause final
 /// \endcode
 /// In this example directive '#pragma omp taskgroup' has clause
 /// 'task_reduction' with operator '+' and the variables 'a' and 'b'.
-class OMPTaskReductionClause final
+class CLANG_ABI OMPTaskReductionClause final
     : public OMPVarListClause<OMPTaskReductionClause>,
       public OMPClauseWithPostUpdate,
       private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
@@ -4105,7 +4106,7 @@ class OMPTaskReductionClause final
 /// \endcode
 /// In this example directive '#pragma omp task' has clause 'in_reduction' with
 /// operator '+' and the variables 'a' and 'b'.
-class OMPInReductionClause final
+class CLANG_ABI OMPInReductionClause final
     : public OMPVarListClause<OMPInReductionClause>,
       public OMPClauseWithPostUpdate,
       private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
@@ -4361,7 +4362,7 @@ class OMPInReductionClause final
 /// \endcode
 /// In this example directive '#pragma omp simd' has clause 'linear'
 /// with variables 'a', 'b' and linear step '2'.
-class OMPLinearClause final
+class CLANG_ABI OMPLinearClause final
     : public OMPVarListClause<OMPLinearClause>,
       public OMPClauseWithPostUpdate,
       private llvm::TrailingObjects<OMPLinearClause, Expr *> {
@@ -4651,7 +4652,7 @@ class OMPLinearClause final
 /// \endcode
 /// In this example directive '#pragma omp simd' has clause 'aligned'
 /// with variables 'a', 'b' and alignment '8'.
-class OMPAlignedClause final
+class CLANG_ABI OMPAlignedClause final
     : public OMPVarListClause<OMPAlignedClause>,
       private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
   friend class OMPClauseReader;
@@ -4749,7 +4750,7 @@ class OMPAlignedClause final
 /// \endcode
 /// In this example directive '#pragma omp parallel' has clause 'copyin'
 /// with the variables 'a' and 'b'.
-class OMPCopyinClause final
+class CLANG_ABI OMPCopyinClause final
     : public OMPVarListClause<OMPCopyinClause>,
       private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
   // Class has 3 additional tail allocated arrays:
@@ -4926,7 +4927,7 @@ class OMPCopyinClause final
 /// \endcode
 /// In this example directive '#pragma omp single' has clause 'copyprivate'
 /// with the variables 'a' and 'b'.
-class OMPCopyprivateClause final
+class CLANG_ABI OMPCopyprivateClause final
     : public OMPVarListClause<OMPCopyprivateClause>,
       private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
   friend class OMPClauseReader;
@@ -5094,7 +5095,7 @@ class OMPCopyprivateClause final
 /// \endcode
 /// In this example directive '#pragma omp flush' has implicit clause 'flush'
 /// with the variables 'a' and 'b'.
-class OMPFlushClause final
+class CLANG_ABI OMPFlushClause final
     : public OMPVarListClause<OMPFlushClause>,
       private llvm::TrailingObjects<OMPFlushClause, Expr *> {
   friend OMPVarListClause;
@@ -5171,7 +5172,7 @@ class OMPFlushClause final
 /// \endcode
 /// In this example directive '#pragma omp depobj' has implicit clause 'depobj'
 /// with the depobj 'a'.
-class OMPDepobjClause final : public OMPClause {
+class CLANG_ABI OMPDepobjClause final : public OMPClause {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -5254,7 +5255,7 @@ class OMPDepobjClause final : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp task' with clause 'depend' with the
 /// variables 'a' and 'b' with dependency 'in'.
-class OMPDependClause final
+class CLANG_ABI OMPDependClause final
     : public OMPVarListClause<OMPDependClause>,
       private llvm::TrailingObjects<OMPDependClause, Expr *> {
   friend class OMPClauseReader;
@@ -5557,7 +5558,7 @@ class OMPSIMDClause : public OMPClause {
 
 /// Struct that defines common infrastructure to handle mappable
 /// expressions used in OpenMP clauses.
-class OMPClauseMappableExprCommon {
+class CLANG_ABI OMPClauseMappableExprCommon {
 public:
   /// Class that represents a component of a mappable expression. E.g.
   /// for an expression S.a, the first component is a declaration reference
@@ -6204,7 +6205,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
 /// \endcode
 /// In this example directive '#pragma omp target' has clause 'map'
 /// with the variables 'a' and 'b'.
-class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
+class CLANG_ABI OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
                            private llvm::TrailingObjects<
                                OMPMapClause, Expr *, ValueDecl *, unsigned,
                                OMPClauseMappableExprCommon::MappableComponent> {
@@ -6475,7 +6476,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
 /// \code
 /// #pragma omp target teams ompx_bare num_teams(x, y, z)
 /// \endcode
-class OMPNumTeamsClause final
+class CLANG_ABI OMPNumTeamsClause final
     : public OMPVarListClause<OMPNumTeamsClause>,
       public OMPClauseWithPreInit,
       private llvm::TrailingObjects<OMPNumTeamsClause, Expr *> {
@@ -6568,7 +6569,7 @@ class OMPNumTeamsClause final
 /// \code
 /// #pragma omp target teams ompx_bare thread_limit(x, y, z)
 /// \endcode
-class OMPThreadLimitClause final
+class CLANG_ABI OMPThreadLimitClause final
     : public OMPVarListClause<OMPThreadLimitClause>,
       public OMPClauseWithPreInit,
       private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
@@ -6655,7 +6656,7 @@ class OMPThreadLimitClause final
 /// \endcode
 /// In this example directive '#pragma omp teams' has clause 'priority' with
 /// single expression 'n'.
-class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
+class CLANG_ABI OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -6729,7 +6730,7 @@ class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit {
 /// \endcode
 /// In this example directive '#pragma omp taskloop' has clause 'grainsize'
 /// with single expression '4'.
-class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
+class CLANG_ABI OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -6861,7 +6862,7 @@ class OMPNogroupClause : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp taskloop' has clause 'num_tasks'
 /// with single expression '4'.
-class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
+class CLANG_ABI OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -7249,7 +7250,7 @@ class OMPDefaultmapClause : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp target update' has clause 'to'
 /// with the variables 'a' and 'b'.
-class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
+class CLANG_ABI OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
                           private llvm::TrailingObjects<
                               OMPToClause, Expr *, ValueDecl *, unsigned,
                               OMPClauseMappableExprCommon::MappableComponent> {
@@ -7449,7 +7450,7 @@ class OMPToClause final : public OMPMappableExprListClause<OMPToClause>,
 /// \endcode
 /// In this example directive '#pragma omp target update' has clause 'from'
 /// with the variables 'a' and 'b'.
-class OMPFromClause final
+class CLANG_ABI OMPFromClause final
     : public OMPMappableExprListClause<OMPFromClause>,
       private llvm::TrailingObjects<
           OMPFromClause, Expr *, ValueDecl *, unsigned,
@@ -7649,7 +7650,7 @@ class OMPFromClause final
 /// \endcode
 /// In this example directive '#pragma omp target data' has clause
 /// 'use_device_ptr' with the variables 'a' and 'b'.
-class OMPUseDevicePtrClause final
+class CLANG_ABI OMPUseDevicePtrClause final
     : public OMPMappableExprListClause<OMPUseDevicePtrClause>,
       private llvm::TrailingObjects<
           OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned,
@@ -7813,7 +7814,7 @@ class OMPUseDevicePtrClause final
 /// \endcode
 /// In this example directive '#pragma omp target data' has clause
 /// 'use_device_addr' with the variables 'a' and 'b'.
-class OMPUseDeviceAddrClause final
+class CLANG_ABI OMPUseDeviceAddrClause final
     : public OMPMappableExprListClause<OMPUseDeviceAddrClause>,
       private llvm::TrailingObjects<
           OMPUseDeviceAddrClause, Expr *, ValueDecl *, unsigned,
@@ -7917,7 +7918,7 @@ class OMPUseDeviceAddrClause final
 /// \endcode
 /// In this example directive '#pragma omp target' has clause
 /// 'is_device_ptr' with the variables 'a' and 'b'.
-class OMPIsDevicePtrClause final
+class CLANG_ABI OMPIsDevicePtrClause final
     : public OMPMappableExprListClause<OMPIsDevicePtrClause>,
       private llvm::TrailingObjects<
           OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned,
@@ -8020,7 +8021,7 @@ class OMPIsDevicePtrClause final
 /// \endcode
 /// In this example directive '#pragma omp target' has clause
 /// 'has_device_ptr' with the variables 'a' and 'b'.
-class OMPHasDeviceAddrClause final
+class CLANG_ABI OMPHasDeviceAddrClause final
     : public OMPMappableExprListClause<OMPHasDeviceAddrClause>,
       private llvm::TrailingObjects<
           OMPHasDeviceAddrClause, Expr *, ValueDecl *, unsigned,
@@ -8123,7 +8124,7 @@ class OMPHasDeviceAddrClause final
 /// \endcode
 /// In this example directive '#pragma omp simd' has clause 'nontemporal' for
 /// the variable 'a'.
-class OMPNontemporalClause final
+class CLANG_ABI OMPNontemporalClause final
     : public OMPVarListClause<OMPNontemporalClause>,
       private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
   friend class OMPClauseReader;
@@ -8323,7 +8324,7 @@ class OMPOrderClause final : public OMPClause {
 /// \code
 /// #pragma omp interop init(target:obj)
 /// \endcode
-class OMPInitClause final
+class CLANG_ABI OMPInitClause final
     : public OMPVarListClause<OMPInitClause>,
       private llvm::TrailingObjects<OMPInitClause, Expr *> {
   friend class OMPClauseReader;
@@ -8606,7 +8607,7 @@ class OMPDestroyClause final : public OMPClause {
 /// \endcode
 /// In this example directive '#pragma omp dispatch' has simple 'novariants'
 /// clause with condition 'a > 5'.
-class OMPNovariantsClause final
+class CLANG_ABI OMPNovariantsClause final
     : public OMPOneStmtClause<llvm::omp::OMPC_novariants, OMPClause>,
       public OMPClauseWithPreInit {
   friend class OMPClauseReader;
@@ -8653,7 +8654,7 @@ class OMPNovariantsClause final
 /// \endcode
 /// In this example directive '#pragma omp dispatch' has simple 'nocontext'
 /// clause with condition 'a > 5'.
-class OMPNocontextClause final
+class CLANG_ABI OMPNocontextClause final
     : public OMPOneStmtClause<llvm::omp::OMPC_nocontext, OMPClause>,
       public OMPClauseWithPreInit {
   friend class OMPClauseReader;
@@ -8731,7 +8732,7 @@ class OMPDetachClause final
 /// \endcode
 /// In this example directive '#pragma omp scan' has clause 'inclusive'
 /// with the variables 'a' and 'b'.
-class OMPInclusiveClause final
+class CLANG_ABI OMPInclusiveClause final
     : public OMPVarListClause<OMPInclusiveClause>,
       private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
   friend class OMPClauseReader;
@@ -8805,7 +8806,7 @@ class OMPInclusiveClause final
 /// \endcode
 /// In this example directive '#pragma omp scan' has clause 'exclusive'
 /// with the variables 'a' and 'b'.
-class OMPExclusiveClause final
+class CLANG_ABI OMPExclusiveClause final
     : public OMPVarListClause<OMPExclusiveClause>,
       private llvm::TrailingObjects<OMPExclusiveClause, Expr *> {
   friend class OMPClauseReader;
@@ -8880,7 +8881,7 @@ class OMPExclusiveClause final
 /// \endcode
 /// In this example directive '#pragma omp target' has clause 'uses_allocators'
 /// with the allocators 'default_allocator' and user-defined 'my_allocator'.
-class OMPUsesAllocatorsClause final
+class CLANG_ABI OMPUsesAllocatorsClause final
     : public OMPClause,
       private llvm::TrailingObjects<OMPUsesAllocatorsClause, Expr *,
                                     SourceLocation> {
@@ -9006,7 +9007,7 @@ class OMPUsesAllocatorsClause final
 /// In this example directive '#pragma omp task' has clause 'affinity' with the
 /// affinity modifer 'iterator(i = 0:n)' and locator items '([3][n])a', 'b[:n]'
 /// and 'c[i]'.
-class OMPAffinityClause final
+class CLANG_ABI OMPAffinityClause final
     : public OMPVarListClause<OMPAffinityClause>,
       private llvm::TrailingObjects<OMPAffinityClause, Expr *> {
   friend class OMPClauseReader;
@@ -9146,7 +9147,7 @@ class OMPFilterClause final
 /// \code
 /// #pragma omp loop bind(parallel)
 /// \endcode
-class OMPBindClause final : public OMPNoChildClause<llvm::omp::OMPC_bind> {
+class CLANG_ABI OMPBindClause final : public OMPNoChildClause<llvm::omp::OMPC_bind> {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -9253,7 +9254,7 @@ template<class ImplClass, typename RetTy = void>
 class ConstOMPClauseVisitor :
       public OMPClauseVisitorBase <ImplClass, const_ptr, RetTy> {};
 
-class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
+class CLANG_ABI OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
   raw_ostream &OS;
   const PrintingPolicy &Policy;
 
@@ -9293,7 +9294,7 @@ struct OMPTraitSet {
 /// collection of selector sets, each with an associated kind and an ordered
 /// collection of selectors. A selector has a kind, an optional score/condition,
 /// and an ordered collection of properties.
-class OMPTraitInfo {
+class CLANG_ABI OMPTraitInfo {
   /// Private constructor accesible only by ASTContext.
   OMPTraitInfo() {}
   friend class ASTContext;
@@ -9348,11 +9349,11 @@ class OMPTraitInfo {
   /// Print a human readable representation into \p OS.
   void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
 };
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo &TI);
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo *TI);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo &TI);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const OMPTraitInfo *TI);
 
 /// Clang specific specialization of the OMPContext to lookup target features.
-struct TargetOMPContext final : public llvm::omp::OMPContext {
+struct CLANG_ABI TargetOMPContext final : public llvm::omp::OMPContext {
   TargetOMPContext(ASTContext &ASTCtx,
                    std::function<void(StringRef)> &&DiagUnknownTrait,
                    const FunctionDecl *CurrentFunctionDecl,
@@ -9372,7 +9373,7 @@ struct TargetOMPContext final : public llvm::omp::OMPContext {
 /// Contains data for OpenMP directives: clauses, children
 /// expressions/statements (helpers for codegen) and associated statement, if
 /// any.
-class OMPChildren final
+class CLANG_ABI OMPChildren final
     : private llvm::TrailingObjects<OMPChildren, OMPClause *, Stmt *> {
   friend TrailingObjects;
   friend class OMPClauseReader;
@@ -9561,7 +9562,7 @@ class OMPXDynCGroupMemClause
 /// \endcode
 /// In this example directive '#pragma omp ordered' with clause 'doacross' with
 /// a dependence-type 'sink' and loop-iteration vector expressions i-1 and j-1.
-class OMPDoacrossClause final
+class CLANG_ABI OMPDoacrossClause final
     : public OMPVarListClause<OMPDoacrossClause>,
       private llvm::TrailingObjects<OMPDoacrossClause, Expr *> {
   friend class OMPClauseReader;
diff --git a/clang/include/clang/AST/ParentMap.h b/clang/include/clang/AST/ParentMap.h
index 86e2f048a34453..6e4b372acdfdfa 100644
--- a/clang/include/clang/AST/ParentMap.h
+++ b/clang/include/clang/AST/ParentMap.h
@@ -13,11 +13,12 @@
 #ifndef LLVM_CLANG_AST_PARENTMAP_H
 #define LLVM_CLANG_AST_PARENTMAP_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
 class Stmt;
 class Expr;
 
-class ParentMap {
+class CLANG_ABI ParentMap {
   void* Impl;
 public:
   ParentMap(Stmt* ASTRoot);
diff --git a/clang/include/clang/AST/ParentMapContext.h b/clang/include/clang/AST/ParentMapContext.h
index 6f79038627d9e1..5c43e15f7a6885 100644
--- a/clang/include/clang/AST/ParentMapContext.h
+++ b/clang/include/clang/AST/ParentMapContext.h
@@ -16,11 +16,12 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class DynTypedNodeList;
 
-class ParentMapContext {
+class CLANG_ABI ParentMapContext {
 public:
   ParentMapContext(ASTContext &Ctx);
 
diff --git a/clang/include/clang/AST/PrettyDeclStackTrace.h b/clang/include/clang/AST/PrettyDeclStackTrace.h
index 82df031d4126f4..8ebe7ed245cdbc 100644
--- a/clang/include/clang/AST/PrettyDeclStackTrace.h
+++ b/clang/include/clang/AST/PrettyDeclStackTrace.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_AST_PRETTYDECLSTACKTRACE_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/PrettyStackTrace.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ class Decl;
 /// PrettyDeclStackTraceEntry - If a crash occurs in the parser while
 /// parsing something related to a declaration, include that
 /// declaration in the stack trace.
-class PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry {
+class CLANG_ABI PrettyDeclStackTraceEntry : public llvm::PrettyStackTraceEntry {
   ASTContext &Context;
   Decl *TheDecl;
   SourceLocation Loc;
diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
index 91818776b770cf..b0ea1a63d2c813 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -22,7 +23,7 @@ class DeclContext;
 class LangOptions;
 class Stmt;
 
-class PrinterHelper {
+class CLANG_ABI PrinterHelper {
 public:
   virtual ~PrinterHelper();
   virtual bool handledStmt(Stmt* E, raw_ostream& OS) = 0;
diff --git a/clang/include/clang/AST/QualTypeNames.h b/clang/include/clang/AST/QualTypeNames.h
index daa86cda2d992a..289563e028370b 100644
--- a/clang/include/clang/AST/QualTypeNames.h
+++ b/clang/include/clang/AST/QualTypeNames.h
@@ -61,6 +61,7 @@
 #define LLVM_CLANG_AST_QUALTYPENAMES_H
 
 #include "clang/AST/ASTContext.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace TypeName {
@@ -72,7 +73,7 @@ namespace TypeName {
 /// \param[in] Ctx - the ASTContext to be used.
 /// \param[in] WithGlobalNsPrefix - If true, then the global namespace
 /// specifier "::" will be prepended to the fully qualified name.
-std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx,
+CLANG_ABI std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx,
                                   const PrintingPolicy &Policy,
                                   bool WithGlobalNsPrefix = false);
 
@@ -85,7 +86,7 @@ std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx,
 /// \param[in] Ctx - the ASTContext to be used.
 /// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
 /// specifier "::" should be prepended or not.
-QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
+CLANG_ABI QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
                                bool WithGlobalNsPrefix = false);
 } // end namespace TypeName
 } // end namespace clang
diff --git a/clang/include/clang/AST/Randstruct.h b/clang/include/clang/AST/Randstruct.h
index d5eaf30919e3a6..aa7f2072a6b502 100644
--- a/clang/include/clang/AST/Randstruct.h
+++ b/clang/include/clang/AST/Randstruct.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_AST_RANDSTRUCT_H
 #define LLVM_CLANG_AST_RANDSTRUCT_H
 
+#include "clang/Support/Compiler.h"
 namespace llvm {
 template <typename T> class SmallVectorImpl;
 } // end namespace llvm
@@ -26,7 +27,7 @@ class RecordDecl;
 
 namespace randstruct {
 
-bool randomizeStructureLayout(const ASTContext &Context, RecordDecl *RD,
+CLANG_ABI bool randomizeStructureLayout(const ASTContext &Context, RecordDecl *RD,
                               llvm::SmallVectorImpl<Decl *> &FinalOrdering);
 
 } // namespace randstruct
diff --git a/clang/include/clang/AST/RawCommentList.h b/clang/include/clang/AST/RawCommentList.h
index 3e4567b546a71d..b2e7d236c9cccd 100644
--- a/clang/include/clang/AST/RawCommentList.h
+++ b/clang/include/clang/AST/RawCommentList.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/CommentOptions.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Allocator.h"
@@ -29,7 +30,7 @@ namespace comments {
   class FullComment;
 } // end namespace comments
 
-class RawComment {
+class CLANG_ABI RawComment {
 public:
   enum CommentKind {
     RCK_Invalid,      ///< Invalid comment
@@ -209,7 +210,7 @@ class RawComment {
 
 /// This class represents all comments included in the translation unit,
 /// sorted in order of appearance in the translation unit.
-class RawCommentList {
+class CLANG_ABI RawCommentList {
 public:
   RawCommentList(SourceManager &SourceMgr) : SourceMgr(SourceMgr) {}
 
diff --git a/clang/include/clang/AST/RecordLayout.h b/clang/include/clang/AST/RecordLayout.h
index dd18f9c49f84fb..eaa98eeccfc316 100644
--- a/clang/include/clang/AST/RecordLayout.h
+++ b/clang/include/clang/AST/RecordLayout.h
@@ -17,6 +17,7 @@
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -35,7 +36,7 @@ class CXXRecordDecl;
 /// This class is also used to contain layout information for one
 /// ObjCInterfaceDecl. FIXME - Find appropriate name.
 /// These objects are managed by ASTContext.
-class ASTRecordLayout {
+class CLANG_ABI ASTRecordLayout {
 public:
   struct VBaseInfo {
     /// The offset to this virtual base in the complete-object layout
diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h
index 8d320a9ced2792..0736e3aabb62b9 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_AST_REDECLARABLE_H
 
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/iterator_range.h"
@@ -306,7 +307,7 @@ class Redeclarable {
 
 /// Get the primary declaration for a declaration from an AST file. That
 /// will be the first-loaded declaration.
-Decl *getPrimaryMergedDecl(Decl *D);
+CLANG_ABI Decl *getPrimaryMergedDecl(Decl *D);
 
 /// Provides common interface for the Decls that cannot be redeclared,
 /// but can be merged if the same declaration is brought in from multiple
diff --git a/clang/include/clang/AST/SelectorLocationsKind.h b/clang/include/clang/AST/SelectorLocationsKind.h
index 6e9923de6742f6..341c90b87482d5 100644
--- a/clang/include/clang/AST/SelectorLocationsKind.h
+++ b/clang/include/clang/AST/SelectorLocationsKind.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class Selector;
@@ -42,7 +43,7 @@ enum SelectorLocationsKind {
 };
 
 /// Returns true if all \p SelLocs are in a "standard" location.
-SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
+CLANG_ABI SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
                                               ArrayRef<SourceLocation> SelLocs,
                                               ArrayRef<Expr *> Args,
                                               SourceLocation EndLoc);
@@ -53,14 +54,14 @@ SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
 /// \param WithArgSpace if true the standard location is with a space apart
 /// before arguments: "[foo first: 1 second: 2]"
 /// If false: "[foo first:1 second:2]"
-SourceLocation getStandardSelectorLoc(unsigned Index,
+CLANG_ABI SourceLocation getStandardSelectorLoc(unsigned Index,
                                       Selector Sel,
                                       bool WithArgSpace,
                                       ArrayRef<Expr *> Args,
                                       SourceLocation EndLoc);
 
 /// Returns true if all \p SelLocs are in a "standard" location.
-SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
+CLANG_ABI SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
                                               ArrayRef<SourceLocation> SelLocs,
                                               ArrayRef<ParmVarDecl *> Args,
                                               SourceLocation EndLoc);
@@ -71,7 +72,7 @@ SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
 /// \param WithArgSpace if true the standard location is with a space apart
 /// before arguments: "-(id)first: (int)x second: (int)y;"
 /// If false: "-(id)first:(int)x second:(int)y;"
-SourceLocation getStandardSelectorLoc(unsigned Index,
+CLANG_ABI SourceLocation getStandardSelectorLoc(unsigned Index,
                                       Selector Sel,
                                       bool WithArgSpace,
                                       ArrayRef<ParmVarDecl *> Args,
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 83fafbabb1d460..b2a0106f1fc454 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -27,6 +27,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TypeTraits.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
@@ -81,7 +82,7 @@ enum class StringLiteralKind;
 
 /// Stmt - This represents one statement.
 ///
-class alignas(void *) Stmt {
+class CLANG_ABI alignas(void *) Stmt {
 public:
   enum StmtClass {
     NoStmtClass = 0,
@@ -1622,7 +1623,7 @@ class NullStmt : public Stmt {
 };
 
 /// CompoundStmt - This represents a group of statements like { stmt stmt }.
-class CompoundStmt final
+class CLANG_ABI CompoundStmt final
     : public Stmt,
       private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
   friend class ASTStmtReader;
@@ -1822,7 +1823,7 @@ class SwitchCase : public Stmt {
 
 /// CaseStmt - Represent a case statement. It can optionally be a GNU case
 /// statement of the form LHS ... RHS representing a range of cases.
-class CaseStmt final
+class CLANG_ABI CaseStmt final
     : public SwitchCase,
       private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
   friend TrailingObjects;
@@ -2035,7 +2036,7 @@ Stmt *SwitchCase::getSubStmt() {
 /// Value statements have a special meaning when they are the last non-null
 /// statement in a GNU statement expression, where they determine the value
 /// of the statement expression.
-class ValueStmt : public Stmt {
+class CLANG_ABI ValueStmt : public Stmt {
 protected:
   using Stmt::Stmt;
 
@@ -2054,7 +2055,7 @@ class ValueStmt : public Stmt {
 
 /// LabelStmt - Represents a label, which has a substatement.  For example:
 ///    foo: return;
-class LabelStmt : public ValueStmt {
+class CLANG_ABI LabelStmt : public ValueStmt {
   LabelDecl *TheDecl;
   Stmt *SubStmt;
   bool SideEntry = false;
@@ -2101,7 +2102,7 @@ class LabelStmt : public ValueStmt {
 ///
 /// Represents an attribute applied to a statement. For example:
 ///   [[omp::for(...)]] for (...) { ... }
-class AttributedStmt final
+class CLANG_ABI AttributedStmt final
     : public ValueStmt,
       private llvm::TrailingObjects<AttributedStmt, const Attr *> {
   friend class ASTStmtReader;
@@ -2159,7 +2160,7 @@ class AttributedStmt final
 };
 
 /// IfStmt - This represents an if/then/else.
-class IfStmt final
+class CLANG_ABI IfStmt final
     : public Stmt,
       private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
   friend TrailingObjects;
@@ -2410,7 +2411,7 @@ class IfStmt final
 };
 
 /// SwitchStmt - This represents a 'switch' stmt.
-class SwitchStmt final : public Stmt,
+class CLANG_ABI SwitchStmt final : public Stmt,
                          private llvm::TrailingObjects<SwitchStmt, Stmt *> {
   friend TrailingObjects;
 
@@ -2606,7 +2607,7 @@ class SwitchStmt final : public Stmt,
 };
 
 /// WhileStmt - This represents a 'while' stmt.
-class WhileStmt final : public Stmt,
+class CLANG_ABI WhileStmt final : public Stmt,
                         private llvm::TrailingObjects<WhileStmt, Stmt *> {
   friend TrailingObjects;
 
@@ -2804,7 +2805,7 @@ class DoStmt : public Stmt {
 /// ForStmt - This represents a 'for (init;cond;inc)' stmt.  Note that any of
 /// the init/cond/inc parts of the ForStmt will be null if they were not
 /// specified in the source.
-class ForStmt : public Stmt {
+class CLANG_ABI ForStmt : public Stmt {
   friend class ASTStmtReader;
 
   enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
@@ -2924,7 +2925,7 @@ class GotoStmt : public Stmt {
 };
 
 /// IndirectGotoStmt - This represents an indirect goto.
-class IndirectGotoStmt : public Stmt {
+class CLANG_ABI IndirectGotoStmt : public Stmt {
   SourceLocation StarLoc;
   Stmt *Target;
 
@@ -3040,7 +3041,7 @@ class BreakStmt : public Stmt {
 /// return a value, and it allows returning a value in functions declared to
 /// return void.  We explicitly model this in the AST, which means you can't
 /// depend on the return type of the function and the presence of an argument.
-class ReturnStmt final
+class CLANG_ABI ReturnStmt final
     : public Stmt,
       private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
   friend TrailingObjects;
@@ -3123,7 +3124,7 @@ class ReturnStmt final
 };
 
 /// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
-class AsmStmt : public Stmt {
+class CLANG_ABI AsmStmt : public Stmt {
 protected:
   friend class ASTStmtReader;
 
@@ -3282,7 +3283,7 @@ class AsmStmt : public Stmt {
 };
 
 /// This represents a GCC inline-assembly statement extension.
-class GCCAsmStmt : public AsmStmt {
+class CLANG_ABI GCCAsmStmt : public AsmStmt {
   friend class ASTStmtReader;
 
   SourceLocation RParenLoc;
@@ -3317,7 +3318,7 @@ class GCCAsmStmt : public AsmStmt {
   /// AsmStringPiece - this is part of a decomposed asm string specification
   /// (for use with the AnalyzeAsmString function below).  An asm string is
   /// considered to be a concatenation of these parts.
-  class AsmStringPiece {
+  class CLANG_ABI AsmStringPiece {
   public:
     enum Kind {
       String,  // String in .ll asm string form, "$" -> "$$" and "%%" -> "%".
@@ -3505,7 +3506,7 @@ class GCCAsmStmt : public AsmStmt {
 };
 
 /// This represents a Microsoft inline-assembly statement extension.
-class MSAsmStmt : public AsmStmt {
+class CLANG_ABI MSAsmStmt : public AsmStmt {
   friend class ASTStmtReader;
 
   SourceLocation LBraceLoc, EndLoc;
@@ -3609,7 +3610,7 @@ class MSAsmStmt : public AsmStmt {
   }
 };
 
-class SEHExceptStmt : public Stmt {
+class CLANG_ABI SEHExceptStmt : public Stmt {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -3653,7 +3654,7 @@ class SEHExceptStmt : public Stmt {
   }
 };
 
-class SEHFinallyStmt : public Stmt {
+class CLANG_ABI SEHFinallyStmt : public Stmt {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -3688,7 +3689,7 @@ class SEHFinallyStmt : public Stmt {
   }
 };
 
-class SEHTryStmt : public Stmt {
+class CLANG_ABI SEHTryStmt : public Stmt {
   friend class ASTReader;
   friend class ASTStmtReader;
 
@@ -3780,7 +3781,7 @@ class SEHLeaveStmt : public Stmt {
 ///   compute();
 /// }
 /// @endcode
-class CapturedStmt : public Stmt {
+class CLANG_ABI CapturedStmt : public Stmt {
 public:
   /// The different capture forms: by 'this', by reference, capture for
   /// variable-length array type etc.
@@ -3793,7 +3794,7 @@ class CapturedStmt : public Stmt {
 
   /// Describes the capture of either a variable, or 'this', or
   /// variable-length array type.
-  class Capture {
+  class CLANG_ABI Capture {
     llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
     SourceLocation Loc;
 
diff --git a/clang/include/clang/AST/StmtCXX.h b/clang/include/clang/AST/StmtCXX.h
index 8b4ef24ed376a1..04e7f91e3040b0 100644
--- a/clang/include/clang/AST/StmtCXX.h
+++ b/clang/include/clang/AST/StmtCXX.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Stmt.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
@@ -25,7 +26,7 @@ class VarDecl;
 
 /// CXXCatchStmt - This represents a C++ catch block.
 ///
-class CXXCatchStmt : public Stmt {
+class CLANG_ABI CXXCatchStmt : public Stmt {
   SourceLocation CatchLoc;
   /// The exception-declaration of the type.
   VarDecl *ExceptionDecl;
@@ -65,7 +66,7 @@ class CXXCatchStmt : public Stmt {
 
 /// CXXTryStmt - A C++ try block, including all handlers.
 ///
-class CXXTryStmt final : public Stmt,
+class CLANG_ABI CXXTryStmt final : public Stmt,
                          private llvm::TrailingObjects<CXXTryStmt, Stmt *> {
 
   friend TrailingObjects;
@@ -132,7 +133,7 @@ class CXXTryStmt final : public Stmt,
 /// This is stored in a partially-desugared form to allow full semantic
 /// analysis of the constituent components. The original syntactic components
 /// can be extracted using getLoopVariable and getRangeInit.
-class CXXForRangeStmt : public Stmt {
+class CLANG_ABI CXXForRangeStmt : public Stmt {
   SourceLocation ForLoc;
   enum { INIT, RANGE, BEGINSTMT, ENDSTMT, COND, INC, LOOPVAR, BODY, END };
   // SubExprs[RANGE] is an expression or declstmt.
@@ -315,7 +316,7 @@ class MSDependentExistsStmt : public Stmt {
 /// Represents the body of a coroutine. This wraps the normal function
 /// body and holds the additional semantic context required to set up and tear
 /// down the coroutine frame.
-class CoroutineBodyStmt final
+class CLANG_ABI CoroutineBodyStmt final
     : public Stmt,
       private llvm::TrailingObjects<CoroutineBodyStmt, Stmt *> {
   enum SubStmt {
diff --git a/clang/include/clang/AST/StmtIterator.h b/clang/include/clang/AST/StmtIterator.h
index e98408c51a5054..e50dd8c84ae862 100644
--- a/clang/include/clang/AST/StmtIterator.h
+++ b/clang/include/clang/AST/StmtIterator.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_AST_STMTITERATOR_H
 #define LLVM_CLANG_AST_STMTITERATOR_H
 
+#include "clang/Support/Compiler.h"
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
@@ -24,7 +25,7 @@ class Decl;
 class Stmt;
 class VariableArrayType;
 
-class StmtIteratorBase {
+class CLANG_ABI StmtIteratorBase {
 protected:
   enum {
     StmtMode = 0x0,
diff --git a/clang/include/clang/AST/StmtObjC.h b/clang/include/clang/AST/StmtObjC.h
index 03bc61f54cdf53..5871011d3dc521 100644
--- a/clang/include/clang/AST/StmtObjC.h
+++ b/clang/include/clang/AST/StmtObjC.h
@@ -13,6 +13,7 @@
 #define LLVM_CLANG_AST_STMTOBJC_H
 
 #include "clang/AST/Stmt.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
@@ -20,7 +21,7 @@ namespace clang {
 /// Represents Objective-C's collection statement.
 ///
 /// This is represented as 'for (element 'in' collection-expression)' stmt.
-class ObjCForCollectionStmt : public Stmt {
+class CLANG_ABI ObjCForCollectionStmt : public Stmt {
   enum { ELEM, COLLECTION, BODY, END_EXPR };
   Stmt* SubExprs[END_EXPR]; // SubExprs[ELEM] is an expression or declstmt.
   SourceLocation ForLoc;
@@ -162,7 +163,7 @@ class ObjCAtFinallyStmt : public Stmt {
 };
 
 /// Represents Objective-C's \@try ... \@catch ... \@finally statement.
-class ObjCAtTryStmt final
+class CLANG_ABI ObjCAtTryStmt final
     : public Stmt,
       private llvm::TrailingObjects<ObjCAtTryStmt, Stmt *> {
   friend TrailingObjects;
diff --git a/clang/include/clang/AST/StmtOpenACC.h b/clang/include/clang/AST/StmtOpenACC.h
index b3aea09be03ddf..e2483627e7df10 100644
--- a/clang/include/clang/AST/StmtOpenACC.h
+++ b/clang/include/clang/AST/StmtOpenACC.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Stmt.h"
 #include "clang/Basic/OpenACCKinds.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace clang {
@@ -126,7 +127,7 @@ class OpenACCLoopConstruct;
 /// those three, as they are semantically identical, and have only minor
 /// differences in the permitted list of clauses, which can be differentiated by
 /// the 'Kind'.
-class OpenACCComputeConstruct final
+class CLANG_ABI OpenACCComputeConstruct final
     : public OpenACCAssociatedStmtConstruct,
       public llvm::TrailingObjects<OpenACCComputeConstruct,
                                    const OpenACCClause *> {
@@ -194,7 +195,7 @@ class OpenACCComputeConstruct final
 /// This class represents a 'loop' construct.  The 'loop' construct applies to a
 /// 'for' loop (or range-for loop), and is optionally associated with a Compute
 /// Construct.
-class OpenACCLoopConstruct final
+class CLANG_ABI OpenACCLoopConstruct final
     : public OpenACCAssociatedStmtConstruct,
       public llvm::TrailingObjects<OpenACCLoopConstruct,
                                    const OpenACCClause *> {
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index 930670d17f2d1c..7fb7e8b22a332b 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -21,6 +21,7 @@
 #include "clang/AST/StmtCXX.h"
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -263,7 +264,7 @@ class OMPCanonicalLoop : public Stmt {
 /// This is a basic class for representing single OpenMP executable
 /// directive.
 ///
-class OMPExecutableDirective : public Stmt {
+class CLANG_ABI OMPExecutableDirective : public Stmt {
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 
@@ -609,7 +610,7 @@ class OMPExecutableDirective : public Stmt {
 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
 /// variables 'c' and 'd'.
 ///
-class OMPParallelDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPParallelDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -680,7 +681,7 @@ class OMPParallelDirective : public OMPExecutableDirective {
 
 /// The base class for all loop-based directives, including loop transformation
 /// directives.
-class OMPLoopBasedDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPLoopBasedDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
 
 protected:
@@ -957,7 +958,7 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
 };
 
 /// The base class for all loop transformation directives.
-class OMPLoopTransformationDirective : public OMPLoopBasedDirective {
+class CLANG_ABI OMPLoopTransformationDirective : public OMPLoopBasedDirective {
   friend class ASTStmtReader;
 
   /// Number of loops generated by this loop transformation.
@@ -1001,7 +1002,7 @@ class OMPLoopTransformationDirective : public OMPLoopBasedDirective {
 /// This is a common base class for loop directives ('omp simd', 'omp
 /// for', 'omp for simd' etc.). It is responsible for the loop code generation.
 ///
-class OMPLoopDirective : public OMPLoopBasedDirective {
+class CLANG_ABI OMPLoopDirective : public OMPLoopBasedDirective {
   friend class ASTStmtReader;
 
   /// Offsets to the stored exprs.
@@ -1568,7 +1569,7 @@ class OMPLoopDirective : public OMPLoopBasedDirective {
 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
 ///
-class OMPSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -1631,7 +1632,7 @@ class OMPSimdDirective : public OMPLoopDirective {
 /// variables 'a' and 'b' and 'reduction' with operator '+' and variables 'c'
 /// and 'd'.
 ///
-class OMPForDirective : public OMPLoopDirective {
+class CLANG_ABI OMPForDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if current directive has inner cancel directive.
@@ -1721,7 +1722,7 @@ class OMPForDirective : public OMPLoopDirective {
 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
 ///
-class OMPForSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPForSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -1784,7 +1785,7 @@ class OMPForSimdDirective : public OMPLoopDirective {
 /// the variables 'a' and 'b' and 'reduction' with operator '+' and variables
 /// 'c' and 'd'.
 ///
-class OMPSectionsDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPSectionsDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -1861,7 +1862,7 @@ class OMPSectionsDirective : public OMPExecutableDirective {
 /// #pragma omp section
 /// \endcode
 ///
-class OMPSectionDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPSectionDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -1922,7 +1923,7 @@ class OMPSectionDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp scope' has clauses 'private' with
 /// the variables 'a' and 'b' and nowait.
 ///
-class OMPScopeDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPScopeDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -1974,7 +1975,7 @@ class OMPScopeDirective final : public OMPExecutableDirective {
 /// In this example directive '#pragma omp single' has clauses 'private' with
 /// the variables 'a' and 'b' and 'copyprivate' with variables 'c' and 'd'.
 ///
-class OMPSingleDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPSingleDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2025,7 +2026,7 @@ class OMPSingleDirective : public OMPExecutableDirective {
 /// #pragma omp master
 /// \endcode
 ///
-class OMPMasterDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPMasterDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2073,7 +2074,7 @@ class OMPMasterDirective : public OMPExecutableDirective {
 /// #pragma omp critical
 /// \endcode
 ///
-class OMPCriticalDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPCriticalDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Name of the directive.
@@ -2144,7 +2145,7 @@ class OMPCriticalDirective : public OMPExecutableDirective {
 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
 /// variables 'c' and 'd'.
 ///
-class OMPParallelForDirective : public OMPLoopDirective {
+class CLANG_ABI OMPParallelForDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -2241,7 +2242,7 @@ class OMPParallelForDirective : public OMPLoopDirective {
 /// and linear step 's', 'reduction' with operator '+' and variables 'c' and
 /// 'd'.
 ///
-class OMPParallelForSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPParallelForSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2306,7 +2307,7 @@ class OMPParallelForSimdDirective : public OMPLoopDirective {
 /// In this example directive '#pragma omp parallel master' has clauses
 /// 'private' with the variables 'a' and 'b'
 ///
-class OMPParallelMasterDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPParallelMasterDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -2369,7 +2370,7 @@ class OMPParallelMasterDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp parallel masked' has a clause
 /// 'filter' with the variable tid
 ///
-class OMPParallelMaskedDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPParallelMaskedDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -2433,7 +2434,7 @@ class OMPParallelMaskedDirective final : public OMPExecutableDirective {
 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
 /// and variables 'c' and 'd'.
 ///
-class OMPParallelSectionsDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPParallelSectionsDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -2514,7 +2515,7 @@ class OMPParallelSectionsDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp task' has clauses 'private' with the
 /// variables 'a' and 'b' and 'final' with condition 'd'.
 ///
-class OMPTaskDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTaskDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if this directive has inner cancel directive.
@@ -2576,7 +2577,7 @@ class OMPTaskDirective : public OMPExecutableDirective {
 /// #pragma omp taskyield
 /// \endcode
 ///
-class OMPTaskyieldDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTaskyieldDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2622,7 +2623,7 @@ class OMPTaskyieldDirective : public OMPExecutableDirective {
 /// #pragma omp barrier
 /// \endcode
 ///
-class OMPBarrierDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPBarrierDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2668,7 +2669,7 @@ class OMPBarrierDirective : public OMPExecutableDirective {
 /// #pragma omp taskwait
 /// \endcode
 ///
-class OMPTaskwaitDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTaskwaitDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2719,7 +2720,7 @@ class OMPTaskwaitDirective : public OMPExecutableDirective {
 /// #pragma omp taskgroup
 /// \endcode
 ///
-class OMPTaskgroupDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTaskgroupDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2786,7 +2787,7 @@ class OMPTaskgroupDirective : public OMPExecutableDirective {
 /// 'omp flush' directive does not have clauses but have an optional list of
 /// variables to flush. This list of variables is stored within some fake clause
 /// FlushClause.
-class OMPFlushDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPFlushDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2838,7 +2839,7 @@ class OMPFlushDirective : public OMPExecutableDirective {
 /// \endcode
 /// In this example directive '#pragma omp  depobj' initializes a depobj object
 /// 'a' with dependence type 'in' and a list with 'x' and 'y' locators.
-class OMPDepobjDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPDepobjDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -2890,7 +2891,7 @@ class OMPDepobjDirective final : public OMPExecutableDirective {
 /// #pragma omp ordered
 /// \endcode
 ///
-class OMPOrderedDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPOrderedDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -2944,7 +2945,7 @@ class OMPOrderedDirective : public OMPExecutableDirective {
 /// \endcode
 /// In this example directive '#pragma omp atomic' has clause 'capture'.
 ///
-class OMPAtomicDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPAtomicDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -3149,7 +3150,7 @@ class OMPAtomicDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp target' has clause 'if' with
 /// condition 'a'.
 ///
-class OMPTargetDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3203,7 +3204,7 @@ class OMPTargetDirective : public OMPExecutableDirective {
 /// with the value '0', 'if' with condition 'a' and 'map' with array
 /// section 'b[:]'.
 ///
-class OMPTargetDataDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetDataDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3257,7 +3258,7 @@ class OMPTargetDataDirective : public OMPExecutableDirective {
 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
 /// section 'b[:]'.
 ///
-class OMPTargetEnterDataDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetEnterDataDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3312,7 +3313,7 @@ class OMPTargetEnterDataDirective : public OMPExecutableDirective {
 /// 'device' with the value '0', 'if' with condition 'a' and 'map' with array
 /// section 'b[:]'.
 ///
-class OMPTargetExitDataDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetExitDataDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3366,7 +3367,7 @@ class OMPTargetExitDataDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp target parallel' has clause 'if' with
 /// condition 'a'.
 ///
-class OMPTargetParallelDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetParallelDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -3446,7 +3447,7 @@ class OMPTargetParallelDirective : public OMPExecutableDirective {
 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
 /// and variables 'c' and 'd'.
 ///
-class OMPTargetParallelForDirective : public OMPLoopDirective {
+class CLANG_ABI OMPTargetParallelForDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -3541,7 +3542,7 @@ class OMPTargetParallelForDirective : public OMPLoopDirective {
 /// In this example directive '#pragma omp teams' has clause 'if' with
 /// condition 'a'.
 ///
-class OMPTeamsDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTeamsDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3594,7 +3595,7 @@ class OMPTeamsDirective : public OMPExecutableDirective {
 /// \endcode
 ///
 /// In this example a cancellation point is created for innermost 'for' region.
-class OMPCancellationPointDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPCancellationPointDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
@@ -3652,7 +3653,7 @@ class OMPCancellationPointDirective : public OMPExecutableDirective {
 /// \endcode
 ///
 /// In this example a cancel is created for innermost 'for' region.
-class OMPCancelDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPCancelDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   OpenMPDirectiveKind CancelRegion = llvm::omp::OMPD_unknown;
@@ -3712,7 +3713,7 @@ class OMPCancelDirective : public OMPExecutableDirective {
 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
 /// 'num_tasks' with expression 'num'.
 ///
-class OMPTaskLoopDirective : public OMPLoopDirective {
+class CLANG_ABI OMPTaskLoopDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -3785,7 +3786,7 @@ class OMPTaskLoopDirective : public OMPLoopDirective {
 /// with the variables 'a' and 'b', 'grainsize' with expression 'val' and
 /// 'num_tasks' with expression 'num'.
 ///
-class OMPTaskLoopSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPTaskLoopSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -3851,7 +3852,7 @@ class OMPTaskLoopSimdDirective : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPMasterTaskLoopDirective : public OMPLoopDirective {
+class CLANG_ABI OMPMasterTaskLoopDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -3927,7 +3928,7 @@ class OMPMasterTaskLoopDirective : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPMaskedTaskLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPMaskedTaskLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -4003,7 +4004,7 @@ class OMPMaskedTaskLoopDirective final : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPMasterTaskLoopSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPMasterTaskLoopSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -4068,7 +4069,7 @@ class OMPMasterTaskLoopSimdDirective : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -4134,7 +4135,7 @@ class OMPMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
+class CLANG_ABI OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -4212,7 +4213,7 @@ class OMPParallelMasterTaskLoopDirective : public OMPLoopDirective {
 /// 'private' with the variables 'a' and 'b', 'grainsize' with expression 'val'
 /// and 'num_tasks' with expression 'num'.
 ///
-class OMPParallelMaskedTaskLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPParallelMaskedTaskLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -4290,7 +4291,7 @@ class OMPParallelMaskedTaskLoopDirective final : public OMPLoopDirective {
 /// clauses 'private' with the variables 'a' and 'b', 'grainsize' with
 /// expression 'val' and 'num_tasks' with expression 'num'.
 ///
-class OMPParallelMasterTaskLoopSimdDirective : public OMPLoopDirective {
+class CLANG_ABI OMPParallelMasterTaskLoopSimdDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -4357,7 +4358,7 @@ class OMPParallelMasterTaskLoopSimdDirective : public OMPLoopDirective {
 /// clauses 'private' with the variables 'a' and 'b', 'grainsize' with
 /// expression 'val' and 'num_tasks' with expression 'num'.
 ///
-class OMPParallelMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPParallelMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -4422,7 +4423,7 @@ class OMPParallelMaskedTaskLoopSimdDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp distribute' has clauses 'private'
 /// with the variables 'a' and 'b'
 ///
-class OMPDistributeDirective : public OMPLoopDirective {
+class CLANG_ABI OMPDistributeDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4488,7 +4489,7 @@ class OMPDistributeDirective : public OMPLoopDirective {
 /// argument 'a', clause 'from' with argument 'b' and clause 'device' with
 /// argument '1'.
 ///
-class OMPTargetUpdateDirective : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetUpdateDirective : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -4544,7 +4545,7 @@ class OMPTargetUpdateDirective : public OMPExecutableDirective {
 /// In this example directive '#pragma omp distribute parallel for' has clause
 /// 'private' with the variables 'a' and 'b'
 ///
-class OMPDistributeParallelForDirective : public OMPLoopDirective {
+class CLANG_ABI OMPDistributeParallelForDirective : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -4640,7 +4641,7 @@ class OMPDistributeParallelForDirective : public OMPLoopDirective {
 /// In this example directive '#pragma omp distribute parallel for simd' has
 /// clause 'private' with the variables 'x'
 ///
-class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4705,7 +4706,7 @@ class OMPDistributeParallelForSimdDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp distribute simd' has clause
 /// 'private' with the variables 'x'
 ///
-class OMPDistributeSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPDistributeSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4771,7 +4772,7 @@ class OMPDistributeSimdDirective final : public OMPLoopDirective {
 /// 'private' with the variable 'a', 'map' with the variable 'b' and 'safelen'
 /// with the variable 'c'.
 ///
-class OMPTargetParallelForSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetParallelForSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4838,7 +4839,7 @@ class OMPTargetParallelForSimdDirective final : public OMPLoopDirective {
 /// with the variable 'a', 'map' with the variable 'b' and 'safelen' with
 /// the variable 'c'.
 ///
-class OMPTargetSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4903,7 +4904,7 @@ class OMPTargetSimdDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp teams distribute' has clauses
 /// 'private' with the variables 'a' and 'b'
 ///
-class OMPTeamsDistributeDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTeamsDistributeDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -4969,7 +4970,7 @@ class OMPTeamsDistributeDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp teams distribute simd'
 /// has clause 'private' with the variables 'a' and 'b'
 ///
-class OMPTeamsDistributeSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTeamsDistributeSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5036,7 +5037,7 @@ class OMPTeamsDistributeSimdDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp teams distribute parallel for simd'
 /// has clause 'private' with the variables 'x'
 ///
-class OMPTeamsDistributeParallelForSimdDirective final
+class CLANG_ABI OMPTeamsDistributeParallelForSimdDirective final
     : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
@@ -5103,7 +5104,7 @@ class OMPTeamsDistributeParallelForSimdDirective final
 /// In this example directive '#pragma omp teams distribute parallel for'
 /// has clause 'private' with the variables 'x'
 ///
-class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if the construct has inner cancel directive.
@@ -5196,7 +5197,7 @@ class OMPTeamsDistributeParallelForDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp target teams' has clause 'if' with
 /// condition 'a>0'.
 ///
-class OMPTargetTeamsDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPTargetTeamsDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -5252,7 +5253,7 @@ class OMPTargetTeamsDirective final : public OMPExecutableDirective {
 /// In this example directive '#pragma omp target teams distribute' has clause
 /// 'private' with the variables 'x'
 ///
-class OMPTargetTeamsDistributeDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetTeamsDistributeDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5318,7 +5319,7 @@ class OMPTargetTeamsDistributeDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp target teams distribute parallel
 /// for' has clause 'private' with the variables 'x'
 ///
-class OMPTargetTeamsDistributeParallelForDirective final
+class CLANG_ABI OMPTargetTeamsDistributeParallelForDirective final
     : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
@@ -5416,7 +5417,7 @@ class OMPTargetTeamsDistributeParallelForDirective final
 /// In this example directive '#pragma omp target teams distribute parallel
 /// for simd' has clause 'private' with the variables 'x'
 ///
-class OMPTargetTeamsDistributeParallelForSimdDirective final
+class CLANG_ABI OMPTargetTeamsDistributeParallelForSimdDirective final
     : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
@@ -5487,7 +5488,7 @@ class OMPTargetTeamsDistributeParallelForSimdDirective final
 /// In this example directive '#pragma omp target teams distribute simd'
 /// has clause 'private' with the variables 'x'
 ///
-class OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5545,7 +5546,7 @@ class OMPTargetTeamsDistributeSimdDirective final : public OMPLoopDirective {
 };
 
 /// This represents the '#pragma omp tile' loop transformation directive.
-class OMPTileDirective final : public OMPLoopTransformationDirective {
+class CLANG_ABI OMPTileDirective final : public OMPLoopTransformationDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5627,7 +5628,7 @@ class OMPTileDirective final : public OMPLoopTransformationDirective {
 /// #pragma omp unroll
 /// for (int i = 0; i < 64; ++i)
 /// \endcode
-class OMPUnrollDirective final : public OMPLoopTransformationDirective {
+class CLANG_ABI OMPUnrollDirective final : public OMPLoopTransformationDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5701,7 +5702,7 @@ class OMPUnrollDirective final : public OMPLoopTransformationDirective {
 /// for (int i = 0; i < n; ++i)
 ///   ...
 /// \endcode
-class OMPReverseDirective final : public OMPLoopTransformationDirective {
+class CLANG_ABI OMPReverseDirective final : public OMPLoopTransformationDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5766,7 +5767,7 @@ class OMPReverseDirective final : public OMPLoopTransformationDirective {
 ///     for (int j = 0; j < n; ++j)
 ///       ..
 /// \endcode
-class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
+class CLANG_ABI OMPInterchangeDirective final : public OMPLoopTransformationDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5839,7 +5840,7 @@ class OMPInterchangeDirective final : public OMPLoopTransformationDirective {
 /// \endcode
 /// In this example directive '#pragma omp scan' has clause 'inclusive' with
 /// list item 'a'.
-class OMPScanDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPScanDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -5892,7 +5893,7 @@ class OMPScanDirective final : public OMPExecutableDirective {
 /// In this example directive '#pragma omp interop' has
 /// clauses 'init', 'device', 'depend' and 'nowait'.
 ///
-class OMPInteropDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPInteropDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -5945,7 +5946,7 @@ class OMPInteropDirective final : public OMPExecutableDirective {
 /// This example shows a directive '#pragma omp dispatch' with a
 /// device clause with variable 'dnum'.
 ///
-class OMPDispatchDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPDispatchDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -6010,7 +6011,7 @@ class OMPDispatchDirective final : public OMPExecutableDirective {
 /// This example shows a directive '#pragma omp masked' with a filter clause
 /// with variable 'tid'.
 ///
-class OMPMaskedDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPMaskedDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
@@ -6061,7 +6062,7 @@ class OMPMaskedDirective final : public OMPExecutableDirective {
 /// In this example directive '#pragma omp metadirective' has clauses 'when'
 /// with a dynamic user condition to check if a variable 'N > 10'
 ///
-class OMPMetaDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPMetaDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   Stmt *IfStmt;
@@ -6100,7 +6101,7 @@ class OMPMetaDirective final : public OMPExecutableDirective {
 /// clauses 'private' with the variables 'a' and 'b', 'binding' with
 /// modifier 'parallel' and 'order(concurrent).
 ///
-class OMPGenericLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPGenericLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -6162,7 +6163,7 @@ class OMPGenericLoopDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp teams loop' has
 /// clauses 'private' with the variables 'a' and 'b', and order(concurrent).
 ///
-class OMPTeamsGenericLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTeamsGenericLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -6227,7 +6228,7 @@ class OMPTeamsGenericLoopDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp target teams loop' has
 /// clauses 'private' with the variables 'a' and 'b', and order(concurrent).
 ///
-class OMPTargetTeamsGenericLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetTeamsGenericLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// true if loop directive's associated loop can be a parallel for.
@@ -6302,7 +6303,7 @@ class OMPTargetTeamsGenericLoopDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp parallel loop' has
 /// clauses 'private' with the variables 'a' and 'b', and order(concurrent).
 ///
-class OMPParallelGenericLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPParallelGenericLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -6367,7 +6368,7 @@ class OMPParallelGenericLoopDirective final : public OMPLoopDirective {
 /// In this example directive '#pragma omp target parallel loop' has
 /// clauses 'private' with the variables 'a' and 'b', and order(concurrent).
 ///
-class OMPTargetParallelGenericLoopDirective final : public OMPLoopDirective {
+class CLANG_ABI OMPTargetParallelGenericLoopDirective final : public OMPLoopDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -6429,7 +6430,7 @@ class OMPTargetParallelGenericLoopDirective final : public OMPLoopDirective {
 /// \code
 /// #pragma omp error
 /// \endcode
-class OMPErrorDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPErrorDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
   /// Build directive with the given start and end location.
@@ -6471,7 +6472,7 @@ class OMPErrorDirective final : public OMPExecutableDirective {
 
 // It's not really an executable directive, but it seems convenient to use
 // that as the parent class.
-class OMPAssumeDirective final : public OMPExecutableDirective {
+class CLANG_ABI OMPAssumeDirective final : public OMPExecutableDirective {
   friend class ASTStmtReader;
   friend class OMPExecutableDirective;
 
diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h
index 0eaa4b0eedb35f..3e9adc8a452a94 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -20,6 +20,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -58,7 +59,7 @@ class TypeSourceInfo;
 class ValueDecl;
 
 /// Represents a template argument.
-class TemplateArgument {
+class CLANG_ABI TemplateArgument {
 public:
   /// The kind of template argument we're storing.
   enum ArgKind {
@@ -469,7 +470,7 @@ class TemplateArgument {
 };
 
 /// Location information for a TemplateArgument.
-struct TemplateArgumentLocInfo {
+struct CLANG_ABI TemplateArgumentLocInfo {
 private:
   struct TemplateTemplateArgLocInfo {
     // FIXME: We'd like to just use the qualifier in the TemplateName,
@@ -521,7 +522,7 @@ struct TemplateArgumentLocInfo {
 
 /// Location wrapper for a TemplateArgument.  TemplateArgument is to
 /// TemplateArgumentLoc as Type is to TypeLoc.
-class TemplateArgumentLoc {
+class CLANG_ABI TemplateArgumentLoc {
   TemplateArgument Argument;
   TemplateArgumentLocInfo LocInfo;
 
@@ -671,7 +672,7 @@ class TemplateArgumentListInfo {
 /// the "<int>" in "sort<int>".
 /// This is safe to be used inside an AST node, in contrast with
 /// TemplateArgumentListInfo.
-struct ASTTemplateArgumentListInfo final
+struct CLANG_ABI ASTTemplateArgumentListInfo final
     : private llvm::TrailingObjects<ASTTemplateArgumentListInfo,
                                     TemplateArgumentLoc> {
 private:
@@ -725,7 +726,7 @@ struct ASTTemplateArgumentListInfo final
 /// as such, doesn't contain the array of TemplateArgumentLoc itself,
 /// but expects the containing object to also provide storage for
 /// that.
-struct alignas(void *) ASTTemplateKWAndArgsInfo {
+struct CLANG_ABI alignas(void *) ASTTemplateKWAndArgsInfo {
   /// The source location of the left angle bracket ('<').
   SourceLocation LAngleLoc;
 
@@ -757,7 +758,7 @@ struct alignas(void *) ASTTemplateKWAndArgsInfo {
                 TemplateArgumentListInfo &List) const;
 };
 
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       const TemplateArgument &Arg);
 
 } // namespace clang
diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h
index ce97f834bfc1dc..4bb9823e09fe97 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -16,6 +16,7 @@
 #include "clang/AST/DependenceFlags.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -145,7 +146,7 @@ class OverloadedTemplateStorage : public UncommonTemplateNameStorage {
 /// This kind of template names occurs when the parameter pack has been
 /// provided with a template template argument pack in a context where its
 /// enclosing pack expansion could not be fully expanded.
-class SubstTemplateTemplateParmPackStorage : public UncommonTemplateNameStorage,
+class CLANG_ABI SubstTemplateTemplateParmPackStorage : public UncommonTemplateNameStorage,
                                              public llvm::FoldingSetNode {
   const TemplateArgument *Arguments;
   llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
@@ -217,7 +218,7 @@ struct DefaultArguments {
 /// specifier in the typedef. "apply" is a nested template, and can
 /// only be understood in the context of a template instantiation,
 /// hence is represented as a dependent template name.
-class TemplateName {
+class CLANG_ABI TemplateName {
   // NameDecl is either a TemplateDecl or a UsingShadowDecl depending on the
   // NameKind.
   // !! There is no free low bits in 32-bit builds to discriminate more than 4
@@ -399,12 +400,12 @@ class TemplateName {
 
 /// Insertion operator for diagnostics.  This allows sending TemplateName's
 /// into a diagnostic with <<.
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       TemplateName N);
 
 /// A structure for storing the information associated with a
 /// substituted template template parameter.
-class SubstTemplateTemplateParmStorage
+class CLANG_ABI SubstTemplateTemplateParmStorage
   : public UncommonTemplateNameStorage, public llvm::FoldingSetNode {
   friend class ASTContext;
 
@@ -445,7 +446,7 @@ class SubstTemplateTemplateParmStorage
                       std::optional<unsigned> PackIndex);
 };
 
-class DeducedTemplateStorage : public UncommonTemplateNameStorage,
+class CLANG_ABI DeducedTemplateStorage : public UncommonTemplateNameStorage,
                                public llvm::FoldingSetNode {
   friend class ASTContext;
 
diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h
index 9c320c8ae3e54c..43c593c01ec318 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -19,13 +19,14 @@
 #include "clang/AST/CommentCommandTraits.h"
 #include "clang/AST/CommentVisitor.h"
 #include "clang/AST/DeclVisitor.h"
-#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TemplateArgumentVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
 #include "clang/AST/TypeVisitor.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -125,7 +126,7 @@ class TextTreeStructure {
       : OS(OS), ShowColors(ShowColors) {}
 };
 
-class TextNodeDumper
+class CLANG_ABI TextNodeDumper
     : public TextTreeStructure,
       public comments::ConstCommentVisitor<TextNodeDumper, void,
                                            const comments::FullComment *>,
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 8ff04cf89a6b91..a209f2dcfe921a 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -32,6 +32,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Visibility.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -320,7 +321,7 @@ class PointerAuthQualifier {
 /// * MS: __unaligned
 /// * Embedded C (TR18037): address spaces
 /// * Objective C: the GC attributes (none, weak, or strong)
-class Qualifiers {
+class CLANG_ABI Qualifiers {
 public:
   enum TQ : uint64_t {
     // NOTE: These flags must be kept in sync with DeclSpec::TQ.
@@ -942,7 +943,7 @@ enum class TypeOfKind : uint8_t {
 /// simple wrapper class that acts like a smart pointer.  A third bit
 /// indicates whether there are extended qualifiers present, in which
 /// case the pointer points to a special structure.
-class QualType {
+class CLANG_ABI QualType {
   friend class QualifierCollector;
 
   // Thankfully, these are efficiently composable.
@@ -1646,7 +1647,7 @@ class QualType {
   static bool hasNonTrivialToPrimitiveCopyCUnion(const RecordDecl *RD);
 };
 
-raw_ostream &operator<<(raw_ostream &OS, QualType QT);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, QualType QT);
 
 } // namespace clang
 
@@ -1831,7 +1832,7 @@ enum class VectorKind;
 ///
 /// Types, once created, are immutable.
 ///
-class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
+class CLANG_ABI alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
 public:
   enum TypeClass {
 #define TYPE(Class, Base) Class,
@@ -2997,25 +2998,25 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
 
 /// This will check for a TypedefType by removing any existing sugar
 /// until it reaches a TypedefType or a non-sugared type.
-template <> const TypedefType *Type::getAs() const;
-template <> const UsingType *Type::getAs() const;
+template <> CLANG_ABI const TypedefType *Type::getAs() const;
+template <> CLANG_ABI const UsingType *Type::getAs() const;
 
 /// This will check for a TemplateSpecializationType by removing any
 /// existing sugar until it reaches a TemplateSpecializationType or a
 /// non-sugared type.
-template <> const TemplateSpecializationType *Type::getAs() const;
+template <> CLANG_ABI const TemplateSpecializationType *Type::getAs() const;
 
 /// This will check for an AttributedType by removing any existing sugar
 /// until it reaches an AttributedType or a non-sugared type.
-template <> const AttributedType *Type::getAs() const;
+template <> CLANG_ABI const AttributedType *Type::getAs() const;
 
 /// This will check for a BoundsAttributedType by removing any existing
 /// sugar until it reaches an BoundsAttributedType or a non-sugared type.
-template <> const BoundsAttributedType *Type::getAs() const;
+template <> CLANG_ABI const BoundsAttributedType *Type::getAs() const;
 
 /// This will check for a CountAttributedType by removing any existing
 /// sugar until it reaches an CountAttributedType or a non-sugared type.
-template <> const CountAttributedType *Type::getAs() const;
+template <> CLANG_ABI const CountAttributedType *Type::getAs() const;
 
 // We can do canonical leaf types faster, because we don't have to
 // worry about preserving child type decoration.
@@ -3031,7 +3032,7 @@ template <> inline const Class##Type *Type::castAs() const { \
 
 /// This class is used for builtin types like 'int'.  Builtin
 /// types are always canonical and have a literal name field.
-class BuiltinType : public Type {
+class CLANG_ABI BuiltinType : public Type {
 public:
   enum Kind {
 // OpenCL image types
@@ -3223,7 +3224,7 @@ class PointerType : public Type, public llvm::FoldingSetNode {
 
 /// [BoundsSafety] Represents information of declarations referenced by the
 /// arguments of the `counted_by` attribute and the likes.
-class TypeCoupledDeclRefInfo {
+class CLANG_ABI TypeCoupledDeclRefInfo {
 public:
   using BaseTy = llvm::PointerIntPair<ValueDecl *, 1, unsigned>;
 
@@ -3255,7 +3256,7 @@ class TypeCoupledDeclRefInfo {
 /// Provides a common interface to navigate declarations referred to by the
 /// bounds expression.
 
-class BoundsAttributedType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI BoundsAttributedType : public Type, public llvm::FoldingSetNode {
   QualType WrappedTy;
 
 protected:
@@ -3300,7 +3301,7 @@ class BoundsAttributedType : public Type, public llvm::FoldingSetNode {
 
 /// Represents a sugar type with `__counted_by` or `__sized_by` annotations,
 /// including their `_or_null` variants.
-class CountAttributedType final
+class CLANG_ABI CountAttributedType final
     : public BoundsAttributedType,
       public llvm::TrailingObjects<CountAttributedType,
                                    TypeCoupledDeclRefInfo> {
@@ -3516,7 +3517,7 @@ class RValueReferenceType : public ReferenceType {
 /// A pointer to member type per C++ 8.3.3 - Pointers to members.
 ///
 /// This includes both pointers to data members and pointer to member functions.
-class MemberPointerType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI MemberPointerType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these.
 
   QualType PointeeType;
@@ -3574,7 +3575,7 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode {
 enum class ArraySizeModifier { Normal, Static, Star };
 
 /// Represents an array type, per C99 6.7.5.2 - Array Declarators.
-class ArrayType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI ArrayType : public Type, public llvm::FoldingSetNode {
 private:
   /// The element type of the array.
   QualType ElementType;
@@ -3612,7 +3613,7 @@ class ArrayType : public Type, public llvm::FoldingSetNode {
 /// Represents the canonical version of C arrays with a specified constant size.
 /// For example, the canonical type for 'int A[4 + 4*100]' is a
 /// ConstantArrayType where the element type is 'int' and the size is 404.
-class ConstantArrayType : public ArrayType {
+class CLANG_ABI ConstantArrayType : public ArrayType {
   friend class ASTContext; // ASTContext creates these.
 
   struct ExternalSize {
@@ -3857,7 +3858,7 @@ class VariableArrayType : public ArrayType {
 /// For these types, we won't actually know what the array bound is
 /// until template instantiation occurs, at which point this will
 /// become either a ConstantArrayType or a VariableArrayType.
-class DependentSizedArrayType : public ArrayType {
+class CLANG_ABI DependentSizedArrayType : public ArrayType {
   friend class ASTContext; // ASTContext creates these.
 
   /// An assignment expression that will instantiate to the
@@ -3915,7 +3916,7 @@ class DependentSizedArrayType : public ArrayType {
 ///   typedef T __attribute__((address_space(AddrSpace))) type;
 /// }
 /// \endcode
-class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI DependentAddressSpaceType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
 
   Expr *AddrSpaceExpr;
@@ -3955,7 +3956,7 @@ class DependentAddressSpaceType : public Type, public llvm::FoldingSetNode {
 ///   typedef T __attribute__((ext_vector_type(Size))) type;
 /// }
 /// \endcode
-class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
 
   Expr *SizeExpr;
@@ -4029,7 +4030,7 @@ enum class VectorKind {
 /// bytes; or from an Altivec __vector or vector declaration.
 /// Since the constructor takes the number of vector elements, the
 /// client is responsible for converting the size into the number of elements.
-class VectorType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI VectorType : public Type, public llvm::FoldingSetNode {
 protected:
   friend class ASTContext; // ASTContext creates these.
 
@@ -4081,7 +4082,7 @@ class VectorType : public Type, public llvm::FoldingSetNode {
 ///   typedef T __attribute__((vector_size(Size))) type;
 /// }
 /// \endcode
-class DependentVectorType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI DependentVectorType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
 
   QualType ElementType;
@@ -4191,7 +4192,7 @@ class ExtVectorType : public VectorType {
 /// Represents a matrix type, as defined in the Matrix Types clang extensions.
 /// __attribute__((matrix_type(rows, columns))), where "rows" specifies
 /// number of rows and "columns" specifies the number of columns.
-class MatrixType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI MatrixType : public Type, public llvm::FoldingSetNode {
 protected:
   friend class ASTContext;
 
@@ -4227,7 +4228,7 @@ class MatrixType : public Type, public llvm::FoldingSetNode {
 };
 
 /// Represents a concrete matrix type with constant number of rows and columns
-class ConstantMatrixType final : public MatrixType {
+class CLANG_ABI ConstantMatrixType final : public MatrixType {
 protected:
   friend class ASTContext;
 
@@ -4286,7 +4287,7 @@ class ConstantMatrixType final : public MatrixType {
 
 /// Represents a matrix type where the type and the number of rows and columns
 /// is dependent on a template.
-class DependentSizedMatrixType final : public MatrixType {
+class CLANG_ABI DependentSizedMatrixType final : public MatrixType {
   friend class ASTContext;
 
   Expr *RowExpr;
@@ -4316,7 +4317,7 @@ class DependentSizedMatrixType final : public MatrixType {
 
 /// FunctionType - C99 6.7.5.3 - Function Declarators.  This is the common base
 /// class of FunctionNoProtoType and FunctionProtoType.
-class FunctionType : public Type {
+class CLANG_ABI FunctionType : public Type {
   // The type returned by the function.
   QualType ResultType;
 
@@ -4711,7 +4712,7 @@ class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode {
 
 /// Represents an abstract function effect, using just an enumeration describing
 /// its kind.
-class FunctionEffect {
+class CLANG_ABI FunctionEffect {
 public:
   /// Identifies the particular effect.
   enum class Kind : uint8_t {
@@ -4835,7 +4836,7 @@ class EffectConditionExpr {
 /// A FunctionEffect plus a potential boolean expression determining whether
 /// the effect is declared (e.g. nonblocking(expr)). Generally the condition
 /// expression when present, is dependent.
-struct FunctionEffectWithCondition {
+struct CLANG_ABI FunctionEffectWithCondition {
   FunctionEffect Effect;
   EffectConditionExpr Cond;
 
@@ -4845,7 +4846,7 @@ struct FunctionEffectWithCondition {
   /// Return a textual description of the effect, and its condition, if any.
   std::string description() const;
 
-  friend raw_ostream &operator<<(raw_ostream &OS,
+  friend CLANG_ABI raw_ostream &operator<<(raw_ostream &OS,
                                  const FunctionEffectWithCondition &CFE);
 };
 
@@ -4898,7 +4899,7 @@ template <typename Container> class FunctionEffectIterator {
 /// FunctionProtoType.
 ///
 /// See also FunctionEffectSet, in Sema, which provides a mutable set.
-class FunctionEffectsRef {
+class CLANG_ABI FunctionEffectsRef {
   // Restrict classes which can call the private constructor -- these friends
   // all maintain the required invariants. FunctionEffectSet is generally the
   // only way in which the arrays are created; FunctionProtoType will not
@@ -4952,7 +4953,7 @@ class FunctionEffectsRef {
 };
 
 /// A mutable set of FunctionEffect::Kind.
-class FunctionEffectKindSet {
+class CLANG_ABI FunctionEffectKindSet {
   // For now this only needs to be a bitmap.
   constexpr static size_t EndBitPos = FunctionEffect::KindCount;
   using KindBitsT = std::bitset<EndBitPos>;
@@ -4973,7 +4974,7 @@ class FunctionEffectKindSet {
   }
 
   // Iterates through the bits which are set.
-  class iterator {
+  class CLANG_ABI iterator {
     const FunctionEffectKindSet *Outer = nullptr;
     size_t Idx = 0;
 
@@ -5034,7 +5035,7 @@ class FunctionEffectKindSet {
 /// Used to compare and merge effects on declarations.
 ///
 /// Has the same invariants as FunctionEffectsRef.
-class FunctionEffectSet {
+class CLANG_ABI FunctionEffectSet {
   SmallVector<FunctionEffect> Effects;
   SmallVector<EffectConditionExpr> Conditions;
 
@@ -5089,7 +5090,7 @@ class FunctionEffectSet {
 /// canonical type. FunctionProtoType has several trailing objects, some of
 /// which optional. For more information about the trailing objects see
 /// the first comment inside FunctionProtoType.
-class FunctionProtoType final
+class CLANG_ABI FunctionProtoType final
     : public FunctionType,
       public llvm::FoldingSetNode,
       private llvm::TrailingObjects<
@@ -5154,7 +5155,7 @@ class FunctionProtoType final
   /// ExceptionSpecInfo is not stored as such in FunctionProtoType but is
   /// used to group together the various bits of information about the
   /// exception specification.
-  struct ExceptionSpecInfo {
+  struct CLANG_ABI ExceptionSpecInfo {
     /// The kind of exception specification this is.
     ExceptionSpecificationType Type = EST_None;
 
@@ -5692,7 +5693,7 @@ class UnresolvedUsingType : public Type {
   }
 };
 
-class UsingType final : public Type,
+class CLANG_ABI UsingType final : public Type,
                         public llvm::FoldingSetNode,
                         private llvm::TrailingObjects<UsingType, QualType> {
   UsingShadowDecl *Found;
@@ -5724,7 +5725,7 @@ class UsingType final : public Type,
   static bool classof(const Type *T) { return T->getTypeClass() == Using; }
 };
 
-class TypedefType final : public Type,
+class CLANG_ABI TypedefType final : public Type,
                           public llvm::FoldingSetNode,
                           private llvm::TrailingObjects<TypedefType, QualType> {
   TypedefNameDecl *Decl;
@@ -5760,7 +5761,7 @@ class TypedefType final : public Type,
 
 /// Sugar type that represents a type that was qualified by a qualifier written
 /// as a macro invocation.
-class MacroQualifiedType : public Type {
+class CLANG_ABI MacroQualifiedType : public Type {
   friend class ASTContext; // ASTContext creates these.
 
   QualType UnderlyingTy;
@@ -5792,7 +5793,7 @@ class MacroQualifiedType : public Type {
 
 /// Represents a `typeof` (or __typeof__) expression (a C23 feature and GCC
 /// extension) or a `typeof_unqual` expression (a C23 feature).
-class TypeOfExprType : public Type {
+class CLANG_ABI TypeOfExprType : public Type {
   Expr *TOExpr;
   const ASTContext &Context;
 
@@ -5825,7 +5826,7 @@ class TypeOfExprType : public Type {
 /// This class is used internally by the ASTContext to manage
 /// canonical, dependent types, only. Clients will only see instances
 /// of this class via TypeOfExprType nodes.
-class DependentTypeOfExprType : public TypeOfExprType,
+class CLANG_ABI DependentTypeOfExprType : public TypeOfExprType,
                                 public llvm::FoldingSetNode {
 public:
   DependentTypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind)
@@ -5842,7 +5843,7 @@ class DependentTypeOfExprType : public TypeOfExprType,
 
 /// Represents `typeof(type)`, a C23 feature and GCC extension, or
 /// `typeof_unqual(type), a C23 feature.
-class TypeOfType : public Type {
+class CLANG_ABI TypeOfType : public Type {
   friend class ASTContext; // ASTContext creates these.
 
   QualType TOType;
@@ -5869,7 +5870,7 @@ class TypeOfType : public Type {
 };
 
 /// Represents the type `decltype(expr)` (C++11).
-class DecltypeType : public Type {
+class CLANG_ABI DecltypeType : public Type {
   Expr *E;
   QualType UnderlyingType;
 
@@ -5897,7 +5898,7 @@ class DecltypeType : public Type {
 /// This class is used internally by the ASTContext to manage
 /// canonical, dependent types, only. Clients will only see instances
 /// of this class via DecltypeType nodes.
-class DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode {
+class CLANG_ABI DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode {
 public:
   DependentDecltypeType(Expr *E, QualType UnderlyingTpe);
 
@@ -5909,7 +5910,7 @@ class DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode {
                       Expr *E);
 };
 
-class PackIndexingType final
+class CLANG_ABI PackIndexingType final
     : public Type,
       public llvm::FoldingSetNode,
       private llvm::TrailingObjects<PackIndexingType, QualType> {
@@ -5982,7 +5983,7 @@ class PackIndexingType final
 };
 
 /// A unary type transform, which is a type constructed from another.
-class UnaryTransformType : public Type {
+class CLANG_ABI UnaryTransformType : public Type {
 public:
   enum UTTKind {
 #define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
@@ -6024,7 +6025,7 @@ class UnaryTransformType : public Type {
 /// This class is used internally by the ASTContext to manage
 /// canonical, dependent types, only. Clients will only see instances
 /// of this class via UnaryTransformType nodes.
-class DependentUnaryTransformType : public UnaryTransformType,
+class CLANG_ABI DependentUnaryTransformType : public UnaryTransformType,
                                     public llvm::FoldingSetNode {
 public:
   DependentUnaryTransformType(const ASTContext &C, QualType BaseType,
@@ -6041,7 +6042,7 @@ class DependentUnaryTransformType : public UnaryTransformType,
   }
 };
 
-class TagType : public Type {
+class CLANG_ABI TagType : public Type {
   friend class ASTReader;
   template <class T> friend class serialization::AbstractTypeReader;
 
@@ -6065,7 +6066,7 @@ class TagType : public Type {
 
 /// A helper class that allows the use of isa/cast/dyncast
 /// to detect TagType objects of structs/unions/classes.
-class RecordType : public TagType {
+class CLANG_ABI RecordType : public TagType {
 protected:
   friend class ASTContext; // ASTContext creates these.
 
@@ -6120,7 +6121,7 @@ class EnumType : public TagType {
 ///   - the modified type is the TypedefType for int32_t
 ///   - the equivalent type is VectorType(16, int32_t)
 ///   - the canonical type is VectorType(16, int)
-class AttributedType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI AttributedType : public Type, public llvm::FoldingSetNode {
 public:
   using Kind = attr::Kind;
 
@@ -6312,7 +6313,7 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
   }
 };
 
-class TemplateTypeParmType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI TemplateTypeParmType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these
 
   // The associated TemplateTypeParmDecl for the non-canonical type.
@@ -6369,7 +6370,7 @@ class TemplateTypeParmType : public Type, public llvm::FoldingSetNode {
 /// been replaced with these.  They are used solely to record that a
 /// type was originally written as a template type parameter;
 /// therefore they are never canonical.
-class SubstTemplateTypeParmType final
+class CLANG_ABI SubstTemplateTypeParmType final
     : public Type,
       public llvm::FoldingSetNode,
       private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
@@ -6442,7 +6443,7 @@ class SubstTemplateTypeParmType final
 /// that pack expansion (e.g., when all template parameters have corresponding
 /// arguments), this type will be replaced with the \c SubstTemplateTypeParmType
 /// at the current pack substitution index.
-class SubstTemplateTypeParmPackType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI SubstTemplateTypeParmPackType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
 
   /// A pointer to the set of template arguments that this
@@ -6534,7 +6535,7 @@ class DeducedType : public Type {
 
 /// Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained
 /// by a type-constraint.
-class AutoType : public DeducedType, public llvm::FoldingSetNode {
+class CLANG_ABI AutoType : public DeducedType, public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these
 
   ConceptDecl *TypeConstraintConcept;
@@ -6639,7 +6640,7 @@ class DeducedTemplateSpecializationType : public DeducedType,
 /// TemplateArguments, followed by a QualType representing the
 /// non-canonical aliased type when the template is a type alias
 /// template.
-class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these
 
   /// The name of the template being specialized.  This is
@@ -6732,24 +6733,24 @@ class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
 
 /// Print a template argument list, including the '<' and '>'
 /// enclosing the template arguments.
-void printTemplateArgumentList(raw_ostream &OS,
+CLANG_ABI void printTemplateArgumentList(raw_ostream &OS,
                                ArrayRef<TemplateArgument> Args,
                                const PrintingPolicy &Policy,
                                const TemplateParameterList *TPL = nullptr);
 
-void printTemplateArgumentList(raw_ostream &OS,
+CLANG_ABI void printTemplateArgumentList(raw_ostream &OS,
                                ArrayRef<TemplateArgumentLoc> Args,
                                const PrintingPolicy &Policy,
                                const TemplateParameterList *TPL = nullptr);
 
-void printTemplateArgumentList(raw_ostream &OS,
+CLANG_ABI void printTemplateArgumentList(raw_ostream &OS,
                                const TemplateArgumentListInfo &Args,
                                const PrintingPolicy &Policy,
                                const TemplateParameterList *TPL = nullptr);
 
 /// Make a best-effort determination of whether the type T can be produced by
 /// substituting Args into the default argument of Param.
-bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
+CLANG_ABI bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
                                   const NamedDecl *Param,
                                   ArrayRef<TemplateArgument> Args,
                                   unsigned Depth);
@@ -6771,7 +6772,7 @@ bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
 /// declaration, and within that scope every template specialization
 /// will canonicalize to the injected class name (when appropriate
 /// according to the rules of the language).
-class InjectedClassNameType : public Type {
+class CLANG_ABI InjectedClassNameType : public Type {
   friend class ASTContext; // ASTContext creates these.
   friend class ASTNodeImporter;
   friend class ASTReader; // FIXME: ASTContext::getInjectedClassNameType is not
@@ -6870,7 +6871,7 @@ enum class TagTypeKind {
 /// The keyword in stored in the free bits of the base class.
 /// Also provides a few static helpers for converting and printing
 /// elaborated type keyword and tag type kind enumerations.
-class TypeWithKeyword : public Type {
+class CLANG_ABI TypeWithKeyword : public Type {
 protected:
   TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc,
                   QualType Canonical, TypeDependence Dependence)
@@ -7053,7 +7054,7 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
 /// Represents a template specialization type whose template cannot be
 /// resolved, e.g.
 ///   A<T>::template B<T>
-class DependentTemplateSpecializationType : public TypeWithKeyword,
+class CLANG_ABI DependentTemplateSpecializationType : public TypeWithKeyword,
                                             public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these
 
@@ -7228,7 +7229,7 @@ class ObjCProtocolQualifiers {
 
 /// Represents a type parameter type in Objective C. It can take
 /// a list of protocols.
-class ObjCTypeParamType : public Type,
+class CLANG_ABI ObjCTypeParamType : public Type,
                           public ObjCProtocolQualifiers<ObjCTypeParamType>,
                           public llvm::FoldingSetNode {
   friend class ASTContext;
@@ -7303,7 +7304,7 @@ class ObjCTypeParamType : public Type,
 /// 'id<P>' is an ObjCObjectPointerType whose pointee is an ObjCObjectType
 /// with base BuiltinType::ObjCIdType and protocol list [P].  Eventually
 /// this should get its own sugar class to better represent the source.
-class ObjCObjectType : public Type,
+class CLANG_ABI ObjCObjectType : public Type,
                        public ObjCProtocolQualifiers<ObjCObjectType> {
   friend class ObjCProtocolQualifiers<ObjCObjectType>;
 
@@ -7455,7 +7456,7 @@ class ObjCObjectType : public Type,
 /// of ObjCObjectType, so as to not increase the footprint of
 /// ObjCInterfaceType.  Code outside of ASTContext and the core type
 /// system should not reference this type.
-class ObjCObjectTypeImpl : public ObjCObjectType, public llvm::FoldingSetNode {
+class CLANG_ABI ObjCObjectTypeImpl : public ObjCObjectType, public llvm::FoldingSetNode {
   friend class ASTContext;
 
   // If anyone adds fields here, ObjCObjectType::getProtocolStorage()
@@ -7502,7 +7503,7 @@ inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
 ///     fail to compile.
 ///   - It is its own base type.  That is, if T is an ObjCInterfaceType*,
 ///     T->getBaseType() == QualType(T, 0).
-class ObjCInterfaceType : public ObjCObjectType {
+class CLANG_ABI ObjCInterfaceType : public ObjCObjectType {
   friend class ASTContext; // ASTContext creates these.
   friend class ASTReader;
   template <class T> friend class serialization::AbstractTypeReader;
@@ -7558,7 +7559,7 @@ inline ObjCInterfaceDecl *ObjCObjectType::getInterface() const {
 ///
 /// Pointers to pointers to Objective C objects are still PointerTypes;
 /// only the first level of pointer gets it own type implementation.
-class ObjCObjectPointerType : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI ObjCObjectPointerType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext; // ASTContext creates these.
 
   QualType PointeeType;
@@ -7792,7 +7793,7 @@ class PipeType : public Type, public llvm::FoldingSetNode {
 };
 
 /// A fixed int type of a specified bitwidth.
-class BitIntType final : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI BitIntType final : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
   LLVM_PREFERRED_TYPE(bool)
   unsigned IsUnsigned : 1;
@@ -7822,7 +7823,7 @@ class BitIntType final : public Type, public llvm::FoldingSetNode {
   static bool classof(const Type *T) { return T->getTypeClass() == BitInt; }
 };
 
-class DependentBitIntType final : public Type, public llvm::FoldingSetNode {
+class CLANG_ABI DependentBitIntType final : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;
   llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
 
@@ -7849,7 +7850,7 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode {
 };
 
 /// A qualifier set is used to build a set of qualifiers.
-class QualifierCollector : public Qualifiers {
+class CLANG_ABI QualifierCollector : public Qualifiers {
 public:
   QualifierCollector(Qualifiers Qs = Qualifiers()) : Qualifiers(Qs) {}
 
@@ -7880,7 +7881,7 @@ class QualifierCollector : public Qualifiers {
 /// TypeLoc TL = TypeSourceInfo->getTypeLoc();
 /// TL.getBeginLoc().print(OS, SrcMgr);
 /// @endcode
-class alignas(8) TypeSourceInfo {
+class CLANG_ABI alignas(8) TypeSourceInfo {
   // Contains a memory block after the class, used for type source information,
   // allocated by ASTContext.
   friend class ASTContext;
@@ -8521,8 +8522,8 @@ inline bool Type::isNullPtrType() const {
   return isSpecificBuiltinType(BuiltinType::NullPtr);
 }
 
-bool IsEnumDeclComplete(EnumDecl *);
-bool IsEnumDeclScoped(EnumDecl *);
+CLANG_ABI bool IsEnumDeclComplete(EnumDecl *);
+CLANG_ABI bool IsEnumDeclScoped(EnumDecl *);
 
 inline bool Type::isIntegerType() const {
   if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
@@ -8809,7 +8810,7 @@ QualType DecayedType::getPointeeType() const {
 // as a scaled integer.
 // TODO: At some point, we should change the arguments to instead just accept an
 // APFixedPoint instead of APSInt and scale.
-void FixedPointValueToString(SmallVectorImpl<char> &Str, llvm::APSInt Val,
+CLANG_ABI void FixedPointValueToString(SmallVectorImpl<char> &Str, llvm::APSInt Val,
                              unsigned Scale);
 
 inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) {
diff --git a/clang/include/clang/AST/VTTBuilder.h b/clang/include/clang/AST/VTTBuilder.h
index 3c19e61a8701ca..b396e5a3a6c056 100644
--- a/clang/include/clang/AST/VTTBuilder.h
+++ b/clang/include/clang/AST/VTTBuilder.h
@@ -17,6 +17,7 @@
 #include "clang/AST/BaseSubobject.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -68,7 +69,7 @@ struct VTTComponent {
 };
 
 /// Class for building VTT layout information.
-class VTTBuilder {
+class CLANG_ABI VTTBuilder {
   ASTContext &Ctx;
 
   /// The most derived class for which we're building this vtable.
diff --git a/clang/include/clang/AST/VTableBuilder.h b/clang/include/clang/AST/VTableBuilder.h
index a5de41dbc22f14..ba83a005bb3ebb 100644
--- a/clang/include/clang/AST/VTableBuilder.h
+++ b/clang/include/clang/AST/VTableBuilder.h
@@ -19,6 +19,7 @@
 #include "clang/AST/RecordLayout.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/Thunk.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include <memory>
 #include <utility>
@@ -230,7 +231,7 @@ class VTableComponent {
   int64_t Value;
 };
 
-class VTableLayout {
+class CLANG_ABI VTableLayout {
 public:
   typedef std::pair<uint64_t, ThunkInfo> VTableThunkTy;
   struct AddressPointLocation {
@@ -318,7 +319,7 @@ class VTableLayout {
   }
 };
 
-class VTableContextBase {
+class CLANG_ABI VTableContextBase {
 public:
   typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
 
@@ -360,7 +361,7 @@ class VTableContextBase {
   static bool hasVtableSlot(const CXXMethodDecl *MD);
 };
 
-class ItaniumVTableContext : public VTableContextBase {
+class CLANG_ABI ItaniumVTableContext : public VTableContextBase {
 public:
   typedef llvm::DenseMap<const CXXMethodDecl *, const CXXMethodDecl *>
       OriginalMethodMapTy;
@@ -570,7 +571,7 @@ struct MethodVFTableLocation {
   }
 };
 
-class MicrosoftVTableContext : public VTableContextBase {
+class CLANG_ABI MicrosoftVTableContext : public VTableContextBase {
 public:
 
 private:
diff --git a/clang/include/clang/ASTMatchers/ASTMatchFinder.h b/clang/include/clang/ASTMatchers/ASTMatchFinder.h
index a387d9037b7da4..77d1de37bf1468 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchFinder.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchFinder.h
@@ -41,6 +41,7 @@
 #define LLVM_CLANG_ASTMATCHERS_ASTMATCHFINDER_H
 
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Timer.h"
@@ -66,13 +67,13 @@ namespace ast_matchers {
 /// See ASTMatchers.h for more information about how to create matchers.
 ///
 /// Not intended to be subclassed.
-class MatchFinder {
+class CLANG_ABI MatchFinder {
 public:
   /// Contains all information for a given match.
   ///
   /// Every time a match is found, the MatchFinder will invoke the registered
   /// MatchCallback with a MatchResult containing information about the match.
-  struct MatchResult {
+  struct CLANG_ABI MatchResult {
     MatchResult(const BoundNodes &Nodes, clang::ASTContext *Context);
 
     /// Contains the nodes bound on the current match.
@@ -89,7 +90,7 @@ class MatchFinder {
 
   /// Called when the Match registered for it was successfully found
   /// in the AST.
-  class MatchCallback {
+  class CLANG_ABI MatchCallback {
   public:
     virtual ~MatchCallback();
 
@@ -120,7 +121,7 @@ class MatchFinder {
   };
 
   /// Called when parsing is finished. Intended for testing only.
-  class ParsingDoneTestCallback {
+  class CLANG_ABI ParsingDoneTestCallback {
   public:
     virtual ~ParsingDoneTestCallback();
     virtual void run() = 0;
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index f1c72efc238784..1698dc31faa5ea 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -79,6 +79,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TypeTraits.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
@@ -181,7 +182,7 @@ inline internal::TrueMatcher anything() { return internal::TrueMatcher(); }
 /// \endcode
 /// decl(hasDeclContext(translationUnitDecl()))
 ///   matches "int X", but not "int Y".
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
     translationUnitDecl;
 
 /// Matches typedef declarations.
@@ -193,7 +194,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
 /// \endcode
 /// typedefDecl()
 ///   matches "typedef int X", but not "using Y = int"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
     typedefDecl;
 
 /// Matches typedef name declarations.
@@ -205,7 +206,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl>
 /// \endcode
 /// typedefNameDecl()
 ///   matches "typedef int X" and "using Y = int"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
     typedefNameDecl;
 
 /// Matches type alias declarations.
@@ -217,7 +218,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
 /// \endcode
 /// typeAliasDecl()
 ///   matches "using Y = int", but not "typedef int X"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
     typeAliasDecl;
 
 /// Matches type alias template declarations.
@@ -227,7 +228,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl>
 ///   template <typename T>
 ///   using Y = X<T>;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
     typeAliasTemplateDecl;
 
 /// Matches AST nodes that were expanded within the main-file.
@@ -337,7 +338,7 @@ AST_POLYMORPHIC_MATCHER_P(isExpandedFromMacro,
 ///     friend X;
 ///   };
 /// \endcode
-extern const internal::VariadicAllOfMatcher<Decl> decl;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<Decl> decl;
 
 /// Matches decomposition-declarations.
 ///
@@ -349,7 +350,7 @@ extern const internal::VariadicAllOfMatcher<Decl> decl;
 ///   int number = 42;
 ///   auto [foo, bar] = std::make_pair{42, 42};
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl>
     decompositionDecl;
 
 /// Matches binding declarations
@@ -359,7 +360,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl>
 /// \code
 ///   auto [foo, bar] = std::make_pair{42, 42};
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl>
     bindingDecl;
 
 /// Matches a declaration of a linkage specification.
@@ -370,7 +371,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl>
 /// \endcode
 /// linkageSpecDecl()
 ///   matches "extern "C" {}"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
     linkageSpecDecl;
 
 /// Matches a declaration of anything that could have a name.
@@ -384,7 +385,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
 ///     } U;
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
 
 /// Matches a declaration of label.
 ///
@@ -395,7 +396,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
 /// \endcode
 /// labelDecl()
 ///   matches 'FOO:'
-extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
 
 /// Matches a declaration of a namespace.
 ///
@@ -406,7 +407,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
 /// \endcode
 /// namespaceDecl()
 ///   matches "namespace {}" and "namespace test {}"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
     namespaceDecl;
 
 /// Matches a declaration of a namespace alias.
@@ -418,7 +419,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl>
 /// \endcode
 /// namespaceAliasDecl()
 ///   matches "namespace alias" but not "namespace test"
-extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
     namespaceAliasDecl;
 
 /// Matches class, struct, and union declarations.
@@ -430,7 +431,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
 ///   struct S {};
 ///   union U {};
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
 
 /// Matches C++ class declarations.
 ///
@@ -439,7 +440,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
 ///   class X;
 ///   template<class T> class Z {};
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
     cxxRecordDecl;
 
 /// Matches C++ class template declarations.
@@ -448,7 +449,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl>
 /// \code
 ///   template<class T> class Z {};
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
     classTemplateDecl;
 
 /// Matches C++ class template specializations.
@@ -461,7 +462,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
 /// \endcode
 /// classTemplateSpecializationDecl()
 ///   matches the specializations \c A<int> and \c A<double>
-extern const internal::VariadicDynCastAllOfMatcher<
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<
     Decl, ClassTemplateSpecializationDecl>
     classTemplateSpecializationDecl;
 
@@ -480,7 +481,7 @@ extern const internal::VariadicDynCastAllOfMatcher<
 /// \endcode
 /// classTemplatePartialSpecializationDecl()
 ///   matches the specialization \c A<T,T*,I> but not \c A<int,int,1>
-extern const internal::VariadicDynCastAllOfMatcher<
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<
     Decl, ClassTemplatePartialSpecializationDecl>
     classTemplatePartialSpecializationDecl;
 
@@ -493,7 +494,7 @@ extern const internal::VariadicDynCastAllOfMatcher<
 /// \endcode
 /// declaratorDecl()
 ///   matches \c int y.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
     declaratorDecl;
 
 /// Matches parameter variable declarations.
@@ -504,7 +505,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
 /// \endcode
 /// parmVarDecl()
 ///   matches \c int x.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
     parmVarDecl;
 
 /// Matches C++ access specifier declarations.
@@ -518,7 +519,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl>
 /// \endcode
 /// accessSpecDecl()
 ///   matches 'public:'
-extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
     accessSpecDecl;
 
 /// Matches class bases.
@@ -528,7 +529,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
 ///   class B {};
 ///   class C : public virtual B {};
 /// \endcode
-extern const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
 
 /// Matches constructor initializers.
 ///
@@ -539,7 +540,7 @@ extern const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
 ///     int i;
 ///   };
 /// \endcode
-extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
+CLANG_ABI extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
     cxxCtorInitializer;
 
 /// Matches template arguments.
@@ -551,7 +552,7 @@ extern const internal::VariadicAllOfMatcher<CXXCtorInitializer>
 /// \endcode
 /// templateArgument()
 ///   matches 'int' in C<int>.
-extern const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
 
 /// Matches template arguments (with location info).
 ///
@@ -562,7 +563,7 @@ extern const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
 /// \endcode
 /// templateArgumentLoc()
 ///   matches 'int' in C<int>.
-extern const internal::VariadicAllOfMatcher<TemplateArgumentLoc>
+CLANG_ABI extern const internal::VariadicAllOfMatcher<TemplateArgumentLoc>
     templateArgumentLoc;
 
 /// Matches template name.
@@ -574,7 +575,7 @@ extern const internal::VariadicAllOfMatcher<TemplateArgumentLoc>
 /// \endcode
 /// templateName()
 ///   matches 'X' in X<int>.
-extern const internal::VariadicAllOfMatcher<TemplateName> templateName;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<TemplateName> templateName;
 
 /// Matches non-type template parameter declarations.
 ///
@@ -584,7 +585,7 @@ extern const internal::VariadicAllOfMatcher<TemplateName> templateName;
 /// \endcode
 /// nonTypeTemplateParmDecl()
 ///   matches 'N', but not 'T'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl,
                                                    NonTypeTemplateParmDecl>
     nonTypeTemplateParmDecl;
 
@@ -596,7 +597,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl,
 /// \endcode
 /// templateTypeParmDecl()
 ///   matches 'T', but not 'N'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
     templateTypeParmDecl;
 
 /// Matches template template parameter declarations.
@@ -607,7 +608,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
 /// \endcode
 /// templateTypeParmDecl()
 ///   matches 'Z', but not 'N'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl,
                                                    TemplateTemplateParmDecl>
     templateTemplateParmDecl;
 
@@ -1233,7 +1234,7 @@ AST_MATCHER_P(TemplateArgument, equalsIntegralValue,
 /// \endcode
 /// autoreleasePoolStmt(stmt()) matches the declaration of "x"
 /// inside the autorelease pool.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
        ObjCAutoreleasePoolStmt> autoreleasePoolStmt;
 
 /// Matches any value declaration.
@@ -1243,7 +1244,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 ///   enum X { A, B, C };
 ///   void F();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
 
 /// Matches C++ constructor declarations.
 ///
@@ -1256,7 +1257,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
 ///     int DoSomething();
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
     cxxConstructorDecl;
 
 /// Matches explicit C++ destructor declarations.
@@ -1268,7 +1269,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
 ///     virtual ~Foo();
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
     cxxDestructorDecl;
 
 /// Matches enum declarations.
@@ -1279,7 +1280,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
 ///     A, B, C
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
 
 /// Matches enum constants.
 ///
@@ -1289,7 +1290,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
 ///     A, B, C
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
     enumConstantDecl;
 
 /// Matches tag declarations.
@@ -1304,7 +1305,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
 ///     A, B, C
 ///   };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
 
 /// Matches method declarations.
 ///
@@ -1312,7 +1313,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
 /// \code
 ///   class X { void y(); };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
     cxxMethodDecl;
 
 /// Matches conversion operator declarations.
@@ -1321,7 +1322,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl>
 /// \code
 ///   class X { operator int() const; };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
     cxxConversionDecl;
 
 /// Matches user-defined and implicitly generated deduction guide.
@@ -1332,7 +1333,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
 ///   class X { X(int) };
 ///   X(int) -> X<int>;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
     cxxDeductionGuideDecl;
 
 /// Matches concept declarations.
@@ -1342,7 +1343,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
 ///   template<typename T>
 ///   concept integral = std::is_integral_v<T>;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl>
     conceptDecl;
 
 /// Matches variable declarations.
@@ -1354,7 +1355,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl>
 /// \code
 ///   int a;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
 
 /// Matches field declarations.
 ///
@@ -1364,7 +1365,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
 /// \endcode
 /// fieldDecl()
 ///   matches 'm'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
 
 /// Matches indirect field declarations.
 ///
@@ -1374,7 +1375,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
 /// \endcode
 /// indirectFieldDecl()
 ///   matches 'a'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
     indirectFieldDecl;
 
 /// Matches function declarations.
@@ -1383,7 +1384,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
 /// \code
 ///   void f();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
     functionDecl;
 
 /// Matches C++ function template declarations.
@@ -1392,7 +1393,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl>
 /// \code
 ///   template<class T> void f(T t) {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
     functionTemplateDecl;
 
 /// Matches friend declarations.
@@ -1403,7 +1404,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
 /// \endcode
 /// friendDecl()
 ///   matches 'friend void foo()'.
-extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
 
 /// Matches statements.
 ///
@@ -1413,7 +1414,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
 /// \endcode
 /// stmt()
 ///   matches both the compound statement '{ ++a; }' and '++a'.
-extern const internal::VariadicAllOfMatcher<Stmt> stmt;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<Stmt> stmt;
 
 /// Matches declaration statements.
 ///
@@ -1423,7 +1424,7 @@ extern const internal::VariadicAllOfMatcher<Stmt> stmt;
 /// \endcode
 /// declStmt()
 ///   matches 'int a'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
 
 /// Matches member expressions.
 ///
@@ -1436,7 +1437,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
 /// \endcode
 /// memberExpr()
 ///   matches this->x, x, y.x, a, this->b
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
 
 /// Matches unresolved member expressions.
 ///
@@ -1450,7 +1451,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
 /// \endcode
 /// unresolvedMemberExpr()
 ///   matches x.f<T>
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
     unresolvedMemberExpr;
 
 /// Matches member expressions where the actual member referenced could not be
@@ -1462,7 +1463,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
 /// \endcode
 /// cxxDependentScopeMemberExpr()
 ///   matches t.g
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    CXXDependentScopeMemberExpr>
     cxxDependentScopeMemberExpr;
 
@@ -1474,7 +1475,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 ///   x.y();
 ///   y();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
 
 /// Matches call expressions which were resolved using ADL.
 ///
@@ -1504,7 +1505,7 @@ AST_MATCHER(CallExpr, usesADL) { return Node.usesADL(); }
 /// \code
 ///   [&](){return 5;}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
 
 /// Matches member call expressions.
 ///
@@ -1513,7 +1514,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
 ///   X x;
 ///   x.y();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
     cxxMemberCallExpr;
 
 /// Matches ObjectiveC Message invocation expressions.
@@ -1525,7 +1526,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
 /// \code
 ///   [[NSString alloc] initWithString:@"Hello"]
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
     objcMessageExpr;
 
 /// Matches ObjectiveC String literal expressions.
@@ -1534,7 +1535,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
 /// \code
 ///   NSString *s = @"abcd";
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral>
     objcStringLiteral;
 
 /// Matches Objective-C interface declarations.
@@ -1544,7 +1545,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral>
 ///   @interface Foo
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
     objcInterfaceDecl;
 
 /// Matches Objective-C implementation declarations.
@@ -1554,7 +1555,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
 ///   @implementation Foo
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
     objcImplementationDecl;
 
 /// Matches Objective-C protocol declarations.
@@ -1564,7 +1565,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
 ///   @protocol FooDelegate
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
     objcProtocolDecl;
 
 /// Matches Objective-C category declarations.
@@ -1574,7 +1575,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
 ///   @interface Foo (Additions)
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
     objcCategoryDecl;
 
 /// Matches Objective-C category definitions.
@@ -1584,7 +1585,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
 ///   @implementation Foo (Additions)
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
     objcCategoryImplDecl;
 
 /// Matches Objective-C method declarations.
@@ -1599,7 +1600,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
 ///   - (void)method {}
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
     objcMethodDecl;
 
 /// Matches block declarations.
@@ -1612,7 +1613,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
 ///     printf("%d", p);
 ///   })
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
     blockDecl;
 
 /// Matches Objective-C instance variable declarations.
@@ -1624,7 +1625,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
 ///   }
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
     objcIvarDecl;
 
 /// Matches Objective-C property declarations.
@@ -1635,7 +1636,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl>
 ///   @property BOOL enabled;
 ///   @end
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
     objcPropertyDecl;
 
 /// Matches Objective-C \@throw statements.
@@ -1644,7 +1645,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
 /// \code
 ///   @throw obj;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
     objcThrowStmt;
 
 /// Matches Objective-C @try statements.
@@ -1654,7 +1655,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
 ///   @try {}
 ///   @catch (...) {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
     objcTryStmt;
 
 /// Matches Objective-C @catch statements.
@@ -1664,7 +1665,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt>
 ///   @try {}
 ///   @catch (...) {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
     objcCatchStmt;
 
 /// Matches Objective-C @finally statements.
@@ -1674,7 +1675,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
 ///   @try {}
 ///   @finally {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
     objcFinallyStmt;
 
 /// Matches expressions that introduce cleanups to be run at the end
@@ -1684,7 +1685,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
 /// \code
 ///   const std::string str = std::string();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
     exprWithCleanups;
 
 /// Matches init list expressions.
@@ -1697,7 +1698,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
 /// \endcode
 /// initListExpr()
 ///   matches "{ 1, 2 }" and "{ 5, 6 }"
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr>
     initListExpr;
 
 /// Matches the syntactic form of init list expressions
@@ -1720,7 +1721,7 @@ AST_MATCHER_P(InitListExpr, hasSyntacticForm,
 /// \endcode
 /// cxxStdInitializerListExpr()
 ///   matches "{ 1, 2, 3 }" and "{ 4, 5 }"
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    CXXStdInitializerListExpr>
     cxxStdInitializerListExpr;
 
@@ -1732,7 +1733,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 /// \endcode
 /// implicitValueInitExpr()
 ///   matches "[0].y" (implicitly)
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
     implicitValueInitExpr;
 
 /// Matches paren list expressions.
@@ -1750,7 +1751,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
 /// \endcode
 /// parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
 /// has a predefined type and is a ParenExpr, not a ParenListExpr.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
     parenListExpr;
 
 /// Matches substitutions of non-type template parameters.
@@ -1763,7 +1764,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr>
 /// \endcode
 /// substNonTypeTemplateParmExpr()
 ///   matches "N" in the right-hand side of "static const int n = N;"
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    SubstNonTypeTemplateParmExpr>
     substNonTypeTemplateParmExpr;
 
@@ -1776,7 +1777,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 /// \endcode
 /// usingDecl()
 ///   matches \code using X::x \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
 
 /// Matches using-enum declarations.
 ///
@@ -1787,7 +1788,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
 /// \endcode
 /// usingEnumDecl()
 ///   matches \code using enum X::x \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl>
     usingEnumDecl;
 
 /// Matches using namespace declarations.
@@ -1799,7 +1800,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl>
 /// \endcode
 /// usingDirectiveDecl()
 ///   matches \code using namespace X \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
     usingDirectiveDecl;
 
 /// Matches reference to a name that can be looked up during parsing
@@ -1816,7 +1817,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
 /// \endcode
 /// unresolvedLookupExpr()
 ///   matches \code foo<T>() \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
     unresolvedLookupExpr;
 
 /// Matches unresolved using value declarations.
@@ -1830,7 +1831,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
 /// \endcode
 /// unresolvedUsingValueDecl()
 ///   matches \code using X::x \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl,
                                                    UnresolvedUsingValueDecl>
     unresolvedUsingValueDecl;
 
@@ -1849,7 +1850,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl,
 /// \endcode
 /// unresolvedUsingTypenameDecl()
 ///   matches \code using Base<T>::Foo \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl,
                                                    UnresolvedUsingTypenameDecl>
     unresolvedUsingTypenameDecl;
 
@@ -1862,7 +1863,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl,
 ///   case 37: break;
 ///   }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
     constantExpr;
 
 /// Matches parentheses used in expressions.
@@ -1872,7 +1873,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr>
 ///   int foo() { return 1; }
 ///   int a = (foo() + 1);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
 
 /// Matches constructor call expressions (including implicit ones).
 ///
@@ -1884,7 +1885,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
 ///   int n;
 ///   f(string(ptr, n), ptr);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
     cxxConstructExpr;
 
 /// Matches unresolved constructor call expressions.
@@ -1895,7 +1896,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
 ///   template <typename T>
 ///   void f(const T& t) { return T(t); }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    CXXUnresolvedConstructExpr>
     cxxUnresolvedConstructExpr;
 
@@ -1909,7 +1910,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 ///   int f() { return i; }
 /// };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
     cxxThisExpr;
 
 /// Matches nodes where temporaries are created.
@@ -1920,7 +1921,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr>
 ///   FunctionTakesString(GetStringByValue());
 ///   FunctionTakesStringByPointer(GetStringPointer());
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
     cxxBindTemporaryExpr;
 
 /// Matches nodes where temporaries are materialized.
@@ -1941,7 +1942,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
 /// \code
 ///   f();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    MaterializeTemporaryExpr>
     materializeTemporaryExpr;
 
@@ -1953,7 +1954,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 /// \endcode
 /// cxxNewExpr()
 ///   matches 'new X'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
 
 /// Matches delete expressions.
 ///
@@ -1963,7 +1964,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
 /// \endcode
 /// cxxDeleteExpr()
 ///   matches 'delete X'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
     cxxDeleteExpr;
 
 /// Matches noexcept expressions.
@@ -1979,7 +1980,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr>
 /// cxxNoexceptExpr()
 ///   matches `noexcept(a())`, `noexcept(b())` and `noexcept(c())`.
 ///   doesn't match the noexcept specifier in the declarations a, b, c or d.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
     cxxNoexceptExpr;
 
 /// Matches a loop initializing the elements of an array in a number of contexts:
@@ -1999,7 +2000,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
 /// arrayInitLoopExpr() matches the implicit loop that initializes each element of
 /// the implicit array field inside the lambda object, that represents the array `a`
 /// captured by value.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
     arrayInitLoopExpr;
 
 /// The arrayInitIndexExpr consists of two subexpressions: a common expression
@@ -2018,7 +2019,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
 /// over the array `a` to copy each element to the anonymous array
 /// that backs the structured binding `[x, y]` elements of which are
 /// referred to by their aliases `x` and `y`.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
     arrayInitIndexExpr;
 
 /// Matches array subscript expressions.
@@ -2029,7 +2030,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
 /// \endcode
 /// arraySubscriptExpr()
 ///   matches "a[1]"
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
     arraySubscriptExpr;
 
 /// Matches the value of a default argument at the call site.
@@ -2041,7 +2042,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
 ///   void f(int x, int y = 0);
 ///   f(42);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
     cxxDefaultArgExpr;
 
 /// Matches overloaded operator calls.
@@ -2060,7 +2061,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
 /// \endcode
 /// See also the binaryOperation() matcher for more-general matching of binary
 /// uses of this AST node.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
     cxxOperatorCallExpr;
 
 /// Matches C++17 fold expressions.
@@ -2072,7 +2073,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
 ///       return (0 + ... + args);
 ///   }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr>
     cxxFoldExpr;
 
 /// Matches rewritten binary operators
@@ -2092,7 +2093,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr>
 /// \endcode
 /// See also the binaryOperation() matcher for more-general matching
 /// of this AST node.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    CXXRewrittenBinaryOperator>
     cxxRewrittenBinaryOperator;
 
@@ -2102,7 +2103,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 /// \code
 ///   void f() { x(); }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
 
 /// Matches expressions that refer to declarations.
 ///
@@ -2111,7 +2112,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
 ///   bool x;
 ///   if (x) {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
     declRefExpr;
 
 /// Matches a reference to an ObjCIvar.
@@ -2125,7 +2126,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr>
 ///   a = @"hello";
 /// }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
     objcIvarRefExpr;
 
 /// Matches a reference to a block.
@@ -2134,7 +2135,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr>
 /// \code
 ///   void f() { ^{}(); }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
 
 /// Matches if statements.
 ///
@@ -2142,7 +2143,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
 /// \code
 ///   if (x) {}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
 
 /// Matches for statements.
 ///
@@ -2151,7 +2152,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
 ///   for (;;) {}
 ///   int i[] =  {1, 2, 3}; for (auto a : i);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
 
 /// Matches the increment statement of a for loop.
 ///
@@ -2189,7 +2190,7 @@ AST_MATCHER_P(ForStmt, hasLoopInit, internal::Matcher<Stmt>,
 ///   int i[] =  {1, 2, 3}; for (auto a : i);
 ///   for(int j = 0; j < 5; ++j);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
     cxxForRangeStmt;
 
 /// Matches the initialization statement of a for loop.
@@ -2228,7 +2229,7 @@ AST_MATCHER_P(CXXForRangeStmt, hasRangeInit, internal::Matcher<Expr>,
 /// \endcode
 /// whileStmt()
 ///   matches 'while (true) {}'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
 
 /// Matches do statements.
 ///
@@ -2238,7 +2239,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
 /// \endcode
 /// doStmt()
 ///   matches 'do {} while(true)'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
 
 /// Matches break statements.
 ///
@@ -2248,7 +2249,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
 /// \endcode
 /// breakStmt()
 ///   matches 'break'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
 
 /// Matches continue statements.
 ///
@@ -2258,7 +2259,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
 /// \endcode
 /// continueStmt()
 ///   matches 'continue'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
     continueStmt;
 
 /// Matches co_return statements.
@@ -2269,7 +2270,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt>
 /// \endcode
 /// coreturnStmt()
 ///   matches 'co_return'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt>
     coreturnStmt;
 
 /// Matches return statements.
@@ -2280,7 +2281,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt>
 /// \endcode
 /// returnStmt()
 ///   matches 'return 1'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
 
 /// Matches goto statements.
 ///
@@ -2291,7 +2292,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
 /// \endcode
 /// gotoStmt()
 ///   matches 'goto FOO'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
 
 /// Matches label statements.
 ///
@@ -2302,7 +2303,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
 /// \endcode
 /// labelStmt()
 ///   matches 'FOO:'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
 
 /// Matches address of label statements (GNU extension).
 ///
@@ -2314,7 +2315,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
 /// \endcode
 /// addrLabelExpr()
 ///   matches '&&FOO'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
     addrLabelExpr;
 
 /// Matches switch statements.
@@ -2325,7 +2326,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr>
 /// \endcode
 /// switchStmt()
 ///   matches 'switch(a)'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
 
 /// Matches case and default statements inside switch statements.
 ///
@@ -2335,7 +2336,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
 /// \endcode
 /// switchCase()
 ///   matches 'case 42:' and 'default:'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
 
 /// Matches case statements inside switch statements.
 ///
@@ -2345,7 +2346,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
 /// \endcode
 /// caseStmt()
 ///   matches 'case 42:'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
 
 /// Matches default statements inside switch statements.
 ///
@@ -2355,7 +2356,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
 /// \endcode
 /// defaultStmt()
 ///   matches 'default:'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
     defaultStmt;
 
 /// Matches compound statements.
@@ -2364,7 +2365,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt>
 /// \code
 ///   for (;;) {{}}
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
     compoundStmt;
 
 /// Matches catch statements.
@@ -2374,7 +2375,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt>
 /// \endcode
 /// cxxCatchStmt()
 ///   matches 'catch(int i)'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
     cxxCatchStmt;
 
 /// Matches try statements.
@@ -2384,7 +2385,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt>
 /// \endcode
 /// cxxTryStmt()
 ///   matches 'try {}'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
 
 /// Matches throw expressions.
 ///
@@ -2393,7 +2394,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
 /// \endcode
 /// cxxThrowExpr()
 ///   matches 'throw 5'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
     cxxThrowExpr;
 
 /// Matches null statements.
@@ -2403,7 +2404,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr>
 /// \endcode
 /// nullStmt()
 ///   matches the second ';'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
 
 /// Matches asm statements.
 ///
@@ -2413,7 +2414,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
 /// \endcode
 /// asmStmt()
 ///   matches '__asm("mov al, 2")'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
 
 /// Matches bool literals.
 ///
@@ -2421,7 +2422,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
 /// \code
 ///   true
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
     cxxBoolLiteral;
 
 /// Matches string literals (also matches wide string literals).
@@ -2431,7 +2432,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
 ///   char *s = "abcd";
 ///   wchar_t *ws = L"abcd";
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
     stringLiteral;
 
 /// Matches character literals (also matches wchar_t).
@@ -2444,14 +2445,14 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral>
 ///   char ch = 'a';
 ///   wchar_t chw = L'a';
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
     characterLiteral;
 
 /// Matches integer literals of all sizes / encodings, e.g.
 /// 1, 1L, 0x1 and 1U.
 ///
 /// Does not match character-encoded integers such as L'a'.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
     integerLiteral;
 
 /// Matches float literals of all sizes / encodings, e.g.
@@ -2461,22 +2462,22 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
 /// \code
 ///   float a = 10;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
     floatLiteral;
 
 /// Matches imaginary literals, which are based on integer and floating
 /// point literals e.g.: 1i, 1.0i
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
     imaginaryLiteral;
 
 /// Matches fixed point literals
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
     fixedPointLiteral;
 
 /// Matches user defined literal operator call.
 ///
 /// Example match: "foo"_suffix
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
     userDefinedLiteral;
 
 /// Matches compound (i.e. non-scalar) literals
@@ -2486,7 +2487,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
 ///   int array[4] = {1};
 ///   vector int myvec = (vector int)(1, 2);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
     compoundLiteralExpr;
 
 /// Matches co_await expressions.
@@ -2497,10 +2498,10 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
 /// \endcode
 /// coawaitExpr()
 ///   matches 'co_await 1'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
     coawaitExpr;
 /// Matches co_await expressions where the type of the promise is dependent
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
     dependentCoawaitExpr;
 /// Matches co_yield expressions.
 ///
@@ -2510,7 +2511,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
 /// \endcode
 /// coyieldExpr()
 ///   matches 'co_yield 1'
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
     coyieldExpr;
 
 /// Matches coroutine body statements.
@@ -2521,27 +2522,27 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
 ///     co_return;
 ///   }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
     coroutineBodyStmt;
 
 /// Matches nullptr literal.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
     cxxNullPtrLiteralExpr;
 
 /// Matches GNU __builtin_choose_expr.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr>
     chooseExpr;
 
 /// Matches builtin function __builtin_convertvector.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
     convertVectorExpr;
 
 /// Matches GNU __null expression.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr>
     gnuNullExpr;
 
 /// Matches C11 _Generic expression.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
     genericSelectionExpr;
 
 /// Matches atomic builtins.
@@ -2549,7 +2550,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
 /// \code
 ///   void foo() { int *ptr; __atomic_load_n(ptr, 1); }
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
 
 /// Matches statement expression (GNU extension).
 ///
@@ -2557,7 +2558,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
 /// \code
 ///   int C = ({ int X = 4; X; });
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
 
 /// Matches binary operator expressions.
 ///
@@ -2566,7 +2567,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
 ///   !(a || b)
 /// \endcode
 /// See also the binaryOperation() matcher for more-general matching.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
     binaryOperator;
 
 /// Matches unary operator expressions.
@@ -2575,7 +2576,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
 /// \code
 ///   !a || b
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
     unaryOperator;
 
 /// Matches conditional operator expressions.
@@ -2584,7 +2585,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator>
 /// \code
 ///   (a ? b : c) + 42
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
     conditionalOperator;
 
 /// Matches binary conditional operator expressions (GNU extension).
@@ -2593,7 +2594,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
 /// \code
 ///   (a ?: b) + 42;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    BinaryConditionalOperator>
     binaryConditionalOperator;
 
@@ -2605,7 +2606,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt,
 /// \code
 ///   (a ?: c) + 42;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
     opaqueValueExpr;
 
 /// Matches a C++ static_assert declaration.
@@ -2621,7 +2622,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
 ///   };
 ///   static_assert(sizeof(S) == sizeof(int));
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
     staticAssertDecl;
 
 /// Matches a reinterpret_cast expression.
@@ -2634,7 +2635,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
 /// \code
 ///   void* p = reinterpret_cast<char*>(&p);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
     cxxReinterpretCastExpr;
 
 /// Matches a C++ static_cast expression.
@@ -2650,7 +2651,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
 /// \code
 ///   long eight(static_cast<long>(8));
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
     cxxStaticCastExpr;
 
 /// Matches a dynamic_cast expression.
@@ -2665,7 +2666,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
 ///   B b;
 ///   D* p = dynamic_cast<D*>(&b);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
     cxxDynamicCastExpr;
 
 /// Matches a const_cast expression.
@@ -2676,7 +2677,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
 ///   const int &r(n);
 ///   int* p = const_cast<int*>(&r);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
     cxxConstCastExpr;
 
 /// Matches a C-style cast expression.
@@ -2685,7 +2686,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
 /// \code
 ///   int i = (int) 2.2f;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
     cStyleCastExpr;
 
 /// Matches explicit cast expressions.
@@ -2709,14 +2710,14 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
 /// \code
 ///   long ell = 42;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
     explicitCastExpr;
 
 /// Matches the implicit cast nodes of Clang's AST.
 ///
 /// This matches many different places, including function call return value
 /// eliding, as well as any type conversions.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
     implicitCastExpr;
 
 /// Matches any cast nodes of Clang's AST.
@@ -2732,7 +2733,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
 ///   int i = (0);
 ///   int k = 0;
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
 
 /// Matches functional cast expressions
 ///
@@ -2742,7 +2743,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
 ///   Foo g = (Foo) bar;
 ///   Foo h = Foo(bar);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
     cxxFunctionalCastExpr;
 
 /// Matches functional cast expressions having N != 1 arguments
@@ -2751,7 +2752,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
 /// \code
 ///   Foo h = Foo(bar, bar);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
     cxxTemporaryObjectExpr;
 
 /// Matches predefined identifier expressions [C99 6.4.2.2].
@@ -2760,7 +2761,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
 /// \code
 ///   printf("%s", __func__);
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
     predefinedExpr;
 
 /// Matches C99 designated initializer expressions [C99 6.7.8].
@@ -2769,7 +2770,7 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
 /// \code
 ///   point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
     designatedInitExpr;
 
 /// Matches designated initializer expressions that contain
@@ -2788,13 +2789,13 @@ AST_MATCHER_P(DesignatedInitExpr, designatorCountIs, unsigned, N) {
 }
 
 /// Matches \c QualTypes in the clang AST.
-extern const internal::VariadicAllOfMatcher<QualType> qualType;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<QualType> qualType;
 
 /// Matches \c Types in the clang AST.
-extern const internal::VariadicAllOfMatcher<Type> type;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<Type> type;
 
 /// Matches \c TypeLocs in the clang AST.
-extern const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
 
 /// Matches if any of the given matchers matches.
 ///
@@ -2815,21 +2816,21 @@ extern const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
 /// \c b.
 ///
 /// Usable as: Any Matcher
-extern const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI extern const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     eachOf;
 
 /// Matches if any of the given matchers matches.
 ///
 /// Usable as: Any Matcher
-extern const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI extern const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     anyOf;
 
 /// Matches if all given matchers match.
 ///
 /// Usable as: Any Matcher
-extern const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI extern const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     allOf;
 
@@ -2857,7 +2858,7 @@ extern const internal::VariadicOperatorMatcherFunc<
 /// member named "bar" in that class.
 ///
 /// Usable as: Any Matcher
-extern const internal::VariadicOperatorMatcherFunc<1, 1> optionally;
+CLANG_ABI extern const internal::VariadicOperatorMatcherFunc<1, 1> optionally;
 
 /// Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
 ///
@@ -2868,7 +2869,7 @@ extern const internal::VariadicOperatorMatcherFunc<1, 1> optionally;
 /// \endcode
 /// unaryExprOrTypeTraitExpr()
 ///   matches \c sizeof(x) and \c alignof(x)
-extern const internal::VariadicDynCastAllOfMatcher<Stmt,
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt,
                                                    UnaryExprOrTypeTraitExpr>
     unaryExprOrTypeTraitExpr;
 
@@ -2974,7 +2975,7 @@ auto mapAnyOf(internal::VariadicDynCastAllOfMatcher<T, U> const &...) {
 ///           return;
 ///   }
 /// \endcode
-extern const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
+CLANG_ABI extern const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
                                        CXXRewrittenBinaryOperator>
     binaryOperation;
 
@@ -3012,7 +3013,7 @@ extern const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
 /// invocation(hasArgument(0, integerLiteral(equals(42))))
 /// \endcode
 /// matches the expression in both doCall and doConstruct
-extern const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation;
+CLANG_ABI extern const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation;
 
 /// Matches unary expressions that have a specific type of argument.
 ///
@@ -3091,7 +3092,7 @@ inline internal::Matcher<NamedDecl> hasName(StringRef Name) {
 /// \code
 ///     anyOf(hasName(a), hasName(b), hasName(c))
 /// \endcode
-extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
+CLANG_ABI extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
                                         internal::hasAnyNameFunc>
     hasAnyName;
 
@@ -3154,7 +3155,7 @@ hasOverloadedOperatorName(StringRef Name) {
 ///   hasAnyOverloadedOperatorName("+", "-")
 /// Is equivalent to
 ///   anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
-extern const internal::VariadicFunction<
+CLANG_ABI extern const internal::VariadicFunction<
     internal::PolymorphicMatcher<internal::HasOverloadedOperatorNameMatcher,
                                  AST_POLYMORPHIC_SUPPORTED_TYPES(
                                      CXXOperatorCallExpr, FunctionDecl),
@@ -3476,7 +3477,7 @@ AST_MATCHER(CXXRecordDecl, isLambda) {
 /// casts and paren casts. If you are matching with expr then you should
 /// probably consider using ignoringParenImpCasts like:
 /// has(ignoringParenImpCasts(expr())).
-extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has;
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has;
 
 /// Matches AST nodes that have descendant AST nodes that match the
 /// provided matcher.
@@ -3492,7 +3493,7 @@ extern const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has;
 /// DescendantT must be an AST base type.
 ///
 /// Usable as: Any Matcher
-extern const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<
     internal::HasDescendantMatcher>
     hasDescendant;
 
@@ -3514,7 +3515,7 @@ extern const internal::ArgumentAdaptingMatcherFunc<
 /// matches instead of only on the first one.
 ///
 /// Usable as: Any Matcher
-extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
     forEach;
 
 /// Matches AST nodes that have descendant AST nodes that match the
@@ -3544,7 +3545,7 @@ extern const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher>
 /// \endcode
 ///
 /// Usable as: Any Matcher
-extern const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<
     internal::ForEachDescendantMatcher>
     forEachDescendant;
 
@@ -3579,7 +3580,7 @@ internal::Matcher<T> findAll(const internal::Matcher<T> &Matcher) {
 /// \c compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
 ///
 /// Usable as: Any Matcher
-extern const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<
     internal::HasParentMatcher,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
@@ -3596,7 +3597,7 @@ extern const internal::ArgumentAdaptingMatcherFunc<
 /// \c expr(integerLiteral(hasAncestor(ifStmt()))) matches \c 42, but not 43.
 ///
 /// Usable as: Any Matcher
-extern const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI extern const internal::ArgumentAdaptingMatcherFunc<
     internal::HasAncestorMatcher,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
@@ -3611,7 +3612,7 @@ extern const internal::ArgumentAdaptingMatcherFunc<
 /// \endcode
 ///
 /// Usable as: Any Matcher
-extern const internal::VariadicOperatorMatcherFunc<1, 1> unless;
+CLANG_ABI extern const internal::VariadicOperatorMatcherFunc<1, 1> unless;
 
 /// Matches a node if the declaration associated with that node
 /// matches the given matcher.
@@ -3825,7 +3826,7 @@ AST_MATCHER_P(ObjCMessageExpr, hasSelector, std::string, BaseName) {
 ///     [myObj methodA:argA];
 ///     [myObj methodB:argB];
 /// \endcode
-extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
+CLANG_ABI extern const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>,
                                         StringRef,
                                         internal::hasAnySelectorFunc>
                                         hasAnySelector;
@@ -4918,7 +4919,7 @@ AST_POLYMORPHIC_MATCHER_P(hasAnyArgument,
 /// \endcode
 /// In the matcher `lambdaExpr(hasAnyCapture(lambdaCapture()))`,
 /// `lambdaCapture()` matches `x` and `x=1`.
-extern const internal::VariadicAllOfMatcher<LambdaCapture> lambdaCapture;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<LambdaCapture> lambdaCapture;
 
 /// Matches any capture in a lambda expression.
 ///
@@ -5912,7 +5913,7 @@ AST_POLYMORPHIC_MATCHER_P(
 ///    hasAnyOperatorName("+", "-")
 ///  Is equivalent to
 ///    anyOf(hasOperatorName("+"), hasOperatorName("-"))
-extern const internal::VariadicFunction<
+CLANG_ABI extern const internal::VariadicFunction<
     internal::PolymorphicMatcher<internal::HasAnyOperatorNameMatcher,
                                  AST_POLYMORPHIC_SUPPORTED_TYPES(
                                      BinaryOperator, CXXOperatorCallExpr,
@@ -6808,7 +6809,7 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(internal::BindableMatcher<TypeLoc>, loc,
 /// \endcode
 /// qualifiedTypeLoc()
 ///   matches `const int`.
-extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
     qualifiedTypeLoc;
 
 /// Matches `QualifiedTypeLoc`s that have an unqualified `TypeLoc` matching
@@ -6849,7 +6850,7 @@ AST_MATCHER_P(FunctionDecl, hasReturnTypeLoc, internal::Matcher<TypeLoc>,
 /// \endcode
 /// pointerTypeLoc()
 ///   matches `int*`.
-extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
     pointerTypeLoc;
 
 /// Matches pointer `TypeLoc`s that have a pointee `TypeLoc` matching
@@ -6876,7 +6877,7 @@ AST_MATCHER_P(PointerTypeLoc, hasPointeeLoc, internal::Matcher<TypeLoc>,
 /// \endcode
 /// referenceTypeLoc()
 ///   matches `int&` and `int&&`.
-extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
     referenceTypeLoc;
 
 /// Matches reference `TypeLoc`s that have a referent `TypeLoc` matching
@@ -6903,7 +6904,7 @@ AST_MATCHER_P(ReferenceTypeLoc, hasReferentLoc, internal::Matcher<TypeLoc>,
 /// \endcode
 /// varDecl(hasTypeLoc(templateSpecializationTypeLoc(typeLoc())))
 ///   matches `C<char> var`.
-extern const internal::VariadicDynCastAllOfMatcher<
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<
     TypeLoc, TemplateSpecializationTypeLoc>
     templateSpecializationTypeLoc;
 
@@ -6965,7 +6966,7 @@ AST_POLYMORPHIC_MATCHER_P2(
 /// \endcode
 /// elaboratedTypeLoc()
 ///   matches the `TypeLoc` of the variable declaration of `ss`.
-extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
     elaboratedTypeLoc;
 
 /// Matches elaborated `TypeLoc`s that have a named `TypeLoc` matching
@@ -7026,7 +7027,7 @@ using AstTypeMatcher = internal::VariadicDynCastAllOfMatcher<Type, NodeType>;
 /// \endcode
 /// builtinType()
 ///   matches "int b", "float c" and "bool d"
-extern const AstTypeMatcher<BuiltinType> builtinType;
+CLANG_ABI extern const AstTypeMatcher<BuiltinType> builtinType;
 
 /// Matches all kinds of arrays.
 ///
@@ -7038,7 +7039,7 @@ extern const AstTypeMatcher<BuiltinType> builtinType;
 /// \endcode
 /// arrayType()
 ///   matches "int a[]", "int b[4]" and "int c[a[0]]";
-extern const AstTypeMatcher<ArrayType> arrayType;
+CLANG_ABI extern const AstTypeMatcher<ArrayType> arrayType;
 
 /// Matches C99 complex types.
 ///
@@ -7048,7 +7049,7 @@ extern const AstTypeMatcher<ArrayType> arrayType;
 /// \endcode
 /// complexType()
 ///   matches "_Complex float f"
-extern const AstTypeMatcher<ComplexType> complexType;
+CLANG_ABI extern const AstTypeMatcher<ComplexType> complexType;
 
 /// Matches any real floating-point type (float, double, long double).
 ///
@@ -7092,7 +7093,7 @@ AST_TYPELOC_TRAVERSE_MATCHER_DECL(hasElementType, getElement,
 /// \endcode
 /// constantArrayType()
 ///   matches "int a[2]"
-extern const AstTypeMatcher<ConstantArrayType> constantArrayType;
+CLANG_ABI extern const AstTypeMatcher<ConstantArrayType> constantArrayType;
 
 /// Matches nodes that have the specified size.
 ///
@@ -7127,7 +7128,7 @@ AST_POLYMORPHIC_MATCHER_P(hasSize,
 /// \endcode
 /// dependentSizedArrayType()
 ///   matches "T data[Size]"
-extern const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
+CLANG_ABI extern const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
 
 /// Matches C++ extended vector type where either the type or size is
 /// dependent.
@@ -7141,7 +7142,7 @@ extern const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
 /// \endcode
 /// dependentSizedExtVectorType()
 ///   matches "T __attribute__((ext_vector_type(Size)))"
-extern const AstTypeMatcher<DependentSizedExtVectorType>
+CLANG_ABI extern const AstTypeMatcher<DependentSizedExtVectorType>
     dependentSizedExtVectorType;
 
 /// Matches C arrays with unspecified size.
@@ -7154,7 +7155,7 @@ extern const AstTypeMatcher<DependentSizedExtVectorType>
 /// \endcode
 /// incompleteArrayType()
 ///   matches "int a[]" and "int c[]"
-extern const AstTypeMatcher<IncompleteArrayType> incompleteArrayType;
+CLANG_ABI extern const AstTypeMatcher<IncompleteArrayType> incompleteArrayType;
 
 /// Matches C arrays with a specified size that is not an
 /// integer-constant-expression.
@@ -7169,7 +7170,7 @@ extern const AstTypeMatcher<IncompleteArrayType> incompleteArrayType;
 /// \endcode
 /// variableArrayType()
 ///   matches "int c[a[0]]"
-extern const AstTypeMatcher<VariableArrayType> variableArrayType;
+CLANG_ABI extern const AstTypeMatcher<VariableArrayType> variableArrayType;
 
 /// Matches \c VariableArrayType nodes that have a specific size
 /// expression.
@@ -7196,7 +7197,7 @@ AST_MATCHER_P(VariableArrayType, hasSizeExpr,
 /// \endcode
 /// atomicType()
 ///   matches "_Atomic(int) i"
-extern const AstTypeMatcher<AtomicType> atomicType;
+CLANG_ABI extern const AstTypeMatcher<AtomicType> atomicType;
 
 /// Matches atomic types with a specific value type.
 ///
@@ -7222,7 +7223,7 @@ AST_TYPELOC_TRAVERSE_MATCHER_DECL(hasValueType, getValue,
 /// \endcode
 /// autoType()
 ///   matches "auto n" and "auto i"
-extern const AstTypeMatcher<AutoType> autoType;
+CLANG_ABI extern const AstTypeMatcher<AutoType> autoType;
 
 /// Matches types nodes representing C++11 decltype(<expr>) types.
 ///
@@ -7234,7 +7235,7 @@ extern const AstTypeMatcher<AutoType> autoType;
 /// \endcode
 /// decltypeType()
 ///   matches "decltype(i + j)"
-extern const AstTypeMatcher<DecltypeType> decltypeType;
+CLANG_ABI extern const AstTypeMatcher<DecltypeType> decltypeType;
 
 /// Matches \c AutoType nodes where the deduced type is a specific type.
 ///
@@ -7277,7 +7278,7 @@ AST_TYPE_TRAVERSE_MATCHER(hasUnderlyingType, getUnderlyingType,
 /// \endcode
 /// functionType()
 ///   matches "int (*f)(int)" and the type of "g".
-extern const AstTypeMatcher<FunctionType> functionType;
+CLANG_ABI extern const AstTypeMatcher<FunctionType> functionType;
 
 /// Matches \c FunctionProtoType nodes.
 ///
@@ -7289,7 +7290,7 @@ extern const AstTypeMatcher<FunctionType> functionType;
 /// functionProtoType()
 ///   matches "int (*f)(int)" and the type of "g" in C++ mode.
 ///   In C mode, "g" is not matched because it does not contain a prototype.
-extern const AstTypeMatcher<FunctionProtoType> functionProtoType;
+CLANG_ABI extern const AstTypeMatcher<FunctionProtoType> functionProtoType;
 
 /// Matches \c ParenType nodes.
 ///
@@ -7301,7 +7302,7 @@ extern const AstTypeMatcher<FunctionProtoType> functionProtoType;
 ///
 /// \c varDecl(hasType(pointsTo(parenType()))) matches \c ptr_to_array but not
 /// \c array_of_ptrs.
-extern const AstTypeMatcher<ParenType> parenType;
+CLANG_ABI extern const AstTypeMatcher<ParenType> parenType;
 
 /// Matches \c ParenType nodes where the inner type is a specific type.
 ///
@@ -7322,7 +7323,7 @@ AST_TYPE_TRAVERSE_MATCHER(innerType, getInnerType,
 /// "void (^)(int)".
 ///
 /// The \c pointee is always required to be a \c FunctionType.
-extern const AstTypeMatcher<BlockPointerType> blockPointerType;
+CLANG_ABI extern const AstTypeMatcher<BlockPointerType> blockPointerType;
 
 /// Matches member pointer types.
 /// Given
@@ -7332,7 +7333,7 @@ extern const AstTypeMatcher<BlockPointerType> blockPointerType;
 /// \endcode
 /// memberPointerType()
 ///   matches "A::* ptr"
-extern const AstTypeMatcher<MemberPointerType> memberPointerType;
+CLANG_ABI extern const AstTypeMatcher<MemberPointerType> memberPointerType;
 
 /// Matches pointer types, but does not match Objective-C object pointer
 /// types.
@@ -7349,7 +7350,7 @@ extern const AstTypeMatcher<MemberPointerType> memberPointerType;
 /// \endcode
 /// pointerType()
 ///   matches "int *a", but does not match "Foo *f".
-extern const AstTypeMatcher<PointerType> pointerType;
+CLANG_ABI extern const AstTypeMatcher<PointerType> pointerType;
 
 /// Matches an Objective-C object pointer type, which is different from
 /// a pointer type, despite being syntactically similar.
@@ -7364,7 +7365,7 @@ extern const AstTypeMatcher<PointerType> pointerType;
 /// \endcode
 /// pointerType()
 ///   matches "Foo *f", but does not match "int *a".
-extern const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType;
+CLANG_ABI extern const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType;
 
 /// Matches both lvalue and rvalue reference types.
 ///
@@ -7380,7 +7381,7 @@ extern const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType;
 /// \endcode
 ///
 /// \c referenceType() matches the types of \c b, \c c, \c d, \c e, and \c f.
-extern const AstTypeMatcher<ReferenceType> referenceType;
+CLANG_ABI extern const AstTypeMatcher<ReferenceType> referenceType;
 
 /// Matches lvalue reference types.
 ///
@@ -7397,7 +7398,7 @@ extern const AstTypeMatcher<ReferenceType> referenceType;
 ///
 /// \c lValueReferenceType() matches the types of \c b, \c d, and \c e. \c e is
 /// matched since the type is deduced as int& by reference collapsing rules.
-extern const AstTypeMatcher<LValueReferenceType> lValueReferenceType;
+CLANG_ABI extern const AstTypeMatcher<LValueReferenceType> lValueReferenceType;
 
 /// Matches rvalue reference types.
 ///
@@ -7414,7 +7415,7 @@ extern const AstTypeMatcher<LValueReferenceType> lValueReferenceType;
 ///
 /// \c rValueReferenceType() matches the types of \c c and \c f. \c e is not
 /// matched as it is deduced to int& by reference collapsing rules.
-extern const AstTypeMatcher<RValueReferenceType> rValueReferenceType;
+CLANG_ABI extern const AstTypeMatcher<RValueReferenceType> rValueReferenceType;
 
 /// Narrows PointerType (and similar) matchers to those where the
 /// \c pointee matches a given matcher.
@@ -7443,7 +7444,7 @@ AST_TYPELOC_TRAVERSE_MATCHER_DECL(
 /// \endcode
 /// typedefType()
 ///   matches "typedef int X"
-extern const AstTypeMatcher<TypedefType> typedefType;
+CLANG_ABI extern const AstTypeMatcher<TypedefType> typedefType;
 
 /// Matches qualified types when the qualifier is applied via a macro.
 ///
@@ -7455,7 +7456,7 @@ extern const AstTypeMatcher<TypedefType> typedefType;
 /// \endcode
 /// macroQualifiedType()
 ///   matches the type of the typedef declaration of \c X but not \c Y.
-extern const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
+CLANG_ABI extern const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
 
 /// Matches enum types.
 ///
@@ -7470,7 +7471,7 @@ extern const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
 //
 /// \c enumType() matches the type of the variable declarations of both \c c and
 /// \c s.
-extern const AstTypeMatcher<EnumType> enumType;
+CLANG_ABI extern const AstTypeMatcher<EnumType> enumType;
 
 /// Matches template specialization types.
 ///
@@ -7485,7 +7486,7 @@ extern const AstTypeMatcher<EnumType> enumType;
 ///
 /// \c templateSpecializationType() matches the type of the explicit
 /// instantiation in \c A and the type of the variable declaration in \c B.
-extern const AstTypeMatcher<TemplateSpecializationType>
+CLANG_ABI extern const AstTypeMatcher<TemplateSpecializationType>
     templateSpecializationType;
 
 /// Matches C++17 deduced template specialization types, e.g. deduced class
@@ -7500,7 +7501,7 @@ extern const AstTypeMatcher<TemplateSpecializationType>
 /// \endcode
 /// \c deducedTemplateSpecializationType() matches the type in the declaration
 /// of the variable \c c.
-extern const AstTypeMatcher<DeducedTemplateSpecializationType>
+CLANG_ABI extern const AstTypeMatcher<DeducedTemplateSpecializationType>
     deducedTemplateSpecializationType;
 
 /// Matches types nodes representing unary type transformations.
@@ -7511,7 +7512,7 @@ extern const AstTypeMatcher<DeducedTemplateSpecializationType>
 /// \endcode
 /// unaryTransformType()
 ///   matches "__underlying_type(T)"
-extern const AstTypeMatcher<UnaryTransformType> unaryTransformType;
+CLANG_ABI extern const AstTypeMatcher<UnaryTransformType> unaryTransformType;
 
 /// Matches record types (e.g. structs, classes).
 ///
@@ -7526,7 +7527,7 @@ extern const AstTypeMatcher<UnaryTransformType> unaryTransformType;
 ///
 /// \c recordType() matches the type of the variable declarations of both \c c
 /// and \c s.
-extern const AstTypeMatcher<RecordType> recordType;
+CLANG_ABI extern const AstTypeMatcher<RecordType> recordType;
 
 /// Matches tag types (record and enum types).
 ///
@@ -7541,7 +7542,7 @@ extern const AstTypeMatcher<RecordType> recordType;
 ///
 /// \c tagType() matches the type of the variable declarations of both \c e
 /// and \c c.
-extern const AstTypeMatcher<TagType> tagType;
+CLANG_ABI extern const AstTypeMatcher<TagType> tagType;
 
 /// Matches types specified with an elaborated type keyword or with a
 /// qualified name.
@@ -7561,7 +7562,7 @@ extern const AstTypeMatcher<TagType> tagType;
 ///
 /// \c elaboratedType() matches the type of the variable declarations of both
 /// \c c and \c d.
-extern const AstTypeMatcher<ElaboratedType> elaboratedType;
+CLANG_ABI extern const AstTypeMatcher<ElaboratedType> elaboratedType;
 
 /// Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
 /// matches \c InnerMatcher if the qualifier exists.
@@ -7616,7 +7617,7 @@ AST_MATCHER_P(ElaboratedType, namesType, internal::Matcher<QualType>,
 /// \endcode
 ///
 /// \c usingType() matches the type of the variable declaration of \c s.
-extern const AstTypeMatcher<UsingType> usingType;
+CLANG_ABI extern const AstTypeMatcher<UsingType> usingType;
 
 /// Matches types that represent the result of substituting a type for a
 /// template type parameter.
@@ -7630,7 +7631,7 @@ extern const AstTypeMatcher<UsingType> usingType;
 /// \endcode
 ///
 /// \c substTemplateTypeParmType() matches the type of 't' but not '1'
-extern const AstTypeMatcher<SubstTemplateTypeParmType>
+CLANG_ABI extern const AstTypeMatcher<SubstTemplateTypeParmType>
     substTemplateTypeParmType;
 
 /// Matches template type parameter substitutions that have a replacement
@@ -7656,7 +7657,7 @@ AST_TYPE_TRAVERSE_MATCHER(
 /// \code
 ///   template <typename T> void f(int i);
 /// \endcode
-extern const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType;
+CLANG_ABI extern const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType;
 
 /// Matches injected class name types.
 ///
@@ -7668,7 +7669,7 @@ extern const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType;
 ///     void g(S<T> s);
 ///   };
 /// \endcode
-extern const AstTypeMatcher<InjectedClassNameType> injectedClassNameType;
+CLANG_ABI extern const AstTypeMatcher<InjectedClassNameType> injectedClassNameType;
 
 /// Matches decayed type
 /// Example matches i[] in declaration of f.
@@ -7680,7 +7681,7 @@ extern const AstTypeMatcher<InjectedClassNameType> injectedClassNameType;
 ///     i[1] = 0;
 ///   }
 /// \endcode
-extern const AstTypeMatcher<DecayedType> decayedType;
+CLANG_ABI extern const AstTypeMatcher<DecayedType> decayedType;
 
 /// Matches the decayed type, whoes decayed type matches \c InnerMatcher
 AST_MATCHER_P(DecayedType, hasDecayedType, internal::Matcher<QualType>,
@@ -7721,11 +7722,11 @@ AST_MATCHER_P(Decl, hasDeclContext, internal::Matcher<Decl>, InnerMatcher) {
 /// \endcode
 /// nestedNameSpecifier()
 ///   matches "ns::" and both "A::"
-extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
+CLANG_ABI extern const internal::VariadicAllOfMatcher<NestedNameSpecifier>
     nestedNameSpecifier;
 
 /// Same as \c nestedNameSpecifier but matches \c NestedNameSpecifierLoc.
-extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
+CLANG_ABI extern const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
     nestedNameSpecifierLoc;
 
 /// Matches \c NestedNameSpecifierLocs for which the given inner
@@ -7843,7 +7844,7 @@ AST_MATCHER_P(NestedNameSpecifier, specifiesNamespace,
 /// \endcode
 /// attr()
 ///   matches "nodiscard", "nonnull", "noinline", and the whole "#pragma" line.
-extern const internal::VariadicAllOfMatcher<Attr> attr;
+CLANG_ABI extern const internal::VariadicAllOfMatcher<Attr> attr;
 
 /// Overloads for the \c equalsNode matcher.
 /// FIXME: Implement for other node types.
@@ -8197,7 +8198,7 @@ AST_MATCHER_P(ReturnStmt, hasReturnValue, internal::Matcher<Expr>,
 /// \code
 ///   kernel<<<i,j>>>();
 /// \endcode
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
     cudaKernelCallExpr;
 
 /// Matches expressions that resolve to a null pointer constant, such as
@@ -8602,7 +8603,7 @@ AST_MATCHER_P(Expr, ignoringElidableConstructorCall, internal::Matcher<Expr>,
 ///
 /// ``ompExecutableDirective()`` matches ``omp parallel``,
 /// ``omp parallel default(none)`` and ``omp taskyield``.
-extern const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
     ompExecutableDirective;
 
 /// Matches standalone OpenMP directives,
@@ -8677,7 +8678,7 @@ AST_MATCHER_P(OMPExecutableDirective, hasAnyClause,
 ///
 /// ``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``,
 /// `` default(private)`` and ``default(firstprivate)``
-extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
+CLANG_ABI extern const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
     ompDefaultClause;
 
 /// Matches if the OpenMP ``default`` clause has ``none`` kind specified.
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index c1cc63fdb7433f..b343c4262bee46 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -49,6 +49,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/OperatorKinds.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -272,11 +273,11 @@ class BoundNodesMap {
 ///
 /// The tree builder is used during the matching process to insert the bound
 /// nodes from the Id matcher.
-class BoundNodesTreeBuilder {
+class CLANG_ABI BoundNodesTreeBuilder {
 public:
   /// A visitor interface to visit all BoundNodes results for a
   /// BoundNodesTree.
-  class Visitor {
+  class CLANG_ABI Visitor {
   public:
     virtual ~Visitor() = default;
 
@@ -334,7 +335,7 @@ class ASTMatchFinder;
 /// Used by the implementation of Matcher<T> and DynTypedMatcher.
 /// In general, implement MatcherInterface<T> or SingleNodeMatcherInterface<T>
 /// instead.
-class DynMatcherInterface
+class CLANG_ABI DynMatcherInterface
     : public llvm::ThreadSafeRefCountedBase<DynMatcherInterface> {
 public:
   virtual ~DynMatcherInterface() = default;
@@ -403,7 +404,7 @@ template <typename> class Matcher;
 /// It checks whether the \c DynTypedNode is convertible into the type of the
 /// underlying matcher and then do the actual match on the actual node, or
 /// return false if it is not convertible.
-class DynTypedMatcher {
+class CLANG_ABI DynTypedMatcher {
 public:
   /// Takes ownership of the provided implementation pointer.
   template <typename T>
@@ -694,7 +695,7 @@ inline Matcher<T> makeMatcher(MatcherInterface<T> *Implementation) {
 /// In the future, we want to implement this for all nodes for which it makes
 /// sense. In the case of matchesAncestorOf, we'll want to implement it for
 /// all nodes, as all nodes have ancestors.
-class ASTMatchFinder {
+class CLANG_ABI ASTMatchFinder {
 public:
   /// Defines how bindings are processed on recursive matches.
   enum BindKind {
@@ -936,7 +937,7 @@ class HasOverloadedOperatorNameMatcher : public SingleNodeMatcherInterface<T> {
 /// Matches named declarations with a specific name.
 ///
 /// See \c hasName() and \c hasAnyName() in ASTMatchers.h for details.
-class HasNameMatcher : public SingleNodeMatcherInterface<NamedDecl> {
+class CLANG_ABI HasNameMatcher : public SingleNodeMatcherInterface<NamedDecl> {
  public:
   explicit HasNameMatcher(std::vector<std::string> Names);
 
@@ -970,11 +971,11 @@ class HasNameMatcher : public SingleNodeMatcherInterface<NamedDecl> {
 
 /// Trampoline function to use VariadicFunction<> to construct a
 ///        HasNameMatcher.
-Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs);
+CLANG_ABI Matcher<NamedDecl> hasAnyNameFunc(ArrayRef<const StringRef *> NameRefs);
 
 /// Trampoline function to use VariadicFunction<> to construct a
 ///        hasAnySelector matcher.
-Matcher<ObjCMessageExpr> hasAnySelectorFunc(
+CLANG_ABI Matcher<ObjCMessageExpr> hasAnySelectorFunc(
     ArrayRef<const StringRef *> NameRefs);
 
 /// Matches declarations for QualType and CallExpr.
@@ -2212,7 +2213,7 @@ CompoundStmtMatcher<StmtExpr>::get(const StmtExpr &Node) {
 /// location (in the chain of expansions) at which \p MacroName was
 /// expanded. Since the macro may have been expanded inside a series of
 /// expansions, that location may itself be a MacroID.
-std::optional<SourceLocation> getExpansionLocOfMacro(StringRef MacroName,
+CLANG_ABI std::optional<SourceLocation> getExpansionLocOfMacro(StringRef MacroName,
                                                      SourceLocation Loc,
                                                      const ASTContext &Context);
 
@@ -2294,24 +2295,24 @@ using HasOpNameMatcher =
                                     CXXRewrittenBinaryOperator, UnaryOperator>),
                        std::vector<std::string>>;
 
-HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef<const StringRef *> NameRefs);
+CLANG_ABI HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef<const StringRef *> NameRefs);
 
 using HasOverloadOpNameMatcher =
     PolymorphicMatcher<HasOverloadedOperatorNameMatcher,
                        void(TypeList<CXXOperatorCallExpr, FunctionDecl>),
                        std::vector<std::string>>;
 
-HasOverloadOpNameMatcher
+CLANG_ABI HasOverloadOpNameMatcher
 hasAnyOverloadedOperatorNameFunc(ArrayRef<const StringRef *> NameRefs);
 
 /// Returns true if \p Node has a base specifier matching \p BaseSpec.
 ///
 /// A class is not considered to be derived from itself.
-bool matchesAnyBase(const CXXRecordDecl &Node,
+CLANG_ABI bool matchesAnyBase(const CXXRecordDecl &Node,
                     const Matcher<CXXBaseSpecifier> &BaseSpecMatcher,
                     ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder);
 
-std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
+CLANG_ABI std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
                                                   llvm::Regex::RegexFlags Flags,
                                                   StringRef MatcherID);
 
diff --git a/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h b/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
index 960d59a747fc45..7e99c26b3db31f 100644
--- a/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
+++ b/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
@@ -16,6 +16,7 @@
 
 #include "clang/ASTMatchers/Dynamic/VariantValue.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
@@ -47,7 +48,7 @@ struct ParserValue {
 };
 
 /// Helper class to manage error messages.
-class Diagnostics {
+class CLANG_ABI Diagnostics {
 public:
   /// Parser context types.
   enum ContextType {
@@ -85,7 +86,7 @@ class Diagnostics {
   };
 
   /// Helper stream class.
-  class ArgStream {
+  class CLANG_ABI ArgStream {
   public:
     ArgStream(std::vector<std::string> *Out) : Out(Out) {}
     template <class T> ArgStream &operator<<(const T &Arg) {
@@ -103,7 +104,7 @@ class Diagnostics {
   /// parsing/construction can fail. Any error triggered within a context will
   /// keep information about the context chain.
   /// This class should be used as a RAII instance in the stack.
-  struct Context {
+  struct CLANG_ABI Context {
   public:
     /// About to call the constructor for a matcher.
     enum ConstructMatcherEnum { ConstructMatcher };
@@ -123,7 +124,7 @@ class Diagnostics {
   ///
   /// This context will take care of merging all errors that happen within it
   /// as "candidate" overloads for the same matcher.
-  struct OverloadContext {
+  struct CLANG_ABI OverloadContext {
   public:
    OverloadContext(Diagnostics* Error);
    ~OverloadContext();
diff --git a/clang/include/clang/ASTMatchers/Dynamic/Parser.h b/clang/include/clang/ASTMatchers/Dynamic/Parser.h
index 7adaef5054b5de..adb03b4f876286 100644
--- a/clang/include/clang/ASTMatchers/Dynamic/Parser.h
+++ b/clang/include/clang/ASTMatchers/Dynamic/Parser.h
@@ -38,6 +38,7 @@
 #include "clang/ASTMatchers/ASTMatchersInternal.h"
 #include "clang/ASTMatchers/Dynamic/Registry.h"
 #include "clang/ASTMatchers/Dynamic/VariantValue.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -52,7 +53,7 @@ namespace dynamic {
 class Diagnostics;
 
 /// Matcher expression parser.
-class Parser {
+class CLANG_ABI Parser {
 public:
   /// Interface to connect the parser with the registry and more.
   ///
@@ -64,7 +65,7 @@ class Parser {
   /// creation and do some extra work. For example, it could apply some
   /// transformation to the matcher by adding some id() nodes, or could detect
   /// specific matcher nodes for more efficient lookup.
-  class Sema {
+  class CLANG_ABI Sema {
   public:
     virtual ~Sema();
 
@@ -134,7 +135,7 @@ class Parser {
 
   /// Sema implementation that uses the matcher registry to process the
   ///   tokens.
-  class RegistrySema : public Parser::Sema {
+  class CLANG_ABI RegistrySema : public Parser::Sema {
   public:
     ~RegistrySema() override;
 
diff --git a/clang/include/clang/ASTMatchers/Dynamic/Registry.h b/clang/include/clang/ASTMatchers/Dynamic/Registry.h
index 50711addc6e3e3..fe808fd1ad94db 100644
--- a/clang/include/clang/ASTMatchers/Dynamic/Registry.h
+++ b/clang/include/clang/ASTMatchers/Dynamic/Registry.h
@@ -18,6 +18,7 @@
 
 #include "clang/ASTMatchers/Dynamic/Diagnostics.h"
 #include "clang/ASTMatchers/Dynamic/VariantValue.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <optional>
@@ -35,7 +36,7 @@ class MatcherDescriptor;
 
 /// A smart (owning) pointer for MatcherDescriptor. We can't use unique_ptr
 /// because MatcherDescriptor is forward declared
-class MatcherDescriptorPtr {
+class CLANG_ABI MatcherDescriptorPtr {
 public:
   explicit MatcherDescriptorPtr(MatcherDescriptor *);
   ~MatcherDescriptorPtr();
@@ -79,7 +80,7 @@ struct MatcherCompletion {
   unsigned Specificity;
 };
 
-class Registry {
+class CLANG_ABI Registry {
 public:
   Registry() = delete;
 
diff --git a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h
index c99d32f5f784a5..2826946358557d 100644
--- a/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h
+++ b/clang/include/clang/ASTMatchers/Dynamic/VariantValue.h
@@ -19,6 +19,7 @@
 
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/ASTMatchers/ASTMatchersInternal.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include <memory>
 #include <optional>
@@ -31,7 +32,7 @@ namespace dynamic {
 /// Kind identifier.
 ///
 /// It supports all types that VariantValue can contain.
-class ArgKind {
+class CLANG_ABI ArgKind {
  public:
   enum Kind {
     AK_Matcher,
@@ -102,9 +103,9 @@ using ast_matchers::internal::DynTypedMatcher;
 ///    matcher, or a polymorphic one with only one overload.
 ///  - hasTypedMatcher<T>()/getTypedMatcher<T>(): These calls will determine if
 ///    the underlying matcher(s) can unambiguously return a Matcher<T>.
-class VariantMatcher {
+class CLANG_ABI VariantMatcher {
   /// Methods that depend on T from hasTypedMatcher/getTypedMatcher.
-  class MatcherOps {
+  class CLANG_ABI MatcherOps {
   public:
     MatcherOps(ASTNodeKind NodeKind) : NodeKind(NodeKind) {}
 
@@ -129,7 +130,7 @@ class VariantMatcher {
   /// Payload interface to be specialized by each matcher type.
   ///
   /// It follows a similar interface as VariantMatcher itself.
-  class Payload {
+  class CLANG_ABI Payload {
   public:
     virtual ~Payload();
     virtual std::optional<DynTypedMatcher> getSingleMatcher() const = 0;
@@ -251,7 +252,7 @@ class VariantMatcher {
 ///  - \c unsigned
 ///  - \c llvm::StringRef
 ///  - \c VariantMatcher (\c DynTypedMatcher / \c Matcher<T>)
-class VariantValue {
+class CLANG_ABI VariantValue {
 public:
   VariantValue() : Type(VT_Nothing) {}
 
diff --git a/clang/include/clang/ASTMatchers/GtestMatchers.h b/clang/include/clang/ASTMatchers/GtestMatchers.h
index e19d91a674f2ec..fa43b4d35ea39d 100644
--- a/clang/include/clang/ASTMatchers/GtestMatchers.h
+++ b/clang/include/clang/ASTMatchers/GtestMatchers.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/Stmt.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -42,42 +43,42 @@ enum class MockArgs {
 
 /// Matcher for gtest's ASSERT comparison macros including ASSERT_EQ, ASSERT_NE,
 /// ASSERT_GE, ASSERT_GT, ASSERT_LE and ASSERT_LT.
-internal::BindableMatcher<Stmt> gtestAssert(GtestCmp Cmp, StatementMatcher Left,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestAssert(GtestCmp Cmp, StatementMatcher Left,
                                             StatementMatcher Right);
 
 /// Matcher for gtest's ASSERT_THAT macro.
-internal::BindableMatcher<Stmt> gtestAssertThat(StatementMatcher Actual,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestAssertThat(StatementMatcher Actual,
                                                 StatementMatcher Matcher);
 
 /// Matcher for gtest's EXPECT comparison macros including EXPECT_EQ, EXPECT_NE,
 /// EXPECT_GE, EXPECT_GT, EXPECT_LE and EXPECT_LT.
-internal::BindableMatcher<Stmt> gtestExpect(GtestCmp Cmp, StatementMatcher Left,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestExpect(GtestCmp Cmp, StatementMatcher Left,
                                             StatementMatcher Right);
 
 /// Matcher for gtest's EXPECT_THAT macro.
-internal::BindableMatcher<Stmt> gtestExpectThat(StatementMatcher Actual,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestExpectThat(StatementMatcher Actual,
                                                 StatementMatcher Matcher);
 
 /// Matcher for gtest's EXPECT_CALL macro. `MockObject` matches the mock
 /// object and `MockMethodName` is the name of the method invoked on the mock
 /// object.
-internal::BindableMatcher<Stmt> gtestExpectCall(StatementMatcher MockObject,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestExpectCall(StatementMatcher MockObject,
                                                 llvm::StringRef MockMethodName,
                                                 MockArgs Args);
 
 /// Matcher for gtest's EXPECT_CALL macro. `MockCall` matches the whole mock
 /// member method call. This API is more flexible but requires more knowledge of
 /// the AST structure of EXPECT_CALL macros.
-internal::BindableMatcher<Stmt> gtestExpectCall(StatementMatcher MockCall,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestExpectCall(StatementMatcher MockCall,
                                                 MockArgs Args);
 
 /// Like the first `gtestExpectCall` overload but for `ON_CALL`.
-internal::BindableMatcher<Stmt> gtestOnCall(StatementMatcher MockObject,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestOnCall(StatementMatcher MockObject,
                                             llvm::StringRef MockMethodName,
                                             MockArgs Args);
 
 /// Like the second `gtestExpectCall` overload but for `ON_CALL`.
-internal::BindableMatcher<Stmt> gtestOnCall(StatementMatcher MockCall,
+CLANG_ABI internal::BindableMatcher<Stmt> gtestOnCall(StatementMatcher MockCall,
                                             MockArgs Args);
 
 } // namespace ast_matchers
diff --git a/clang/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h b/clang/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
index 16c0a7af0504e9..bfd7a84b6e8f06 100644
--- a/clang/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
+++ b/clang/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_CFGREACHABILITYANALYSIS_H
 #define LLVM_CLANG_ANALYSIS_ANALYSES_CFGREACHABILITYANALYSIS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 
@@ -28,7 +29,7 @@ class CFGBlock;
 // tend to have a common destination, so we lazily do a predecessor search
 // from the destination node and cache the results to prevent work
 // duplication.
-class CFGReverseBlockReachabilityAnalysis {
+class CLANG_ABI CFGReverseBlockReachabilityAnalysis {
   using ReachableSet = llvm::BitVector;
   using ReachableMap = llvm::DenseMap<unsigned, ReachableSet>;
 
diff --git a/clang/include/clang/Analysis/Analyses/CalledOnceCheck.h b/clang/include/clang/Analysis/Analyses/CalledOnceCheck.h
index 6a1528a2da248f..fdbcfdaa10b900 100644
--- a/clang/include/clang/Analysis/Analyses/CalledOnceCheck.h
+++ b/clang/include/clang/Analysis/Analyses/CalledOnceCheck.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_CALLEDONCECHECK_H
 #define LLVM_CLANG_ANALYSIS_ANALYSES_CALLEDONCECHECK_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
 
 class AnalysisDeclContext;
@@ -117,7 +118,7 @@ class CalledOnceCheckHandler {
 /// \param CheckConventionalParameters -- true, if we want to check parameters
 /// not explicitly marked as 'called once', but having the same requirements
 /// according to conventions.
-void checkCalledOnceParameters(AnalysisDeclContext &AC,
+CLANG_ABI void checkCalledOnceParameters(AnalysisDeclContext &AC,
                                CalledOnceCheckHandler &Handler,
                                bool CheckConventionalParameters);
 
diff --git a/clang/include/clang/Analysis/Analyses/Consumed.h b/clang/include/clang/Analysis/Analyses/Consumed.h
index 3e2788cac3c9cb..7347f7c4a67969 100644
--- a/clang/include/clang/Analysis/Analyses/Consumed.h
+++ b/clang/include/clang/Analysis/Analyses/Consumed.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -53,7 +54,7 @@ namespace consumed {
   using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
   using DiagList = std::list<DelayedDiag>;
 
-  class ConsumedWarningsHandlerBase {
+  class CLANG_ABI ConsumedWarningsHandlerBase {
   public:
     virtual ~ConsumedWarningsHandlerBase();
 
@@ -139,7 +140,7 @@ namespace consumed {
                                        SourceLocation Loc) {}
   };
 
-  class ConsumedStateMap {
+  class CLANG_ABI ConsumedStateMap {
     using VarMapType = llvm::DenseMap<const VarDecl *, ConsumedState>;
     using TmpMapType =
         llvm::DenseMap<const CXXBindTemporaryExpr *, ConsumedState>;
@@ -207,7 +208,7 @@ namespace consumed {
     bool operator!=(const ConsumedStateMap *Other) const;
   };
 
-  class ConsumedBlockInfo {
+  class CLANG_ABI ConsumedBlockInfo {
     std::vector<std::unique_ptr<ConsumedStateMap>> StateMapsArray;
     std::vector<unsigned int> VisitOrder;
 
@@ -240,7 +241,7 @@ namespace consumed {
   };
 
   /// A class that handles the analysis of uniqueness violations.
-  class ConsumedAnalyzer {
+  class CLANG_ABI ConsumedAnalyzer {
     ConsumedBlockInfo BlockInfo;
     std::unique_ptr<ConsumedStateMap> CurrStates;
 
diff --git a/clang/include/clang/Analysis/Analyses/Dominators.h b/clang/include/clang/Analysis/Analyses/Dominators.h
index 7dd54c5ce262cc..0b39441cd13443 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -15,12 +15,13 @@
 
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/GenericIteratedDominanceFrontier.h"
 #include "llvm/Support/GenericDomTree.h"
 #include "llvm/Support/GenericDomTreeConstruction.h"
+#include "llvm/Support/GenericIteratedDominanceFrontier.h"
 #include "llvm/Support/raw_ostream.h"
 
 // FIXME: There is no good reason for the domtree to require a print method
@@ -182,8 +183,8 @@ class CFGDominatorTreeImpl : public ManagedAnalysis {
 using CFGDomTree = CFGDominatorTreeImpl</*IsPostDom*/ false>;
 using CFGPostDomTree = CFGDominatorTreeImpl</*IsPostDom*/ true>;
 
-template<> void CFGDominatorTreeImpl<true>::anchor();
-template<> void CFGDominatorTreeImpl<false>::anchor();
+template<> CLANG_ABI CLANG_ABI void CFGDominatorTreeImpl<true>::anchor();
+template<> CLANG_ABI CLANG_ABI void CFGDominatorTreeImpl<false>::anchor();
 
 } // end of namespace clang
 
diff --git a/clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h b/clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
index c7a5b016c949d0..73d6c7f5feb96d 100644
--- a/clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
+++ b/clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
@@ -9,6 +9,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_EXPRMUTATIONANALYZER_H
 
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include <memory>
 
@@ -38,7 +39,7 @@ class ExprMutationAnalyzer {
       FuncParmAnalyzer.clear();
     }
   };
-  struct Analyzer {
+  struct CLANG_ABI Analyzer {
     Analyzer(const Stmt &Stm, ASTContext &Context, Memoized &Memorized)
         : Stm(Stm), Context(Context), Memorized(Memorized) {}
 
@@ -113,7 +114,7 @@ class ExprMutationAnalyzer {
 
 // A convenient wrapper around ExprMutationAnalyzer for analyzing function
 // params.
-class FunctionParmMutationAnalyzer {
+class CLANG_ABI FunctionParmMutationAnalyzer {
 public:
   static FunctionParmMutationAnalyzer *
   getFunctionParmMutationAnalyzer(const FunctionDecl &Func, ASTContext &Context,
diff --git a/clang/include/clang/Analysis/Analyses/IntervalPartition.h b/clang/include/clang/Analysis/Analyses/IntervalPartition.h
index 28a7afad41a75f..b06f023d31b5ca 100644
--- a/clang/include/clang/Analysis/Analyses/IntervalPartition.h
+++ b/clang/include/clang/Analysis/Analyses/IntervalPartition.h
@@ -20,6 +20,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_INTERVALPARTITION_H
 
 #include "clang/Analysis/CFG.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
 #include <deque>
 #include <memory>
@@ -47,9 +48,9 @@ namespace clang {
 ///
 /// This WTO construction is described in Section 4.2 of [Bourdoncle1993].
 using WeakTopologicalOrdering = std::vector<const CFGBlock *>;
-std::optional<WeakTopologicalOrdering> getIntervalWTO(const CFG &Cfg);
+CLANG_ABI std::optional<WeakTopologicalOrdering> getIntervalWTO(const CFG &Cfg);
 
-struct WTOCompare {
+struct CLANG_ABI WTOCompare {
   WTOCompare(const WeakTopologicalOrdering &WTO);
 
   bool operator()(const CFGBlock *B1, const CFGBlock *B2) const {
@@ -107,16 +108,16 @@ struct CFGIntervalNode {
 // pointer stability.
 using CFGIntervalGraph = std::deque<CFGIntervalNode>;
 
-std::vector<const CFGBlock *> buildInterval(const CFGBlock *Header);
+CLANG_ABI std::vector<const CFGBlock *> buildInterval(const CFGBlock *Header);
 
 // Partitions `Cfg` into intervals and constructs the graph of the intervals
 // based on the edges between nodes in these intervals.
-CFGIntervalGraph partitionIntoIntervals(const CFG &Cfg);
+CLANG_ABI CFGIntervalGraph partitionIntoIntervals(const CFG &Cfg);
 
 // (Further) partitions `Graph` into intervals and constructs the graph of the
 // intervals based on the edges between nodes (themselves intervals) in these
 // intervals.
-CFGIntervalGraph partitionIntoIntervals(const CFGIntervalGraph &Graph);
+CLANG_ABI CFGIntervalGraph partitionIntoIntervals(const CFGIntervalGraph &Graph);
 } // namespace internal
 } // namespace clang
 
diff --git a/clang/include/clang/Analysis/Analyses/LiveVariables.h b/clang/include/clang/Analysis/Analyses/LiveVariables.h
index 8a3dd0c35e64c9..03543e5701715a 100644
--- a/clang/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/clang/include/clang/Analysis/Analyses/LiveVariables.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Analysis/AnalysisDeclContext.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ImmutableSet.h"
 
 namespace clang {
@@ -25,9 +26,9 @@ class Stmt;
 class DeclRefExpr;
 class SourceManager;
 
-class LiveVariables : public ManagedAnalysis {
+class CLANG_ABI LiveVariables : public ManagedAnalysis {
 public:
-  class LivenessValues {
+  class CLANG_ABI LivenessValues {
   public:
 
     llvm::ImmutableSet<const Expr *> liveExprs;
@@ -51,7 +52,7 @@ class LiveVariables : public ManagedAnalysis {
     friend class LiveVariables;
   };
 
-  class Observer {
+  class CLANG_ABI Observer {
     virtual void anchor();
   public:
     virtual ~Observer() {}
@@ -109,7 +110,7 @@ class LiveVariables : public ManagedAnalysis {
   void *impl;
 };
 
-class RelaxedLiveVariables : public LiveVariables {
+class CLANG_ABI RelaxedLiveVariables : public LiveVariables {
 public:
   static std::unique_ptr<LiveVariables>
   create(AnalysisDeclContext &analysisContext) {
diff --git a/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h b/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
index c4998bb2285f7c..fcf5e0537a8ddc 100644
--- a/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
+++ b/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
@@ -16,6 +16,7 @@
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PostOrderIterator.h"
@@ -24,7 +25,7 @@
 
 namespace clang {
 
-class PostOrderCFGView : public ManagedAnalysis {
+class CLANG_ABI PostOrderCFGView : public ManagedAnalysis {
   virtual void anchor();
 
 public:
@@ -126,7 +127,7 @@ class PostOrderCFGView : public ManagedAnalysis {
 
   bool empty() const { return begin() == end(); }
 
-  struct BlockOrderCompare {
+  struct CLANG_ABI BlockOrderCompare {
     const PostOrderCFGView &POV;
 
   public:
diff --git a/clang/include/clang/Analysis/Analyses/ReachableCode.h b/clang/include/clang/Analysis/Analyses/ReachableCode.h
index f1b63f74b6c80a..50dc71ad2b04c0 100644
--- a/clang/include/clang/Analysis/Analyses/ReachableCode.h
+++ b/clang/include/clang/Analysis/Analyses/ReachableCode.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 
 //===----------------------------------------------------------------------===//
 // Forward declarations.
@@ -44,7 +45,7 @@ enum UnreachableKind {
   UK_Other
 };
 
-class Callback {
+class CLANG_ABI Callback {
   virtual void anchor();
 public:
   virtual ~Callback() {}
@@ -55,10 +56,10 @@ class Callback {
 
 /// ScanReachableFromBlock - Mark all blocks reachable from Start.
 /// Returns the total number of blocks that were marked reachable.
-unsigned ScanReachableFromBlock(const CFGBlock *Start,
+CLANG_ABI unsigned ScanReachableFromBlock(const CFGBlock *Start,
                                 llvm::BitVector &Reachable);
 
-void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
+CLANG_ABI void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
                          Callback &CB);
 
 }} // end namespace clang::reachable_code
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafety.h b/clang/include/clang/Analysis/Analyses/ThreadSafety.h
index 0866b09bab2995..e6f179c6258c6b 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafety.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafety.h
@@ -19,6 +19,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETY_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -96,7 +97,7 @@ enum LockErrorKind {
 };
 
 /// Handler class for thread safety warnings.
-class ThreadSafetyHandler {
+class CLANG_ABI ThreadSafetyHandler {
 public:
   using Name = StringRef;
 
@@ -249,15 +250,15 @@ class ThreadSafetyHandler {
 /// We traverse the blocks in the CFG, compute the set of mutexes that are held
 /// at the end of each block, and issue warnings for thread safety violations.
 /// Each block in the CFG is traversed exactly once.
-void runThreadSafetyAnalysis(AnalysisDeclContext &AC,
+CLANG_ABI void runThreadSafetyAnalysis(AnalysisDeclContext &AC,
                              ThreadSafetyHandler &Handler,
                              BeforeSet **Bset);
 
-void threadSafetyCleanup(BeforeSet *Cache);
+CLANG_ABI void threadSafetyCleanup(BeforeSet *Cache);
 
 /// Helper function that returns a LockKind required for the given level
 /// of access.
-LockKind getLockKindFromAccessKind(AccessKind AK);
+CLANG_ABI LockKind getLockKindFromAccessKind(AccessKind AK);
 
 } // namespace threadSafety
 } // namespace clang
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index e99c5b2466334a..f92083d7d21665 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -29,6 +29,7 @@
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -336,7 +337,7 @@ class CapabilityExpr {
 };
 
 // Translate clang::Expr to til::SExpr.
-class SExprBuilder {
+class CLANG_ABI SExprBuilder {
 public:
   /// Encapsulates the lexical context of a function call.  The lexical
   /// context includes the arguments to the call, including the implicit object
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
index 8d938c1b23c07d..3d6092f6cc8508 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
@@ -13,6 +13,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYLOGICAL_H
 
 #include "clang/Analysis/Analyses/ThreadSafetyTIL.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace threadSafety {
@@ -93,7 +94,7 @@ class Not : public LExpr {
 
 /// Logical implication. Returns true if LHS implies RHS, i.e. if LHS
 /// holds, then RHS must hold. For example, (A & B) implies A.
-bool implies(const LExpr *LHS, const LExpr *RHS);
+CLANG_ABI bool implies(const LExpr *LHS, const LExpr *RHS);
 
 bool LExpr::implies(const LExpr *RHS) const {
   return lexpr::implies(this, RHS);
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
index 65dd66ee093fe4..ad8fcb36b8b3a9 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
@@ -49,6 +49,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/Analysis/Analyses/ThreadSafetyUtil.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
@@ -138,10 +139,10 @@ const TIL_CastOpcode   CAST_Min = CAST_none;
 const TIL_CastOpcode   CAST_Max = CAST_toInt;
 
 /// Return the name of a unary opcode.
-StringRef getUnaryOpcodeString(TIL_UnaryOpcode Op);
+CLANG_ABI StringRef getUnaryOpcodeString(TIL_UnaryOpcode Op);
 
 /// Return the name of a binary opcode.
-StringRef getBinaryOpcodeString(TIL_BinaryOpcode Op);
+CLANG_ABI StringRef getBinaryOpcodeString(TIL_BinaryOpcode Op);
 
 /// ValueTypes are data types that can actually be held in registers.
 /// All variables and expressions must have a value type.
@@ -432,7 +433,7 @@ class Variable : public SExpr {
 
 /// Placeholder for an expression that has not yet been created.
 /// Used to implement lazy copy and rewriting strategies.
-class Future : public SExpr {
+class CLANG_ABI Future : public SExpr {
 public:
   enum FutureStatus {
     FS_pending,
@@ -1505,7 +1506,7 @@ inline ArrayRef<BasicBlock*> Terminator::successors() {
 /// which are "arguments" to the function, followed by a sequence of
 /// instructions.  It ends with a Terminator, which is a Branch or Goto to
 /// another basic block in the same SCFG.
-class BasicBlock : public SExpr {
+class CLANG_ABI BasicBlock : public SExpr {
 public:
   using InstrArray = SimpleArray<SExpr *>;
   using BlockArray = SimpleArray<BasicBlock *>;
@@ -1692,7 +1693,7 @@ class BasicBlock : public SExpr {
 /// An SCFG is a control-flow graph.  It consists of a set of basic blocks,
 /// each of which terminates in a branch to another basic block.  There is one
 /// entry point, and one exit point.
-class SCFG : public SExpr {
+class CLANG_ABI SCFG : public SExpr {
 public:
   using BlockArray = SimpleArray<BasicBlock *>;
   using iterator = BlockArray::iterator;
@@ -1907,9 +1908,9 @@ class Let : public SExpr {
   SExpr* Body;
 };
 
-const SExpr *getCanonicalVal(const SExpr *E);
-SExpr* simplifyToCanonicalVal(SExpr *E);
-void simplifyIncompleteArg(til::Phi *Ph);
+CLANG_ABI const SExpr *getCanonicalVal(const SExpr *E);
+CLANG_ABI SExpr* simplifyToCanonicalVal(SExpr *E);
+CLANG_ABI void simplifyIncompleteArg(til::Phi *Ph);
 
 } // namespace til
 } // namespace threadSafety
diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h b/clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
index ac7b24cdb4a6c9..38928ca8f005c9 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Allocator.h"
@@ -75,7 +76,7 @@ inline void *operator new(size_t Sz,
 namespace clang {
 namespace threadSafety {
 
-std::string getSourceLiteralString(const Expr *CE);
+CLANG_ABI std::string getSourceLiteralString(const Expr *CE);
 
 namespace til {
 
diff --git a/clang/include/clang/Analysis/Analyses/UninitializedValues.h b/clang/include/clang/Analysis/Analyses/UninitializedValues.h
index a2b37deddcec29..ee45d1bf672881 100644
--- a/clang/include/clang/Analysis/Analyses/UninitializedValues.h
+++ b/clang/include/clang/Analysis/Analyses/UninitializedValues.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_ANALYSIS_ANALYSES_UNINITIALIZEDVALUES_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 
 namespace clang {
@@ -101,7 +102,7 @@ class UninitUse {
   bool branch_empty() const { return UninitBranches.empty(); }
 };
 
-class UninitVariablesHandler {
+class CLANG_ABI UninitVariablesHandler {
 public:
   UninitVariablesHandler() = default;
   virtual ~UninitVariablesHandler();
@@ -125,7 +126,7 @@ struct UninitVariablesAnalysisStats {
   unsigned NumBlockVisits;
 };
 
-void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg,
+CLANG_ABI void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg,
                                        AnalysisDeclContext &ac,
                                        UninitVariablesHandler &handler,
                                        UninitVariablesAnalysisStats &stats);
diff --git a/clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h b/clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
index 267cde64f8f23c..b90d44625bded3 100644
--- a/clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
+++ b/clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
@@ -18,6 +18,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/Stmt.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 
 namespace clang {
@@ -25,7 +26,7 @@ namespace clang {
 using VarGrpTy = std::vector<const VarDecl *>;
 using VarGrpRef = ArrayRef<const VarDecl *>;
 
-class VariableGroupsManager {
+class CLANG_ABI VariableGroupsManager {
 public:
   VariableGroupsManager() = default;
   virtual ~VariableGroupsManager() = default;
@@ -82,7 +83,7 @@ class FixitStrategy {
 
 /// The interface that lets the caller handle unsafe buffer usage analysis
 /// results by overriding this class's handle... methods.
-class UnsafeBufferUsageHandler {
+class CLANG_ABI UnsafeBufferUsageHandler {
 #ifndef NDEBUG
 public:
   // A self-debugging facility that you can use to notify the user when
@@ -177,13 +178,13 @@ class UnsafeBufferUsageHandler {
 
 // This function invokes the analysis and allows the caller to react to it
 // through the handler class.
-void checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler,
+CLANG_ABI void checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler,
                             bool EmitSuggestions);
 
 namespace internal {
 // Tests if any two `FixItHint`s in `FixIts` conflict.  Two `FixItHint`s
 // conflict if they have overlapping source ranges.
-bool anyConflict(const llvm::SmallVectorImpl<FixItHint> &FixIts,
+CLANG_ABI bool anyConflict(const llvm::SmallVectorImpl<FixItHint> &FixIts,
                  const SourceManager &SM);
 } // namespace internal
 } // end namespace clang
diff --git a/clang/include/clang/Analysis/AnalysisDeclContext.h b/clang/include/clang/Analysis/AnalysisDeclContext.h
index a517a4e757c9ff..b1afbc018f1c04 100644
--- a/clang/include/clang/Analysis/AnalysisDeclContext.h
+++ b/clang/include/clang/Analysis/AnalysisDeclContext.h
@@ -22,6 +22,7 @@
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/CodeInjector.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/StringRef.h"
@@ -48,7 +49,7 @@ class VarDecl;
 
 /// The base class of a hierarchy of objects representing analyses tied
 /// to AnalysisDeclContext.
-class ManagedAnalysis {
+class CLANG_ABI ManagedAnalysis {
 protected:
   ManagedAnalysis() = default;
 
@@ -69,7 +70,7 @@ class ManagedAnalysis {
 
 /// AnalysisDeclContext contains the context data for the function, method
 /// or block under analysis.
-class AnalysisDeclContext {
+class CLANG_ABI AnalysisDeclContext {
   // Backpoint to the AnalysisManager object that created this
   // AnalysisDeclContext. This may be null.
   AnalysisDeclContextManager *ADCMgr;
@@ -212,7 +213,7 @@ class AnalysisDeclContext {
 /// the help of StackFrameContext and inside the function calls the
 /// BlockInvocationContext. It is needed for context sensitive analysis to
 /// model entering, leaving or inlining function calls.
-class LocationContext : public llvm::FoldingSetNode {
+class CLANG_ABI LocationContext : public llvm::FoldingSetNode {
 public:
   enum ContextKind { StackFrame, Block };
 
@@ -296,7 +297,7 @@ class LocationContext : public llvm::FoldingSetNode {
 };
 
 /// It represents a stack frame of the call stack (based on CallEvent).
-class StackFrameContext : public LocationContext {
+class CLANG_ABI StackFrameContext : public LocationContext {
   friend class LocationContextManager;
 
   // The call site where this stack frame is established.
@@ -350,7 +351,7 @@ class StackFrameContext : public LocationContext {
 };
 
 /// It represents a block invocation (based on BlockCall).
-class BlockInvocationContext : public LocationContext {
+class CLANG_ABI BlockInvocationContext : public LocationContext {
   friend class LocationContextManager;
 
   const BlockDecl *BD;
@@ -384,7 +385,7 @@ class BlockInvocationContext : public LocationContext {
   }
 };
 
-class LocationContextManager {
+class CLANG_ABI LocationContextManager {
   llvm::FoldingSet<LocationContext> Contexts;
 
   // ID used for generating a new location context.
@@ -422,7 +423,7 @@ class LocationContextManager {
   void clear();
 };
 
-class AnalysisDeclContextManager {
+class CLANG_ABI AnalysisDeclContextManager {
   using ContextMap =
       llvm::DenseMap<const Decl *, std::unique_ptr<AnalysisDeclContext>>;
 
diff --git a/clang/include/clang/Analysis/BodyFarm.h b/clang/include/clang/Analysis/BodyFarm.h
index 52be29cb7885e7..e07bdba4cfbee4 100644
--- a/clang/include/clang/Analysis/BodyFarm.h
+++ b/clang/include/clang/Analysis/BodyFarm.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/DeclBase.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include <optional>
 
@@ -27,7 +28,7 @@ class ObjCMethodDecl;
 class Stmt;
 class CodeInjector;
 
-class BodyFarm {
+class CLANG_ABI BodyFarm {
 public:
   BodyFarm(ASTContext &C, CodeInjector *injector) : C(C), Injector(injector) {}
 
diff --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h
index a7ff38c786a8fe..0e5ddfef7e4b67 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -20,6 +20,7 @@
 #include "clang/Analysis/ConstructionContext.h"
 #include "clang/Analysis/Support/BumpVector.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -52,7 +53,7 @@ class LangOptions;
 class VarDecl;
 
 /// Represents a top-level expression in a basic block.
-class CFGElement {
+class CLANG_ABI CFGElement {
 public:
   enum Kind {
     // main kind
@@ -363,7 +364,7 @@ class CFGScopeEnd : public CFGElement {
 
 /// Represents C++ object destructor implicitly generated by compiler on various
 /// occasions.
-class CFGImplicitDtor : public CFGElement {
+class CLANG_ABI CFGImplicitDtor : public CFGElement {
 protected:
   CFGImplicitDtor() = default;
 
@@ -601,7 +602,7 @@ class CFGTerminator {
 ///     vbase inits    |  already handled by the most derived class; not yet
 ///
 /// But note that any of that may be NULL in case of optimized-out edges.
-class CFGBlock {
+class CLANG_ABI CFGBlock {
   class ElementList {
     using ImplTy = BumpVector<CFGElement>;
 
@@ -816,7 +817,7 @@ class CFGBlock {
   /// trivially unreachable.  For some cases it allows one to encode scenarios
   /// where a block was substituted because the original (now alternate) block
   /// is unreachable.
-  class AdjacentBlock {
+  class CLANG_ABI AdjacentBlock {
     enum Kind {
       AB_Normal,
       AB_Unreachable,
@@ -1211,7 +1212,7 @@ class CFGCallback {
 ///  Entry block.  The CFG solely represents control-flow; it consists of
 ///  CFGBlocks which are simply containers of Stmt*'s in the AST the CFG
 ///  was constructed from.
-class CFG {
+class CLANG_ABI CFG {
 public:
   //===--------------------------------------------------------------------===//
   // CFG Construction & Manipulation.
@@ -1456,7 +1457,7 @@ class CFG {
   llvm::DenseMap<const DeclStmt *, const DeclStmt *> SyntheticDeclStmts;
 };
 
-Expr *extractElementInitializerFromNestedAILE(const ArrayInitLoopExpr *AILE);
+CLANG_ABI Expr *extractElementInitializerFromNestedAILE(const ArrayInitLoopExpr *AILE);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Analysis/CFGStmtMap.h b/clang/include/clang/Analysis/CFGStmtMap.h
index 93cd9cfc5bdff2..baf1944a6fa24f 100644
--- a/clang/include/clang/Analysis/CFGStmtMap.h
+++ b/clang/include/clang/Analysis/CFGStmtMap.h
@@ -15,13 +15,14 @@
 #define LLVM_CLANG_ANALYSIS_CFGSTMTMAP_H
 
 #include "clang/Analysis/CFG.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 class ParentMap;
 class Stmt;
 
-class CFGStmtMap {
+class CLANG_ABI CFGStmtMap {
   ParentMap *PM;
   void *M;
 
diff --git a/clang/include/clang/Analysis/CallGraph.h b/clang/include/clang/Analysis/CallGraph.h
index 78f8d115550178..ba89e14c706030 100644
--- a/clang/include/clang/Analysis/CallGraph.h
+++ b/clang/include/clang/Analysis/CallGraph.h
@@ -19,6 +19,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/STLExtras.h"
@@ -39,7 +40,7 @@ class Stmt;
 /// The call graph extends itself with the given declarations by implementing
 /// the recursive AST visitor, which constructs the graph by visiting the given
 /// declarations.
-class CallGraph : public RecursiveASTVisitor<CallGraph> {
+class CLANG_ABI CallGraph : public RecursiveASTVisitor<CallGraph> {
   friend class CallGraphNode;
 
   using FunctionMapTy =
@@ -144,7 +145,7 @@ class CallGraph : public RecursiveASTVisitor<CallGraph> {
   void addNodeForDecl(Decl *D, bool IsGlobal);
 };
 
-class CallGraphNode {
+class CLANG_ABI CallGraphNode {
 public:
   struct CallRecord {
     CallGraphNode *Callee;
diff --git a/clang/include/clang/Analysis/CloneDetection.h b/clang/include/clang/Analysis/CloneDetection.h
index 3385579584b5a2..92c669849ef24f 100644
--- a/clang/include/clang/Analysis/CloneDetection.h
+++ b/clang/include/clang/Analysis/CloneDetection.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_ANALYSIS_CLONEDETECTION_H
 
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Regex.h"
 #include <vector>
 
@@ -30,7 +31,7 @@ class CompoundStmt;
 ///
 /// Can either identify a single arbitrary Stmt object, a continuous sequence of
 /// child statements inside a CompoundStmt or no statements at all.
-class StmtSequence {
+class CLANG_ABI StmtSequence {
   /// If this object identifies a sequence of statements inside a CompoundStmt,
   /// S points to this CompoundStmt. If this object only identifies a single
   /// Stmt, then S is a pointer to this Stmt.
@@ -163,7 +164,7 @@ class StmtSequence {
 /// This class only searches for clones in executable source code
 /// (e.g. function bodies). Other clones (e.g. cloned comments or declarations)
 /// are not supported.
-class CloneDetector {
+class CLANG_ABI CloneDetector {
 
 public:
   /// A collection of StmtSequences that share an arbitrary property.
@@ -219,7 +220,7 @@ class CloneDetector {
 
 /// This class is a utility class that contains utility functions for building
 /// custom constraints.
-class CloneConstraint {
+class CLANG_ABI CloneConstraint {
 public:
   /// Removes all groups by using a filter function.
   /// \param CloneGroups The list of CloneGroups that is supposed to be
@@ -251,7 +252,7 @@ class CloneConstraint {
 /// them. Add the slower RecursiveCloneTypeIIVerifyConstraint later in the
 /// constraint chain, not necessarily immediately, to eliminate hash collisions
 /// through a more detailed analysis.
-class RecursiveCloneTypeIIHashConstraint {
+class CLANG_ABI RecursiveCloneTypeIIHashConstraint {
 public:
   void constrain(std::vector<CloneDetector::CloneGroup> &Sequences);
 };
@@ -262,7 +263,7 @@ class RecursiveCloneTypeIIHashConstraint {
 /// In contrast to the RecursiveCloneTypeIIHashConstraint, all clones in a clone
 /// group are guaranteed to be type II clones of each other, but it is too
 /// slow to efficiently handle large amounts of clones.
-class RecursiveCloneTypeIIVerifyConstraint {
+class CLANG_ABI RecursiveCloneTypeIIVerifyConstraint {
 public:
   void constrain(std::vector<CloneDetector::CloneGroup> &Sequences);
 };
@@ -272,7 +273,7 @@ class RecursiveCloneTypeIIVerifyConstraint {
 /// Complexity is here defined as the total amount of children of a statement.
 /// This constraint assumes the first statement in the group is representative
 /// for all other statements in the group in terms of complexity.
-class MinComplexityConstraint {
+class CLANG_ABI MinComplexityConstraint {
   unsigned MinComplexity;
 
 public:
@@ -315,11 +316,11 @@ class MinGroupSizeConstraint {
 };
 
 /// Ensures that no clone group fully contains another clone group.
-struct OnlyLargestCloneConstraint {
+struct CLANG_ABI OnlyLargestCloneConstraint {
   void constrain(std::vector<CloneDetector::CloneGroup> &Result);
 };
 
-struct FilenamePatternConstraint {
+struct CLANG_ABI FilenamePatternConstraint {
   StringRef IgnoredFilesPattern;
   std::shared_ptr<llvm::Regex> IgnoredFilesRegex;
 
@@ -340,7 +341,7 @@ struct FilenamePatternConstraint {
 };
 
 /// Analyzes the pattern of the referenced variables in a statement.
-class VariablePattern {
+class CLANG_ABI VariablePattern {
 
   /// Describes an occurrence of a variable reference in a statement.
   struct VariableOccurence {
@@ -429,7 +430,7 @@ class VariablePattern {
 };
 
 /// Ensures that all clones reference variables in the same pattern.
-struct MatchingVariablePatternConstraint {
+struct CLANG_ABI MatchingVariablePatternConstraint {
   void constrain(std::vector<CloneDetector::CloneGroup> &CloneGroups);
 };
 
diff --git a/clang/include/clang/Analysis/CodeInjector.h b/clang/include/clang/Analysis/CodeInjector.h
index a59dc0a9415901..fd99503d72bf0e 100644
--- a/clang/include/clang/Analysis/CodeInjector.h
+++ b/clang/include/clang/Analysis/CodeInjector.h
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_CODEINJECTOR_H
 #define LLVM_CLANG_ANALYSIS_CODEINJECTOR_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
 
 class Stmt;
@@ -32,7 +33,7 @@ class ObjCMethodDecl;
 /// the body can be arbitrary, but it is advised to use memoization to avoid
 /// unnecessary reparsing of the external source that provides the body of the
 /// functions.
-class CodeInjector {
+class CLANG_ABI CodeInjector {
 public:
   CodeInjector();
   virtual ~CodeInjector();
diff --git a/clang/include/clang/Analysis/ConstructionContext.h b/clang/include/clang/Analysis/ConstructionContext.h
index e19a2050009590..c3befc9aa21e33 100644
--- a/clang/include/clang/Analysis/ConstructionContext.h
+++ b/clang/include/clang/Analysis/ConstructionContext.h
@@ -16,9 +16,10 @@
 #ifndef LLVM_CLANG_ANALYSIS_CONSTRUCTIONCONTEXT_H
 #define LLVM_CLANG_ANALYSIS_CONSTRUCTIONCONTEXT_H
 
-#include "clang/Analysis/Support/BumpVector.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
+#include "clang/Analysis/Support/BumpVector.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -210,7 +211,7 @@ class ConstructionContextItem {
 /// (which has links to the previous layers) and classifies the seemingly
 /// arbitrary chain of layers into one of the possible ways of constructing
 /// an object in C++ for user-friendly experience.
-class ConstructionContextLayer {
+class CLANG_ABI ConstructionContextLayer {
   const ConstructionContextLayer *Parent = nullptr;
   ConstructionContextItem Item;
 
@@ -240,7 +241,7 @@ class ConstructionContextLayer {
 /// an object in C++. The context re-captures the essential parent AST nodes
 /// of the CXXConstructExpr it is assigned to and presents these nodes
 /// through easy-to-understand accessor methods.
-class ConstructionContext {
+class CLANG_ABI ConstructionContext {
 public:
   enum Kind {
     SimpleVariableKind,
diff --git a/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h b/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
index 8531d17767ba51..802068341a637b 100644
--- a/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
+++ b/clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_ANALYSIS_DOMAINSPECIFIC_COCOACONVENTIONS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -23,17 +24,17 @@ class QualType;
 namespace ento {
 namespace cocoa {
 
-  bool isRefType(QualType RetTy, StringRef Prefix,
+  CLANG_ABI bool isRefType(QualType RetTy, StringRef Prefix,
                  StringRef Name = StringRef());
 
-  bool isCocoaObjectRef(QualType T);
+  CLANG_ABI bool isCocoaObjectRef(QualType T);
 
 }
 
 namespace coreFoundation {
-  bool isCFObjectRef(QualType T);
+  CLANG_ABI bool isCFObjectRef(QualType T);
 
-  bool followsCreateRule(const FunctionDecl *FD);
+  CLANG_ABI bool followsCreateRule(const FunctionDecl *FD);
 }
 
 }} // end: "clang:ento"
diff --git a/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h b/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
index 80d7cb8e03a18a..e079cb7474fca3 100644
--- a/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
+++ b/clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
@@ -15,13 +15,14 @@
 #define LLVM_CLANG_ANALYSIS_DOMAINSPECIFIC_OBJCNORETURN_H
 
 #include "clang/Basic/IdentifierTable.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 class ASTContext;
 class ObjCMessageExpr;
 
-class ObjCNoReturn {
+class CLANG_ABI ObjCNoReturn {
   /// Cached "raise" selector.
   Selector RaiseSel;
 
diff --git a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
index ec4d041254877f..4f4696e0bde6fa 100644
--- a/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/ASTOps.h
@@ -18,6 +18,7 @@
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Type.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SetVector.h"
 
@@ -34,18 +35,18 @@ namespace dataflow {
 ///   * `ExprWithCleanups` - The CFG will generate the appropriate calls to
 ///   destructors and then omit the node.
 ///
-const Expr &ignoreCFGOmittedNodes(const Expr &E);
-const Stmt &ignoreCFGOmittedNodes(const Stmt &S);
+CLANG_ABI const Expr &ignoreCFGOmittedNodes(const Expr &E);
+CLANG_ABI const Stmt &ignoreCFGOmittedNodes(const Stmt &S);
 
 /// A set of `FieldDecl *`. Use `SmallSetVector` to guarantee deterministic
 /// iteration order.
 using FieldSet = llvm::SmallSetVector<const FieldDecl *, 4>;
 
 /// Returns the set of all fields in the type.
-FieldSet getObjectFields(QualType Type);
+CLANG_ABI FieldSet getObjectFields(QualType Type);
 
 /// Returns whether `Fields` and `FieldLocs` contain the same fields.
-bool containsSameFields(const FieldSet &Fields,
+CLANG_ABI bool containsSameFields(const FieldSet &Fields,
                         const RecordStorageLocation::FieldToLoc &FieldLocs);
 
 /// Helper class for initialization of a record with an `InitListExpr`.
@@ -53,7 +54,7 @@ bool containsSameFields(const FieldSet &Fields,
 /// and the fields of the record; this helper class separates these out into two
 /// different lists. In addition, it deals with special cases associated with
 /// unions.
-class RecordInitListHelper {
+class CLANG_ABI RecordInitListHelper {
 public:
   // `InitList` must have record type.
   RecordInitListHelper(const InitListExpr *InitList);
@@ -148,10 +149,10 @@ struct ReferencedDecls {
 };
 
 /// Returns declarations that are declared in or referenced from `FD`.
-ReferencedDecls getReferencedDecls(const FunctionDecl &FD);
+CLANG_ABI ReferencedDecls getReferencedDecls(const FunctionDecl &FD);
 
 /// Returns declarations that are declared in or referenced from `S`.
-ReferencedDecls getReferencedDecls(const Stmt &S);
+CLANG_ABI ReferencedDecls getReferencedDecls(const Stmt &S);
 
 } // namespace dataflow
 } // namespace clang
diff --git a/clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h b/clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h
index 5c64e5b0947498..0b0dfb15c84794 100644
--- a/clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h
+++ b/clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h
@@ -19,6 +19,7 @@
 #include "clang/AST/Stmt.h"
 #include "clang/Analysis/CFG.h"
 #include "clang/Analysis/FlowSensitive/ASTOps.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Error.h"
@@ -29,7 +30,7 @@ namespace clang {
 namespace dataflow {
 
 namespace internal {
-class StmtToBlockMap {
+class CLANG_ABI StmtToBlockMap {
 public:
   StmtToBlockMap(const CFG &Cfg);
 
@@ -44,7 +45,7 @@ class StmtToBlockMap {
 
 /// Holds CFG with additional information derived from it that is needed to
 /// perform dataflow analysis.
-class AdornedCFG {
+class CLANG_ABI AdornedCFG {
 public:
   /// Builds an `AdornedCFG` from a `FunctionDecl`.
   /// `Func.doesThisDeclarationHaveABody()` must be true, and
diff --git a/clang/include/clang/Analysis/FlowSensitive/Arena.h b/clang/include/clang/Analysis/FlowSensitive/Arena.h
index 394ce054e65f11..9800f683805ed2 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Arena.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Arena.h
@@ -11,6 +11,7 @@
 #include "clang/Analysis/FlowSensitive/Formula.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <vector>
 
@@ -18,7 +19,7 @@ namespace clang::dataflow {
 
 /// The Arena owns the objects that model data within an analysis.
 /// For example, `Value`, `StorageLocation`, `Atom`, and `Formula`.
-class Arena {
+class CLANG_ABI Arena {
 public:
   Arena()
       : True(Formula::create(Alloc, Formula::Literal, {}, 1)),
diff --git a/clang/include/clang/Analysis/FlowSensitive/CNFFormula.h b/clang/include/clang/Analysis/FlowSensitive/CNFFormula.h
index fb13e774c67fe7..4ff63bf8bbb641 100644
--- a/clang/include/clang/Analysis/FlowSensitive/CNFFormula.h
+++ b/clang/include/clang/Analysis/FlowSensitive/CNFFormula.h
@@ -17,6 +17,7 @@
 #include <vector>
 
 #include "clang/Analysis/FlowSensitive/Formula.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace dataflow {
@@ -65,7 +66,7 @@ inline constexpr Variable var(Literal L) { return L >> 1; }
 
 /// A boolean formula in 3-CNF (conjunctive normal form with at most 3 literals
 /// per clause).
-class CNFFormula {
+class CLANG_ABI CNFFormula {
   /// `LargestVar` is equal to the largest positive integer that represents a
   /// variable in the formula.
   const Variable LargestVar;
@@ -170,7 +171,7 @@ class CNFFormula {
 /// form where each clause has at least one and at most three literals.
 /// `Atomics` is populated with a mapping from `Variables` to the corresponding
 /// `Atom`s for atomic booleans in the input formulas.
-CNFFormula buildCNF(const llvm::ArrayRef<const Formula *> &Formulas,
+CLANG_ABI CNFFormula buildCNF(const llvm::ArrayRef<const Formula *> &Formulas,
                     llvm::DenseMap<Variable, Atom> &Atomics);
 
 } // namespace dataflow
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index e6efde091871fc..aa3c222d975444 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -28,6 +28,7 @@
 #include "clang/Analysis/FlowSensitive/MatchSwitch.h"
 #include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
 #include "clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallVector.h"
@@ -392,7 +393,7 @@ diagnoseFunction(const FunctionDecl &FuncDecl, ASTContext &ASTCtx,
 /// Abstract base class for dataflow "models": reusable analysis components that
 /// model a particular aspect of program semantics in the `Environment`. For
 /// example, a model may capture a type and its related functions.
-class DataflowModel : public Environment::ValueModel {
+class CLANG_ABI DataflowModel : public Environment::ValueModel {
 public:
   /// Return value indicates whether the model processed the `Element`.
   virtual bool transfer(const CFGElement &Element, Environment &Env) = 0;
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
index 5be4a1145f40d7..52eaed19e7d1de 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
@@ -24,6 +24,7 @@
 #include "clang/Analysis/FlowSensitive/Solver.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SetVector.h"
@@ -44,7 +45,7 @@ struct ContextSensitiveOptions {
 
 /// Owns objects that encompass the state of a program and stores context that
 /// is used during dataflow analysis.
-class DataflowAnalysisContext {
+class CLANG_ABI DataflowAnalysisContext {
 public:
   struct Options {
     /// Options for analyzing function bodies when present in the translation
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
index 097ff2bdfe7ada..2dc3e98e1c424b 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -26,6 +26,7 @@
 #include "clang/Analysis/FlowSensitive/Logger.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/MapVector.h"
@@ -62,7 +63,7 @@ struct WidenResult {
 /// local and global variables are not currently invalidated on function calls.
 /// This is unsound and should be taken into account when designing dataflow
 /// analyses.
-class Environment {
+class CLANG_ABI Environment {
 public:
   /// Supplements `Environment` with non-standard comparison and join
   /// operations.
@@ -813,13 +814,13 @@ class Environment {
 /// `CXXMemberCallExpr`, or null if none is defined in the environment.
 /// Dereferences the pointer if the member call expression was written using
 /// `->`.
-RecordStorageLocation *getImplicitObjectLocation(const CXXMemberCallExpr &MCE,
+CLANG_ABI RecordStorageLocation *getImplicitObjectLocation(const CXXMemberCallExpr &MCE,
                                                  const Environment &Env);
 
 /// Returns the storage location for the base object of a `MemberExpr`, or null
 /// if none is defined in the environment. Dereferences the pointer if the
 /// member expression was written using `->`.
-RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
+CLANG_ABI RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
                                              const Environment &Env);
 
 } // namespace dataflow
diff --git a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
index 6b9f3681490af1..48d78c843e050e 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
@@ -19,16 +19,17 @@
 
 #include "clang/Analysis/FlowSensitive/Solver.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace dataflow {
 
 /// Returns a string representation of a value kind.
-llvm::StringRef debugString(Value::Kind Kind);
+CLANG_ABI llvm::StringRef debugString(Value::Kind Kind);
 
 /// Returns a string representation of the result status of a SAT check.
-llvm::StringRef debugString(Solver::Result::Status Status);
+CLANG_ABI llvm::StringRef debugString(Solver::Result::Status Status);
 
 } // namespace dataflow
 } // namespace clang
diff --git a/clang/include/clang/Analysis/FlowSensitive/Formula.h b/clang/include/clang/Analysis/FlowSensitive/Formula.h
index 0e6352403a832f..20d1f120684de1 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Formula.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Formula.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_FORMULA_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
@@ -46,7 +47,7 @@ enum class Atom : unsigned {};
 /// trailing objects.
 /// For this reason, Formulas are Arena-allocated and over-aligned.
 class Formula;
-class alignas(const Formula *) Formula {
+class CLANG_ABI alignas(const Formula *) Formula {
 public:
   enum Kind : unsigned {
     /// A reference to an atomic boolean variable.
diff --git a/clang/include/clang/Analysis/FlowSensitive/Logger.h b/clang/include/clang/Analysis/FlowSensitive/Logger.h
index f2e64810d00506..4149aee4616781 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Logger.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Logger.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_LOGGER_H
 
 #include "clang/Analysis/CFG.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
 
@@ -24,7 +25,7 @@ struct TypeErasedDataflowAnalysisState;
 ///
 /// The framework reports key structural events (e.g. traversal of blocks).
 /// The specific analysis can add extra details to be presented in context.
-class Logger {
+class CLANG_ABI Logger {
 public:
   /// Returns a dummy logger that does nothing.
   static Logger &null();
diff --git a/clang/include/clang/Analysis/FlowSensitive/Models/ChromiumCheckModel.h b/clang/include/clang/Analysis/FlowSensitive/Models/ChromiumCheckModel.h
index b4315e41d79fa6..91752f4070491c 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Models/ChromiumCheckModel.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Models/ChromiumCheckModel.h
@@ -15,6 +15,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/Analysis/FlowSensitive/DataflowAnalysis.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
 
 namespace clang {
@@ -22,7 +23,7 @@ namespace dataflow {
 
 /// Models the behavior of Chromium's CHECK, DCHECK, etc. macros, so that code
 /// after a call to `*CHECK` can rely on the condition being true.
-class ChromiumCheckModel : public DataflowModel {
+class CLANG_ABI ChromiumCheckModel : public DataflowModel {
 public:
   ChromiumCheckModel() = default;
   bool transfer(const CFGElement &Element, Environment &Env) override;
diff --git a/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h b/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h
index 09eb8b93822612..1758dbc5807db1 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h
@@ -21,6 +21,7 @@
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
 #include "clang/Analysis/FlowSensitive/NoopLattice.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 
 namespace clang {
@@ -42,7 +43,7 @@ struct UncheckedOptionalAccessModelOptions {
 /// Dataflow analysis that models whether optionals hold values or not.
 ///
 /// Models the `std::optional`, `absl::optional`, and `base::Optional` types.
-class UncheckedOptionalAccessModel
+class CLANG_ABI UncheckedOptionalAccessModel
     : public DataflowAnalysis<UncheckedOptionalAccessModel, NoopLattice> {
 public:
   UncheckedOptionalAccessModel(ASTContext &Ctx, dataflow::Environment &Env);
@@ -58,7 +59,7 @@ class UncheckedOptionalAccessModel
   CFGMatchSwitch<TransferState<NoopLattice>> TransferMatchSwitch;
 };
 
-class UncheckedOptionalAccessDiagnoser {
+class CLANG_ABI UncheckedOptionalAccessDiagnoser {
 public:
   UncheckedOptionalAccessDiagnoser(
       UncheckedOptionalAccessModelOptions Options = {});
diff --git a/clang/include/clang/Analysis/FlowSensitive/RecordOps.h b/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
index 8fad45fc11d81e..d5e2f0bf880234 100644
--- a/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
+++ b/clang/include/clang/Analysis/FlowSensitive/RecordOps.h
@@ -15,6 +15,7 @@
 
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace dataflow {
@@ -36,7 +37,7 @@ namespace dataflow {
 ///    - The type of `Src` must be derived from `Dest`, or
 ///    - The type of `Dest` must be derived from `Src` (in this case, any fields
 ///      that are only present in `Dest` are not overwritten).
-void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
+CLANG_ABI void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
                 Environment &Env);
 
 /// Returns whether the records `Loc1` and `Loc2` are equal.
@@ -57,7 +58,7 @@ void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
 /// Requirements:
 ///
 ///  `Src` and `Dst` must have the same canonical unqualified type.
-bool recordsEqual(const RecordStorageLocation &Loc1, const Environment &Env1,
+CLANG_ABI bool recordsEqual(const RecordStorageLocation &Loc1, const Environment &Env1,
                   const RecordStorageLocation &Loc2, const Environment &Env2);
 
 inline bool recordsEqual(const RecordStorageLocation &Loc1,
diff --git a/clang/include/clang/Analysis/FlowSensitive/SimplifyConstraints.h b/clang/include/clang/Analysis/FlowSensitive/SimplifyConstraints.h
index fadb3caf0a4c8e..629d440980a9e0 100644
--- a/clang/include/clang/Analysis/FlowSensitive/SimplifyConstraints.h
+++ b/clang/include/clang/Analysis/FlowSensitive/SimplifyConstraints.h
@@ -11,6 +11,7 @@
 
 #include "clang/Analysis/FlowSensitive/Arena.h"
 #include "clang/Analysis/FlowSensitive/Formula.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SetVector.h"
 
 namespace clang {
@@ -40,7 +41,7 @@ struct SimplifyConstraintsInfo {
 /// that the set of solutions is the same before and after simplification.
 /// `Info`, if non-null, will be populated with information about the
 /// simplifications that were made to the formula (e.g. to display to the user).
-void simplifyConstraints(llvm::SetVector<const Formula *> &Constraints,
+CLANG_ABI void simplifyConstraints(llvm::SetVector<const Formula *> &Constraints,
                          Arena &arena, SimplifyConstraintsInfo *Info = nullptr);
 
 } // namespace dataflow
diff --git a/clang/include/clang/Analysis/FlowSensitive/Solver.h b/clang/include/clang/Analysis/FlowSensitive/Solver.h
index 6166a503ab413a..e3a898efffc7dc 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Solver.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Solver.h
@@ -16,6 +16,7 @@
 
 #include "clang/Analysis/FlowSensitive/Formula.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include <optional>
@@ -25,7 +26,7 @@ namespace clang {
 namespace dataflow {
 
 /// An interface for a SAT solver that can be used by dataflow analyses.
-class Solver {
+class CLANG_ABI Solver {
 public:
   struct Result {
     enum class Status {
@@ -92,8 +93,8 @@ class Solver {
   virtual bool reachedLimit() const = 0;
 };
 
-llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Solver::Result &);
-llvm::raw_ostream &operator<<(llvm::raw_ostream &, Solver::Result::Assignment);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Solver::Result &);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &, Solver::Result::Assignment);
 
 } // namespace dataflow
 } // namespace clang
diff --git a/clang/include/clang/Analysis/FlowSensitive/Transfer.h b/clang/include/clang/Analysis/FlowSensitive/Transfer.h
index 940025e02100f9..412d60d1516142 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Transfer.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Transfer.h
@@ -18,12 +18,13 @@
 #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
 #include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace dataflow {
 
 /// Maps statements to the environments of basic blocks that contain them.
-class StmtToEnvMap {
+class CLANG_ABI StmtToEnvMap {
 public:
   // `CurBlockID` is the ID of the block currently being processed, and
   // `CurState` is the pending state currently associated with this block. These
@@ -53,7 +54,7 @@ class StmtToEnvMap {
 /// Requirements:
 ///
 ///  `S` must not be `ParenExpr` or `ExprWithCleanups`.
-void transfer(const StmtToEnvMap &StmtToEnv, const Stmt &S, Environment &Env,
+CLANG_ABI void transfer(const StmtToEnvMap &StmtToEnv, const Stmt &S, Environment &Env,
               Environment::ValueModel &Model);
 
 } // namespace dataflow
diff --git a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
index 512453e2be67ad..21eb2ead7d4044 100644
--- a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
@@ -25,6 +25,7 @@
 #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h"
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
 #include "clang/Analysis/FlowSensitive/DataflowLattice.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/Any.h"
 #include "llvm/Support/Error.h"
 
@@ -51,7 +52,7 @@ struct TypeErasedLattice {
 };
 
 /// Type-erased base class for dataflow analyses built on a single lattice type.
-class TypeErasedDataflowAnalysis : public Environment::ValueModel {
+class CLANG_ABI TypeErasedDataflowAnalysis : public Environment::ValueModel {
   DataflowAnalysisOptions Options;
 
 public:
@@ -157,7 +158,7 @@ struct CFGEltCallbacksTypeErased {
 /// blocks. This parameter is a backstop to prevent infinite loops, in the case
 /// of bugs in the lattice and/or transfer functions that prevent the analysis
 /// from converging.
-llvm::Expected<std::vector<std::optional<TypeErasedDataflowAnalysisState>>>
+CLANG_ABI llvm::Expected<std::vector<std::optional<TypeErasedDataflowAnalysisState>>>
 runTypeErasedDataflowAnalysis(
     const AdornedCFG &ACFG, TypeErasedDataflowAnalysis &Analysis,
     const Environment &InitEnv,
diff --git a/clang/include/clang/Analysis/FlowSensitive/Value.h b/clang/include/clang/Analysis/FlowSensitive/Value.h
index 97efa3a93ce6d9..acbd19201d7f0d 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Value.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Value.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/Analysis/FlowSensitive/Formula.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -88,7 +89,7 @@ class Value {
 /// * TopBoolValue -- both are `TopBoolValue`s.
 ///
 /// Otherwise, falls back to pointer equality.
-bool areEquivalentValues(const Value &Val1, const Value &Val2);
+CLANG_ABI bool areEquivalentValues(const Value &Val1, const Value &Val2);
 
 /// Models a boolean.
 class BoolValue : public Value {
@@ -182,7 +183,7 @@ class PointerValue final : public Value {
   StorageLocation &PointeeLoc;
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const Value &Val);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, const Value &Val);
 
 } // namespace dataflow
 } // namespace clang
diff --git a/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h b/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
index d74380b78e935d..d876eefb04072c 100644
--- a/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
+++ b/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
@@ -16,6 +16,7 @@
 
 #include "clang/Analysis/FlowSensitive/Formula.h"
 #include "clang/Analysis/FlowSensitive/Solver.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 
 namespace clang {
@@ -28,7 +29,7 @@ namespace dataflow {
 /// for unit propagation.
 //
 // [1] https://en.wikipedia.org/wiki/DPLL_algorithm
-class WatchedLiteralsSolver : public Solver {
+class CLANG_ABI WatchedLiteralsSolver : public Solver {
   // Count of the iterations of the main loop of the solver. This spans *all*
   // calls to the underlying solver across the life of this object. It is
   // reduced with every (non-trivial) call to the solver.
diff --git a/clang/include/clang/Analysis/IssueHash.h b/clang/include/clang/Analysis/IssueHash.h
index 78bebbdb6ec749..3a1b20ba9d8c9f 100644
--- a/clang/include/clang/Analysis/IssueHash.h
+++ b/clang/include/clang/Analysis/IssueHash.h
@@ -8,6 +8,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_ISSUEHASH_H
 #define LLVM_CLANG_ANALYSIS_ISSUEHASH_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallString.h"
 
 namespace clang {
@@ -31,7 +32,7 @@ class LangOptions;
 ///   - Name of the enclosing declaration.
 ///   - Contents of the line of code with the issue, excluding whitespace.
 ///   - Column number (but not the line number! - which makes it stable).
-llvm::SmallString<32> getIssueHash(const FullSourceLoc &IssueLoc,
+CLANG_ABI llvm::SmallString<32> getIssueHash(const FullSourceLoc &IssueLoc,
                                    llvm::StringRef CheckerName,
                                    llvm::StringRef WarningMessage,
                                    const Decl *IssueDecl,
@@ -40,7 +41,7 @@ llvm::SmallString<32> getIssueHash(const FullSourceLoc &IssueLoc,
 /// Get the unhashed string representation of the V1 issue hash.
 /// When hashed, it becomes the actual issue hash. Useful for testing.
 /// See GetIssueHashV1() for more information.
-std::string getIssueString(const FullSourceLoc &IssueLoc,
+CLANG_ABI std::string getIssueString(const FullSourceLoc &IssueLoc,
                            llvm::StringRef CheckerName,
                            llvm::StringRef WarningMessage,
                            const Decl *IssueDecl, const LangOptions &LangOpts);
diff --git a/clang/include/clang/Analysis/MacroExpansionContext.h b/clang/include/clang/Analysis/MacroExpansionContext.h
index 2a27aba76656d6..2e032059567478 100644
--- a/clang/include/clang/Analysis/MacroExpansionContext.h
+++ b/clang/include/clang/Analysis/MacroExpansionContext.h
@@ -12,6 +12,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -70,7 +71,7 @@ class MacroExpansionRangeRecorder;
 ///         variable declarations.
 /// \remark MacroExpansionContext object must outlive the Preprocessor
 ///         parameter.
-class MacroExpansionContext {
+class CLANG_ABI MacroExpansionContext {
 public:
   /// Creates a MacroExpansionContext.
   /// \remark You must call registerForPreprocessor to set the required
diff --git a/clang/include/clang/Analysis/PathDiagnostic.h b/clang/include/clang/Analysis/PathDiagnostic.h
index 5907df022e449d..b8262ea9886284 100644
--- a/clang/include/clang/Analysis/PathDiagnostic.h
+++ b/clang/include/clang/Analysis/PathDiagnostic.h
@@ -17,6 +17,7 @@
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -89,7 +90,7 @@ struct PathDiagnosticConsumerOptions {
   bool ShouldDisplayDiagnosticName = false;
 };
 
-class PathDiagnosticConsumer {
+class CLANG_ABI PathDiagnosticConsumer {
 public:
   class PDFileEntry : public llvm::FoldingSetNode {
   public:
@@ -107,7 +108,7 @@ class PathDiagnosticConsumer {
     void Profile(llvm::FoldingSetNodeID &ID) { ID = NodeID; }
   };
 
-  class FilesMade {
+  class CLANG_ABI FilesMade {
     llvm::BumpPtrAllocator Alloc;
     llvm::FoldingSet<PDFileEntry> Set;
 
@@ -192,7 +193,7 @@ class PathDiagnosticRange : public SourceRange {
 using LocationOrAnalysisDeclContext =
     llvm::PointerUnion<const LocationContext *, AnalysisDeclContext *>;
 
-class PathDiagnosticLocation {
+class CLANG_ABI PathDiagnosticLocation {
 private:
   enum Kind { RangeK, SingleLocK, StmtK, DeclK } K = SingleLocK;
 
@@ -400,7 +401,7 @@ class PathDiagnosticLocationPair {
 // Path "pieces" for path-sensitive diagnostics.
 //===----------------------------------------------------------------------===//
 
-class PathDiagnosticPiece: public llvm::FoldingSetNode {
+class CLANG_ABI PathDiagnosticPiece: public llvm::FoldingSetNode {
 public:
   enum Kind { ControlFlow, Event, Macro, Call, Note, PopUp };
   enum DisplayHint { Above, Below };
@@ -491,7 +492,7 @@ class PathDiagnosticPiece: public llvm::FoldingSetNode {
 
 using PathDiagnosticPieceRef = std::shared_ptr<PathDiagnosticPiece>;
 
-class PathPieces : public std::list<PathDiagnosticPieceRef> {
+class CLANG_ABI PathPieces : public std::list<PathDiagnosticPieceRef> {
   void flattenTo(PathPieces &Primary, PathPieces &Current,
                  bool ShouldFlattenMacros) const;
 
@@ -505,7 +506,7 @@ class PathPieces : public std::list<PathDiagnosticPieceRef> {
   void dump() const;
 };
 
-class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
+class CLANG_ABI PathDiagnosticSpotPiece : public PathDiagnosticPiece {
 private:
   PathDiagnosticLocation Pos;
 
@@ -531,7 +532,7 @@ class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
   }
 };
 
-class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
+class CLANG_ABI PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
   std::optional<bool> IsPrunable;
 
 public:
@@ -559,7 +560,7 @@ class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
   }
 };
 
-class PathDiagnosticCallPiece : public PathDiagnosticPiece {
+class CLANG_ABI PathDiagnosticCallPiece : public PathDiagnosticPiece {
   const Decl *Caller;
   const Decl *Callee = nullptr;
 
@@ -629,7 +630,7 @@ class PathDiagnosticCallPiece : public PathDiagnosticPiece {
   }
 };
 
-class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
+class CLANG_ABI PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
   std::vector<PathDiagnosticLocationPair> LPairs;
 
 public:
@@ -699,7 +700,7 @@ class PathDiagnosticControlFlowPiece : public PathDiagnosticPiece {
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 };
 
-class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
+class CLANG_ABI PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
 public:
   PathDiagnosticMacroPiece(const PathDiagnosticLocation &pos)
       : PathDiagnosticSpotPiece(pos, "", Macro) {}
@@ -722,7 +723,7 @@ class PathDiagnosticMacroPiece : public PathDiagnosticSpotPiece {
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 };
 
-class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
+class CLANG_ABI PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
 public:
   PathDiagnosticNotePiece(const PathDiagnosticLocation &Pos, StringRef S,
                           bool AddPosRange = true)
@@ -738,7 +739,7 @@ class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 };
 
-class PathDiagnosticPopUpPiece: public PathDiagnosticSpotPiece {
+class CLANG_ABI PathDiagnosticPopUpPiece: public PathDiagnosticSpotPiece {
 public:
   PathDiagnosticPopUpPiece(const PathDiagnosticLocation &Pos, StringRef S,
                            bool AddPosRange = true)
@@ -760,7 +761,7 @@ using FilesToLineNumsMap = std::map<FileID, std::set<unsigned>>;
 /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
 ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
 ///  each which represent the pieces of the path.
-class PathDiagnostic : public llvm::FoldingSetNode {
+class CLANG_ABI PathDiagnostic : public llvm::FoldingSetNode {
   std::string CheckerName;
   const Decl *DeclWithIssue;
   std::string BugType;
diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h
index b9339570e1ae70..a7344c740fb1cb 100644
--- a/clang/include/clang/Analysis/ProgramPoint.h
+++ b/clang/include/clang/Analysis/ProgramPoint.h
@@ -16,6 +16,7 @@
 
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/Analysis/CFG.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -35,7 +36,7 @@ class LocationContext;
 /// ProgramPoints can be "tagged" as representing points specific to a given
 /// analysis entity.  Tags are abstract annotations, with an associated
 /// description and potentially other information.
-class ProgramPointTag {
+class CLANG_ABI ProgramPointTag {
 public:
   ProgramPointTag(void *tagKind = nullptr) : TagKind(tagKind) {}
   virtual ~ProgramPointTag();
@@ -48,14 +49,14 @@ class ProgramPointTag {
   const void *const TagKind;
 };
 
-class SimpleProgramPointTag : public ProgramPointTag {
+class CLANG_ABI SimpleProgramPointTag : public ProgramPointTag {
   std::string Desc;
 public:
   SimpleProgramPointTag(StringRef MsgProvider, StringRef Msg);
   StringRef getTagDescription() const override;
 };
 
-class ProgramPoint {
+class CLANG_ABI ProgramPoint {
 public:
   enum Kind { BlockEdgeKind,
               BlockEntranceKind,
diff --git a/clang/include/clang/Analysis/RetainSummaryManager.h b/clang/include/clang/Analysis/RetainSummaryManager.h
index 86865b9da4214b..f5eaf5782ee52c 100644
--- a/clang/include/clang/Analysis/RetainSummaryManager.h
+++ b/clang/include/clang/Analysis/RetainSummaryManager.h
@@ -15,15 +15,16 @@
 #ifndef LLVM_CLANG_ANALYSIS_RETAINSUMMARYMANAGER_H
 #define LLVM_CLANG_ANALYSIS_RETAINSUMMARYMANAGER_H
 
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/ImmutableMap.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/ParentMap.h"
 #include "clang/Analysis/AnyCall.h"
 #include "clang/Analysis/SelectorExtras.h"
+#include "clang/Support/Compiler.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/ADT/ImmutableMap.h"
 #include "llvm/ADT/STLExtras.h"
 #include <optional>
 
@@ -447,7 +448,7 @@ class ObjCSummaryCache {
 
 class RetainSummaryTemplate;
 
-class RetainSummaryManager {
+class CLANG_ABI RetainSummaryManager {
   typedef llvm::DenseMap<const FunctionDecl*, const RetainSummary *>
           FuncSummariesTy;
 
diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h
index 175e0551db7656..3d21c5e00c3033 100644
--- a/clang/include/clang/Basic/ASTSourceDescriptor.h
+++ b/clang/include/clang/Basic/ASTSourceDescriptor.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H
 
 #include "clang/Basic/Module.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
 #include <utility>
@@ -25,7 +26,7 @@ namespace clang {
 /// Abstracts clang modules and precompiled header files and holds
 /// everything needed to generate debug info for an imported module
 /// or PCH.
-class ASTSourceDescriptor {
+class CLANG_ABI ASTSourceDescriptor {
   StringRef PCHModuleName;
   StringRef Path;
   StringRef ASTFile;
diff --git a/clang/include/clang/Basic/AttrSubjectMatchRules.h b/clang/include/clang/Basic/AttrSubjectMatchRules.h
index bec8122ea930a6..4c1ee443c17a57 100644
--- a/clang/include/clang/Basic/AttrSubjectMatchRules.h
+++ b/clang/include/clang/Basic/AttrSubjectMatchRules.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H
 #define LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ enum SubjectMatchRule {
 #include "clang/Basic/AttrSubMatchRulesList.inc"
 };
 
-const char *getSubjectMatchRuleSpelling(SubjectMatchRule Rule);
+CLANG_ABI const char *getSubjectMatchRuleSpelling(SubjectMatchRule Rule);
 
 using ParsedSubjectMatchRuleSet = llvm::DenseMap<int, SourceRange>;
 
diff --git a/clang/include/clang/Basic/AttributeCommonInfo.h b/clang/include/clang/Basic/AttributeCommonInfo.h
index 5f024b4b5fd782..5cab4bbd605314 100644
--- a/clang/include/clang/Basic/AttributeCommonInfo.h
+++ b/clang/include/clang/Basic/AttributeCommonInfo.h
@@ -16,13 +16,14 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 class ASTRecordWriter;
 class IdentifierInfo;
 
-class AttributeCommonInfo {
+class CLANG_ABI AttributeCommonInfo {
 public:
   /// The style used to specify an attribute.
   enum Syntax {
diff --git a/clang/include/clang/Basic/Attributes.h b/clang/include/clang/Basic/Attributes.h
index 61666a6f4d9ac4..432ffd879f501b 100644
--- a/clang/include/clang/Basic/Attributes.h
+++ b/clang/include/clang/Basic/Attributes.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_BASIC_ATTRIBUTES_H
 
 #include "clang/Basic/AttributeCommonInfo.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -19,7 +20,7 @@ class TargetInfo;
 
 /// Return the version number associated with the attribute if we
 /// recognize and implement the attribute specified by the given information.
-int hasAttribute(AttributeCommonInfo::Syntax Syntax,
+CLANG_ABI int hasAttribute(AttributeCommonInfo::Syntax Syntax,
                  const IdentifierInfo *Scope, const IdentifierInfo *Attr,
                  const TargetInfo &Target, const LangOptions &LangOpts);
 
diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
index 89f65682ae5b41..0ae974a64d2bee 100644
--- a/clang/include/clang/Basic/Builtins.h
+++ b/clang/include/clang/Basic/Builtins.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_BASIC_BUILTINS_H
 #define LLVM_CLANG_BASIC_BUILTINS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -48,7 +49,7 @@ enum LanguageID : uint16_t {
   ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG     // builtin requires MS mode.
 };
 
-struct HeaderDesc {
+struct CLANG_ABI HeaderDesc {
   enum HeaderID : uint16_t {
 #define HEADER(ID, NAME) ID,
 #include "clang/Basic/BuiltinHeaders.def"
@@ -82,7 +83,7 @@ struct Info {
 /// Builtins from an optional auxiliary target are stored in
 /// AuxTSRecords. Their IDs are shifted up by TSRecords.size() and need to
 /// be translated back with getAuxBuiltinID() before use.
-class Context {
+class CLANG_ABI Context {
   llvm::ArrayRef<Info> TSRecords;
   llvm::ArrayRef<Info> AuxTSRecords;
 
@@ -297,7 +298,7 @@ class Context {
 /// enabled.
 /// \p TargetFeatureMap maps a target feature to true if it is enabled and
 ///    false if it is disabled.
-bool evaluateRequiredTargetFeatures(
+CLANG_ABI bool evaluateRequiredTargetFeatures(
     llvm::StringRef RequiredFatures,
     const llvm::StringMap<bool> &TargetFetureMap);
 
diff --git a/clang/include/clang/Basic/CLWarnings.h b/clang/include/clang/Basic/CLWarnings.h
index 9b8be93bad3a6e..238ac51eb9f2c9 100644
--- a/clang/include/clang/Basic/CLWarnings.h
+++ b/clang/include/clang/Basic/CLWarnings.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_BASIC_CLWARNINGS_H
 #define LLVM_CLANG_BASIC_CLWARNINGS_H
 
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
@@ -19,7 +20,7 @@ enum class Group;
 
 /// For cl.exe warning IDs that cleany map to clang diagnostic groups,
 /// returns the corresponding group. Else, returns an empty Optional.
-std::optional<diag::Group> diagGroupFromCLWarningID(unsigned);
+CLANG_ABI std::optional<diag::Group> diagGroupFromCLWarningID(unsigned);
 
 } // end namespace clang
 
diff --git a/clang/include/clang/Basic/CharInfo.h b/clang/include/clang/Basic/CharInfo.h
index 87626eeb8a7004..e0016d12133d67 100644
--- a/clang/include/clang/Basic/CharInfo.h
+++ b/clang/include/clang/Basic/CharInfo.h
@@ -10,13 +10,14 @@
 #define LLVM_CLANG_BASIC_CHARINFO_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataTypes.h"
 
 namespace clang {
 namespace charinfo {
-  extern const uint16_t InfoTable[256];
+  CLANG_ABI extern const uint16_t InfoTable[256];
 
   enum {
     CHAR_HORZ_WS  = 0x0001,  // '\t', '\f', '\v'.  Note, no '\0'
diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h
index 2dcf98b465661e..690bd05d882dbf 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/PointerAuthOptions.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/XRayInstr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/Frontend/Debug/Options.h"
 #include "llvm/Frontend/Driver/CodeGenOptions.h"
@@ -53,7 +54,7 @@ class CodeGenOptionsBase {
 
 /// CodeGenOptions - Track various options which control how the code
 /// is optimized and passed to the backend.
-class CodeGenOptions : public CodeGenOptionsBase {
+class CLANG_ABI CodeGenOptions : public CodeGenOptionsBase {
 public:
   enum InliningMethod {
     NormalInlining,     // Use the standard function inlining pass.
diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h
index 83699f8897f663..613a0c53aee198 100644
--- a/clang/include/clang/Basic/Cuda.h
+++ b/clang/include/clang/Basic/Cuda.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_BASIC_CUDA_H
 #define LLVM_CLANG_BASIC_CUDA_H
 
+#include "clang/Support/Compiler.h"
 namespace llvm {
 class StringRef;
 class Twine;
@@ -48,9 +49,9 @@ enum class CudaVersion {
       CUDA_125, // Partially supported. Proceed with a warning.
   NEW = 10000,  // Too new. Issue a warning, but allow using it.
 };
-const char *CudaVersionToString(CudaVersion V);
+CLANG_ABI const char *CudaVersionToString(CudaVersion V);
 // Input is "Major.Minor"
-CudaVersion CudaStringToVersion(const llvm::Twine &S);
+CLANG_ABI CudaVersion CudaStringToVersion(const llvm::Twine &S);
 
 enum class OffloadArch {
   UNUSED,
@@ -154,17 +155,17 @@ static inline bool IsAMDOffloadArch(OffloadArch A) {
   return A >= OffloadArch::GFX600 && A < OffloadArch::Generic;
 }
 
-const char *OffloadArchToString(OffloadArch A);
-const char *OffloadArchToVirtualArchString(OffloadArch A);
+CLANG_ABI const char *OffloadArchToString(OffloadArch A);
+CLANG_ABI const char *OffloadArchToVirtualArchString(OffloadArch A);
 
 // The input should have the form "sm_20".
-OffloadArch StringToOffloadArch(llvm::StringRef S);
+CLANG_ABI OffloadArch StringToOffloadArch(llvm::StringRef S);
 
 /// Get the earliest CudaVersion that supports the given OffloadArch.
-CudaVersion MinVersionForOffloadArch(OffloadArch A);
+CLANG_ABI CudaVersion MinVersionForOffloadArch(OffloadArch A);
 
 /// Get the latest CudaVersion that supports the given OffloadArch.
-CudaVersion MaxVersionForOffloadArch(OffloadArch A);
+CLANG_ABI CudaVersion MaxVersionForOffloadArch(OffloadArch A);
 
 //  Various SDK-dependent features that affect CUDA compilation
 enum class CudaFeature {
@@ -174,9 +175,9 @@ enum class CudaFeature {
   CUDA_USES_FATBIN_REGISTER_END,
 };
 
-CudaVersion ToCudaVersion(llvm::VersionTuple);
-bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
-bool CudaFeatureEnabled(CudaVersion, CudaFeature);
+CLANG_ABI CudaVersion ToCudaVersion(llvm::VersionTuple);
+CLANG_ABI bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
+CLANG_ABI bool CudaFeatureEnabled(CudaVersion, CudaFeature);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/DarwinSDKInfo.h b/clang/include/clang/Basic/DarwinSDKInfo.h
index db20b968a898ea..61457cc79cabb9 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_BASIC_DARWINSDKINFO_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/VersionTuple.h"
@@ -26,7 +27,7 @@ class Object;
 namespace clang {
 
 /// The information about the darwin SDK that was used during this compilation.
-class DarwinSDKInfo {
+class CLANG_ABI DarwinSDKInfo {
 public:
   /// A value that describes two os-environment pairs that can be used as a key
   /// to the version map in the SDK.
@@ -83,7 +84,7 @@ class DarwinSDKInfo {
   ///
   /// e.g. "macOS_iOSMac":{"10.15":"13.1"} is an example of a macOS -> Mac
   /// Catalyst version map.
-  class RelatedTargetVersionMapping {
+  class CLANG_ABI RelatedTargetVersionMapping {
   public:
     RelatedTargetVersionMapping(
         VersionTuple MinimumKeyVersion, VersionTuple MaximumKeyVersion,
@@ -189,7 +190,7 @@ class DarwinSDKInfo {
 ///
 /// \returns an error if the SDKSettings.json file is invalid, std::nullopt if
 /// the SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise.
-Expected<std::optional<DarwinSDKInfo>>
+CLANG_ABI Expected<std::optional<DarwinSDKInfo>>
 parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath);
 
 } // end namespace clang
diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h
index 3b1efdb12824c7..6d058b38557923 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -185,7 +186,7 @@ struct DiagnosticStorage {
 
 /// An allocator for DiagnosticStorage objects, which uses a small cache to
 /// objects, used to reduce malloc()/free() traffic for partial diagnostics.
-class DiagStorageAllocator {
+class CLANG_ABI DiagStorageAllocator {
   static const unsigned NumCached = 16;
   DiagnosticStorage Cached[NumCached];
   DiagnosticStorage *FreeList[NumCached];
@@ -224,7 +225,7 @@ class DiagStorageAllocator {
 /// as errors" and passes them off to the DiagnosticConsumer for reporting to
 /// the user. DiagnosticsEngine is tied to one translation unit and one
 /// SourceManager.
-class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
+class CLANG_ABI DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
 public:
   /// The level of the diagnostic, after it has been through mapping.
   enum Level {
@@ -342,7 +343,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
   /// A new DiagState is created and kept around when diagnostic pragmas modify
   /// the state so that we know what is the diagnostic state at any given
   /// source location.
-  class DiagState {
+  class CLANG_ABI DiagState {
     llvm::DenseMap<unsigned, DiagnosticMapping> DiagMap;
 
   public:
@@ -399,7 +400,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
 
   /// A mapping from files to the diagnostic states for those files. Lazily
   /// built on demand for files in which the diagnostic state has not changed.
-  class DiagStateMap {
+  class CLANG_ABI DiagStateMap {
   public:
     /// Add an initial diagnostic state.
     void appendFirst(DiagState *State);
@@ -449,7 +450,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
 
     /// Description of the diagnostic states and state transitions for a
     /// particular FileID.
-    struct File {
+    struct CLANG_ABI File {
       /// The diagnostic state for the parent file. This is strictly redundant,
       /// as looking up the DecomposedIncludedLoc for the FileID in the Files
       /// map would give us this, but we cache it here for performance.
@@ -564,7 +565,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
   DiagnosticsEngine &operator=(const DiagnosticsEngine &) = delete;
   ~DiagnosticsEngine();
 
-  friend void DiagnosticsTestHelper(DiagnosticsEngine &);
+  friend CLANG_ABI void DiagnosticsTestHelper(DiagnosticsEngine &);
   LLVM_DUMP_METHOD void dump() const;
   LLVM_DUMP_METHOD void dump(StringRef DiagName) const;
 
@@ -1188,7 +1189,7 @@ class StreamingDiagnostic {
 /// This ensures that compilers with somewhat reasonable optimizers will promote
 /// the common fields to registers, eliminating increments of the NumArgs field,
 /// for example.
-class DiagnosticBuilder : public StreamingDiagnostic {
+class CLANG_ABI DiagnosticBuilder : public StreamingDiagnostic {
   friend class DiagnosticsEngine;
   friend class PartialDiagnostic;
   friend class Diagnostic;
@@ -1458,7 +1459,7 @@ operator<<(const StreamingDiagnostic &DB, const std::optional<FixItHint> &Opt) {
 /// context-sensitive keyword.
 using DiagNullabilityKind = std::pair<NullabilityKind, bool>;
 
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       DiagNullabilityKind nullability);
 
 inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc,
@@ -1466,7 +1467,7 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc,
   return DiagnosticBuilder(this, Loc, DiagID);
 }
 
-const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+CLANG_ABI const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                       llvm::Error &&E);
 
 inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) {
@@ -1480,7 +1481,7 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) {
 /// A little helper class (which is basically a smart pointer that forwards
 /// info from DiagnosticsEngine and DiagnosticStorage) that allows clients to
 /// enquire about the diagnostic.
-class Diagnostic {
+class CLANG_ABI Diagnostic {
   const DiagnosticsEngine *DiagObj;
   SourceLocation DiagLoc;
   unsigned DiagID;
@@ -1602,7 +1603,7 @@ class Diagnostic {
  * Represents a diagnostic in a form that can be retained until its
  * corresponding source manager is destroyed.
  */
-class StoredDiagnostic {
+class CLANG_ABI StoredDiagnostic {
   unsigned ID;
   DiagnosticsEngine::Level Level;
   FullSourceLoc Loc;
@@ -1648,11 +1649,11 @@ class StoredDiagnostic {
 };
 
 // Simple debug printing of StoredDiagnostic.
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const StoredDiagnostic &);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const StoredDiagnostic &);
 
 /// Abstract interface, implemented by clients of the front-end, which
 /// formats and prints fully processed diagnostics.
-class DiagnosticConsumer {
+class CLANG_ABI DiagnosticConsumer {
 protected:
   unsigned NumWarnings = 0;       ///< Number of warnings reported
   unsigned NumErrors = 0;         ///< Number of errors reported
@@ -1707,7 +1708,7 @@ class DiagnosticConsumer {
 };
 
 /// A diagnostic client that ignores all diagnostics.
-class IgnoringDiagConsumer : public DiagnosticConsumer {
+class CLANG_ABI IgnoringDiagConsumer : public DiagnosticConsumer {
   virtual void anchor();
 
   void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
@@ -1719,7 +1720,7 @@ class IgnoringDiagConsumer : public DiagnosticConsumer {
 /// Diagnostic consumer that forwards diagnostics along to an
 /// existing, already-initialized diagnostic consumer.
 ///
-class ForwardingDiagnosticConsumer : public DiagnosticConsumer {
+class CLANG_ABI ForwardingDiagnosticConsumer : public DiagnosticConsumer {
   DiagnosticConsumer &Target;
 
 public:
@@ -1757,10 +1758,10 @@ const char ToggleHighlight = 127;
 
 /// ProcessWarningOptions - Initialize the diagnostic client and process the
 /// warning options specified on the command line.
-void ProcessWarningOptions(DiagnosticsEngine &Diags,
+CLANG_ABI void ProcessWarningOptions(DiagnosticsEngine &Diags,
                            const DiagnosticOptions &Opts,
                            bool ReportDiags = true);
-void EscapeStringForDiagnostic(StringRef Str, SmallVectorImpl<char> &OutStr);
+CLANG_ABI void EscapeStringForDiagnostic(StringRef Str, SmallVectorImpl<char> &OutStr);
 } // namespace clang
 
 #endif // LLVM_CLANG_BASIC_DIAGNOSTIC_H
diff --git a/clang/include/clang/Basic/DiagnosticError.h b/clang/include/clang/Basic/DiagnosticError.h
index 744f7fe19db79c..1a694d4b32cbc4 100644
--- a/clang/include/clang/Basic/DiagnosticError.h
+++ b/clang/include/clang/Basic/DiagnosticError.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_BASIC_DIAGNOSTICERROR_H
 
 #include "clang/Basic/PartialDiagnostic.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include <optional>
 
@@ -18,7 +19,7 @@ namespace clang {
 /// Carries a Clang diagnostic in an llvm::Error.
 ///
 /// Users should emit the stored diagnostic using the DiagnosticsEngine.
-class DiagnosticError : public llvm::ErrorInfo<DiagnosticError> {
+class CLANG_ABI DiagnosticError : public llvm::ErrorInfo<DiagnosticError> {
 public:
   DiagnosticError(PartialDiagnosticAt Diag) : Diag(std::move(Diag)) {}
 
diff --git a/clang/include/clang/Basic/DiagnosticIDs.h b/clang/include/clang/Basic/DiagnosticIDs.h
index a051af327de28f..ec5faaeb63cbcf 100644
--- a/clang/include/clang/Basic/DiagnosticIDs.h
+++ b/clang/include/clang/Basic/DiagnosticIDs.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_DIAGNOSTICIDS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -178,7 +179,7 @@ class DiagnosticMapping {
 /// Used for handling and querying diagnostic IDs.
 ///
 /// Can be used and shared by multiple Diagnostics for multiple translation units.
-class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
+class CLANG_ABI DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
 public:
   /// The level of the diagnostic, after it has been through mapping.
   enum Level {
diff --git a/clang/include/clang/Basic/DiagnosticOptions.h b/clang/include/clang/Basic/DiagnosticOptions.h
index 30141c2b8f4475..b57364295b10f4 100644
--- a/clang/include/clang/Basic/DiagnosticOptions.h
+++ b/clang/include/clang/Basic/DiagnosticOptions.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include <string>
 #include <type_traits>
@@ -64,11 +65,11 @@ inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS,
     static_cast<UT>(LHS) & static_cast<UT>(RHS));
 }
 
-raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);
+CLANG_ABI raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M);
 
 /// Options for controlling the compiler diagnostics engine.
 class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{
-  friend bool ParseDiagnosticArgs(DiagnosticOptions &, llvm::opt::ArgList &,
+  friend CLANG_ABI bool ParseDiagnosticArgs(DiagnosticOptions &, llvm::opt::ArgList &,
                                   clang::DiagnosticsEngine *, bool);
 
   friend class CompilerInvocation;
diff --git a/clang/include/clang/Basic/ExpressionTraits.h b/clang/include/clang/Basic/ExpressionTraits.h
index b38ebd9ac60b93..199239a931462b 100644
--- a/clang/include/clang/Basic/ExpressionTraits.h
+++ b/clang/include/clang/Basic/ExpressionTraits.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H
 #define LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
@@ -27,10 +28,10 @@ enum ExpressionTrait {
 };
 
 /// Return the internal name of type trait \p T. Never null.
-const char *getTraitName(ExpressionTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitName(ExpressionTrait T) LLVM_READONLY;
 
 /// Return the spelling of the type trait \p TT. Never null.
-const char *getTraitSpelling(ExpressionTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitSpelling(ExpressionTrait T) LLVM_READONLY;
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h
index 68d4bf60930037..36e74e616c6abe 100644
--- a/clang/include/clang/Basic/FileEntry.h
+++ b/clang/include/clang/Basic/FileEntry.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/CustomizableOptional.h"
 #include "clang/Basic/DirectoryEntry.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -297,7 +298,7 @@ inline bool operator!=(const OptionalFileEntryRef &LHS, const FileEntry *RHS) {
 ///
 /// If the 'File' member is valid, then this FileEntry has an open file
 /// descriptor for the file.
-class FileEntry {
+class CLANG_ABI FileEntry {
   friend class FileManager;
   friend class FileEntryTestHelper;
   FileEntry();
diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h
index ce4e8c1fbe16eb..c7d3aa388ec54d 100644
--- a/clang/include/clang/Basic/FileManager.h
+++ b/clang/include/clang/Basic/FileManager.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/FileEntry.h"
 #include "clang/Basic/FileSystemOptions.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -50,7 +51,7 @@ class FileSystemStatCache;
 /// on "inode", so that a file with two names (e.g. symlinked) will be treated
 /// as a single file.
 ///
-class FileManager : public RefCountedBase<FileManager> {
+class CLANG_ABI FileManager : public RefCountedBase<FileManager> {
   IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;
   FileSystemOptions FileSystemOpts;
   llvm::SpecificBumpPtrAllocator<FileEntry> FilesAlloc;
diff --git a/clang/include/clang/Basic/FileSystemStatCache.h b/clang/include/clang/Basic/FileSystemStatCache.h
index 5a003a748178d3..94e58a974ddb0c 100644
--- a/clang/include/clang/Basic/FileSystemStatCache.h
+++ b/clang/include/clang/Basic/FileSystemStatCache.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_FILESYSTEMSTATCACHE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
@@ -32,7 +33,7 @@ namespace clang {
 /// Abstract interface for introducing a FileManager cache for 'stat'
 /// system calls, which is used by precompiled and pretokenized headers to
 /// improve performance.
-class FileSystemStatCache {
+class CLANG_ABI FileSystemStatCache {
   virtual void anchor();
 
 public:
@@ -66,7 +67,7 @@ class FileSystemStatCache {
 /// A stat "cache" that can be used by FileManager to keep
 /// track of the results of stat() calls that occur throughout the
 /// execution of the front end.
-class MemorizeStatCalls : public FileSystemStatCache {
+class CLANG_ABI MemorizeStatCalls : public FileSystemStatCache {
 public:
   /// The set of stat() calls that have been seen.
   llvm::StringMap<llvm::vfs::Status, llvm::BumpPtrAllocator> StatCalls;
diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h
index ae9ebd9f59154e..2550a5447878f3 100644
--- a/clang/include/clang/Basic/IdentifierTable.h
+++ b/clang/include/clang/Basic/IdentifierTable.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/DiagnosticIDs.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -114,7 +115,7 @@ enum class InterestingIdentifier {
 /// variable or function name).  The preprocessor keeps this information in a
 /// set, and all tok::identifier tokens have a pointer to one of these.
 /// It is aligned to 8 bytes because DeclarationName needs the lower 3 bits.
-class alignas(IdentifierInfoAlignment) IdentifierInfo {
+class CLANG_ABI alignas(IdentifierInfoAlignment) IdentifierInfo {
   friend class IdentifierTable;
 
   // Front-end token ID or tok::identifier.
@@ -604,7 +605,7 @@ class PoisonIdentifierRAIIObject {
 /// advance, and end-of-sequence checking in a single
 /// operation. Subclasses of this iterator type will provide the
 /// actual functionality.
-class IdentifierIterator {
+class CLANG_ABI IdentifierIterator {
 protected:
   IdentifierIterator() = default;
 
@@ -623,7 +624,7 @@ class IdentifierIterator {
 };
 
 /// Provides lookups to, and iteration over, IdentiferInfo objects.
-class IdentifierInfoLookup {
+class CLANG_ABI IdentifierInfoLookup {
 public:
   virtual ~IdentifierInfoLookup();
 
@@ -652,7 +653,7 @@ class IdentifierInfoLookup {
 /// This has no other purpose, but this is an extremely performance-critical
 /// piece of the code, as each occurrence of every identifier goes through
 /// here when lexed.
-class IdentifierTable {
+class CLANG_ABI IdentifierTable {
   // Shark shows that using MallocAllocator is *much* slower than using this
   // BumpPtrAllocator!
   using HashTableTy = llvm::StringMap<IdentifierInfo *, llvm::BumpPtrAllocator>;
@@ -906,7 +907,7 @@ class alignas(IdentifierInfoAlignment) DeclarationNameExtra {
 /// selector containing more than one keyword. We use a folding set
 /// to unique aggregate names (keyword selectors in ObjC parlance). Access to
 /// this class is provided strictly through Selector.
-class alignas(IdentifierInfoAlignment) MultiKeywordSelector
+class CLANG_ABI alignas(IdentifierInfoAlignment) MultiKeywordSelector
     : public detail::DeclarationNameExtra,
       public llvm::FoldingSetNode {
   MultiKeywordSelector(unsigned nKeys) : DeclarationNameExtra(nKeys) {}
@@ -963,7 +964,7 @@ class alignas(IdentifierInfoAlignment) MultiKeywordSelector
 /// MultiKeywordSelector (which is private). This enables us to optimize
 /// selectors that take no arguments and selectors that take 1 argument, which
 /// accounts for 78% of all selectors in Cocoa.h.
-class Selector {
+class CLANG_ABI Selector {
   friend class Diagnostic;
   friend class SelectorTable; // only the SelectorTable can create these
   friend class DeclarationName; // and the AST's DeclarationName.
@@ -1119,7 +1120,7 @@ class Selector {
 
 /// This table allows us to fully hide how we implement
 /// multi-keyword caching.
-class SelectorTable {
+class CLANG_ABI SelectorTable {
   // Actually a SelectorTableImpl
   void *Impl;
 
@@ -1171,7 +1172,7 @@ namespace llvm {
 /// Define DenseMapInfo so that Selectors can be used as keys in DenseMap and
 /// DenseSets.
 template <>
-struct DenseMapInfo<clang::Selector> {
+struct CLANG_ABI DenseMapInfo<clang::Selector> {
   static clang::Selector getEmptyKey() {
     return clang::Selector::getEmptyMarker();
   }
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index e2d4206c72cc96..71941911850ef4 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -22,6 +22,7 @@
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/TargetCXXABI.h"
 #include "clang/Basic/Visibility.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/TargetParser/Triple.h"
@@ -496,7 +497,7 @@ class LangOptionsBase {
 
 /// Keeps track of the various options that can be
 /// enabled, which controls the dialect of C or C++ that is accepted.
-class LangOptions : public LangOptionsBase {
+class CLANG_ABI LangOptions : public LangOptionsBase {
 public:
   /// The used language standard.
   LangStandard::Kind LangStd;
@@ -815,7 +816,7 @@ class LangOptions : public LangOptionsBase {
 
 /// Floating point control options
 class FPOptionsOverride;
-class FPOptions {
+class CLANG_ABI FPOptions {
 public:
   // We start by defining the layout.
   using storage_type = uint32_t;
@@ -967,7 +968,7 @@ class FPOptions {
 ///
 /// The is implemented as a value of the new FPOptions plus a mask showing which
 /// fields are actually set in it.
-class FPOptionsOverride {
+class CLANG_ABI FPOptionsOverride {
   FPOptions Options = FPOptions::getFromOpaqueInt(0);
   FPOptions::storage_type OverrideMask = 0;
 
diff --git a/clang/include/clang/Basic/LangStandard.h b/clang/include/clang/Basic/LangStandard.h
index 56a0d2c95e2b19..340c12031ba8c0 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_BASIC_LANGSTANDARD_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace llvm {
@@ -44,7 +45,7 @@ enum class Language : uint8_t {
   HLSL,
   ///@}
 };
-StringRef languageToString(Language L);
+CLANG_ABI StringRef languageToString(Language L);
 
 enum LangFeatures {
   LineComment = (1 << 0),
@@ -69,7 +70,7 @@ enum LangFeatures {
 
 /// LangStandard - Information about the properties of a particular language
 /// standard.
-struct LangStandard {
+struct CLANG_ABI LangStandard {
   enum Kind {
 #define LANGSTANDARD(id, name, lang, desc, features) \
     lang_##id,
@@ -156,7 +157,7 @@ struct LangStandard {
   static const LangStandard *getLangStandardForName(StringRef Name);
 };
 
-LangStandard::Kind getDefaultLanguageStandard(clang::Language Lang,
+CLANG_ABI LangStandard::Kind getDefaultLanguageStandard(clang::Language Lang,
                                               const llvm::Triple &T);
 
 }  // end namespace clang
diff --git a/clang/include/clang/Basic/MakeSupport.h b/clang/include/clang/Basic/MakeSupport.h
index c663014ba7bcf4..30e345f0ac75b9 100644
--- a/clang/include/clang/Basic/MakeSupport.h
+++ b/clang/include/clang/Basic/MakeSupport.h
@@ -10,13 +10,14 @@
 #define LLVM_CLANG_BASIC_MAKESUPPORT_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
 
 /// Quote target names for inclusion in GNU Make dependency files.
 /// Only the characters '$', '#', ' ', '\t' are quoted.
-void quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res);
+CLANG_ABI void quoteMakeTarget(StringRef Target, SmallVectorImpl<char> &Res);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h
index e86f4303d732b8..cdc39bd578063f 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/DirectoryEntry.h"
 #include "clang/Basic/FileEntry.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -102,7 +103,7 @@ struct ASTFileSignature : std::array<uint8_t, 20> {
 /// Describes a module or submodule.
 ///
 /// Aligned to 8 bytes to allow for llvm::PointerIntPair<Module *, 3>.
-class alignas(8) Module {
+class CLANG_ABI alignas(8) Module {
 public:
   /// The name of this module.
   std::string Name;
@@ -808,7 +809,7 @@ class alignas(8) Module {
 };
 
 /// A set of visible modules.
-class VisibleModuleSet {
+class CLANG_ABI VisibleModuleSet {
 public:
   VisibleModuleSet() = default;
   VisibleModuleSet(VisibleModuleSet &&O)
diff --git a/clang/include/clang/Basic/NoSanitizeList.h b/clang/include/clang/Basic/NoSanitizeList.h
index 43415859fcd54c..021037b474e132 100644
--- a/clang/include/clang/Basic/NoSanitizeList.h
+++ b/clang/include/clang/Basic/NoSanitizeList.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
 #include <vector>
@@ -26,7 +27,7 @@ class SanitizerMask;
 class SourceManager;
 class SanitizerSpecialCaseList;
 
-class NoSanitizeList {
+class CLANG_ABI NoSanitizeList {
   std::unique_ptr<SanitizerSpecialCaseList> SSCL;
   SourceManager &SM;
 
diff --git a/clang/include/clang/Basic/ObjCRuntime.h b/clang/include/clang/Basic/ObjCRuntime.h
index 1ccf60f0b7bee7..a8a7f46f648926 100644
--- a/clang/include/clang/Basic/ObjCRuntime.h
+++ b/clang/include/clang/Basic/ObjCRuntime.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_OBJCRUNTIME_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/HashBuilder.h"
@@ -25,7 +26,7 @@
 namespace clang {
 
 /// The basic abstraction for the target Objective-C runtime.
-class ObjCRuntime {
+class CLANG_ABI ObjCRuntime {
 public:
   /// The basic Objective-C runtimes that we know about.
   enum Kind {
@@ -506,7 +507,7 @@ class ObjCRuntime {
   }
 };
 
-raw_ostream &operator<<(raw_ostream &out, const ObjCRuntime &value);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &out, const ObjCRuntime &value);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
index d6cb1a210519df..15c7bcda872855 100644
--- a/clang/include/clang/Basic/OpenCLOptions.h
+++ b/clang/include/clang/Basic/OpenCLOptions.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_OPENCLOPTIONS_H
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 
 namespace clang {
@@ -66,7 +67,7 @@ static inline bool isOpenCLVersionContainedInMask(const LangOptions &LO,
 } // end anonymous namespace
 
 /// OpenCL supported extensions and optional core features
-class OpenCLOptions {
+class CLANG_ABI OpenCLOptions {
 
 public:
   // OpenCL C v1.2 s6.5 - All program scope variables must be declared in the
diff --git a/clang/include/clang/Basic/OpenMPKinds.h b/clang/include/clang/Basic/OpenMPKinds.h
index 1acdafa8572211..3acaf8ae3b9bc6 100644
--- a/clang/include/clang/Basic/OpenMPKinds.h
+++ b/clang/include/clang/Basic/OpenMPKinds.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_OPENMPKINDS_H
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/Sequence.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Frontend/OpenMP/OMPConstants.h"
@@ -233,41 +234,41 @@ struct OMPInteropInfo final {
   llvm::SmallVector<Expr *, 4> PreferTypes;
 };
 
-unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
+CLANG_ABI unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str,
                                    const LangOptions &LangOpts);
-const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
+CLANG_ABI const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type);
 
 /// Checks if the specified directive is a directive with an associated
 /// loop construct.
 /// \param DKind Specified directive.
 /// \return true - the directive is a loop-associated directive like 'omp simd'
 /// or 'omp for' directive, otherwise - false.
-bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a worksharing directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a worksharing directive like 'omp for',
 /// otherwise - false.
-bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a taskloop directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a worksharing directive like 'omp taskloop',
 /// otherwise - false.
-bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPTaskLoopDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a parallel-kind directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a parallel-like directive like 'omp
 /// parallel', otherwise - false.
-bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a target code offload directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a target code offload directive like
 /// 'omp target', 'omp target parallel', 'omp target xxx'
 /// otherwise - false.
-bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a target data offload directive.
 /// \param DKind Specified directive.
@@ -275,7 +276,7 @@ bool isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind);
 /// 'omp target data', 'omp target update', 'omp target enter data',
 /// 'omp target exit data'
 /// otherwise - false.
-bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified composite/combined directive constitutes a teams
 /// directive in the outermost nest.  For example
@@ -283,26 +284,26 @@ bool isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind);
 /// \param DKind Specified directive.
 /// \return true - the directive has teams on the outermost nest, otherwise -
 /// false.
-bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a teams-kind directive.  For example,
 /// 'omp teams distribute' or 'omp target teams'.
 /// \param DKind Specified directive.
 /// \return true - the directive is a teams-like directive, otherwise - false.
-bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a simd directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a simd directive like 'omp simd',
 /// otherwise - false.
-bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is a distribute directive.
 /// \param DKind Specified directive.
 /// \return true - the directive is a distribute-directive like 'omp
 /// distribute',
 /// otherwise - false.
-bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified composite/combined directive constitutes a
 /// distribute directive in the outermost nest.  For example,
@@ -310,44 +311,44 @@ bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
 /// \param DKind Specified directive.
 /// \return true - the directive has distribute on the outermost nest.
 /// otherwise - false.
-bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPNestingDistributeDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive constitutes a 'loop' directive in the
 /// outermost nest.  For example, 'omp teams loop' or 'omp loop'.
 /// \param DKind Specified directive.
 /// \return true - the directive has loop on the outermost nest.
 /// otherwise - false.
-bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPGenericLoopDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified clause is one of private clauses like
 /// 'private', 'firstprivate', 'reduction' etc..
 /// \param Kind Clause kind.
 /// \return true - the clause is a private clause, otherwise - false.
-bool isOpenMPPrivate(OpenMPClauseKind Kind);
+CLANG_ABI bool isOpenMPPrivate(OpenMPClauseKind Kind);
 
 /// Checks if the specified clause is one of threadprivate clauses like
 /// 'threadprivate', 'copyin' or 'copyprivate'.
 /// \param Kind Clause kind.
 /// \return true - the clause is a threadprivate clause, otherwise - false.
-bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
+CLANG_ABI bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
 
 /// Checks if the specified directive kind is one of tasking directives - task,
 /// taskloop, taksloop simd, master taskloop, parallel master taskloop, master
 /// taskloop simd, or parallel master taskloop simd.
-bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
+CLANG_ABI bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
 
 /// Checks if the specified directive kind is one of the composite or combined
 /// directives that need loop bound sharing across loops outlined in nested
 /// functions
-bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
+CLANG_ABI bool isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind);
 
 /// Checks if the specified directive is a loop transformation directive.
 /// \param DKind Specified directive.
 /// \return True iff the directive is a loop transformation.
-bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPLoopTransformationDirective(OpenMPDirectiveKind DKind);
 
 /// Return the captured regions of an OpenMP directive.
-void getOpenMPCaptureRegions(
+CLANG_ABI void getOpenMPCaptureRegions(
     llvm::SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
     OpenMPDirectiveKind DKind);
 
@@ -356,19 +357,19 @@ void getOpenMPCaptureRegions(
 /// \param DKind Specified directive.
 /// \return true - if the above condition is met for this directive
 /// otherwise - false.
-bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified target directive, combined or not, needs task based
 /// thread_limit
 /// \param DKind Specified directive.
 /// \return true - if the above condition is met for this directive
 /// otherwise - false.
-bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind);
+CLANG_ABI bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind);
 
 /// Checks if the parameter to the fail clause in "#pragma atomic compare fail"
 /// is restricted only to memory order clauses of "OMPC_acquire",
 /// "OMPC_relaxed" and "OMPC_seq_cst".
-bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
+CLANG_ABI bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
 
 /// Checks if the specified directive is considered as "executable". This
 /// combines the OpenMP categories of "executable" and "subsidiary", plus
@@ -376,18 +377,18 @@ bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
 /// \param DKind Specified directive.
 /// \return true - if the above condition is met for this directive
 /// otherwise - false.
-bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPExecutableDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive is considered as "informational".
 /// \param DKind Specified directive.
 /// \return true if it is an informational directive, false otherwise.
-bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPInformationalDirective(OpenMPDirectiveKind DKind);
 
 /// Checks if the specified directive can capture variables.
 /// \param DKind Specified directive.
 /// \return true - if the above condition is met for this directive
 /// otherwise - false.
-bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind);
+CLANG_ABI bool isOpenMPCapturingDirective(OpenMPDirectiveKind DKind);
 }
 
 template <>
diff --git a/clang/include/clang/Basic/OperatorKinds.h b/clang/include/clang/Basic/OperatorKinds.h
index 3315df246981d2..a3514e4c25da71 100644
--- a/clang/include/clang/Basic/OperatorKinds.h
+++ b/clang/include/clang/Basic/OperatorKinds.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_BASIC_OPERATORKINDS_H
 #define LLVM_CLANG_BASIC_OPERATORKINDS_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
 
 /// Enumeration specifying the different kinds of C++ overloaded
@@ -28,7 +29,7 @@ enum OverloadedOperatorKind : int {
 
 /// Retrieve the spelling of the given overloaded operator, without
 /// the preceding "operator" keyword.
-const char *getOperatorSpelling(OverloadedOperatorKind Operator);
+CLANG_ABI const char *getOperatorSpelling(OverloadedOperatorKind Operator);
 
 /// Get the other overloaded operator that the given operator can be rewritten
 /// into, if any such operator exists.
diff --git a/clang/include/clang/Basic/OperatorPrecedence.h b/clang/include/clang/Basic/OperatorPrecedence.h
index 9bda3eb28fdfe8..f2c7d4183a4472 100644
--- a/clang/include/clang/Basic/OperatorPrecedence.h
+++ b/clang/include/clang/Basic/OperatorPrecedence.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
 
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -44,7 +45,7 @@ namespace prec {
 }
 
 /// Return the precedence of the specified binary operator token.
-prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator,
+CLANG_ABI prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator,
                                bool CPlusPlus11);
 
 }  // end namespace clang
diff --git a/clang/include/clang/Basic/ParsedAttrInfo.h b/clang/include/clang/Basic/ParsedAttrInfo.h
index fab5c6f1377d27..49e55fb717e46f 100644
--- a/clang/include/clang/Basic/ParsedAttrInfo.h
+++ b/clang/include/clang/Basic/ParsedAttrInfo.h
@@ -17,6 +17,7 @@
 
 #include "clang/Basic/AttrSubjectMatchRules.h"
 #include "clang/Basic/AttributeCommonInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Registry.h"
 #include <climits>
@@ -32,7 +33,7 @@ class Sema;
 class Stmt;
 class TargetInfo;
 
-struct ParsedAttrInfo {
+struct CLANG_ABI ParsedAttrInfo {
   /// Corresponds to the Kind enum.
   LLVM_PREFERRED_TYPE(AttributeCommonInfo::Kind)
   unsigned AttrKind : 16;
@@ -171,7 +172,7 @@ struct ParsedAttrInfo {
 
 typedef llvm::Registry<ParsedAttrInfo> ParsedAttrInfoRegistry;
 
-const std::list<std::unique_ptr<ParsedAttrInfo>> &getAttributePluginInstances();
+CLANG_ABI const std::list<std::unique_ptr<ParsedAttrInfo>> &getAttributePluginInstances();
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/PrettyStackTrace.h b/clang/include/clang/Basic/PrettyStackTrace.h
index 545a63b7e7346a..fa8d1fb97da703 100644
--- a/clang/include/clang/Basic/PrettyStackTrace.h
+++ b/clang/include/clang/Basic/PrettyStackTrace.h
@@ -17,13 +17,14 @@
 #define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/PrettyStackTrace.h"
 
 namespace clang {
 
   /// If a crash happens while one of these objects are live, the message
   /// is printed out along with the specified source location.
-  class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
+  class CLANG_ABI PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry {
     SourceManager &SM;
     SourceLocation Loc;
     const char *Message;
diff --git a/clang/include/clang/Basic/ProfileList.h b/clang/include/clang/Basic/ProfileList.h
index b4217e49c18a35..a892b775057725 100644
--- a/clang/include/clang/Basic/ProfileList.h
+++ b/clang/include/clang/Basic/ProfileList.h
@@ -16,6 +16,7 @@
 #include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
@@ -25,7 +26,7 @@ namespace clang {
 
 class ProfileSpecialCaseList;
 
-class ProfileList {
+class CLANG_ABI ProfileList {
 public:
   /// Represents if an how something should be excluded from profiling.
   enum ExclusionType {
diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
index d024b7dfc2e854..1f43d745d14d3c 100644
--- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h
+++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/SpecialCaseList.h"
 #include <memory>
@@ -29,7 +30,7 @@ class FileSystem;
 
 namespace clang {
 
-class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
+class CLANG_ABI SanitizerSpecialCaseList : public llvm::SpecialCaseList {
 public:
   static std::unique_ptr<SanitizerSpecialCaseList>
   create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
diff --git a/clang/include/clang/Basic/Sanitizers.h b/clang/include/clang/Basic/Sanitizers.h
index c890242269b334..cd403fdb141f1f 100644
--- a/clang/include/clang/Basic/Sanitizers.h
+++ b/clang/include/clang/Basic/Sanitizers.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_SANITIZERS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/HashBuilder.h"
 #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
@@ -31,7 +32,7 @@ class ArgList;
 
 namespace clang {
 
-class SanitizerMask {
+class CLANG_ABI SanitizerMask {
   // NOTE: this class assumes kNumElem == 2 in most of the constexpr functions,
   // in order to work within the C++11 constexpr function constraints. If you
   // change kNumElem, you'll need to update those member functions as well.
@@ -128,7 +129,7 @@ class SanitizerMask {
 };
 
 // Declaring in clang namespace so that it can be found by ADL.
-llvm::hash_code hash_value(const clang::SanitizerMask &Arg);
+CLANG_ABI llvm::hash_code hash_value(const clang::SanitizerMask &Arg);
 
 // Define the set of sanitizer kinds, as well as the set of sanitizers each
 // sanitizer group expands into.
@@ -184,15 +185,15 @@ struct SanitizerSet {
 
 /// Parse a single value from a -fsanitize= or -fno-sanitize= value list.
 /// Returns a non-zero SanitizerMask, or \c 0 if \p Value is not known.
-SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups);
+CLANG_ABI SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups);
 
 /// Serialize a SanitizerSet into values for -fsanitize= or -fno-sanitize=.
-void serializeSanitizerSet(SanitizerSet Set,
+CLANG_ABI void serializeSanitizerSet(SanitizerSet Set,
                            SmallVectorImpl<StringRef> &Values);
 
 /// For each sanitizer group bit set in \p Kinds, set the bits for sanitizers
 /// this group enables.
-SanitizerMask expandSanitizerGroups(SanitizerMask Kinds);
+CLANG_ABI SanitizerMask expandSanitizerGroups(SanitizerMask Kinds);
 
 /// Return the sanitizers which do not affect preprocessing.
 inline SanitizerMask getPPTransparentSanitizers() {
@@ -201,14 +202,14 @@ inline SanitizerMask getPPTransparentSanitizers() {
          SanitizerKind::Undefined | SanitizerKind::FloatDivideByZero;
 }
 
-StringRef AsanDtorKindToString(llvm::AsanDtorKind kind);
+CLANG_ABI StringRef AsanDtorKindToString(llvm::AsanDtorKind kind);
 
-llvm::AsanDtorKind AsanDtorKindFromString(StringRef kind);
+CLANG_ABI llvm::AsanDtorKind AsanDtorKindFromString(StringRef kind);
 
-StringRef AsanDetectStackUseAfterReturnModeToString(
+CLANG_ABI StringRef AsanDetectStackUseAfterReturnModeToString(
     llvm::AsanDetectStackUseAfterReturnMode mode);
 
-llvm::AsanDetectStackUseAfterReturnMode
+CLANG_ABI llvm::AsanDetectStackUseAfterReturnMode
 AsanDetectStackUseAfterReturnModeFromString(StringRef modeStr);
 
 } // namespace clang
diff --git a/clang/include/clang/Basic/Sarif.h b/clang/include/clang/Basic/Sarif.h
index e6c46224b316d5..7e6c5cafee5f0b 100644
--- a/clang/include/clang/Basic/Sarif.h
+++ b/clang/include/clang/Basic/Sarif.h
@@ -33,6 +33,7 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Version.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -377,7 +378,7 @@ class SarifResult {
 /// 2. If SarifDocumentWriter::endRun is called, callers MUST call
 ///    SarifDocumentWriter::createRun, before invoking any of the result
 ///    aggregation methods such as SarifDocumentWriter::appendResult etc.
-class SarifDocumentWriter {
+class CLANG_ABI SarifDocumentWriter {
 private:
   const llvm::StringRef SchemaURI{
       "https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/"
diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h
index 7a0f5ba8d1270b..aa20aa962e52ae 100644
--- a/clang/include/clang/Basic/SourceLocation.h
+++ b/clang/include/clang/Basic/SourceLocation.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/FileEntry.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <cassert>
 #include <cstdint>
@@ -85,7 +86,7 @@ class FileID {
 /// information whether the location is in a file or a macro expansion.
 ///
 /// It is important that this type remains small. It is currently 32 bits wide.
-class SourceLocation {
+class CLANG_ABI SourceLocation {
   friend class ASTReader;
   friend class ASTWriter;
   friend class SourceManager;
@@ -210,7 +211,7 @@ inline bool operator>=(const SourceLocation &LHS, const SourceLocation &RHS) {
 }
 
 /// A trivial tuple used to represent a source range.
-class SourceRange {
+class CLANG_ABI SourceRange {
   SourceLocation B;
   SourceLocation E;
 
@@ -366,7 +367,7 @@ class PresumedLoc {
 /// This class does not guarantee the presence of either the SourceManager or
 /// a valid SourceLocation. Clients should use `isValid()` and `hasManager()`
 /// before calling the member functions.
-class FullSourceLoc : public SourceLocation {
+class CLANG_ABI FullSourceLoc : public SourceLocation {
   const SourceManager *SrcMgr = nullptr;
 
 public:
@@ -515,7 +516,7 @@ namespace llvm {
   };
 
   // Allow calling FoldingSetNodeID::Add with SourceLocation object as parameter
-  template <> struct FoldingSetTrait<clang::SourceLocation, void> {
+  template <> struct CLANG_ABI FoldingSetTrait<clang::SourceLocation, void> {
     static void Profile(const clang::SourceLocation &X, FoldingSetNodeID &ID);
   };
 
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index e0f1ea435d54e4..d05e480c59d7b0 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -38,6 +38,7 @@
 #include "clang/Basic/FileEntry.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
@@ -98,7 +99,7 @@ inline bool isModuleMap(CharacteristicKind CK) {
 
 /// Mapping of line offsets into a source file. This does not own the storage
 /// for the line numbers.
-class LineOffsetMapping {
+class CLANG_ABI LineOffsetMapping {
 public:
   explicit operator bool() const { return Storage; }
   unsigned size() const {
@@ -128,7 +129,7 @@ class LineOffsetMapping {
 /// One instance of this struct is kept for every file loaded or used.
 ///
 /// This object owns the MemoryBuffer object.
-class alignas(8) ContentCache {
+class CLANG_ABI alignas(8) ContentCache {
   /// The actual buffer containing the characters from the input
   /// file.
   mutable std::unique_ptr<llvm::MemoryBuffer> Buffer;
@@ -541,7 +542,7 @@ class SLocEntry {
 } // namespace SrcMgr
 
 /// External source of source location entries.
-class ExternalSLocEntrySource {
+class CLANG_ABI ExternalSLocEntrySource {
 public:
   virtual ~ExternalSLocEntrySource();
 
@@ -660,7 +661,7 @@ using ModuleBuildStack = ArrayRef<std::pair<std::string, FullSourceLoc>>;
 /// the case of a macro expansion, for example, the spelling location indicates
 /// where the expanded token came from and the expansion location specifies
 /// where it was expanded.
-class SourceManager : public RefCountedBase<SourceManager> {
+class CLANG_ABI SourceManager : public RefCountedBase<SourceManager> {
   /// DiagnosticsEngine object.
   DiagnosticsEngine &Diag;
 
@@ -2016,7 +2017,7 @@ class BeforeThanCompare<SourceRange> {
 
 /// SourceManager and necessary dependencies (e.g. VFS, FileManager) for a
 /// single in-memorty file.
-class SourceManagerForFile {
+class CLANG_ABI SourceManagerForFile {
 public:
   /// Creates SourceManager and necessary dependencies (e.g. VFS, FileManager).
   /// The main file in the SourceManager will be \p FileName with \p Content.
diff --git a/clang/include/clang/Basic/SourceManagerInternals.h b/clang/include/clang/Basic/SourceManagerInternals.h
index e67b93aea8a535..79757ef77ace37 100644
--- a/clang/include/clang/Basic/SourceManagerInternals.h
+++ b/clang/include/clang/Basic/SourceManagerInternals.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
@@ -77,7 +78,7 @@ inline bool operator<(unsigned Offset, const LineEntry &E) {
 }
 
 /// Used to hold and unique data used to represent \#line information.
-class LineTableInfo {
+class CLANG_ABI LineTableInfo {
   /// Map used to assign unique IDs to filenames in \#line directives.
   ///
   /// This allows us to unique the filenames that
diff --git a/clang/include/clang/Basic/SourceMgrAdapter.h b/clang/include/clang/Basic/SourceMgrAdapter.h
index be7f9d5051fbf4..e37d8ec46800a8 100644
--- a/clang/include/clang/Basic/SourceMgrAdapter.h
+++ b/clang/include/clang/Basic/SourceMgrAdapter.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_SOURCEMGRADAPTER_H
 
 #include "clang/Basic/SourceManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/SourceMgr.h"
 #include <string>
@@ -27,7 +28,7 @@ class FileEntry;
 
 /// An adapter that can be used to translate diagnostics from one or more
 /// llvm::SourceMgr instances to a ,
-class SourceMgrAdapter {
+class CLANG_ABI SourceMgrAdapter {
   /// Clang source manager.
   SourceManager &SrcMgr;
 
diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h
index 9c089908fdc130..0bcbab8da9cee8 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H
 #define LLVM_CLANG_BASIC_SPECIFIERS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -350,7 +351,7 @@ namespace clang {
     NullableResult,
   };
   /// Prints human-readable debug representation.
-  llvm::raw_ostream &operator<<(llvm::raw_ostream&, NullabilityKind);
+  CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream&, NullabilityKind);
 
   /// Return true if \p L has a weaker nullability annotation than \p R. The
   /// ordering is: Unspecified < Nullable < NonNull.
@@ -359,7 +360,7 @@ namespace clang {
   }
 
   /// Retrieve the spelling of the given nullability kind.
-  llvm::StringRef getNullabilitySpelling(NullabilityKind kind,
+  CLANG_ABI llvm::StringRef getNullabilitySpelling(NullabilityKind kind,
                                          bool isContextSensitive = false);
 
   /// Kinds of parameter ABI.
@@ -402,7 +403,7 @@ namespace clang {
     Unspecified = 3,
   };
 
-  llvm::StringRef getParameterABISpelling(ParameterABI kind);
+  CLANG_ABI llvm::StringRef getParameterABISpelling(ParameterABI kind);
 
   inline llvm::StringRef getAccessSpelling(AccessSpecifier AS) {
     switch (AS) {
diff --git a/clang/include/clang/Basic/Stack.h b/clang/include/clang/Basic/Stack.h
index 30ebd94aedd1f7..f6db85cd562369 100644
--- a/clang/include/clang/Basic/Stack.h
+++ b/clang/include/clang/Basic/Stack.h
@@ -16,6 +16,7 @@
 
 #include <cstddef>
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
 
@@ -27,12 +28,12 @@ namespace clang {
 
   /// Call this once on each thread, as soon after starting the thread as
   /// feasible, to note the approximate address of the bottom of the stack.
-  void noteBottomOfStack();
+  CLANG_ABI void noteBottomOfStack();
 
   /// Determine whether the stack is nearly exhausted.
-  bool isStackNearlyExhausted();
+  CLANG_ABI bool isStackNearlyExhausted();
 
-  void runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
+  CLANG_ABI void runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
                                        llvm::function_ref<void()> Fn);
 
   /// Run a given function on a stack with "sufficient" space. If stack space
diff --git a/clang/include/clang/Basic/SyncScope.h b/clang/include/clang/Basic/SyncScope.h
index 45beff41afa11d..c882a62b9832ef 100644
--- a/clang/include/clang/Basic/SyncScope.h
+++ b/clang/include/clang/Basic/SyncScope.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_SYNCSCOPE_H
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
@@ -95,7 +96,7 @@ inline llvm::StringRef getAsString(SyncScope S) {
 enum class AtomicScopeModelKind { None, OpenCL, HIP, Generic };
 
 /// Defines the interface for synch scope model.
-class AtomicScopeModel {
+class CLANG_ABI AtomicScopeModel {
 public:
   virtual ~AtomicScopeModel() {}
   /// Maps language specific synch scope values to internal
diff --git a/clang/include/clang/Basic/TargetID.h b/clang/include/clang/Basic/TargetID.h
index cef9cb5f0fb21c..fe88b4282e6e5a 100644
--- a/clang/include/clang/Basic/TargetID.h
+++ b/clang/include/clang/Basic/TargetID.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_BASIC_TARGETID_H
 #define LLVM_CLANG_BASIC_TARGETID_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/TargetParser/Triple.h"
@@ -22,13 +23,13 @@ namespace clang {
 /// postfixed by a plus or minus sign delimited by colons, e.g.
 /// gfx908:xnack+:sramecc-. Each processor have a limited
 /// number of predefined features when showing up in a target ID.
-llvm::SmallVector<llvm::StringRef, 4>
+CLANG_ABI llvm::SmallVector<llvm::StringRef, 4>
 getAllPossibleTargetIDFeatures(const llvm::Triple &T,
                                llvm::StringRef Processor);
 
 /// Get processor name from target ID.
 /// Returns canonical processor name or empty if the processor name is invalid.
-llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T,
+CLANG_ABI llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T,
                                          llvm::StringRef OffloadArch);
 
 /// Parse a target ID to get processor and feature map.
@@ -38,24 +39,24 @@ llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T,
 /// If the target ID contains feature+, map it to true.
 /// If the target ID contains feature-, map it to false.
 /// If the target ID does not contain a feature (default), do not map it.
-std::optional<llvm::StringRef> parseTargetID(const llvm::Triple &T,
+CLANG_ABI std::optional<llvm::StringRef> parseTargetID(const llvm::Triple &T,
                                              llvm::StringRef OffloadArch,
                                              llvm::StringMap<bool> *FeatureMap);
 
 /// Returns canonical target ID, assuming \p Processor is canonical and all
 /// entries in \p Features are valid.
-std::string getCanonicalTargetID(llvm::StringRef Processor,
+CLANG_ABI std::string getCanonicalTargetID(llvm::StringRef Processor,
                                  const llvm::StringMap<bool> &Features);
 
 /// Get the conflicted pair of target IDs for a compilation or a bundled code
 /// object, assuming \p TargetIDs are canonicalized. If there is no conflicts,
 /// returns std::nullopt.
-std::optional<std::pair<llvm::StringRef, llvm::StringRef>>
+CLANG_ABI std::optional<std::pair<llvm::StringRef, llvm::StringRef>>
 getConflictTargetIDCombination(const std::set<llvm::StringRef> &TargetIDs);
 
 /// Check whether the provided target ID is compatible with the requested
 /// target ID.
-bool isCompatibleTargetID(llvm::StringRef Provided, llvm::StringRef Requested);
+CLANG_ABI bool isCompatibleTargetID(llvm::StringRef Provided, llvm::StringRef Requested);
 } // namespace clang
 
 #endif
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 57783850606290..413d210b606722 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -23,6 +23,7 @@
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TargetCXXABI.h"
 #include "clang/Basic/TargetOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
@@ -215,7 +216,7 @@ enum OpenCLTypeKind : uint8_t {
 
 /// Exposes information about the current target.
 ///
-class TargetInfo : public TransferrableTargetInfo,
+class CLANG_ABI TargetInfo : public TransferrableTargetInfo,
                    public RefCountedBase<TargetInfo> {
   std::shared_ptr<TargetOptions> TargetOpts;
   llvm::Triple Triple;
diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h
index 1b133dde895876..377c523c37dd3d 100644
--- a/clang/include/clang/Basic/TokenKinds.h
+++ b/clang/include/clang/Basic/TokenKinds.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_BASIC_TOKENKINDS_H
 #define LLVM_CLANG_BASIC_TOKENKINDS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Support/Compiler.h"
 
@@ -61,7 +62,7 @@ enum OnOffSwitch {
 ///
 /// The name of a token will be an internal name (such as "l_square")
 /// and should not be used as part of diagnostic messages.
-const char *getTokenName(TokenKind Kind) LLVM_READNONE;
+CLANG_ABI const char *getTokenName(TokenKind Kind) LLVM_READNONE;
 
 /// Determines the spelling of simple punctuation tokens like
 /// '!' or '%', and returns NULL for literal and annotation tokens.
@@ -70,14 +71,14 @@ const char *getTokenName(TokenKind Kind) LLVM_READNONE;
 /// and will not produce any alternative spellings (e.g., a
 /// digraph). For the actual spelling of a given Token, use
 /// Preprocessor::getSpelling().
-const char *getPunctuatorSpelling(TokenKind Kind) LLVM_READNONE;
+CLANG_ABI const char *getPunctuatorSpelling(TokenKind Kind) LLVM_READNONE;
 
 /// Determines the spelling of simple keyword and contextual keyword
 /// tokens like 'int' and 'dynamic_cast'. Returns NULL for other token kinds.
-const char *getKeywordSpelling(TokenKind Kind) LLVM_READNONE;
+CLANG_ABI const char *getKeywordSpelling(TokenKind Kind) LLVM_READNONE;
 
 /// Returns the spelling of preprocessor keywords, such as "else".
-const char *getPPKeywordSpelling(PPKeywordKind Kind) LLVM_READNONE;
+CLANG_ABI const char *getPPKeywordSpelling(PPKeywordKind Kind) LLVM_READNONE;
 
 /// Return true if this is a raw identifier or an identifier kind.
 inline bool isAnyIdentifier(TokenKind K) {
@@ -102,10 +103,10 @@ inline bool isLiteral(TokenKind K) {
 }
 
 /// Return true if this is any of tok::annot_* kinds.
-bool isAnnotation(TokenKind K);
+CLANG_ABI bool isAnnotation(TokenKind K);
 
 /// Return true if this is an annotation token representing a pragma.
-bool isPragmaAnnotation(TokenKind K);
+CLANG_ABI bool isPragmaAnnotation(TokenKind K);
 
 inline constexpr bool isRegularKeywordAttribute(TokenKind K) {
   return (false
diff --git a/clang/include/clang/Basic/TypeTraits.h b/clang/include/clang/Basic/TypeTraits.h
index eb8b1923152db3..805602c9790654 100644
--- a/clang/include/clang/Basic/TypeTraits.h
+++ b/clang/include/clang/Basic/TypeTraits.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_BASIC_TYPETRAITS_H
 #define LLVM_CLANG_BASIC_TYPETRAITS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
@@ -59,17 +60,17 @@ enum UnaryExprOrTypeTrait {
 };
 
 /// Return the internal name of type trait \p T. Never null.
-const char *getTraitName(TypeTrait T) LLVM_READONLY;
-const char *getTraitName(ArrayTypeTrait T) LLVM_READONLY;
-const char *getTraitName(UnaryExprOrTypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitName(TypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitName(ArrayTypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitName(UnaryExprOrTypeTrait T) LLVM_READONLY;
 
 /// Return the spelling of the type trait \p TT. Never null.
-const char *getTraitSpelling(TypeTrait T) LLVM_READONLY;
-const char *getTraitSpelling(ArrayTypeTrait T) LLVM_READONLY;
-const char *getTraitSpelling(UnaryExprOrTypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitSpelling(TypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitSpelling(ArrayTypeTrait T) LLVM_READONLY;
+CLANG_ABI const char *getTraitSpelling(UnaryExprOrTypeTrait T) LLVM_READONLY;
 
 /// Return the arity of the type trait \p T.
-unsigned getTypeTraitArity(TypeTrait T) LLVM_READONLY;
+CLANG_ABI unsigned getTypeTraitArity(TypeTrait T) LLVM_READONLY;
 
 } // namespace clang
 
diff --git a/clang/include/clang/Basic/Version.h b/clang/include/clang/Basic/Version.h
index 8e4e6928fded50..83c08b5f8c1f89 100644
--- a/clang/include/clang/Basic/Version.h
+++ b/clang/include/clang/Basic/Version.h
@@ -16,49 +16,50 @@
 #define LLVM_CLANG_BASIC_VERSION_H
 
 #include "clang/Basic/Version.inc"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
   /// Retrieves the repository path (e.g., Subversion path) that
   /// identifies the particular Clang branch, tag, or trunk from which this
   /// Clang was built.
-  std::string getClangRepositoryPath();
+  CLANG_ABI std::string getClangRepositoryPath();
 
   /// Retrieves the repository path from which LLVM was built.
   ///
   /// This supports LLVM residing in a separate repository from clang.
-  std::string getLLVMRepositoryPath();
+  CLANG_ABI std::string getLLVMRepositoryPath();
 
   /// Retrieves the repository revision number (or identifier) from which
   /// this Clang was built.
-  std::string getClangRevision();
+  CLANG_ABI std::string getClangRevision();
 
   /// Retrieves the repository revision number (or identifier) from which
   /// LLVM was built.
   ///
   /// If Clang and LLVM are in the same repository, this returns the same
   /// string as getClangRevision.
-  std::string getLLVMRevision();
+  CLANG_ABI std::string getLLVMRevision();
 
   /// Retrieves the Clang vendor tag.
-  std::string getClangVendor();
+  CLANG_ABI std::string getClangVendor();
 
   /// Retrieves the full repository version that is an amalgamation of
   /// the information in getClangRepositoryPath() and getClangRevision().
-  std::string getClangFullRepositoryVersion();
+  CLANG_ABI std::string getClangFullRepositoryVersion();
 
   /// Retrieves a string representing the complete clang version,
   /// which includes the clang version number, the repository version,
   /// and the vendor tag.
-  std::string getClangFullVersion();
+  CLANG_ABI std::string getClangFullVersion();
 
   /// Like getClangFullVersion(), but with a custom tool name.
-  std::string getClangToolFullVersion(llvm::StringRef ToolName);
+  CLANG_ABI std::string getClangToolFullVersion(llvm::StringRef ToolName);
 
   /// Retrieves a string representing the complete clang version suitable
   /// for use in the CPP __VERSION__ macro, which includes the clang version
   /// number, the repository version, and the vendor tag.
-  std::string getClangFullCPPVersion();
+  CLANG_ABI std::string getClangFullCPPVersion();
 }
 
 #endif // LLVM_CLANG_BASIC_VERSION_H
diff --git a/clang/include/clang/Basic/XRayInstr.h b/clang/include/clang/Basic/XRayInstr.h
index 23ca2c75fc9973..5259cc7c2b8116 100644
--- a/clang/include/clang/Basic/XRayInstr.h
+++ b/clang/include/clang/Basic/XRayInstr.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_BASIC_XRAYINSTR_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/MathExtras.h"
 #include <cassert>
@@ -66,10 +67,10 @@ struct XRayInstrSet {
 };
 
 /// Parses a command line argument into a mask.
-XRayInstrMask parseXRayInstrValue(StringRef Value);
+CLANG_ABI XRayInstrMask parseXRayInstrValue(StringRef Value);
 
 /// Serializes a set into a list of command line arguments.
-void serializeXRayInstrValue(XRayInstrSet Set,
+CLANG_ABI void serializeXRayInstrValue(XRayInstrSet Set,
                              SmallVectorImpl<StringRef> &Values);
 
 } // namespace clang
diff --git a/clang/include/clang/Basic/XRayLists.h b/clang/include/clang/Basic/XRayLists.h
index 7ea9d9789aabe1..aca333b1193125 100644
--- a/clang/include/clang/Basic/XRayLists.h
+++ b/clang/include/clang/Basic/XRayLists.h
@@ -14,6 +14,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
@@ -26,7 +27,7 @@ namespace clang {
 
 class SourceManager;
 
-class XRayFunctionFilter {
+class CLANG_ABI XRayFunctionFilter {
   std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
   std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
   std::unique_ptr<llvm::SpecialCaseList> AttrList;
diff --git a/clang/include/clang/CIR/CIRGenerator.h b/clang/include/clang/CIR/CIRGenerator.h
index 9a8930ac46ea9c..505b8af2364288 100644
--- a/clang/include/clang/CIR/CIRGenerator.h
+++ b/clang/include/clang/CIR/CIRGenerator.h
@@ -17,6 +17,7 @@
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/CodeGenOptions.h"
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/VirtualFileSystem.h"
 
@@ -33,7 +34,7 @@ class MLIRContext;
 namespace cir {
 class CIRGenModule;
 
-class CIRGenerator : public clang::ASTConsumer {
+class CLANG_ABI CIRGenerator : public clang::ASTConsumer {
   virtual void anchor();
   clang::DiagnosticsEngine &diags;
   clang::ASTContext *astCtx;
diff --git a/clang/include/clang/CIR/FrontendAction/CIRGenAction.h b/clang/include/clang/CIR/FrontendAction/CIRGenAction.h
index 2ab612613b73da..f311c1d029a8a2 100644
--- a/clang/include/clang/CIR/FrontendAction/CIRGenAction.h
+++ b/clang/include/clang/CIR/FrontendAction/CIRGenAction.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_CIR_CIRGENACTION_H
 
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 
 #include "mlir/IR/BuiltinOps.h"
 #include "mlir/IR/OwningOpRef.h"
@@ -22,7 +23,7 @@ class ModuleOp;
 namespace cir {
 class CIRGenConsumer;
 
-class CIRGenAction : public clang::ASTFrontendAction {
+class CLANG_ABI CIRGenAction : public clang::ASTFrontendAction {
 public:
   enum class OutputType {
     EmitCIR,
@@ -48,7 +49,7 @@ class CIRGenAction : public clang::ASTFrontendAction {
   OutputType Action;
 };
 
-class EmitCIRAction : public CIRGenAction {
+class CLANG_ABI EmitCIRAction : public CIRGenAction {
   virtual void anchor();
 
 public:
diff --git a/clang/include/clang/CodeGen/BackendUtil.h b/clang/include/clang/CodeGen/BackendUtil.h
index fc8ed4f011f922..bfef5d2369cd77 100644
--- a/clang/include/clang/CodeGen/BackendUtil.h
+++ b/clang/include/clang/CodeGen/BackendUtil.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
 #include <memory>
 
@@ -41,7 +42,7 @@ namespace clang {
     Backend_EmitObj        ///< Emit native object files
   };
 
-  void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
+  CLANG_ABI void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
                          const CodeGenOptions &CGOpts,
                          const TargetOptions &TOpts, const LangOptions &LOpts,
                          StringRef TDesc, llvm::Module *M, BackendAction Action,
@@ -49,10 +50,10 @@ namespace clang {
                          std::unique_ptr<raw_pwrite_stream> OS,
                          BackendConsumer *BC = nullptr);
 
-  void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
+  CLANG_ABI void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
                     llvm::MemoryBufferRef Buf);
 
-  void EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
+  CLANG_ABI void EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
                    DiagnosticsEngine &Diags);
 }
 
diff --git a/clang/include/clang/CodeGen/CGFunctionInfo.h b/clang/include/clang/CodeGen/CGFunctionInfo.h
index d19f84d198876f..2bec391823bfeb 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -19,8 +19,9 @@
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Type.h"
-#include "llvm/IR/DerivedTypes.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/Support/TrailingObjects.h"
 #include <cassert>
 
@@ -29,7 +30,7 @@ namespace CodeGen {
 
 /// ABIArgInfo - Helper class to encapsulate information about how a
 /// specific C type should be passed to or returned from a function.
-class ABIArgInfo {
+class CLANG_ABI ABIArgInfo {
 public:
   enum Kind : uint8_t {
     /// Direct - Pass the argument directly using the normal converted LLVM
@@ -573,7 +574,7 @@ struct CGFunctionInfoArgInfo {
 
 /// CGFunctionInfo - Class to encapsulate the information about a
 /// function definition.
-class CGFunctionInfo final
+class CLANG_ABI CGFunctionInfo final
     : public llvm::FoldingSetNode,
       private llvm::TrailingObjects<CGFunctionInfo, CGFunctionInfoArgInfo,
                                     FunctionProtoType::ExtParameterInfo> {
diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h b/clang/include/clang/CodeGen/CodeGenABITypes.h
index 9cbc5a8a2a3f41..f3baeb8c78ca34 100644
--- a/clang/include/clang/CodeGen/CodeGenABITypes.h
+++ b/clang/include/clang/CodeGen/CodeGenABITypes.h
@@ -27,6 +27,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/ABI.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/IR/BasicBlock.h"
 
 namespace llvm {
@@ -60,22 +61,22 @@ struct ImplicitCXXConstructorArgs {
   SmallVector<llvm::Value *, 1> Suffix;
 };
 
-const CGFunctionInfo &arrangeObjCMessageSendSignature(CodeGenModule &CGM,
+CLANG_ABI const CGFunctionInfo &arrangeObjCMessageSendSignature(CodeGenModule &CGM,
                                                       const ObjCMethodDecl *MD,
                                                       QualType receiverType);
 
-const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
+CLANG_ABI const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
                                               CanQual<FunctionProtoType> Ty);
 
-const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
+CLANG_ABI const CGFunctionInfo &arrangeFreeFunctionType(CodeGenModule &CGM,
                                               CanQual<FunctionNoProtoType> Ty);
 
-const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
+CLANG_ABI const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
                                            const CXXRecordDecl *RD,
                                            const FunctionProtoType *FTP,
                                            const CXXMethodDecl *MD);
 
-const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
+CLANG_ABI const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
                                               CanQualType returnType,
                                               ArrayRef<CanQualType> argTypes,
                                               FunctionType::ExtInfo info,
@@ -83,33 +84,33 @@ const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
 
 /// Returns the implicit arguments to add to a complete, non-delegating C++
 /// constructor call.
-ImplicitCXXConstructorArgs
+CLANG_ABI ImplicitCXXConstructorArgs
 getImplicitCXXConstructorArgs(CodeGenModule &CGM, const CXXConstructorDecl *D);
 
-llvm::Value *
+CLANG_ABI llvm::Value *
 getCXXDestructorImplicitParam(CodeGenModule &CGM, llvm::BasicBlock *InsertBlock,
                               llvm::BasicBlock::iterator InsertPoint,
                               const CXXDestructorDecl *D, CXXDtorType Type,
                               bool ForVirtualBase, bool Delegating);
 
 /// Returns null if the function type is incomplete and can't be lowered.
-llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM,
+CLANG_ABI llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM,
                                             const FunctionDecl *FD);
 
-llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
+CLANG_ABI llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
 
 /// Given a non-bitfield struct field, return its index within the elements of
 /// the struct's converted type.  The returned index refers to a field number in
 /// the complete object type which is returned by convertTypeForMemory.  FD must
 /// be a field in RD directly (i.e. not an inherited field).
-unsigned getLLVMFieldNumber(CodeGenModule &CGM,
+CLANG_ABI unsigned getLLVMFieldNumber(CodeGenModule &CGM,
                             const RecordDecl *RD, const FieldDecl *FD);
 
 /// Return a declaration discriminator for the given global decl.
-uint16_t getPointerAuthDeclDiscriminator(CodeGenModule &CGM, GlobalDecl GD);
+CLANG_ABI uint16_t getPointerAuthDeclDiscriminator(CodeGenModule &CGM, GlobalDecl GD);
 
 /// Return a type discriminator for the given function type.
-uint16_t getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
+CLANG_ABI uint16_t getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
                                          QualType FunctionType);
 
 /// Given the language and code-generation options that Clang was configured
@@ -128,14 +129,14 @@ uint16_t getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
 ///
 /// This function assumes that the caller is not defining a function that
 /// requires special no-builtin treatment.
-void addDefaultFunctionDefinitionAttributes(CodeGenModule &CGM,
+CLANG_ABI void addDefaultFunctionDefinitionAttributes(CodeGenModule &CGM,
                                             llvm::AttrBuilder &attrs);
 
 /// Returns the default constructor for a C struct with non-trivially copyable
 /// fields, generating it if necessary. The returned function uses the `cdecl`
 /// calling convention, returns void, and takes a single argument that is a
 /// pointer to the address of the struct.
-llvm::Function *getNonTrivialCStructDefaultConstructor(CodeGenModule &GCM,
+CLANG_ABI llvm::Function *getNonTrivialCStructDefaultConstructor(CodeGenModule &GCM,
                                                        CharUnits DstAlignment,
                                                        bool IsVolatile,
                                                        QualType QT);
@@ -144,7 +145,7 @@ llvm::Function *getNonTrivialCStructDefaultConstructor(CodeGenModule &GCM,
 /// fields, generating it if necessary. The returned function uses the `cdecl`
 /// calling convention, returns void, and takes two arguments: pointers to the
 /// addresses of the destination and source structs, respectively.
-llvm::Function *getNonTrivialCStructCopyConstructor(CodeGenModule &CGM,
+CLANG_ABI llvm::Function *getNonTrivialCStructCopyConstructor(CodeGenModule &CGM,
                                                     CharUnits DstAlignment,
                                                     CharUnits SrcAlignment,
                                                     bool IsVolatile,
@@ -154,7 +155,7 @@ llvm::Function *getNonTrivialCStructCopyConstructor(CodeGenModule &CGM,
 /// fields, generating it if necessary. The returned function uses the `cdecl`
 /// calling convention, returns void, and takes two arguments: pointers to the
 /// addresses of the destination and source structs, respectively.
-llvm::Function *getNonTrivialCStructMoveConstructor(CodeGenModule &CGM,
+CLANG_ABI llvm::Function *getNonTrivialCStructMoveConstructor(CodeGenModule &CGM,
                                                     CharUnits DstAlignment,
                                                     CharUnits SrcAlignment,
                                                     bool IsVolatile,
@@ -164,7 +165,7 @@ llvm::Function *getNonTrivialCStructMoveConstructor(CodeGenModule &CGM,
 /// copyable fields, generating it if necessary. The returned function uses the
 /// `cdecl` calling convention, returns void, and takes two arguments: pointers
 /// to the addresses of the destination and source structs, respectively.
-llvm::Function *getNonTrivialCStructCopyAssignmentOperator(
+CLANG_ABI llvm::Function *getNonTrivialCStructCopyAssignmentOperator(
     CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
     bool IsVolatile, QualType QT);
 
@@ -172,7 +173,7 @@ llvm::Function *getNonTrivialCStructCopyAssignmentOperator(
 /// copyable fields, generating it if necessary. The returned function uses the
 /// `cdecl` calling convention, returns void, and takes two arguments: pointers
 /// to the addresses of the destination and source structs, respectively.
-llvm::Function *getNonTrivialCStructMoveAssignmentOperator(
+CLANG_ABI llvm::Function *getNonTrivialCStructMoveAssignmentOperator(
     CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
     bool IsVolatile, QualType QT);
 
@@ -180,7 +181,7 @@ llvm::Function *getNonTrivialCStructMoveAssignmentOperator(
 /// generating it if necessary. The returned function uses the `cdecl` calling
 /// convention, returns void, and takes a single argument that is a pointer to
 /// the address of the struct.
-llvm::Function *getNonTrivialCStructDestructor(CodeGenModule &CGM,
+CLANG_ABI llvm::Function *getNonTrivialCStructDestructor(CodeGenModule &CGM,
                                                CharUnits DstAlignment,
                                                bool IsVolatile, QualType QT);
 
@@ -189,7 +190,7 @@ llvm::Function *getNonTrivialCStructDestructor(CodeGenModule &CGM,
 /// for emitting a protocol reference in code (e.g. for a protocol expression)
 /// in most runtimes is not as simple as just materializing a pointer to this
 /// object.
-llvm::Constant *emitObjCProtocolObject(CodeGenModule &CGM,
+CLANG_ABI llvm::Constant *emitObjCProtocolObject(CodeGenModule &CGM,
                                        const ObjCProtocolDecl *p);
 }  // end namespace CodeGen
 }  // end namespace clang
diff --git a/clang/include/clang/CodeGen/CodeGenAction.h b/clang/include/clang/CodeGen/CodeGenAction.h
index 186dbb43f01ef7..11061f6769ea53 100644
--- a/clang/include/clang/CodeGen/CodeGenAction.h
+++ b/clang/include/clang/CodeGen/CodeGenAction.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_CODEGEN_CODEGENACTION_H
 
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace llvm {
@@ -21,7 +22,7 @@ namespace clang {
 class BackendConsumer;
 class CodeGenerator;
 
-class CodeGenAction : public ASTFrontendAction {
+class CLANG_ABI CodeGenAction : public ASTFrontendAction {
 private:
   // Let BackendConsumer access LinkModule.
   friend class BackendConsumer;
@@ -88,37 +89,37 @@ class CodeGenAction : public ASTFrontendAction {
   BackendConsumer *BEConsumer = nullptr;
 };
 
-class EmitAssemblyAction : public CodeGenAction {
+class CLANG_ABI EmitAssemblyAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitAssemblyAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-class EmitBCAction : public CodeGenAction {
+class CLANG_ABI EmitBCAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitBCAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-class EmitLLVMAction : public CodeGenAction {
+class CLANG_ABI EmitLLVMAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitLLVMAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-class EmitLLVMOnlyAction : public CodeGenAction {
+class CLANG_ABI EmitLLVMOnlyAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-class EmitCodeGenOnlyAction : public CodeGenAction {
+class CLANG_ABI EmitCodeGenOnlyAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = nullptr);
 };
 
-class EmitObjAction : public CodeGenAction {
+class CLANG_ABI EmitObjAction : public CodeGenAction {
   virtual void anchor();
 public:
   EmitObjAction(llvm::LLVMContext *_VMContext = nullptr);
diff --git a/clang/include/clang/CodeGen/ConstantInitBuilder.h b/clang/include/clang/CodeGen/ConstantInitBuilder.h
index 28d4764b6d60b0..a9e634d6ed0b4f 100644
--- a/clang/include/clang/CodeGen/ConstantInitBuilder.h
+++ b/clang/include/clang/CodeGen/ConstantInitBuilder.h
@@ -15,12 +15,13 @@
 #ifndef LLVM_CLANG_CODEGEN_CONSTANTINITBUILDER_H
 #define LLVM_CLANG_CODEGEN_CONSTANTINITBUILDER_H
 
+#include "clang/AST/CharUnits.h"
+#include "clang/CodeGen/ConstantInitFuture.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/GlobalValue.h"
-#include "clang/AST/CharUnits.h"
-#include "clang/CodeGen/ConstantInitFuture.h"
 
 #include <vector>
 
@@ -51,7 +52,7 @@ class CodeGenModule;
 ///    widgetArray.finishAndAddTo(toplevel);
 ///    auto global = toplevel.finishAndCreateGlobal("WIDGET_LIST", Align,
 ///                                                 /*constant*/ true);
-class ConstantInitBuilderBase {
+class CLANG_ABI ConstantInitBuilderBase {
   struct SelfReference {
     llvm::GlobalVariable *Dummy;
     llvm::SmallVector<llvm::Constant*, 4> Indices;
@@ -97,7 +98,7 @@ class ConstantInitBuilderBase {
 
 /// A concrete base class for struct and array aggregate
 /// initializer builders.
-class ConstantAggregateBuilderBase {
+class CLANG_ABI ConstantAggregateBuilderBase {
 protected:
   ConstantInitBuilderBase &Builder;
   ConstantAggregateBuilderBase *Parent;
diff --git a/clang/include/clang/CodeGen/ConstantInitFuture.h b/clang/include/clang/CodeGen/ConstantInitFuture.h
index 452ba36d20876e..91f374a1def90d 100644
--- a/clang/include/clang/CodeGen/ConstantInitFuture.h
+++ b/clang/include/clang/CodeGen/ConstantInitFuture.h
@@ -17,6 +17,7 @@
 #ifndef LLVM_CLANG_CODEGEN_CONSTANTINITFUTURE_H
 #define LLVM_CLANG_CODEGEN_CONSTANTINITFUTURE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/IR/Constant.h"
 
@@ -44,7 +45,7 @@ namespace CodeGen {
 
 /// A "future" for a completed constant initializer, which can be passed
 /// around independently of any sub-builders (but not the original parent).
-class ConstantInitFuture {
+class CLANG_ABI ConstantInitFuture {
   using PairTy = llvm::PointerUnion<ConstantInitBuilderBase*, llvm::Constant*>;
 
   PairTy Data;
diff --git a/clang/include/clang/CodeGen/ModuleBuilder.h b/clang/include/clang/CodeGen/ModuleBuilder.h
index 59b9840d02e086..0f63c55c31a571 100644
--- a/clang/include/clang/CodeGen/ModuleBuilder.h
+++ b/clang/include/clang/CodeGen/ModuleBuilder.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace llvm {
@@ -49,7 +50,7 @@ namespace CodeGen {
 /// The primary public interface to the Clang code generator.
 ///
 /// This is not really an abstract interface.
-class CodeGenerator : public ASTConsumer {
+class CLANG_ABI CodeGenerator : public ASTConsumer {
   virtual void anchor();
 
 public:
@@ -105,7 +106,7 @@ class CodeGenerator : public ASTConsumer {
 /// CreateLLVMCodeGen - Create a CodeGenerator instance.
 /// It is the responsibility of the caller to call delete on
 /// the allocated CodeGenerator instance.
-CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
+CLANG_ABI CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
                                  llvm::StringRef ModuleName,
                                  IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
                                  const HeaderSearchOptions &HeaderSearchOpts,
diff --git a/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
index 26ee9f22258c1f..d68f571edfe1af 100644
--- a/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
+++ b/clang/include/clang/CodeGen/ObjectFilePCHContainerWriter.h
@@ -10,12 +10,13 @@
 #define LLVM_CLANG_CODEGEN_OBJECTFILEPCHCONTAINEROPERATIONS_H
 
 #include "clang/Frontend/PCHContainerOperations.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 /// A PCHContainerWriter implementation that uses LLVM to
 /// wraps Clang modules inside a COFF, ELF, or Mach-O container.
-class ObjectFilePCHContainerWriter : public PCHContainerWriter {
+class CLANG_ABI ObjectFilePCHContainerWriter : public PCHContainerWriter {
   StringRef getFormat() const override { return "obj"; }
 
   /// Return an ASTConsumer that can be chained with a
diff --git a/clang/include/clang/CodeGen/SwiftCallingConv.h b/clang/include/clang/CodeGen/SwiftCallingConv.h
index d7a0c84699ab0d..946525308823a1 100644
--- a/clang/include/clang/CodeGen/SwiftCallingConv.h
+++ b/clang/include/clang/CodeGen/SwiftCallingConv.h
@@ -17,6 +17,7 @@
 #include "clang/AST/CanonicalType.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/Type.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/TrailingObjects.h"
 #include <cassert>
 
@@ -38,7 +39,7 @@ class CGFunctionInfo;
 
 namespace swiftcall {
 
-class SwiftAggLowering {
+class CLANG_ABI SwiftAggLowering {
   CodeGenModule &CGM;
 
   struct StorageEntry {
@@ -120,29 +121,29 @@ class SwiftAggLowering {
 
 /// Should an aggregate which expands to the given type sequence
 /// be passed/returned indirectly under swiftcall?
-bool shouldPassIndirectly(CodeGenModule &CGM,
+CLANG_ABI bool shouldPassIndirectly(CodeGenModule &CGM,
                           ArrayRef<llvm::Type*> types,
                           bool asReturnValue);
 
 /// Return the maximum voluntary integer size for the current target.
-CharUnits getMaximumVoluntaryIntegerSize(CodeGenModule &CGM);
+CLANG_ABI CharUnits getMaximumVoluntaryIntegerSize(CodeGenModule &CGM);
 
 /// Return the Swift CC's notion of the natural alignment of a type.
-CharUnits getNaturalAlignment(CodeGenModule &CGM, llvm::Type *type);
+CLANG_ABI CharUnits getNaturalAlignment(CodeGenModule &CGM, llvm::Type *type);
 
 /// Is the given integer type "legal" for Swift's perspective on the
 /// current platform?
-bool isLegalIntegerType(CodeGenModule &CGM, llvm::IntegerType *type);
+CLANG_ABI bool isLegalIntegerType(CodeGenModule &CGM, llvm::IntegerType *type);
 
 /// Is the given vector type "legal" for Swift's perspective on the
 /// current platform?
-bool isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
+CLANG_ABI bool isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
                        llvm::VectorType *vectorTy);
-bool isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
+CLANG_ABI bool isLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
                        llvm::Type *eltTy, unsigned numElts);
 
 /// Minimally split a legal vector type.
-std::pair<llvm::Type*, unsigned>
+CLANG_ABI std::pair<llvm::Type*, unsigned>
 splitLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
                      llvm::VectorType *vectorTy);
 
@@ -150,7 +151,7 @@ splitLegalVectorType(CodeGenModule &CGM, CharUnits vectorSize,
 ///
 /// The caller may assume that the sum of the data sizes of the resulting
 /// types will equal the data size of the vector type.
-void legalizeVectorType(CodeGenModule &CGM, CharUnits vectorSize,
+CLANG_ABI void legalizeVectorType(CodeGenModule &CGM, CharUnits vectorSize,
                         llvm::VectorType *vectorTy,
                         llvm::SmallVectorImpl<llvm::Type*> &types);
 
@@ -162,20 +163,20 @@ void legalizeVectorType(CodeGenModule &CGM, CharUnits vectorSize,
 /// references.  A record for which this returns true may still be passed
 /// indirectly for other reasons, such as being too large to fit in a
 /// reasonable number of registers.
-bool mustPassRecordIndirectly(CodeGenModule &CGM, const RecordDecl *record);
+CLANG_ABI bool mustPassRecordIndirectly(CodeGenModule &CGM, const RecordDecl *record);
 
 /// Classify the rules for how to return a particular type.
-ABIArgInfo classifyReturnType(CodeGenModule &CGM, CanQualType type);
+CLANG_ABI ABIArgInfo classifyReturnType(CodeGenModule &CGM, CanQualType type);
 
 /// Classify the rules for how to pass a particular type.
-ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type);
+CLANG_ABI ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type);
 
 /// Compute the ABI information of a swiftcall function.  This is a
 /// private interface for Clang.
-void computeABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI);
+CLANG_ABI void computeABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI);
 
 /// Is swifterror lowered to a register by the target ABI?
-bool isSwiftErrorLoweredInRegister(CodeGenModule &CGM);
+CLANG_ABI bool isSwiftErrorLoweredInRegister(CodeGenModule &CGM);
 
 } // end namespace swiftcall
 } // end namespace CodeGen
diff --git a/clang/include/clang/CrossTU/CrossTranslationUnit.h b/clang/include/clang/CrossTU/CrossTranslationUnit.h
index e6b608a10e61bb..4dc4f61015ed6e 100644
--- a/clang/include/clang/CrossTU/CrossTranslationUnit.h
+++ b/clang/include/clang/CrossTU/CrossTranslationUnit.h
@@ -17,6 +17,7 @@
 #include "clang/AST/ASTImporterSharedState.h"
 #include "clang/Analysis/MacroExpansionContext.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringMap.h"
@@ -58,7 +59,7 @@ enum class index_error_code {
   invocation_list_lookup_unsuccessful
 };
 
-class IndexError : public llvm::ErrorInfo<IndexError> {
+class CLANG_ABI IndexError : public llvm::ErrorInfo<IndexError> {
 public:
   static char ID;
   IndexError(index_error_code C) : Code(C), LineNo(0) {}
@@ -94,10 +95,10 @@ class IndexError : public llvm::ErrorInfo<IndexError> {
 ///
 /// \return Returns a map where the USR is the key and the filepath is the value
 ///         or an error.
-llvm::Expected<llvm::StringMap<std::string>>
+CLANG_ABI llvm::Expected<llvm::StringMap<std::string>>
 parseCrossTUIndex(StringRef IndexPath);
 
-std::string createCrossTUIndexString(const llvm::StringMap<std::string> &Index);
+CLANG_ABI std::string createCrossTUIndexString(const llvm::StringMap<std::string> &Index);
 
 using InvocationListTy = llvm::StringMap<llvm::SmallVector<std::string, 32>>;
 /// Parse the YAML formatted invocation list file content \p FileContent.
@@ -105,14 +106,14 @@ using InvocationListTy = llvm::StringMap<llvm::SmallVector<std::string, 32>>;
 /// paths in the filesystem to a list of command-line parts, which
 /// constitute the invocation needed to compile that file. That invocation
 /// will be used to produce the AST of the TU.
-llvm::Expected<InvocationListTy> parseInvocationList(
+CLANG_ABI llvm::Expected<InvocationListTy> parseInvocationList(
     StringRef FileContent,
     llvm::sys::path::Style PathStyle = llvm::sys::path::Style::posix);
 
 /// Returns true if it makes sense to import a foreign variable definition.
 /// For instance, we don't want to import variables that have non-trivial types
 /// because the constructor might have side-effects.
-bool shouldImport(const VarDecl *VD, const ASTContext &ACtx);
+CLANG_ABI bool shouldImport(const VarDecl *VD, const ASTContext &ACtx);
 
 /// This class is used for tools that requires cross translation
 ///        unit capability.
@@ -124,7 +125,7 @@ bool shouldImport(const VarDecl *VD, const ASTContext &ACtx);
 /// the locations of the AST files for each definition.
 ///
 /// Note that this class also implements caching.
-class CrossTranslationUnitContext {
+class CLANG_ABI CrossTranslationUnitContext {
 public:
   CrossTranslationUnitContext(CompilerInstance &CI);
   ~CrossTranslationUnitContext();
@@ -230,7 +231,7 @@ class CrossTranslationUnitContext {
   using LoadResultTy = llvm::Expected<std::unique_ptr<ASTUnit>>;
 
   /// Loads ASTUnits from AST-dumps or source-files.
-  class ASTLoader {
+  class CLANG_ABI ASTLoader {
   public:
     ASTLoader(CompilerInstance &CI, StringRef CTUDir,
               StringRef InvocationListFilePath);
@@ -288,7 +289,7 @@ class CrossTranslationUnitContext {
 
   /// Storage and load of ASTUnits, cached access, and providing searchability
   /// are the concerns of ASTUnitStorage class.
-  class ASTUnitStorage {
+  class CLANG_ABI ASTUnitStorage {
   public:
     ASTUnitStorage(CompilerInstance &CI);
     /// Loads an ASTUnit for a function.
diff --git a/clang/include/clang/Driver/Action.h b/clang/include/clang/Driver/Action.h
index 04fa8b01b418f8..f9916d4f7a030f 100644
--- a/clang/include/clang/Driver/Action.h
+++ b/clang/include/clang/Driver/Action.h
@@ -12,6 +12,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/Types.h"
 #include "clang/Driver/Util.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
@@ -44,7 +45,7 @@ class ToolChain;
 ///
 /// Actions are usually owned by a Compilation, which creates new
 /// actions via MakeAction().
-class Action {
+class CLANG_ABI Action {
 public:
   using size_type = ActionList::size_type;
   using input_iterator = ActionList::iterator;
@@ -226,7 +227,7 @@ class Action {
   }
 };
 
-class InputAction : public Action {
+class CLANG_ABI InputAction : public Action {
   const llvm::opt::Arg &Input;
   std::string Id;
   virtual void anchor();
@@ -245,7 +246,7 @@ class InputAction : public Action {
   }
 };
 
-class BindArchAction : public Action {
+class CLANG_ABI BindArchAction : public Action {
   virtual void anchor();
 
   /// The architecture to bind, or 0 if the default architecture
@@ -265,13 +266,13 @@ class BindArchAction : public Action {
 /// An offload action combines host or/and device actions according to the
 /// programming model implementation needs and propagates the offloading kind to
 /// its dependences.
-class OffloadAction final : public Action {
+class CLANG_ABI OffloadAction final : public Action {
   virtual void anchor();
 
 public:
   /// Type used to communicate device actions. It associates bound architecture,
   /// toolchain, and offload kind to each action.
-  class DeviceDependences final {
+  class CLANG_ABI DeviceDependences final {
   public:
     using ToolChainList = SmallVector<const ToolChain *, 3>;
     using BoundArchList = SmallVector<const char *, 3>;
@@ -317,7 +318,7 @@ class OffloadAction final : public Action {
 
   /// Type used to communicate host actions. It associates bound architecture,
   /// toolchain, and offload kinds to the host action.
-  class HostDependence final {
+  class CLANG_ABI HostDependence final {
     /// The dependence action.
     Action &HostAction;
 
@@ -396,7 +397,7 @@ class OffloadAction final : public Action {
   static bool classof(const Action *A) { return A->getKind() == OffloadClass; }
 };
 
-class JobAction : public Action {
+class CLANG_ABI JobAction : public Action {
   virtual void anchor();
 
 protected:
@@ -410,7 +411,7 @@ class JobAction : public Action {
   }
 };
 
-class PreprocessJobAction : public JobAction {
+class CLANG_ABI PreprocessJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -421,7 +422,7 @@ class PreprocessJobAction : public JobAction {
   }
 };
 
-class PrecompileJobAction : public JobAction {
+class CLANG_ABI PrecompileJobAction : public JobAction {
   void anchor() override;
 
 protected:
@@ -435,7 +436,7 @@ class PrecompileJobAction : public JobAction {
   }
 };
 
-class ExtractAPIJobAction : public JobAction {
+class CLANG_ABI ExtractAPIJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -448,7 +449,7 @@ class ExtractAPIJobAction : public JobAction {
   void addHeaderInput(Action *Input) { getInputs().push_back(Input); }
 };
 
-class AnalyzeJobAction : public JobAction {
+class CLANG_ABI AnalyzeJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -459,7 +460,7 @@ class AnalyzeJobAction : public JobAction {
   }
 };
 
-class MigrateJobAction : public JobAction {
+class CLANG_ABI MigrateJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -470,7 +471,7 @@ class MigrateJobAction : public JobAction {
   }
 };
 
-class CompileJobAction : public JobAction {
+class CLANG_ABI CompileJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -481,7 +482,7 @@ class CompileJobAction : public JobAction {
   }
 };
 
-class BackendJobAction : public JobAction {
+class CLANG_ABI BackendJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -492,7 +493,7 @@ class BackendJobAction : public JobAction {
   }
 };
 
-class AssembleJobAction : public JobAction {
+class CLANG_ABI AssembleJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -503,7 +504,7 @@ class AssembleJobAction : public JobAction {
   }
 };
 
-class IfsMergeJobAction : public JobAction {
+class CLANG_ABI IfsMergeJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -514,7 +515,7 @@ class IfsMergeJobAction : public JobAction {
   }
 };
 
-class LinkJobAction : public JobAction {
+class CLANG_ABI LinkJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -525,7 +526,7 @@ class LinkJobAction : public JobAction {
   }
 };
 
-class LipoJobAction : public JobAction {
+class CLANG_ABI LipoJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -536,7 +537,7 @@ class LipoJobAction : public JobAction {
   }
 };
 
-class DsymutilJobAction : public JobAction {
+class CLANG_ABI DsymutilJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -547,7 +548,7 @@ class DsymutilJobAction : public JobAction {
   }
 };
 
-class VerifyJobAction : public JobAction {
+class CLANG_ABI VerifyJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -559,7 +560,7 @@ class VerifyJobAction : public JobAction {
   }
 };
 
-class VerifyDebugInfoJobAction : public VerifyJobAction {
+class CLANG_ABI VerifyDebugInfoJobAction : public VerifyJobAction {
   void anchor() override;
 
 public:
@@ -570,7 +571,7 @@ class VerifyDebugInfoJobAction : public VerifyJobAction {
   }
 };
 
-class VerifyPCHJobAction : public VerifyJobAction {
+class CLANG_ABI VerifyPCHJobAction : public VerifyJobAction {
   void anchor() override;
 
 public:
@@ -581,7 +582,7 @@ class VerifyPCHJobAction : public VerifyJobAction {
   }
 };
 
-class OffloadBundlingJobAction : public JobAction {
+class CLANG_ABI OffloadBundlingJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -593,7 +594,7 @@ class OffloadBundlingJobAction : public JobAction {
   }
 };
 
-class OffloadUnbundlingJobAction final : public JobAction {
+class CLANG_ABI OffloadUnbundlingJobAction final : public JobAction {
   void anchor() override;
 
 public:
@@ -642,7 +643,7 @@ class OffloadUnbundlingJobAction final : public JobAction {
   }
 };
 
-class OffloadPackagerJobAction : public JobAction {
+class CLANG_ABI OffloadPackagerJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -653,7 +654,7 @@ class OffloadPackagerJobAction : public JobAction {
   }
 };
 
-class LinkerWrapperJobAction : public JobAction {
+class CLANG_ABI LinkerWrapperJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -664,7 +665,7 @@ class LinkerWrapperJobAction : public JobAction {
   }
 };
 
-class StaticLibJobAction : public JobAction {
+class CLANG_ABI StaticLibJobAction : public JobAction {
   void anchor() override;
 
 public:
@@ -675,7 +676,7 @@ class StaticLibJobAction : public JobAction {
   }
 };
 
-class BinaryAnalyzeJobAction : public JobAction {
+class CLANG_ABI BinaryAnalyzeJobAction : public JobAction {
   void anchor() override;
 
 public:
diff --git a/clang/include/clang/Driver/Compilation.h b/clang/include/clang/Driver/Compilation.h
index 36ae85c4245143..c6ee7f3b2bf731 100644
--- a/clang/include/clang/Driver/Compilation.h
+++ b/clang/include/clang/Driver/Compilation.h
@@ -13,6 +13,7 @@
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Job.h"
 #include "clang/Driver/Util.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -42,7 +43,7 @@ class ToolChain;
 
 /// Compilation - A set of tasks to perform for a single driver
 /// invocation.
-class Compilation {
+class CLANG_ABI Compilation {
   /// The driver we were created by.
   const Driver &TheDriver;
 
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
index 1404e168684821..da336a25d11918 100644
--- a/clang/include/clang/Driver/Distro.h
+++ b/clang/include/clang/Driver/Distro.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_DRIVER_DISTRO_H
 #define LLVM_CLANG_DRIVER_DISTRO_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/Triple.h"
 
@@ -20,7 +21,7 @@ namespace driver {
 /// This class encapsulates the clang Linux distribution detection mechanism
 /// as well as helper functions that match the specific (versioned) results
 /// into wider distribution classes.
-class Distro {
+class CLANG_ABI Distro {
 public:
   enum DistroType {
     // Special value means that no detection was performed yet.
diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h
index 9177d56718ee77..c491f86f46c8ca 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -20,6 +20,7 @@
 #include "clang/Driver/ToolChain.h"
 #include "clang/Driver/Types.h"
 #include "clang/Driver/Util.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringMap.h"
@@ -74,7 +75,7 @@ enum ModuleHeaderMode {
 
 /// Driver - Encapsulate logic for constructing compilation processes
 /// from a set of gcc-driver-like command line arguments.
-class Driver {
+class CLANG_ABI Driver {
   DiagnosticsEngine &Diags;
 
   IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
@@ -821,20 +822,20 @@ class Driver {
 
 /// \return True if the last defined optimization level is -Ofast.
 /// And False otherwise.
-bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
+CLANG_ABI bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
 
 /// \return True if the argument combination will end up generating remarks.
-bool willEmitRemarks(const llvm::opt::ArgList &Args);
+CLANG_ABI bool willEmitRemarks(const llvm::opt::ArgList &Args);
 
 /// Returns the driver mode option's value, i.e. `X` in `--driver-mode=X`. If \p
 /// Args doesn't mention one explicitly, tries to deduce from `ProgName`.
 /// Returns empty on failure.
 /// Common values are "gcc", "g++", "cpp", "cl" and "flang". Returned value need
 /// not be one of these.
-llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef<const char *> Args);
+CLANG_ABI llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef<const char *> Args);
 
 /// Checks whether the value produced by getDriverMode is for CL mode.
-bool IsClangCL(StringRef DriverMode);
+CLANG_ABI bool IsClangCL(StringRef DriverMode);
 
 /// Expand response files from a clang driver or cc1 invocation.
 ///
@@ -842,13 +843,13 @@ bool IsClangCL(StringRef DriverMode);
 /// \param ClangCLMode Whether clang is in CL mode.
 /// \param Alloc Allocator for new arguments.
 /// \param FS Filesystem to use when expanding files.
-llvm::Error expandResponseFiles(SmallVectorImpl<const char *> &Args,
+CLANG_ABI llvm::Error expandResponseFiles(SmallVectorImpl<const char *> &Args,
                                 bool ClangCLMode, llvm::BumpPtrAllocator &Alloc,
                                 llvm::vfs::FileSystem *FS = nullptr);
 
 /// Apply a space separated list of edits to the input argument lists.
 /// See applyOneOverrideOption.
-void applyOverrideOptions(SmallVectorImpl<const char *> &Args,
+CLANG_ABI void applyOverrideOptions(SmallVectorImpl<const char *> &Args,
                           const char *OverrideOpts,
                           llvm::StringSet<> &SavedStrings,
                           raw_ostream *OS = nullptr);
diff --git a/clang/include/clang/Driver/Job.h b/clang/include/clang/Driver/Job.h
index df9449463c53bd..bfde4841506e27 100644
--- a/clang/include/clang/Driver/Job.h
+++ b/clang/include/clang/Driver/Job.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/InputInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -103,7 +104,7 @@ struct ResponseFileSupport {
 
 /// Command - An executable path/name and argument vector to
 /// execute.
-class Command {
+class CLANG_ABI Command {
   /// Source - The action which caused the creation of this job.
   const Action &Source;
 
@@ -240,7 +241,7 @@ class Command {
 };
 
 /// Use the CC1 tool callback when available, to avoid creating a new process
-class CC1Command : public Command {
+class CLANG_ABI CC1Command : public Command {
 public:
   CC1Command(const Action &Source, const Tool &Creator,
              ResponseFileSupport ResponseSupport, const char *Executable,
@@ -259,7 +260,7 @@ class CC1Command : public Command {
 };
 
 /// JobList - A sequence of jobs to perform.
-class JobList {
+class CLANG_ABI JobList {
 public:
   using list_type = SmallVector<std::unique_ptr<Command>, 4>;
   using size_type = list_type::size_type;
diff --git a/clang/include/clang/Driver/Multilib.h b/clang/include/clang/Driver/Multilib.h
index dbed70f4f9008f..2d03ac1033b5a8 100644
--- a/clang/include/clang/Driver/Multilib.h
+++ b/clang/include/clang/Driver/Multilib.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_DRIVER_MULTILIB_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -32,7 +33,7 @@ class Driver;
 /// by a command line flag.
 /// See also MultilibBuilder for building a multilib by mutating it
 /// incrementally.
-class Multilib {
+class CLANG_ABI Multilib {
 public:
   using flags_list = std::vector<std::string>;
 
@@ -99,10 +100,10 @@ class Multilib {
   const std::string &getErrorMessage() const { return Error.value(); }
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
 
 /// See also MultilibSetBuilder for combining multilibs into a set.
-class MultilibSet {
+class CLANG_ABI MultilibSet {
 public:
   using multilib_list = std::vector<Multilib>;
   using const_iterator = multilib_list::const_iterator;
@@ -174,7 +175,7 @@ class MultilibSet {
             void *DiagHandlerCtxt = nullptr);
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const MultilibSet &MS);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, const MultilibSet &MS);
 
 } // namespace driver
 } // namespace clang
diff --git a/clang/include/clang/Driver/MultilibBuilder.h b/clang/include/clang/Driver/MultilibBuilder.h
index 61596c5c573f34..350beef9818fac 100644
--- a/clang/include/clang/Driver/MultilibBuilder.h
+++ b/clang/include/clang/Driver/MultilibBuilder.h
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_DRIVER_MULTILIBBUILDER_H
 
 #include "clang/Driver/Multilib.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace driver {
@@ -19,7 +20,7 @@ namespace driver {
 /// by a command line flag. This class can be used to create a Multilib, and
 /// contains helper functions to mutate it before creating a Multilib instance
 /// with makeMultilib().
-class MultilibBuilder {
+class CLANG_ABI MultilibBuilder {
 public:
   using flags_list = std::vector<std::string>;
 
@@ -93,7 +94,7 @@ class MultilibBuilder {
 /// This class can be used to create a MultilibSet, and contains helper
 /// functions to add combinations of multilibs before creating a MultilibSet
 /// instance with makeMultilibSet().
-class MultilibSetBuilder {
+class CLANG_ABI MultilibSetBuilder {
 public:
   using multilib_list = std::vector<MultilibBuilder>;
 
diff --git a/clang/include/clang/Driver/OffloadBundler.h b/clang/include/clang/Driver/OffloadBundler.h
index 57ecbdcb7d040e..3de9bc335ad84c 100644
--- a/clang/include/clang/Driver/OffloadBundler.h
+++ b/clang/include/clang/Driver/OffloadBundler.h
@@ -17,6 +17,7 @@
 #ifndef LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
 #define LLVM_CLANG_DRIVER_OFFLOADBUNDLER_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Compression.h"
 #include "llvm/Support/Error.h"
 #include "llvm/TargetParser/Triple.h"
@@ -26,7 +27,7 @@
 
 namespace clang {
 
-class OffloadBundlerConfig {
+class CLANG_ABI OffloadBundlerConfig {
 public:
   OffloadBundlerConfig();
 
@@ -52,7 +53,7 @@ class OffloadBundlerConfig {
   std::vector<std::string> OutputFileNames;
 };
 
-class OffloadBundler {
+class CLANG_ABI OffloadBundler {
 public:
   const OffloadBundlerConfig &BundlerConfig;
 
@@ -75,7 +76,7 @@ class OffloadBundler {
 ///  * Offload Kind - Host, OpenMP, or HIP
 ///  * Triple - Standard LLVM Triple
 ///  * TargetID (Optional) - target ID, like gfx906:xnack+ or sm_30
-struct OffloadTargetInfo {
+struct CLANG_ABI OffloadTargetInfo {
   llvm::StringRef OffloadKind;
   llvm::Triple Triple;
   llvm::StringRef TargetID;
@@ -105,7 +106,7 @@ struct OffloadTargetInfo {
 // - Truncated MD5 Hash (8 bytes).
 // - Compressed Data (variable length).
 
-class CompressedOffloadBundle {
+class CLANG_ABI CompressedOffloadBundle {
 private:
   static inline const size_t MagicSize = 4;
   static inline const size_t VersionFieldSize = sizeof(uint16_t);
diff --git a/clang/include/clang/Driver/OptionUtils.h b/clang/include/clang/Driver/OptionUtils.h
index 922f536bf33eac..fee2bbacd3d564 100644
--- a/clang/include/clang/Driver/OptionUtils.h
+++ b/clang/include/clang/Driver/OptionUtils.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Option/OptSpecifier.h"
 
 namespace llvm {
@@ -30,7 +31,7 @@ class ArgList;
 namespace clang {
 /// Return the value of the last argument as an integer, or a default. If Diags
 /// is non-null, emits an error if the argument is given, but non-integral.
-int getLastArgIntValue(const llvm::opt::ArgList &Args,
+CLANG_ABI int getLastArgIntValue(const llvm::opt::ArgList &Args,
                        llvm::opt::OptSpecifier Id, int Default,
                        DiagnosticsEngine *Diags = nullptr, unsigned Base = 0);
 
@@ -40,7 +41,7 @@ inline int getLastArgIntValue(const llvm::opt::ArgList &Args,
   return getLastArgIntValue(Args, Id, Default, &Diags, Base);
 }
 
-uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
+CLANG_ABI uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
                                llvm::opt::OptSpecifier Id, uint64_t Default,
                                DiagnosticsEngine *Diags = nullptr,
                                unsigned Base = 0);
diff --git a/clang/include/clang/Driver/Options.h b/clang/include/clang/Driver/Options.h
index 0797410e9940e2..77f92dd9055f04 100644
--- a/clang/include/clang/Driver/Options.h
+++ b/clang/include/clang/Driver/Options.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_DRIVER_OPTIONS_H
 #define LLVM_CLANG_DRIVER_OPTIONS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Option/OptTable.h"
 #include "llvm/Option/Option.h"
 
@@ -50,7 +51,7 @@ enum ID {
   };
 }
 
-const llvm::opt::OptTable &getDriverOptTable();
+CLANG_ABI const llvm::opt::OptTable &getDriverOptTable();
 }
 }
 
diff --git a/clang/include/clang/Driver/Phases.h b/clang/include/clang/Driver/Phases.h
index 9003c585735133..8d7cf2d866989c 100644
--- a/clang/include/clang/Driver/Phases.h
+++ b/clang/include/clang/Driver/Phases.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_DRIVER_PHASES_H
 #define LLVM_CLANG_DRIVER_PHASES_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
 namespace driver {
 namespace phases {
@@ -28,7 +29,7 @@ namespace phases {
     MaxNumberOfPhases = IfsMerge + 1
   };
 
-  const char *getPhaseName(ID Id);
+  CLANG_ABI const char *getPhaseName(ID Id);
 
 } // end namespace phases
 } // end namespace driver
diff --git a/clang/include/clang/Driver/SanitizerArgs.h b/clang/include/clang/Driver/SanitizerArgs.h
index 0c6f3869549ef7..15bdae071f6d66 100644
--- a/clang/include/clang/Driver/SanitizerArgs.h
+++ b/clang/include/clang/Driver/SanitizerArgs.h
@@ -10,6 +10,7 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Driver/Types.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
@@ -21,7 +22,7 @@ namespace driver {
 
 class ToolChain;
 
-class SanitizerArgs {
+class CLANG_ABI SanitizerArgs {
   SanitizerSet Sanitizers;
   SanitizerSet RecoverableSanitizers;
   SanitizerSet TrapSanitizers;
diff --git a/clang/include/clang/Driver/Tool.h b/clang/include/clang/Driver/Tool.h
index 42cf99a4a9703d..d02fbc5962e748 100644
--- a/clang/include/clang/Driver/Tool.h
+++ b/clang/include/clang/Driver/Tool.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_DRIVER_TOOL_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 
 namespace llvm {
 namespace opt {
@@ -29,7 +30,7 @@ namespace driver {
   typedef SmallVector<InputInfo, 4> InputInfoList;
 
 /// Tool - Information on a specific compilation tool.
-class Tool {
+class CLANG_ABI Tool {
   /// The tool name (for debugging).
   const char *Name;
 
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index 5347e29be91439..ca68e78a45f986 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -15,6 +15,7 @@
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Multilib.h"
 #include "clang/Driver/Types.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FloatingPointMode.h"
@@ -89,7 +90,7 @@ struct ParsedClangName {
 };
 
 /// ToolChain - Access to tools for a single platform.
-class ToolChain {
+class CLANG_ABI ToolChain {
 public:
   using path_list = SmallVector<std::string, 16>;
 
diff --git a/clang/include/clang/Driver/Types.h b/clang/include/clang/Driver/Types.h
index 121b58a6b477d9..cb9f1e2f353b6e 100644
--- a/clang/include/clang/Driver/Types.h
+++ b/clang/include/clang/Driver/Types.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_DRIVER_TYPES_H
 
 #include "clang/Driver/Phases.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Option/ArgList.h"
 
@@ -29,45 +30,45 @@ namespace types {
   };
 
   /// getTypeName - Return the name of the type for \p Id.
-  const char *getTypeName(ID Id);
+  CLANG_ABI const char *getTypeName(ID Id);
 
   /// getPreprocessedType - Get the ID of the type for this input when
   /// it has been preprocessed, or INVALID if this input is not
   /// preprocessed.
-  ID getPreprocessedType(ID Id);
+  CLANG_ABI ID getPreprocessedType(ID Id);
 
   /// getPrecompiledType - Get the ID of the type for this input when
   /// it has been precompiled, or INVALID if this input is not
   /// precompiled.
-  ID getPrecompiledType(ID Id);
+  CLANG_ABI ID getPrecompiledType(ID Id);
 
   /// getTypeTempSuffix - Return the suffix to use when creating a
   /// temp file of this type, or null if unspecified.
-  const char *getTypeTempSuffix(ID Id, bool CLStyle = false);
+  CLANG_ABI const char *getTypeTempSuffix(ID Id, bool CLStyle = false);
 
   /// onlyPrecompileType - Should this type only be precompiled.
-  bool onlyPrecompileType(ID Id);
+  CLANG_ABI bool onlyPrecompileType(ID Id);
 
   /// canTypeBeUserSpecified - Can this type be specified on the
   /// command line (by the type name); this is used when forwarding
   /// commands to gcc.
-  bool canTypeBeUserSpecified(ID Id);
+  CLANG_ABI bool canTypeBeUserSpecified(ID Id);
 
   /// appendSuffixForType - When generating outputs of this type,
   /// should the suffix be appended (instead of replacing the existing
   /// suffix).
-  bool appendSuffixForType(ID Id);
+  CLANG_ABI bool appendSuffixForType(ID Id);
 
   /// canLipoType - Is this type acceptable as the output of a
   /// universal build (currently, just the Nothing, Image, and Object
   /// types).
-  bool canLipoType(ID Id);
+  CLANG_ABI bool canLipoType(ID Id);
 
   /// isAcceptedByClang - Can clang handle this input type.
-  bool isAcceptedByClang(ID Id);
+  CLANG_ABI bool isAcceptedByClang(ID Id);
 
   /// isAcceptedByFlang - Can flang handle this input type.
-  bool isAcceptedByFlang(ID Id);
+  CLANG_ABI bool isAcceptedByFlang(ID Id);
 
   /// isDerivedFromC - Is the input derived from C.
   ///
@@ -75,57 +76,57 @@ namespace types {
   /// TokenConcatenation::AvoidConcat. If this is the case, the preprocessor may
   /// add and remove whitespace between tokens. Used to determine whether the
   /// input can be processed by -fminimize-whitespace.
-  bool isDerivedFromC(ID Id);
+  CLANG_ABI bool isDerivedFromC(ID Id);
 
   /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
-  bool isCXX(ID Id);
+  CLANG_ABI bool isCXX(ID Id);
 
   /// Is this LLVM IR.
-  bool isLLVMIR(ID Id);
+  CLANG_ABI bool isLLVMIR(ID Id);
 
   /// isCuda - Is this a CUDA input.
-  bool isCuda(ID Id);
+  CLANG_ABI bool isCuda(ID Id);
 
   /// isHIP - Is this a HIP input.
-  bool isHIP(ID Id);
+  CLANG_ABI bool isHIP(ID Id);
 
   /// isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers).
-  bool isObjC(ID Id);
+  CLANG_ABI bool isObjC(ID Id);
 
   /// isOpenCL - Is this an "OpenCL" input.
-  bool isOpenCL(ID Id);
+  CLANG_ABI bool isOpenCL(ID Id);
 
   /// isHLSL - Is this an HLSL input.
-  bool isHLSL(ID Id);
+  CLANG_ABI bool isHLSL(ID Id);
 
   /// isSrcFile - Is this a source file, i.e. something that still has to be
   /// preprocessed. The logic behind this is the same that decides if the first
   /// compilation phase is a preprocessing one.
-  bool isSrcFile(ID Id);
+  CLANG_ABI bool isSrcFile(ID Id);
 
   /// lookupTypeForExtension - Lookup the type to use for the file
   /// extension \p Ext.
-  ID lookupTypeForExtension(llvm::StringRef Ext);
+  CLANG_ABI ID lookupTypeForExtension(llvm::StringRef Ext);
 
   /// lookupTypeForTypSpecifier - Lookup the type to use for a user
   /// specified type name.
-  ID lookupTypeForTypeSpecifier(const char *Name);
+  CLANG_ABI ID lookupTypeForTypeSpecifier(const char *Name);
 
   /// getCompilationPhases - Get the list of compilation phases ('Phases') to be
   /// done for type 'Id' up until including LastPhase.
-  llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases>
+  CLANG_ABI llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases>
   getCompilationPhases(ID Id, phases::ID LastPhase = phases::IfsMerge);
-  llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases>
+  CLANG_ABI llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases>
   getCompilationPhases(const clang::driver::Driver &Driver,
                        llvm::opt::DerivedArgList &DAL, ID Id);
 
   /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given
   /// C type (used for clang++ emulation of g++ behaviour)
-  ID lookupCXXTypeForCType(ID Id);
+  CLANG_ABI ID lookupCXXTypeForCType(ID Id);
 
   /// Lookup header file input type that corresponds to given
   /// source file type (used for clang-cl emulation of \Yc).
-  ID lookupHeaderTypeForSourceType(ID Id);
+  CLANG_ABI ID lookupHeaderTypeForSourceType(ID Id);
 
 } // end namespace types
 } // end namespace driver
diff --git a/clang/include/clang/Driver/XRayArgs.h b/clang/include/clang/Driver/XRayArgs.h
index bdd3d979547eed..c3a0602673a2fb 100644
--- a/clang/include/clang/Driver/XRayArgs.h
+++ b/clang/include/clang/Driver/XRayArgs.h
@@ -10,6 +10,7 @@
 
 #include "clang/Basic/XRayInstr.h"
 #include "clang/Driver/Types.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 
@@ -18,7 +19,7 @@ namespace driver {
 
 class ToolChain;
 
-class XRayArgs {
+class CLANG_ABI XRayArgs {
   std::vector<std::string> AlwaysInstrumentFiles;
   std::vector<std::string> NeverInstrumentFiles;
   std::vector<std::string> AttrListFiles;
diff --git a/clang/include/clang/Edit/Commit.h b/clang/include/clang/Edit/Commit.h
index f6c7988e28ee1a..590df1ff7c69df 100644
--- a/clang/include/clang/Edit/Commit.h
+++ b/clang/include/clang/Edit/Commit.h
@@ -12,6 +12,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Edit/FileOffset.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Allocator.h"
@@ -26,7 +27,7 @@ namespace edit {
 
 class EditedSource;
 
-class Commit {
+class CLANG_ABI Commit {
 public:
   enum EditKind {
     Act_Insert,
@@ -34,7 +35,7 @@ class Commit {
     Act_Remove
   };
 
-  struct Edit {
+  struct CLANG_ABI Edit {
     EditKind Kind;
     StringRef Text;
     SourceLocation OrigLoc;
diff --git a/clang/include/clang/Edit/EditedSource.h b/clang/include/clang/Edit/EditedSource.h
index ab76b0d719b05c..72eb788a230e59 100644
--- a/clang/include/clang/Edit/EditedSource.h
+++ b/clang/include/clang/Edit/EditedSource.h
@@ -13,6 +13,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Edit/FileOffset.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -32,7 +33,7 @@ namespace edit {
 class Commit;
 class EditsReceiver;
 
-class EditedSource {
+class CLANG_ABI EditedSource {
   const SourceManager &SourceMgr;
   const LangOptions &LangOpts;
   const PPConditionalDirectiveRecord *PPRec;
diff --git a/clang/include/clang/Edit/EditsReceiver.h b/clang/include/clang/Edit/EditsReceiver.h
index 75e731640047ed..74e1dbc2d63106 100644
--- a/clang/include/clang/Edit/EditsReceiver.h
+++ b/clang/include/clang/Edit/EditsReceiver.h
@@ -11,12 +11,13 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace edit {
 
-class EditsReceiver {
+class CLANG_ABI EditsReceiver {
 public:
   virtual ~EditsReceiver() = default;
 
diff --git a/clang/include/clang/Edit/Rewriters.h b/clang/include/clang/Edit/Rewriters.h
index 210f9a898423e9..0df8e5d17a1217 100644
--- a/clang/include/clang/Edit/Rewriters.h
+++ b/clang/include/clang/Edit/Rewriters.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_EDIT_REWRITERS_H
 #define LLVM_CLANG_EDIT_REWRITERS_H
 
+#include "clang/Support/Compiler.h"
 namespace clang {
   class ObjCMessageExpr;
   class ObjCMethodDecl;
@@ -22,14 +23,14 @@ namespace clang {
 namespace edit {
   class Commit;
 
-bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg,
+CLANG_ABI bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg,
                                          const NSAPI &NS, Commit &commit);
 
-bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
+CLANG_ABI bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
                                 const NSAPI &NS, Commit &commit,
                                 const ParentMap *PMap);
 
-bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
+CLANG_ABI bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
                                   const NSAPI &NS, Commit &commit);
 
 }
diff --git a/clang/include/clang/ExtractAPI/API.h b/clang/include/clang/ExtractAPI/API.h
index 4f34fcc575e807..5af563d7ed77fb 100644
--- a/clang/include/clang/ExtractAPI/API.h
+++ b/clang/include/clang/ExtractAPI/API.h
@@ -23,6 +23,7 @@
 #include "clang/AST/RawCommentList.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/ExtractAPI/DeclarationFragments.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
@@ -153,7 +154,7 @@ struct APIRecord;
 
 // This represents a reference to another symbol that might come from external
 /// sources.
-struct SymbolReference {
+struct CLANG_ABI SymbolReference {
   StringRef Name;
   StringRef USR;
 
@@ -181,7 +182,7 @@ class RecordContext;
 // are compatible with `APISet::createRecord`.
 // When adding a new kind of record don't forget to update APIRecords.inc!
 /// The base representation of an API record. Holds common symbol information.
-struct APIRecord {
+struct CLANG_ABI APIRecord {
   /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
   enum RecordKind {
     RK_Unknown,
@@ -302,7 +303,7 @@ struct APIRecord {
 
 /// Base class used for specific record types that have children records this is
 /// analogous to the DeclContext for the AST
-class RecordContext {
+class CLANG_ABI RecordContext {
 public:
   static bool classof(const APIRecord *Record) {
     return classofKind(Record->getKind());
@@ -396,7 +397,7 @@ struct NamespaceRecord : APIRecord, RecordContext {
 };
 
 /// This holds information associated with global functions.
-struct GlobalFunctionRecord : APIRecord {
+struct CLANG_ABI GlobalFunctionRecord : APIRecord {
   FunctionSignature Signature;
 
   GlobalFunctionRecord(StringRef USR, StringRef Name, SymbolReference Parent,
@@ -477,7 +478,7 @@ struct GlobalFunctionTemplateSpecializationRecord : GlobalFunctionRecord {
 };
 
 /// This holds information associated with global functions.
-struct GlobalVariableRecord : APIRecord, RecordContext {
+struct CLANG_ABI GlobalVariableRecord : APIRecord, RecordContext {
   GlobalVariableRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                        PresumedLoc Loc, AvailabilityInfo Availability,
                        LinkageInfo Linkage, const DocComment &Comment,
@@ -579,7 +580,7 @@ struct GlobalVariableTemplatePartialSpecializationRecord
 };
 
 /// This holds information associated with enum constants.
-struct EnumConstantRecord : APIRecord {
+struct CLANG_ABI EnumConstantRecord : APIRecord {
   EnumConstantRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                      PresumedLoc Loc, AvailabilityInfo Availability,
                      const DocComment &Comment,
@@ -598,7 +599,7 @@ struct EnumConstantRecord : APIRecord {
   virtual void anchor();
 };
 
-struct TagRecord : APIRecord, RecordContext {
+struct CLANG_ABI TagRecord : APIRecord, RecordContext {
   TagRecord(RecordKind Kind, StringRef USR, StringRef Name,
             SymbolReference Parent, PresumedLoc Loc,
             AvailabilityInfo Availability, const DocComment &Comment,
@@ -624,7 +625,7 @@ struct TagRecord : APIRecord, RecordContext {
 };
 
 /// This holds information associated with enums.
-struct EnumRecord : TagRecord {
+struct CLANG_ABI EnumRecord : TagRecord {
   EnumRecord(StringRef USR, StringRef Name, SymbolReference Parent,
              PresumedLoc Loc, AvailabilityInfo Availability,
              const DocComment &Comment, DeclarationFragments Declaration,
@@ -646,7 +647,7 @@ struct EnumRecord : TagRecord {
 };
 
 /// This holds information associated with struct or union fields fields.
-struct RecordFieldRecord : APIRecord, RecordContext {
+struct CLANG_ABI RecordFieldRecord : APIRecord, RecordContext {
   RecordFieldRecord(RecordKind Kind, StringRef USR, StringRef Name,
                     SymbolReference Parent, PresumedLoc Loc,
                     AvailabilityInfo Availability, const DocComment &Comment,
@@ -668,7 +669,7 @@ struct RecordFieldRecord : APIRecord, RecordContext {
 };
 
 /// This holds information associated with structs and unions.
-struct RecordRecord : TagRecord {
+struct CLANG_ABI RecordRecord : TagRecord {
   RecordRecord(RecordKind Kind, StringRef USR, StringRef Name,
                SymbolReference Parent, PresumedLoc Loc,
                AvailabilityInfo Availability, const DocComment &Comment,
@@ -692,7 +693,7 @@ struct RecordRecord : TagRecord {
   virtual ~RecordRecord() = 0;
 };
 
-struct StructFieldRecord : RecordFieldRecord {
+struct CLANG_ABI StructFieldRecord : RecordFieldRecord {
   StructFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                     PresumedLoc Loc, AvailabilityInfo Availability,
                     const DocComment &Comment, DeclarationFragments Declaration,
@@ -710,7 +711,7 @@ struct StructFieldRecord : RecordFieldRecord {
   virtual void anchor();
 };
 
-struct StructRecord : RecordRecord {
+struct CLANG_ABI StructRecord : RecordRecord {
   StructRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                PresumedLoc Loc, AvailabilityInfo Availability,
                const DocComment &Comment, DeclarationFragments Declaration,
@@ -729,7 +730,7 @@ struct StructRecord : RecordRecord {
   virtual void anchor();
 };
 
-struct UnionFieldRecord : RecordFieldRecord {
+struct CLANG_ABI UnionFieldRecord : RecordFieldRecord {
   UnionFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                    PresumedLoc Loc, AvailabilityInfo Availability,
                    const DocComment &Comment, DeclarationFragments Declaration,
@@ -747,7 +748,7 @@ struct UnionFieldRecord : RecordFieldRecord {
   virtual void anchor();
 };
 
-struct UnionRecord : RecordRecord {
+struct CLANG_ABI UnionRecord : RecordRecord {
   UnionRecord(StringRef USR, StringRef Name, SymbolReference Parent,
               PresumedLoc Loc, AvailabilityInfo Availability,
               const DocComment &Comment, DeclarationFragments Declaration,
@@ -766,7 +767,7 @@ struct UnionRecord : RecordRecord {
   virtual void anchor();
 };
 
-struct CXXFieldRecord : APIRecord, RecordContext {
+struct CLANG_ABI CXXFieldRecord : APIRecord, RecordContext {
   CXXFieldRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                  PresumedLoc Loc, AvailabilityInfo Availability,
                  const DocComment &Comment, DeclarationFragments Declaration,
@@ -819,7 +820,7 @@ struct CXXFieldTemplateRecord : CXXFieldRecord {
   static bool classofKind(RecordKind K) { return K == RK_CXXFieldTemplate; }
 };
 
-struct CXXMethodRecord : APIRecord {
+struct CLANG_ABI CXXMethodRecord : APIRecord {
   FunctionSignature Signature;
 
   CXXMethodRecord() = delete;
@@ -838,7 +839,7 @@ struct CXXMethodRecord : APIRecord {
   virtual ~CXXMethodRecord() = 0;
 };
 
-struct CXXConstructorRecord : CXXMethodRecord {
+struct CLANG_ABI CXXConstructorRecord : CXXMethodRecord {
   CXXConstructorRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                        PresumedLoc Loc, AvailabilityInfo Availability,
                        const DocComment &Comment,
@@ -859,7 +860,7 @@ struct CXXConstructorRecord : CXXMethodRecord {
   virtual void anchor();
 };
 
-struct CXXDestructorRecord : CXXMethodRecord {
+struct CLANG_ABI CXXDestructorRecord : CXXMethodRecord {
   CXXDestructorRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                       PresumedLoc Loc, AvailabilityInfo Availability,
                       const DocComment &Comment,
@@ -880,7 +881,7 @@ struct CXXDestructorRecord : CXXMethodRecord {
   virtual void anchor();
 };
 
-struct CXXStaticMethodRecord : CXXMethodRecord {
+struct CLANG_ABI CXXStaticMethodRecord : CXXMethodRecord {
   CXXStaticMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                         PresumedLoc Loc, AvailabilityInfo Availability,
                         const DocComment &Comment,
@@ -901,7 +902,7 @@ struct CXXStaticMethodRecord : CXXMethodRecord {
   virtual void anchor();
 };
 
-struct CXXInstanceMethodRecord : CXXMethodRecord {
+struct CLANG_ABI CXXInstanceMethodRecord : CXXMethodRecord {
   CXXInstanceMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                           PresumedLoc Loc, AvailabilityInfo Availability,
                           const DocComment &Comment,
@@ -966,7 +967,7 @@ struct CXXMethodTemplateSpecializationRecord : CXXMethodRecord {
 };
 
 /// This holds information associated with Objective-C properties.
-struct ObjCPropertyRecord : APIRecord {
+struct CLANG_ABI ObjCPropertyRecord : APIRecord {
   /// The attributes associated with an Objective-C property.
   enum AttributeKind : unsigned {
     NoAttr = 0,
@@ -998,7 +999,7 @@ struct ObjCPropertyRecord : APIRecord {
   virtual ~ObjCPropertyRecord() = 0;
 };
 
-struct ObjCInstancePropertyRecord : ObjCPropertyRecord {
+struct CLANG_ABI ObjCInstancePropertyRecord : ObjCPropertyRecord {
   ObjCInstancePropertyRecord(
       StringRef USR, StringRef Name, SymbolReference Parent, PresumedLoc Loc,
       AvailabilityInfo Availability, const DocComment &Comment,
@@ -1019,7 +1020,7 @@ struct ObjCInstancePropertyRecord : ObjCPropertyRecord {
   virtual void anchor();
 };
 
-struct ObjCClassPropertyRecord : ObjCPropertyRecord {
+struct CLANG_ABI ObjCClassPropertyRecord : ObjCPropertyRecord {
   ObjCClassPropertyRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                           PresumedLoc Loc, AvailabilityInfo Availability,
                           const DocComment &Comment,
@@ -1043,7 +1044,7 @@ struct ObjCClassPropertyRecord : ObjCPropertyRecord {
 };
 
 /// This holds information associated with Objective-C instance variables.
-struct ObjCInstanceVariableRecord : APIRecord {
+struct CLANG_ABI ObjCInstanceVariableRecord : APIRecord {
   ObjCInstanceVariableRecord(StringRef USR, StringRef Name,
                              SymbolReference Parent, PresumedLoc Loc,
                              AvailabilityInfo Availability,
@@ -1065,7 +1066,7 @@ struct ObjCInstanceVariableRecord : APIRecord {
 };
 
 /// This holds information associated with Objective-C methods.
-struct ObjCMethodRecord : APIRecord {
+struct CLANG_ABI ObjCMethodRecord : APIRecord {
   FunctionSignature Signature;
 
   ObjCMethodRecord() = delete;
@@ -1084,7 +1085,7 @@ struct ObjCMethodRecord : APIRecord {
   virtual ~ObjCMethodRecord() = 0;
 };
 
-struct ObjCInstanceMethodRecord : ObjCMethodRecord {
+struct CLANG_ABI ObjCInstanceMethodRecord : ObjCMethodRecord {
   ObjCInstanceMethodRecord(StringRef USR, StringRef Name,
                            SymbolReference Parent, PresumedLoc Loc,
                            AvailabilityInfo Availability,
@@ -1104,7 +1105,7 @@ struct ObjCInstanceMethodRecord : ObjCMethodRecord {
   virtual void anchor();
 };
 
-struct ObjCClassMethodRecord : ObjCMethodRecord {
+struct CLANG_ABI ObjCClassMethodRecord : ObjCMethodRecord {
   ObjCClassMethodRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                         PresumedLoc Loc, AvailabilityInfo Availability,
                         const DocComment &Comment,
@@ -1143,7 +1144,7 @@ struct StaticFieldRecord : CXXFieldRecord {
 
 /// The base representation of an Objective-C container record. Holds common
 /// information associated with Objective-C containers.
-struct ObjCContainerRecord : APIRecord, RecordContext {
+struct CLANG_ABI ObjCContainerRecord : APIRecord, RecordContext {
   SmallVector<SymbolReference> Protocols;
 
   ObjCContainerRecord() = delete;
@@ -1162,7 +1163,7 @@ struct ObjCContainerRecord : APIRecord, RecordContext {
   virtual ~ObjCContainerRecord() = 0;
 };
 
-struct CXXClassRecord : RecordRecord {
+struct CLANG_ABI CXXClassRecord : RecordRecord {
   SmallVector<SymbolReference> Bases;
 
   CXXClassRecord(StringRef USR, StringRef Name, SymbolReference Parent,
@@ -1267,7 +1268,7 @@ struct ConceptRecord : APIRecord {
 };
 
 /// This holds information associated with Objective-C categories.
-struct ObjCCategoryRecord : ObjCContainerRecord {
+struct CLANG_ABI ObjCCategoryRecord : ObjCContainerRecord {
   SymbolReference Interface;
 
   ObjCCategoryRecord(StringRef USR, StringRef Name, SymbolReference Parent,
@@ -1300,7 +1301,7 @@ struct ObjCCategoryRecord : ObjCContainerRecord {
 };
 
 /// This holds information associated with Objective-C interfaces/classes.
-struct ObjCInterfaceRecord : ObjCContainerRecord {
+struct CLANG_ABI ObjCInterfaceRecord : ObjCContainerRecord {
   SymbolReference SuperClass;
 
   ObjCInterfaceRecord(StringRef USR, StringRef Name, SymbolReference Parent,
@@ -1324,7 +1325,7 @@ struct ObjCInterfaceRecord : ObjCContainerRecord {
 };
 
 /// This holds information associated with Objective-C protocols.
-struct ObjCProtocolRecord : ObjCContainerRecord {
+struct CLANG_ABI ObjCProtocolRecord : ObjCContainerRecord {
   ObjCProtocolRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                      PresumedLoc Loc, AvailabilityInfo Availability,
                      const DocComment &Comment,
@@ -1345,7 +1346,7 @@ struct ObjCProtocolRecord : ObjCContainerRecord {
 };
 
 /// This holds information associated with macro definitions.
-struct MacroDefinitionRecord : APIRecord {
+struct CLANG_ABI MacroDefinitionRecord : APIRecord {
   MacroDefinitionRecord(StringRef USR, StringRef Name, SymbolReference Parent,
                         PresumedLoc Loc, DeclarationFragments Declaration,
                         DeclarationFragments SubHeading,
@@ -1368,7 +1369,7 @@ struct MacroDefinitionRecord : APIRecord {
 /// Note: Typedefs for anonymous enums and structs typically don't get emitted
 /// by the serializers but still get a TypedefRecord. Instead we use the
 /// typedef name as a name for the underlying anonymous struct or enum.
-struct TypedefRecord : APIRecord {
+struct CLANG_ABI TypedefRecord : APIRecord {
   SymbolReference UnderlyingType;
 
   TypedefRecord(StringRef USR, StringRef Name, SymbolReference Parent,
@@ -1391,7 +1392,7 @@ struct TypedefRecord : APIRecord {
 };
 
 /// APISet holds the set of API records collected from given inputs.
-class APISet {
+class CLANG_ABI APISet {
 public:
   /// Get the target triple for the ExtractAPI invocation.
   const llvm::Triple &getTarget() const { return Target; }
diff --git a/clang/include/clang/ExtractAPI/APIIgnoresList.h b/clang/include/clang/ExtractAPI/APIIgnoresList.h
index 3eee8e336cb63f..5a2d295dae1b8c 100644
--- a/clang/include/clang/ExtractAPI/APIIgnoresList.h
+++ b/clang/include/clang/ExtractAPI/APIIgnoresList.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_API_IGNORES_LIST_H
 
 #include "clang/Basic/FileManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
@@ -30,7 +31,7 @@ class MemoryBuffer;
 namespace clang {
 namespace extractapi {
 
-struct IgnoresFileNotFound : public llvm::ErrorInfo<IgnoresFileNotFound> {
+struct CLANG_ABI IgnoresFileNotFound : public llvm::ErrorInfo<IgnoresFileNotFound> {
   std::string Path;
   static char ID;
 
@@ -43,7 +44,7 @@ struct IgnoresFileNotFound : public llvm::ErrorInfo<IgnoresFileNotFound> {
 
 /// A type that provides access to a new line separated list of symbol names to
 /// ignore when extracting API information.
-struct APIIgnoresList {
+struct CLANG_ABI APIIgnoresList {
   using FilePathList = std::vector<std::string>;
 
   /// The API to use for generating from the files at \p IgnoresFilePathList.
diff --git a/clang/include/clang/ExtractAPI/DeclarationFragments.h b/clang/include/clang/ExtractAPI/DeclarationFragments.h
index 4ac744459031eb..fc2d8151a6839e 100644
--- a/clang/include/clang/ExtractAPI/DeclarationFragments.h
+++ b/clang/include/clang/ExtractAPI/DeclarationFragments.h
@@ -27,6 +27,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Support/Compiler.h"
 #include <iterator>
 #include <utility>
 #include <vector>
@@ -45,7 +46,7 @@ namespace extractapi {
 ///   int   -> type       "int"
 ///   pi;   -> identifier "pi"
 /// \endcode
-class DeclarationFragments {
+class CLANG_ABI DeclarationFragments {
 public:
   DeclarationFragments() = default;
 
@@ -291,7 +292,7 @@ class FunctionSignature {
 };
 
 /// A factory class to build DeclarationFragments for different kinds of Decl.
-class DeclarationFragmentsBuilder {
+class CLANG_ABI DeclarationFragmentsBuilder {
 public:
   /// Build FunctionSignature for a function-like declaration \c FunctionT like
   /// FunctionDecl, ObjCMethodDecl, or CXXMethodDecl.
diff --git a/clang/include/clang/ExtractAPI/ExtractAPIActionBase.h b/clang/include/clang/ExtractAPI/ExtractAPIActionBase.h
index 08210a7ee05954..2e84857dd4c058 100644
--- a/clang/include/clang/ExtractAPI/ExtractAPIActionBase.h
+++ b/clang/include/clang/ExtractAPI/ExtractAPIActionBase.h
@@ -18,6 +18,7 @@
 #include "clang/ExtractAPI/API.h"
 #include "clang/ExtractAPI/APIIgnoresList.h"
 #include "clang/Frontend/CompilerInstance.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ namespace clang {
 ///
 /// Deriving from this class equips an action with all the necessary tools to
 /// generate ExractAPI information in form of symbol-graphs
-class ExtractAPIActionBase {
+class CLANG_ABI ExtractAPIActionBase {
 protected:
   /// A representation of the APIs this action extracts.
   std::unique_ptr<extractapi::APISet> API;
diff --git a/clang/include/clang/ExtractAPI/FrontendActions.h b/clang/include/clang/ExtractAPI/FrontendActions.h
index 08045a30823db8..355569c7d82efb 100644
--- a/clang/include/clang/ExtractAPI/FrontendActions.h
+++ b/clang/include/clang/ExtractAPI/FrontendActions.h
@@ -17,11 +17,12 @@
 
 #include "clang/ExtractAPI/ExtractAPIActionBase.h"
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 /// ExtractAPIAction sets up the output file and creates the ExtractAPIVisitor.
-class ExtractAPIAction : public ASTFrontendAction,
+class CLANG_ABI ExtractAPIAction : public ASTFrontendAction,
                          private ExtractAPIActionBase {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
@@ -56,7 +57,7 @@ class ExtractAPIAction : public ASTFrontendAction,
 /// Used when the ExtractAPI action needs to be executed as a side effect of a
 /// regular compilation job. Unlike ExtarctAPIAction, this is meant to be used
 /// on regular source files ( .m , .c files) instead of header files
-class WrappingExtractAPIAction : public WrapperFrontendAction,
+class CLANG_ABI WrappingExtractAPIAction : public WrapperFrontendAction,
                                  private ExtractAPIActionBase {
 public:
   WrappingExtractAPIAction(std::unique_ptr<FrontendAction> WrappedAction)
diff --git a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
index f8759bf2d8f25a..2c731728824d82 100644
--- a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
+++ b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
@@ -20,6 +20,7 @@
 #include "clang/ExtractAPI/API.h"
 #include "clang/ExtractAPI/APIIgnoresList.h"
 #include "clang/ExtractAPI/Serialization/APISetVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
@@ -45,7 +46,7 @@ struct SymbolGraphSerializerOption {
 };
 
 /// A representation of the contents of a given module symbol graph
-struct ExtendedModule {
+struct CLANG_ABI ExtendedModule {
   ExtendedModule() = default;
   ExtendedModule(ExtendedModule &&EM) = default;
   ExtendedModule &operator=(ExtendedModule &&EM) = default;
@@ -71,7 +72,7 @@ struct ExtendedModule {
 /// The Symbol Graph format (https://github.com/apple/swift-docc-symbolkit)
 /// models an API set as a directed graph, where nodes are symbol declarations,
 /// and edges are relationships between the connected symbols.
-class SymbolGraphSerializer : public APISetVisitor<SymbolGraphSerializer> {
+class CLANG_ABI SymbolGraphSerializer : public APISetVisitor<SymbolGraphSerializer> {
 private:
   using Base = APISetVisitor<SymbolGraphSerializer>;
   /// The main symbol graph that contains symbols that are either top-level or a
diff --git a/clang/include/clang/ExtractAPI/TypedefUnderlyingTypeResolver.h b/clang/include/clang/ExtractAPI/TypedefUnderlyingTypeResolver.h
index 54aa11c354c0b8..4a2064d4e539e5 100644
--- a/clang/include/clang/ExtractAPI/TypedefUnderlyingTypeResolver.h
+++ b/clang/include/clang/ExtractAPI/TypedefUnderlyingTypeResolver.h
@@ -19,13 +19,14 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/ExtractAPI/API.h"
+#include "clang/Support/Compiler.h"
 
 #include <string>
 
 namespace clang {
 namespace extractapi {
 
-struct TypedefUnderlyingTypeResolver {
+struct CLANG_ABI TypedefUnderlyingTypeResolver {
   /// Gets the underlying type declaration.
   const NamedDecl *getUnderlyingTypeDecl(QualType Type) const;
 
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index a0762b088b68ef..43e303c60c3644 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_FORMAT_FORMAT_H
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Inclusions/IncludeStyle.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -42,17 +43,17 @@ enum class ParseError {
   MissingQualifierType,
   MissingQualifierOrder
 };
-class ParseErrorCategory final : public std::error_category {
+class CLANG_ABI ParseErrorCategory final : public std::error_category {
 public:
   const char *name() const noexcept override;
   std::string message(int EV) const override;
 };
-const std::error_category &getParseCategory();
-std::error_code make_error_code(ParseError e);
+CLANG_ABI const std::error_category &getParseCategory();
+CLANG_ABI std::error_code make_error_code(ParseError e);
 
 /// The ``FormatStyle`` is used to configure the formatting to follow
 /// specific guidelines.
-struct FormatStyle {
+struct CLANG_ABI FormatStyle {
   // If the BasedOn: was InheritParentConfig and this style needs the file from
   // the parent directories. It is not part of the actual style for formatting.
   // Thus the // instead of ///.
@@ -5291,7 +5292,7 @@ struct FormatStyle {
   //
   // The memory management and ownership reminds of a birds nest: chicks
   // leaving the nest take photos of the nest with them.
-  struct FormatStyleSet {
+  struct CLANG_ABI FormatStyleSet {
     typedef std::map<FormatStyle::LanguageKind, FormatStyle> MapType;
 
     std::optional<FormatStyle> Get(FormatStyle::LanguageKind Language) const;
@@ -5317,7 +5318,7 @@ struct FormatStyle {
 private:
   FormatStyleSet StyleSet;
 
-  friend std::error_code
+  friend CLANG_ABI std::error_code
   parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
                      bool AllowUnknownOptions,
                      llvm::SourceMgr::DiagHandlerTy DiagHandler,
@@ -5326,39 +5327,39 @@ struct FormatStyle {
 
 /// Returns a format style complying with the LLVM coding standards:
 /// http://llvm.org/docs/CodingStandards.html.
-FormatStyle getLLVMStyle(
+CLANG_ABI FormatStyle getLLVMStyle(
     FormatStyle::LanguageKind Language = FormatStyle::LanguageKind::LK_Cpp);
 
 /// Returns a format style complying with one of Google's style guides:
 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml.
 /// http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml.
 /// https://developers.google.com/protocol-buffers/docs/style.
-FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language);
+CLANG_ABI FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language);
 
 /// Returns a format style complying with Chromium's style guide:
 /// http://www.chromium.org/developers/coding-style.
-FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language);
+CLANG_ABI FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language);
 
 /// Returns a format style complying with Mozilla's style guide:
 /// https://firefox-source-docs.mozilla.org/code-quality/coding-style/index.html.
-FormatStyle getMozillaStyle();
+CLANG_ABI FormatStyle getMozillaStyle();
 
 /// Returns a format style complying with Webkit's style guide:
 /// http://www.webkit.org/coding/coding-style.html
-FormatStyle getWebKitStyle();
+CLANG_ABI FormatStyle getWebKitStyle();
 
 /// Returns a format style complying with GNU Coding Standards:
 /// http://www.gnu.org/prep/standards/standards.html
-FormatStyle getGNUStyle();
+CLANG_ABI FormatStyle getGNUStyle();
 
 /// Returns a format style complying with Microsoft style guide:
 /// https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
-FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language);
+CLANG_ABI FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language);
 
-FormatStyle getClangFormatStyle();
+CLANG_ABI FormatStyle getClangFormatStyle();
 
 /// Returns style indicating formatting should be not applied at all.
-FormatStyle getNoStyle();
+CLANG_ABI FormatStyle getNoStyle();
 
 /// Gets a predefined style for the specified language by name.
 ///
@@ -5366,7 +5367,7 @@ FormatStyle getNoStyle();
 /// compared case-insensitively.
 ///
 /// Returns ``true`` if the Style has been set.
-bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
+CLANG_ABI bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
                         FormatStyle *Style);
 
 /// Parse configuration from YAML-formatted text.
@@ -5383,7 +5384,7 @@ bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language,
 /// format options are occurred.
 ///
 /// If set all diagnostics are emitted through the DiagHandler.
-std::error_code
+CLANG_ABI std::error_code
 parseConfiguration(llvm::MemoryBufferRef Config, FormatStyle *Style,
                    bool AllowUnknownOptions = false,
                    llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr,
@@ -5397,11 +5398,11 @@ inline std::error_code parseConfiguration(StringRef Config, FormatStyle *Style,
 }
 
 /// Gets configuration in a YAML string.
-std::string configurationAsText(const FormatStyle &Style);
+CLANG_ABI std::string configurationAsText(const FormatStyle &Style);
 
 /// Returns the replacements necessary to sort all ``#include`` blocks
 /// that are affected by ``Ranges``.
-tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
+CLANG_ABI tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
                                    ArrayRef<tooling::Range> Ranges,
                                    StringRef FileName,
                                    unsigned *Cursor = nullptr);
@@ -5409,7 +5410,7 @@ tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
 /// Returns the replacements corresponding to applying and formatting
 /// \p Replaces on success; otheriwse, return an llvm::Error carrying
 /// llvm::StringError.
-Expected<tooling::Replacements>
+CLANG_ABI Expected<tooling::Replacements>
 formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
                    const FormatStyle &Style);
 
@@ -5426,7 +5427,7 @@ formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
 /// The include manipulation is done via ``tooling::HeaderInclude``, see its
 /// documentation for more details on how include insertion points are found and
 /// what edits are produced.
-Expected<tooling::Replacements>
+CLANG_ABI Expected<tooling::Replacements>
 cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
                           const FormatStyle &Style);
 
@@ -5453,7 +5454,7 @@ struct FormattingAttemptStatus {
 ///
 /// If ``Status`` is non-null, its value will be populated with the status of
 /// this formatting attempt. See \c FormattingAttemptStatus.
-tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
+CLANG_ABI tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
                                ArrayRef<tooling::Range> Ranges,
                                StringRef FileName = "<stdin>",
                                FormattingAttemptStatus *Status = nullptr);
@@ -5461,7 +5462,7 @@ tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
 /// Same as above, except if ``IncompleteFormat`` is non-null, its value
 /// will be set to true if any of the affected ranges were not formatted due to
 /// a non-recoverable syntax error.
-tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
+CLANG_ABI tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
                                ArrayRef<tooling::Range> Ranges,
                                StringRef FileName, bool *IncompleteFormat);
 
@@ -5469,7 +5470,7 @@ tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
 /// Code.
 ///
 /// Returns the ``Replacements`` that clean up all \p Ranges in \p Code.
-tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
+CLANG_ABI tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
                               ArrayRef<tooling::Range> Ranges,
                               StringRef FileName = "<stdin>");
 
@@ -5477,7 +5478,7 @@ tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code,
 ///
 /// Returns the ``Replacements`` that fix the namespace comments in all
 /// \p Ranges in \p Code.
-tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style,
+CLANG_ABI tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style,
                                               StringRef Code,
                                               ArrayRef<tooling::Range> Ranges,
                                               StringRef FileName = "<stdin>");
@@ -5488,7 +5489,7 @@ tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style,
 ///
 /// Returns the ``Replacements`` that inserts or removes empty lines separating
 /// definition blocks in all \p Ranges in \p Code.
-tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style,
+CLANG_ABI tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style,
                                                StringRef Code,
                                                ArrayRef<tooling::Range> Ranges,
                                                StringRef FileName = "<stdin>");
@@ -5498,7 +5499,7 @@ tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style,
 ///
 /// Returns the ``Replacements`` that sort the using declarations in all
 /// \p Ranges in \p Code.
-tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
+CLANG_ABI tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
                                             StringRef Code,
                                             ArrayRef<tooling::Range> Ranges,
                                             StringRef FileName = "<stdin>");
@@ -5506,21 +5507,21 @@ tooling::Replacements sortUsingDeclarations(const FormatStyle &Style,
 /// Returns the ``LangOpts`` that the formatter expects you to set.
 ///
 /// \param Style determines specific settings for lexing mode.
-LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle());
+CLANG_ABI LangOptions getFormattingLangOpts(const FormatStyle &Style = getLLVMStyle());
 
 /// Description to be used for help text for a ``llvm::cl`` option for
 /// specifying format style. The description is closely related to the operation
 /// of ``getStyle()``.
-extern const char *StyleOptionHelpDescription;
+CLANG_ABI extern const char *StyleOptionHelpDescription;
 
 /// The suggested format style to use by default. This allows tools using
 /// ``getStyle`` to have a consistent default style.
 /// Different builds can modify the value to the preferred styles.
-extern const char *DefaultFormatStyle;
+CLANG_ABI extern const char *DefaultFormatStyle;
 
 /// The suggested predefined style to use as the fallback style in ``getStyle``.
 /// Different builds can modify the value to the preferred styles.
-extern const char *DefaultFallbackStyle;
+CLANG_ABI extern const char *DefaultFallbackStyle;
 
 /// Construct a FormatStyle based on ``StyleName``.
 ///
@@ -5551,7 +5552,7 @@ extern const char *DefaultFallbackStyle;
 /// \returns FormatStyle as specified by ``StyleName``. If ``StyleName`` is
 /// "file" and no file is found, returns ``FallbackStyle``. If no style could be
 /// determined, returns an Error.
-Expected<FormatStyle>
+CLANG_ABI Expected<FormatStyle>
 getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyle,
          StringRef Code = "", llvm::vfs::FileSystem *FS = nullptr,
          bool AllowUnknownOptions = false,
@@ -5559,7 +5560,7 @@ getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyle,
 
 // Guesses the language from the ``FileName`` and ``Code`` to be formatted.
 // Defaults to FormatStyle::LK_Cpp.
-FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
+CLANG_ABI FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);
 
 // Returns a string representation of ``Language``.
 inline StringRef getLanguageName(FormatStyle::LanguageKind Language) {
@@ -5589,8 +5590,8 @@ inline StringRef getLanguageName(FormatStyle::LanguageKind Language) {
   }
 }
 
-bool isClangFormatOn(StringRef Comment);
-bool isClangFormatOff(StringRef Comment);
+CLANG_ABI bool isClangFormatOn(StringRef Comment);
+CLANG_ABI bool isClangFormatOff(StringRef Comment);
 
 } // end namespace format
 } // end namespace clang
diff --git a/clang/include/clang/Frontend/ASTConsumers.h b/clang/include/clang/Frontend/ASTConsumers.h
index 0e068bf5cccb53..930ae5c584dd75 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/ASTDumperUtils.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace clang {
@@ -25,24 +26,24 @@ class ASTConsumer;
 // original C code.  The output is intended to be in a format such that
 // clang could re-parse the output back into the same AST, but the
 // implementation is still incomplete.
-std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS,
+CLANG_ABI std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS,
                                               StringRef FilterString);
 
 // AST dumper: dumps the raw AST in human-readable form to the given output
 // stream, or stdout if OS is nullptr.
-std::unique_ptr<ASTConsumer>
+CLANG_ABI std::unique_ptr<ASTConsumer>
 CreateASTDumper(std::unique_ptr<raw_ostream> OS, StringRef FilterString,
                 bool DumpDecls, bool Deserialize, bool DumpLookups,
                 bool DumpDeclTypes, ASTDumpOutputFormat Format);
 
 // AST Decl node lister: prints qualified names of all filterable AST Decl
 // nodes.
-std::unique_ptr<ASTConsumer> CreateASTDeclNodeLister();
+CLANG_ABI std::unique_ptr<ASTConsumer> CreateASTDeclNodeLister();
 
 // Graphical AST viewer: for each function definition, creates a graph of
 // the AST and displays it with the graph viewer "dotty".  Also outputs
 // function declarations to stderr.
-std::unique_ptr<ASTConsumer> CreateASTViewer();
+CLANG_ABI std::unique_ptr<ASTConsumer> CreateASTViewer();
 
 } // end clang namespace
 
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 8cefae8587aa34..c485b1a0ffdda4 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -22,12 +22,13 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetOptions.h"
+#include "clang/Frontend/PrecompiledPreamble.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/PreprocessingRecord.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Serialization/ASTBitCodes.h"
-#include "clang/Frontend/PrecompiledPreamble.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -86,7 +87,7 @@ enum class SkipFunctionBodiesScope { None, Preamble, PreambleAndMainFile };
 enum class CaptureDiagsKind { None, All, AllWithoutNonErrorsFromIncludes };
 
 /// Utility class for loading a ASTContext from an AST file.
-class ASTUnit {
+class CLANG_ABI ASTUnit {
 public:
   struct StandaloneFixIt {
     std::pair<unsigned, unsigned> RemoveRange;
@@ -392,7 +393,7 @@ class ASTUnit {
   /// using the ASTUnit in a way that isn't intended to be concurrent, which is
   /// just about any usage.
   /// Becomes a noop in release mode; only useful for debug mode checking.
-  class ConcurrencyState {
+  class CLANG_ABI ConcurrencyState {
     void *Mutex; // a std::recursive_mutex in debug;
 
   public:
diff --git a/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h b/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
index ca284560754fde..e8cfe13f5a0d39 100644
--- a/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
+++ b/clang/include/clang/Frontend/ChainedDiagnosticConsumer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_FRONTEND_CHAINEDDIAGNOSTICCONSUMER_H
 
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace clang {
@@ -19,7 +20,7 @@ class LangOptions;
 /// go to the first client and then the second. The first diagnostic client
 /// should be the "primary" client, and will be used for computing whether the
 /// diagnostics should be included in counts.
-class ChainedDiagnosticConsumer : public DiagnosticConsumer {
+class CLANG_ABI ChainedDiagnosticConsumer : public DiagnosticConsumer {
   virtual void anchor();
   std::unique_ptr<DiagnosticConsumer> OwningPrimary;
   DiagnosticConsumer *Primary;
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h
index 3464654284f199..f3d428b2b0661a 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -18,6 +18,7 @@
 #include "clang/Frontend/Utils.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleLoader.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -76,7 +77,7 @@ enum class DisableValidationForModuleKind;
 /// in to the compiler instance for everything. When possible, utility functions
 /// come in two forms; a short form that reuses the CompilerInstance objects,
 /// and a long form that takes explicit instances of any required objects.
-class CompilerInstance : public ModuleLoader {
+class CLANG_ABI CompilerInstance : public ModuleLoader {
   /// The options used in this compiler instance.
   std::shared_ptr<CompilerInvocation> Invocation;
 
diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h
index 9daa0a1ecf9488..6eda19c71f3763 100644
--- a/clang/include/clang/Frontend/CompilerInvocation.h
+++ b/clang/include/clang/Frontend/CompilerInvocation.h
@@ -21,8 +21,9 @@
 #include "clang/Frontend/MigratorOptions.h"
 #include "clang/Frontend/PreprocessorOutputOptions.h"
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include <memory>
 #include <string>
 
@@ -53,7 +54,7 @@ class TargetOptions;
 
 // This lets us create the DiagnosticsEngine with a properly-filled-out
 // DiagnosticOptions instance.
-std::unique_ptr<DiagnosticOptions>
+CLANG_ABI std::unique_ptr<DiagnosticOptions>
 CreateAndPopulateDiagOpts(ArrayRef<const char *> Argv);
 
 /// Fill out Opts based on the options given in Args.
@@ -63,7 +64,7 @@ CreateAndPopulateDiagOpts(ArrayRef<const char *> Argv);
 ///
 /// When errors are encountered, return false and, if Diags is non-null,
 /// report the error(s).
-bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
+CLANG_ABI bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
                          DiagnosticsEngine *Diags = nullptr,
                          bool DefaultDiagColor = true);
 
@@ -71,7 +72,7 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
 /// behind reference-counted pointers, which is useful for clients that want to
 /// keep select option objects alive (even after CompilerInvocation gets
 /// destroyed) without making a copy.
-class CompilerInvocationBase {
+class CLANG_ABI CompilerInvocationBase {
 protected:
   /// Options controlling the language variant.
   std::shared_ptr<LangOptions> LangOpts;
@@ -208,7 +209,7 @@ class CowCompilerInvocation;
 /// This class is designed to represent an abstract "invocation" of the
 /// compiler, including data such as the include paths, the code generation
 /// options, the warning flags, and so on.
-class CompilerInvocation : public CompilerInvocationBase {
+class CLANG_ABI CompilerInvocation : public CompilerInvocationBase {
 public:
   CompilerInvocation() = default;
   CompilerInvocation(const CompilerInvocation &X)
@@ -357,7 +358,7 @@ class CompilerInvocation : public CompilerInvocationBase {
 };
 
 /// Same as \c CompilerInvocation, but with copy-on-write optimization.
-class CowCompilerInvocation : public CompilerInvocationBase {
+class CLANG_ABI CowCompilerInvocation : public CompilerInvocationBase {
 public:
   CowCompilerInvocation() = default;
   CowCompilerInvocation(const CowCompilerInvocation &X)
@@ -399,15 +400,15 @@ class CowCompilerInvocation : public CompilerInvocationBase {
   /// @}
 };
 
-IntrusiveRefCntPtr<llvm::vfs::FileSystem>
+CLANG_ABI IntrusiveRefCntPtr<llvm::vfs::FileSystem>
 createVFSFromCompilerInvocation(const CompilerInvocation &CI,
                                 DiagnosticsEngine &Diags);
 
-IntrusiveRefCntPtr<llvm::vfs::FileSystem> createVFSFromCompilerInvocation(
+CLANG_ABI IntrusiveRefCntPtr<llvm::vfs::FileSystem> createVFSFromCompilerInvocation(
     const CompilerInvocation &CI, DiagnosticsEngine &Diags,
     IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
 
-IntrusiveRefCntPtr<llvm::vfs::FileSystem>
+CLANG_ABI IntrusiveRefCntPtr<llvm::vfs::FileSystem>
 createVFSFromOverlayFiles(ArrayRef<std::string> VFSOverlayFiles,
                           DiagnosticsEngine &Diags,
                           IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
diff --git a/clang/include/clang/Frontend/DiagnosticRenderer.h b/clang/include/clang/Frontend/DiagnosticRenderer.h
index b939ebe979e711..cf98a939d10d61 100644
--- a/clang/include/clang/Frontend/DiagnosticRenderer.h
+++ b/clang/include/clang/Frontend/DiagnosticRenderer.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -44,7 +45,7 @@ using DiagOrStoredDiag =
 /// A brief worklist:
 /// FIXME: Sink the recursive printing of template instantiations into this
 /// class.
-class DiagnosticRenderer {
+class CLANG_ABI DiagnosticRenderer {
 protected:
   const LangOptions &LangOpts;
   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
@@ -139,7 +140,7 @@ class DiagnosticRenderer {
 
 /// Subclass of DiagnosticRender that turns all subdiagostics into explicit
 /// notes.  It is up to subclasses to further define the behavior.
-class DiagnosticNoteRenderer : public DiagnosticRenderer {
+class CLANG_ABI DiagnosticNoteRenderer : public DiagnosticRenderer {
 public:
   DiagnosticNoteRenderer(const LangOptions &LangOpts,
                          DiagnosticOptions *DiagOpts)
diff --git a/clang/include/clang/Frontend/FrontendAction.h b/clang/include/clang/Frontend/FrontendAction.h
index 039f6f247b6d8c..b36840f1a8a973 100644
--- a/clang/include/clang/Frontend/FrontendAction.h
+++ b/clang/include/clang/Frontend/FrontendAction.h
@@ -22,6 +22,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/FrontendOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include <memory>
@@ -33,7 +34,7 @@ class ASTMergeAction;
 class CompilerInstance;
 
 /// Abstract base class for actions which can be performed by the frontend.
-class FrontendAction {
+class CLANG_ABI FrontendAction {
   FrontendInputFile CurrentInput;
   std::unique_ptr<ASTUnit> CurrentASTUnit;
   CompilerInstance *Instance;
@@ -240,7 +241,7 @@ class FrontendAction {
 };
 
 /// Abstract base class to use for AST consumer-based frontend actions.
-class ASTFrontendAction : public FrontendAction {
+class CLANG_ABI ASTFrontendAction : public FrontendAction {
 protected:
   /// Implement the ExecuteAction interface by running Sema on
   /// the already-initialized AST consumer.
@@ -254,7 +255,7 @@ class ASTFrontendAction : public FrontendAction {
   bool usesPreprocessorOnly() const override { return false; }
 };
 
-class PluginASTAction : public ASTFrontendAction {
+class CLANG_ABI PluginASTAction : public ASTFrontendAction {
   virtual void anchor();
 public:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
@@ -285,7 +286,7 @@ class PluginASTAction : public ASTFrontendAction {
 };
 
 /// Abstract base class to use for preprocessor-based frontend actions.
-class PreprocessorFrontendAction : public FrontendAction {
+class CLANG_ABI PreprocessorFrontendAction : public FrontendAction {
 protected:
   /// Provide a default implementation which returns aborts;
   /// this method should never be called by FrontendAction clients.
@@ -302,7 +303,7 @@ class PreprocessorFrontendAction : public FrontendAction {
 /// Deriving from this class allows an action to inject custom logic around
 /// some existing action's behavior. It implements every virtual method in
 /// the FrontendAction interface by forwarding to the wrapped action.
-class WrapperFrontendAction : public FrontendAction {
+class CLANG_ABI WrapperFrontendAction : public FrontendAction {
 protected:
   std::unique_ptr<FrontendAction> WrappedAction;
 
diff --git a/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h
index a620ddfc40447d..fcb836e5512005 100644
--- a/clang/include/clang/Frontend/FrontendActions.h
+++ b/clang/include/clang/Frontend/FrontendActions.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_FRONTEND_FRONTENDACTIONS_H
 
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 #include <string>
 #include <vector>
@@ -20,7 +21,7 @@ namespace clang {
 // Custom Consumer Actions
 //===----------------------------------------------------------------------===//
 
-class InitOnlyAction : public FrontendAction {
+class CLANG_ABI InitOnlyAction : public FrontendAction {
   void ExecuteAction() override;
 
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
@@ -33,7 +34,7 @@ class InitOnlyAction : public FrontendAction {
 };
 
 /// Preprocessor-based frontend action that also loads PCH files.
-class ReadPCHAndPreprocessAction : public FrontendAction {
+class CLANG_ABI ReadPCHAndPreprocessAction : public FrontendAction {
   void ExecuteAction() override;
 
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
@@ -43,7 +44,7 @@ class ReadPCHAndPreprocessAction : public FrontendAction {
   bool usesPreprocessorOnly() const override { return false; }
 };
 
-class DumpCompilerOptionsAction : public FrontendAction {
+class CLANG_ABI DumpCompilerOptionsAction : public FrontendAction {
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override {
     return nullptr;
@@ -59,31 +60,31 @@ class DumpCompilerOptionsAction : public FrontendAction {
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
 
-class ASTPrintAction : public ASTFrontendAction {
+class CLANG_ABI ASTPrintAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class ASTDumpAction : public ASTFrontendAction {
+class CLANG_ABI ASTDumpAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class ASTDeclListAction : public ASTFrontendAction {
+class CLANG_ABI ASTDeclListAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class ASTViewAction : public ASTFrontendAction {
+class CLANG_ABI ASTViewAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class GeneratePCHAction : public ASTFrontendAction {
+class CLANG_ABI GeneratePCHAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -113,7 +114,7 @@ class GeneratePCHAction : public ASTFrontendAction {
   bool BeginSourceFileAction(CompilerInstance &CI) override;
 };
 
-class GenerateModuleAction : public ASTFrontendAction {
+class CLANG_ABI GenerateModuleAction : public ASTFrontendAction {
   virtual std::unique_ptr<raw_pwrite_stream>
   CreateOutputFile(CompilerInstance &CI, StringRef InFile) = 0;
 
@@ -133,7 +134,7 @@ class GenerateModuleAction : public ASTFrontendAction {
   bool shouldEraseOutputFiles() override;
 };
 
-class GenerateInterfaceStubsAction : public ASTFrontendAction {
+class CLANG_ABI GenerateInterfaceStubsAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -144,7 +145,7 @@ class GenerateInterfaceStubsAction : public ASTFrontendAction {
   bool hasASTFileSupport() const override { return false; }
 };
 
-class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
+class CLANG_ABI GenerateModuleFromModuleMapAction : public GenerateModuleAction {
 private:
   bool BeginSourceFileAction(CompilerInstance &CI) override;
 
@@ -154,7 +155,7 @@ class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
 
 /// Generates full BMI (which contains full information to generate the object
 /// files) for C++20 Named Modules.
-class GenerateModuleInterfaceAction : public GenerateModuleAction {
+class CLANG_ABI GenerateModuleInterfaceAction : public GenerateModuleAction {
 protected:
   bool BeginSourceFileAction(CompilerInstance &CI) override;
 
@@ -168,14 +169,14 @@ class GenerateModuleInterfaceAction : public GenerateModuleAction {
 };
 
 /// Only generates the reduced BMI. This action is mainly used by tests.
-class GenerateReducedModuleInterfaceAction
+class CLANG_ABI GenerateReducedModuleInterfaceAction
     : public GenerateModuleInterfaceAction {
 private:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class GenerateHeaderUnitAction : public GenerateModuleAction {
+class CLANG_ABI GenerateHeaderUnitAction : public GenerateModuleAction {
 
 private:
   bool BeginSourceFileAction(CompilerInstance &CI) override;
@@ -184,7 +185,7 @@ class GenerateHeaderUnitAction : public GenerateModuleAction {
   CreateOutputFile(CompilerInstance &CI, StringRef InFile) override;
 };
 
-class SyntaxOnlyAction : public ASTFrontendAction {
+class CLANG_ABI SyntaxOnlyAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -196,7 +197,7 @@ class SyntaxOnlyAction : public ASTFrontendAction {
 
 /// Dump information about the given module file, to be used for
 /// basic debugging and discovery.
-class DumpModuleInfoAction : public ASTFrontendAction {
+class CLANG_ABI DumpModuleInfoAction : public ASTFrontendAction {
   // Allow other tools (ex lldb) to direct output for their use.
   std::shared_ptr<llvm::raw_ostream> OutputStream;
 
@@ -216,7 +217,7 @@ class DumpModuleInfoAction : public ASTFrontendAction {
   bool hasCodeCompletionSupport() const override { return false; }
 };
 
-class VerifyPCHAction : public ASTFrontendAction {
+class CLANG_ABI VerifyPCHAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -227,7 +228,7 @@ class VerifyPCHAction : public ASTFrontendAction {
   bool hasCodeCompletionSupport() const override { return false; }
 };
 
-class TemplightDumpAction : public ASTFrontendAction {
+class CLANG_ABI TemplightDumpAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -243,7 +244,7 @@ class TemplightDumpAction : public ASTFrontendAction {
  * adaptor, which forwards most of its calls to another action that
  * will consume the merged context.
  */
-class ASTMergeAction : public FrontendAction {
+class CLANG_ABI ASTMergeAction : public FrontendAction {
   /// The action that the merge action adapts.
   std::unique_ptr<FrontendAction> AdaptedAction;
 
@@ -271,7 +272,7 @@ class ASTMergeAction : public FrontendAction {
   bool hasCodeCompletionSupport() const override;
 };
 
-class PrintPreambleAction : public FrontendAction {
+class CLANG_ABI PrintPreambleAction : public FrontendAction {
 protected:
   void ExecuteAction() override;
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &,
@@ -282,7 +283,7 @@ class PrintPreambleAction : public FrontendAction {
   bool usesPreprocessorOnly() const override { return true; }
 };
 
-class PrintDependencyDirectivesSourceMinimizerAction : public FrontendAction {
+class CLANG_ABI PrintDependencyDirectivesSourceMinimizerAction : public FrontendAction {
 protected:
   void ExecuteAction() override;
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &,
@@ -297,29 +298,29 @@ class PrintDependencyDirectivesSourceMinimizerAction : public FrontendAction {
 // Preprocessor Actions
 //===----------------------------------------------------------------------===//
 
-class DumpRawTokensAction : public PreprocessorFrontendAction {
+class CLANG_ABI DumpRawTokensAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 };
 
-class DumpTokensAction : public PreprocessorFrontendAction {
+class CLANG_ABI DumpTokensAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 };
 
-class PreprocessOnlyAction : public PreprocessorFrontendAction {
+class CLANG_ABI PreprocessOnlyAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 };
 
-class PrintPreprocessedAction : public PreprocessorFrontendAction {
+class CLANG_ABI PrintPreprocessedAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 
   bool hasPCHSupport() const override { return true; }
 };
 
-class GetDependenciesByModuleNameAction : public PreprocessOnlyAction {
+class CLANG_ABI GetDependenciesByModuleNameAction : public PreprocessOnlyAction {
   StringRef ModuleName;
   void ExecuteAction() override;
 
diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h
index 8241925c984763..5639f99fa74120 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -14,6 +14,7 @@
 #include "clang/Frontend/CommandLineSourceLoc.h"
 #include "clang/Sema/CodeCompleteOptions.h"
 #include "clang/Serialization/ModuleFileExtension.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -276,7 +277,7 @@ class FrontendInputFile {
 };
 
 /// FrontendOptions - Options for controlling the behavior of the frontend.
-class FrontendOptions {
+class CLANG_ABI FrontendOptions {
 public:
   /// Disable memory freeing on exit.
   LLVM_PREFERRED_TYPE(bool)
diff --git a/clang/include/clang/Frontend/LayoutOverrideSource.h b/clang/include/clang/Frontend/LayoutOverrideSource.h
index c6e2d731118335..907152117b0734 100644
--- a/clang/include/clang/Frontend/LayoutOverrideSource.h
+++ b/clang/include/clang/Frontend/LayoutOverrideSource.h
@@ -11,6 +11,7 @@
 
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -21,7 +22,7 @@ namespace clang {
   /// This class is used only for testing the ability of external AST sources
   /// to override the layout of record types. Its input is the output format
   /// of the command-line argument -fdump-record-layouts.
-  class LayoutOverrideSource : public ExternalASTSource {
+  class CLANG_ABI LayoutOverrideSource : public ExternalASTSource {
     /// The layout of a given record.
     struct Layout {
       /// The size of the record.
diff --git a/clang/include/clang/Frontend/LogDiagnosticPrinter.h b/clang/include/clang/Frontend/LogDiagnosticPrinter.h
index ec22a8b6cc5fb7..f3c91f19a27521 100644
--- a/clang/include/clang/Frontend/LogDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/LogDiagnosticPrinter.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -18,7 +19,7 @@ namespace clang {
 class DiagnosticOptions;
 class LangOptions;
 
-class LogDiagnosticPrinter : public DiagnosticConsumer {
+class CLANG_ABI LogDiagnosticPrinter : public DiagnosticConsumer {
   struct DiagEntry {
     /// The primary message line of the diagnostic.
     std::string Message;
diff --git a/clang/include/clang/Frontend/MultiplexConsumer.h b/clang/include/clang/Frontend/MultiplexConsumer.h
index b190750bb29fb8..ebdd3e2f8e2921 100644
--- a/clang/include/clang/Frontend/MultiplexConsumer.h
+++ b/clang/include/clang/Frontend/MultiplexConsumer.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Sema/SemaConsumer.h"
 #include "clang/Serialization/ASTDeserializationListener.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 #include <vector>
 
@@ -26,7 +27,7 @@ class MultiplexASTMutationListener;
 
 // This ASTDeserializationListener forwards its notifications to a set of
 // child listeners.
-class MultiplexASTDeserializationListener : public ASTDeserializationListener {
+class CLANG_ABI MultiplexASTDeserializationListener : public ASTDeserializationListener {
 public:
   // Does NOT take ownership of the elements in L.
   MultiplexASTDeserializationListener(
@@ -49,7 +50,7 @@ class MultiplexASTDeserializationListener : public ASTDeserializationListener {
 };
 
 // Has a list of ASTConsumers and calls each of them. Owns its children.
-class MultiplexConsumer : public SemaConsumer {
+class CLANG_ABI MultiplexConsumer : public SemaConsumer {
 public:
   // Takes ownership of the pointers in C.
   MultiplexConsumer(std::vector<std::unique_ptr<ASTConsumer>> C);
diff --git a/clang/include/clang/Frontend/PrecompiledPreamble.h b/clang/include/clang/Frontend/PrecompiledPreamble.h
index 624df004bf89e4..83e54a4a4b5286 100644
--- a/clang/include/clang/Frontend/PrecompiledPreamble.h
+++ b/clang/include/clang/Frontend/PrecompiledPreamble.h
@@ -15,6 +15,7 @@
 
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/MD5.h"
@@ -39,7 +40,7 @@ class DeclGroupRef;
 class PCHContainerOperations;
 
 /// Runs lexer to compute suggested preamble bounds.
-PreambleBounds ComputePreambleBounds(const LangOptions &LangOpts,
+CLANG_ABI PreambleBounds ComputePreambleBounds(const LangOptions &LangOpts,
                                      const llvm::MemoryBufferRef &Buffer,
                                      unsigned MaxLines);
 
@@ -48,7 +49,7 @@ class PreambleCallbacks;
 /// A class holding a PCH and all information to check whether it is valid to
 /// reuse the PCH for the subsequent runs. Use BuildPreamble to create PCH and
 /// CanReusePreamble + AddImplicitPreamble to make use of it.
-class PrecompiledPreamble {
+class CLANG_ABI PrecompiledPreamble {
   class PCHStorage;
   struct PreambleFileHash;
 
@@ -140,7 +141,7 @@ class PrecompiledPreamble {
                       llvm::StringSet<> MissingFiles);
 
   /// Data used to determine if a file used in the preamble has been changed.
-  struct PreambleFileHash {
+  struct CLANG_ABI PreambleFileHash {
     /// All files have size set.
     off_t Size = 0;
 
@@ -208,7 +209,7 @@ class PrecompiledPreamble {
 };
 
 /// A set of callbacks to gather useful information while building a preamble.
-class PreambleCallbacks {
+class CLANG_ABI PreambleCallbacks {
 public:
   virtual ~PreambleCallbacks() = default;
 
@@ -247,13 +248,13 @@ enum class BuildPreambleError {
   BadInputs
 };
 
-class BuildPreambleErrorCategory final : public std::error_category {
+class CLANG_ABI BuildPreambleErrorCategory final : public std::error_category {
 public:
   const char *name() const noexcept override;
   std::string message(int condition) const override;
 };
 
-std::error_code make_error_code(BuildPreambleError Error);
+CLANG_ABI std::error_code make_error_code(BuildPreambleError Error);
 } // namespace clang
 
 template <>
diff --git a/clang/include/clang/Frontend/SARIFDiagnostic.h b/clang/include/clang/Frontend/SARIFDiagnostic.h
index ec1d0b8e6a7c9f..91d0b1050c5ed2 100644
--- a/clang/include/clang/Frontend/SARIFDiagnostic.h
+++ b/clang/include/clang/Frontend/SARIFDiagnostic.h
@@ -16,11 +16,12 @@
 
 #include "clang/Basic/Sarif.h"
 #include "clang/Frontend/DiagnosticRenderer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
 
-class SARIFDiagnostic : public DiagnosticRenderer {
+class CLANG_ABI SARIFDiagnostic : public DiagnosticRenderer {
 public:
   SARIFDiagnostic(raw_ostream &OS, const LangOptions &LangOpts,
                   DiagnosticOptions *DiagOpts, SarifDocumentWriter *Writer);
diff --git a/clang/include/clang/Frontend/SARIFDiagnosticPrinter.h b/clang/include/clang/Frontend/SARIFDiagnosticPrinter.h
index f2652833b3c18d..f35aa51f41f857 100644
--- a/clang/include/clang/Frontend/SARIFDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/SARIFDiagnosticPrinter.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Sarif.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
@@ -27,7 +28,7 @@ class LangOptions;
 class SARIFDiagnostic;
 class SarifDocumentWriter;
 
-class SARIFDiagnosticPrinter : public DiagnosticConsumer {
+class CLANG_ABI SARIFDiagnosticPrinter : public DiagnosticConsumer {
 public:
   SARIFDiagnosticPrinter(raw_ostream &OS, DiagnosticOptions *Diags);
   ~SARIFDiagnosticPrinter() = default;
diff --git a/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h b/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h
index 5586ef65e393f4..9a4d536ee443d3 100644
--- a/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/SerializedDiagnosticPrinter.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Frontend/SerializedDiagnostics.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Bitstream/BitstreamWriter.h"
 
 namespace llvm {
@@ -31,7 +32,7 @@ namespace serialized_diags {
 /// This allows wrapper tools for Clang to get diagnostics from Clang
 /// (via libclang) without needing to parse Clang's command line output.
 ///
-std::unique_ptr<DiagnosticConsumer> create(StringRef OutputFile,
+CLANG_ABI std::unique_ptr<DiagnosticConsumer> create(StringRef OutputFile,
                                            DiagnosticOptions *Diags,
                                            bool MergeChildRecords = false);
 
diff --git a/clang/include/clang/Frontend/SerializedDiagnosticReader.h b/clang/include/clang/Frontend/SerializedDiagnosticReader.h
index f7c2012a7662a1..967eb350c8391d 100644
--- a/clang/include/clang/Frontend/SerializedDiagnosticReader.h
+++ b/clang/include/clang/Frontend/SerializedDiagnosticReader.h
@@ -10,8 +10,9 @@
 #define LLVM_CLANG_FRONTEND_SERIALIZEDDIAGNOSTICREADER_H
 
 #include "clang/Basic/LLVM.h"
-#include "llvm/Bitstream/BitstreamReader.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Bitstream/BitstreamReader.h"
 #include "llvm/Support/ErrorOr.h"
 #include <system_error>
 
@@ -36,7 +37,7 @@ enum class SDError {
   HandlerFailed
 };
 
-const std::error_category &SDErrorCategory();
+CLANG_ABI const std::error_category &SDErrorCategory();
 
 inline std::error_code make_error_code(SDError E) {
   return std::error_code(static_cast<int>(E), SDErrorCategory());
@@ -57,7 +58,7 @@ struct Location {
 ///
 /// Subclasses should override the visit* methods with their logic for handling
 /// the various constructs that are found in serialized diagnostics.
-class SerializedDiagnosticReader {
+class CLANG_ABI SerializedDiagnosticReader {
 public:
   SerializedDiagnosticReader() = default;
   virtual ~SerializedDiagnosticReader() = default;
diff --git a/clang/include/clang/Frontend/TextDiagnostic.h b/clang/include/clang/Frontend/TextDiagnostic.h
index a2fe8ae995423b..213279fdef150f 100644
--- a/clang/include/clang/Frontend/TextDiagnostic.h
+++ b/clang/include/clang/Frontend/TextDiagnostic.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTIC_H
 
 #include "clang/Frontend/DiagnosticRenderer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -32,7 +33,7 @@ namespace clang {
 /// beautiful text diagnostics from any particular interfaces. The Clang
 /// DiagnosticClient is implemented through this class as is diagnostic
 /// printing coming out of libclang.
-class TextDiagnostic : public DiagnosticRenderer {
+class CLANG_ABI TextDiagnostic : public DiagnosticRenderer {
   raw_ostream &OS;
   const Preprocessor *PP;
 
diff --git a/clang/include/clang/Frontend/TextDiagnosticBuffer.h b/clang/include/clang/Frontend/TextDiagnosticBuffer.h
index 5945caf89743ab..320264c993d920 100644
--- a/clang/include/clang/Frontend/TextDiagnosticBuffer.h
+++ b/clang/include/clang/Frontend/TextDiagnosticBuffer.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include <cstddef>
 #include <string>
 #include <utility>
@@ -22,7 +23,7 @@
 
 namespace clang {
 
-class TextDiagnosticBuffer : public DiagnosticConsumer {
+class CLANG_ABI TextDiagnosticBuffer : public DiagnosticConsumer {
 public:
   using DiagList = std::vector<std::pair<SourceLocation, std::string>>;
   using iterator = DiagList::iterator;
diff --git a/clang/include/clang/Frontend/TextDiagnosticPrinter.h b/clang/include/clang/Frontend/TextDiagnosticPrinter.h
index 2610bde7513a1a..7a2f845fe1a86a 100644
--- a/clang/include/clang/Frontend/TextDiagnosticPrinter.h
+++ b/clang/include/clang/Frontend/TextDiagnosticPrinter.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include <memory>
 
@@ -24,7 +25,7 @@ class DiagnosticOptions;
 class LangOptions;
 class TextDiagnostic;
 
-class TextDiagnosticPrinter : public DiagnosticConsumer {
+class CLANG_ABI TextDiagnosticPrinter : public DiagnosticConsumer {
   raw_ostream &OS;
   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
 
diff --git a/clang/include/clang/Frontend/Utils.h b/clang/include/clang/Frontend/Utils.h
index 604e42067a3f1e..bbbca05c0733ea 100644
--- a/clang/include/clang/Frontend/Utils.h
+++ b/clang/include/clang/Frontend/Utils.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Driver/OptionUtils.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringMap.h"
@@ -47,20 +48,20 @@ class CodeGenOptions;
 
 /// InitializePreprocessor - Initialize the preprocessor getting it and the
 /// environment ready to process a single file.
-void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts,
+CLANG_ABI void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts,
                             const PCHContainerReader &PCHContainerRdr,
                             const FrontendOptions &FEOpts,
                             const CodeGenOptions &CodeGenOpts);
 
 /// DoPrintPreprocessedInput - Implement -E mode.
-void DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS,
+CLANG_ABI void DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS,
                               const PreprocessorOutputOptions &Opts);
 
 /// An interface for collecting the dependencies of a compilation. Users should
 /// use \c attachToPreprocessor and \c attachToASTReader to get all of the
 /// dependencies.
 /// FIXME: Migrate DependencyGraphGen to use this interface.
-class DependencyCollector {
+class CLANG_ABI DependencyCollector {
 public:
   virtual ~DependencyCollector();
 
@@ -101,7 +102,7 @@ class DependencyCollector {
 /// ASTReader (for module imports), and writes it out at the end of processing
 /// a source file.  Users should attach to the ast reader whenever a module is
 /// loaded.
-class DependencyFileGenerator : public DependencyCollector {
+class CLANG_ABI DependencyFileGenerator : public DependencyCollector {
 public:
   DependencyFileGenerator(const DependencyOutputOptions &Opts);
 
@@ -133,7 +134,7 @@ class DependencyFileGenerator : public DependencyCollector {
 
 /// Collects the dependencies for imported modules into a directory.  Users
 /// should attach to the AST reader whenever a module is loaded.
-class ModuleDependencyCollector : public DependencyCollector {
+class CLANG_ABI ModuleDependencyCollector : public DependencyCollector {
   std::string DestDir;
   bool HasErrors = false;
   llvm::StringSet<> Seen;
@@ -164,7 +165,7 @@ class ModuleDependencyCollector : public DependencyCollector {
 
 /// AttachDependencyGraphGen - Create a dependency graph generator, and attach
 /// it to the given preprocessor.
-void AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile,
+CLANG_ABI void AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile,
                               StringRef SysRoot);
 
 /// AttachHeaderIncludeGen - Create a header include list generator, and attach
@@ -179,7 +180,7 @@ void AttachDependencyGraphGen(Preprocessor &PP, StringRef OutputFile,
 /// information to, instead of writing to stderr.
 /// \param ShowDepth - Whether to indent to show the nesting of the includes.
 /// \param MSStyle - Whether to print in cl.exe /showIncludes style.
-void AttachHeaderIncludeGen(Preprocessor &PP,
+CLANG_ABI void AttachHeaderIncludeGen(Preprocessor &PP,
                             const DependencyOutputOptions &DepOpts,
                             bool ShowAllHeaders = false,
                             StringRef OutputPath = {},
@@ -187,7 +188,7 @@ void AttachHeaderIncludeGen(Preprocessor &PP,
 
 /// The ChainedIncludesSource class converts headers to chained PCHs in
 /// memory, mainly for testing.
-IntrusiveRefCntPtr<ExternalSemaSource>
+CLANG_ABI IntrusiveRefCntPtr<ExternalSemaSource>
 createChainedIncludesSource(CompilerInstance &CI,
                             IntrusiveRefCntPtr<ExternalSemaSource> &Reader);
 
@@ -232,7 +233,7 @@ struct CreateInvocationOptions {
 ///
 /// May return nullptr if an invocation could not be determined.
 /// See CreateInvocationOptions::ShouldRecoverOnErrors to try harder!
-std::unique_ptr<CompilerInvocation>
+CLANG_ABI std::unique_ptr<CompilerInvocation>
 createInvocation(ArrayRef<const char *> Args,
                  CreateInvocationOptions Opts = {});
 
diff --git a/clang/include/clang/Frontend/VerifyDiagnosticConsumer.h b/clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
index ddfae2666c4c39..c2c0c2b39c8578 100644
--- a/clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ b/clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -14,6 +14,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/StringRef.h"
@@ -35,12 +36,12 @@ class TextDiagnosticBuffer;
 /// those expected. See clang/docs/InternalsManual.rst for details about how to
 /// write tests to verify diagnostics.
 ///
-class VerifyDiagnosticConsumer: public DiagnosticConsumer,
+class CLANG_ABI VerifyDiagnosticConsumer: public DiagnosticConsumer,
                                 public CommentHandler {
 public:
   /// Directive - Abstract class representing a parsed verify directive.
   ///
-  class Directive {
+  class CLANG_ABI Directive {
   public:
     static std::unique_ptr<Directive>
     create(bool RegexKind, SourceLocation DirectiveLoc,
diff --git a/clang/include/clang/FrontendTool/Utils.h b/clang/include/clang/FrontendTool/Utils.h
index 22ddec04133398..7aa7408c91c933 100644
--- a/clang/include/clang/FrontendTool/Utils.h
+++ b/clang/include/clang/FrontendTool/Utils.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_FRONTENDTOOL_UTILS_H
 #define LLVM_CLANG_FRONTENDTOOL_UTILS_H
 
+#include "clang/Support/Compiler.h"
 #include <memory>
 
 namespace clang {
@@ -25,13 +26,13 @@ class FrontendAction;
 /// options specified for the compiler invocation.
 ///
 /// \return - The created FrontendAction object
-std::unique_ptr<FrontendAction> CreateFrontendAction(CompilerInstance &CI);
+CLANG_ABI std::unique_ptr<FrontendAction> CreateFrontendAction(CompilerInstance &CI);
 
 /// ExecuteCompilerInvocation - Execute the given actions described by the
 /// compiler invocation object in the given compiler instance.
 ///
 /// \return - True on success.
-bool ExecuteCompilerInvocation(CompilerInstance *Clang);
+CLANG_ABI bool ExecuteCompilerInvocation(CompilerInstance *Clang);
 
 }  // end namespace clang
 
diff --git a/clang/include/clang/Index/CommentToXML.h b/clang/include/clang/Index/CommentToXML.h
index 29904f163dc754..d88b951f764dbb 100644
--- a/clang/include/clang/Index/CommentToXML.h
+++ b/clang/include/clang/Index/CommentToXML.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_INDEX_COMMENTTOXML_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ASTContext;
@@ -20,7 +21,7 @@ class HTMLTagComment;
 }
 
 namespace index {
-class CommentToXMLConverter {
+class CLANG_ABI CommentToXMLConverter {
 public:
   CommentToXMLConverter();
   ~CommentToXMLConverter();
diff --git a/clang/include/clang/Index/IndexSymbol.h b/clang/include/clang/Index/IndexSymbol.h
index 59e90fced3ddab..91abd1108f7ed2 100644
--- a/clang/include/clang/Index/IndexSymbol.h
+++ b/clang/include/clang/Index/IndexSymbol.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/DataTypes.h"
 
@@ -148,28 +149,28 @@ struct SymbolInfo {
   SymbolPropertySet Properties;
 };
 
-SymbolInfo getSymbolInfo(const Decl *D);
+CLANG_ABI SymbolInfo getSymbolInfo(const Decl *D);
 
-SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI);
+CLANG_ABI SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI);
 
-bool isFunctionLocalSymbol(const Decl *D);
+CLANG_ABI bool isFunctionLocalSymbol(const Decl *D);
 
-void applyForEachSymbolRole(SymbolRoleSet Roles,
+CLANG_ABI void applyForEachSymbolRole(SymbolRoleSet Roles,
                             llvm::function_ref<void(SymbolRole)> Fn);
-bool applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles,
+CLANG_ABI bool applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles,
                             llvm::function_ref<bool(SymbolRole)> Fn);
-void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS);
+CLANG_ABI void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS);
 
 /// \returns true if no name was printed, false otherwise.
-bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS);
+CLANG_ABI bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS);
 
-StringRef getSymbolKindString(SymbolKind K);
-StringRef getSymbolSubKindString(SymbolSubKind K);
-StringRef getSymbolLanguageString(SymbolLanguage K);
+CLANG_ABI StringRef getSymbolKindString(SymbolKind K);
+CLANG_ABI StringRef getSymbolSubKindString(SymbolSubKind K);
+CLANG_ABI StringRef getSymbolLanguageString(SymbolLanguage K);
 
-void applyForEachSymbolProperty(SymbolPropertySet Props,
+CLANG_ABI void applyForEachSymbolProperty(SymbolPropertySet Props,
                             llvm::function_ref<void(SymbolProperty)> Fn);
-void printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS);
+CLANG_ABI void printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS);
 
 } // namespace index
 } // namespace clang
diff --git a/clang/include/clang/Index/IndexingAction.h b/clang/include/clang/Index/IndexingAction.h
index 4baa2d5e72603c..5bd61a4ab27f2f 100644
--- a/clang/include/clang/Index/IndexingAction.h
+++ b/clang/include/clang/Index/IndexingAction.h
@@ -14,6 +14,7 @@
 #include "clang/Index/IndexingOptions.h"
 #include "clang/Lex/PPCallbacks.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include <memory>
 
@@ -33,12 +34,12 @@ namespace index {
 class IndexDataConsumer;
 
 /// Creates an ASTConsumer that indexes all symbols (macros and AST decls).
-std::unique_ptr<ASTConsumer>
+CLANG_ABI std::unique_ptr<ASTConsumer>
 createIndexingASTConsumer(std::shared_ptr<IndexDataConsumer> DataConsumer,
                           const IndexingOptions &Opts,
                           std::shared_ptr<Preprocessor> PP);
 
-std::unique_ptr<ASTConsumer> createIndexingASTConsumer(
+CLANG_ABI std::unique_ptr<ASTConsumer> createIndexingASTConsumer(
     std::shared_ptr<IndexDataConsumer> DataConsumer,
     const IndexingOptions &Opts, std::shared_ptr<Preprocessor> PP,
     // Prefer to set Opts.ShouldTraverseDecl and use the above overload.
@@ -46,26 +47,26 @@ std::unique_ptr<ASTConsumer> createIndexingASTConsumer(
     std::function<bool(const Decl *)> ShouldSkipFunctionBody);
 
 /// Creates a frontend action that indexes all symbols (macros and AST decls).
-std::unique_ptr<FrontendAction>
+CLANG_ABI std::unique_ptr<FrontendAction>
 createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
                      const IndexingOptions &Opts);
 
 /// Recursively indexes all decls in the AST.
-void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
+CLANG_ABI void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
                   IndexingOptions Opts);
 
 /// Recursively indexes \p Decls.
-void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP,
+CLANG_ABI void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP,
                         ArrayRef<const Decl *> Decls,
                         IndexDataConsumer &DataConsumer, IndexingOptions Opts);
 
 /// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
 /// The caller is responsible for calling `Consumer.setPreprocessor()`.
-std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
+CLANG_ABI std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
                                                  IndexingOptions Opts);
 
 /// Recursively indexes all top-level decls in the module.
-void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
+CLANG_ABI void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
                      IndexDataConsumer &DataConsumer, IndexingOptions Opts);
 
 } // namespace index
diff --git a/clang/include/clang/Index/USRGeneration.h b/clang/include/clang/Index/USRGeneration.h
index f89fc5cf49302c..a83d91002f2ce4 100644
--- a/clang/include/clang/Index/USRGeneration.h
+++ b/clang/include/clang/Index/USRGeneration.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_INDEX_USRGENERATION_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -29,69 +30,69 @@ static inline StringRef getUSRSpacePrefix() {
 
 /// Generate a USR for a Decl, including the USR prefix.
 /// \returns true if the results should be ignored, false otherwise.
-bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
+CLANG_ABI bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
 
 /// Generate a USR fragment for an Objective-C class.
-void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
+CLANG_ABI void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
                              StringRef ExtSymbolDefinedIn = "",
                              StringRef CategoryContextExtSymbolDefinedIn = "");
 
 /// Generate a USR fragment for an Objective-C class category.
-void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS,
+CLANG_ABI void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS,
                                 StringRef ClsExtSymbolDefinedIn = "",
                                 StringRef CatExtSymbolDefinedIn = "");
 
 /// Generate a USR fragment for an Objective-C instance variable.  The
 /// complete USR can be created by concatenating the USR for the
 /// encompassing class with this USR fragment.
-void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
+CLANG_ABI void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
 
 /// Generate a USR fragment for an Objective-C method.
-void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
+CLANG_ABI void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
                               raw_ostream &OS);
 
 /// Generate a USR fragment for an Objective-C property.
-void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
+CLANG_ABI void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
 
 /// Generate a USR fragment for an Objective-C protocol.
-void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
+CLANG_ABI void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
                                 StringRef ExtSymbolDefinedIn = "");
 
 /// Generate USR fragment for a global (non-nested) enum.
-void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
+CLANG_ABI void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
                               StringRef ExtSymbolDefinedIn = "");
 
 /// Generate a USR fragment for an enum constant.
-void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS);
+CLANG_ABI void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS);
 
 /// Generate a USR for a macro, including the USR prefix.
 ///
 /// \returns true on error, false on success.
-bool generateUSRForMacro(const MacroDefinitionRecord *MD,
+CLANG_ABI bool generateUSRForMacro(const MacroDefinitionRecord *MD,
                          const SourceManager &SM, SmallVectorImpl<char> &Buf);
-bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
+CLANG_ABI bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
                          const SourceManager &SM, SmallVectorImpl<char> &Buf);
 
 /// Generates a USR for a type.
 ///
 /// \return true on error, false on success.
-bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl<char> &Buf);
+CLANG_ABI bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl<char> &Buf);
 
 /// Generate a USR for a module, including the USR prefix.
 /// \returns true on error, false on success.
-bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS);
+CLANG_ABI bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS);
 
 /// Generate a USR for a top-level module name, including the USR prefix.
 /// \returns true on error, false on success.
-bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS);
+CLANG_ABI bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS);
 
 /// Generate a USR fragment for a module.
 /// \returns true on error, false on success.
-bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS);
+CLANG_ABI bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS);
 
 /// Generate a USR fragment for a module name.
 /// \returns true on error, false on success.
-bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS);
+CLANG_ABI bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS);
 
 
 } // namespace index
diff --git a/clang/include/clang/IndexSerialization/SerializablePathCollection.h b/clang/include/clang/IndexSerialization/SerializablePathCollection.h
index 6337a81196688f..fa24110a968865 100644
--- a/clang/include/clang/IndexSerialization/SerializablePathCollection.h
+++ b/clang/include/clang/IndexSerialization/SerializablePathCollection.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_INDEXSERIALIZATION_SERIALIZABLEPATHCOLLECTION_H
 
 #include "clang/Basic/FileManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
@@ -24,7 +25,7 @@ namespace clang {
 namespace index {
 
 /// Pool of strings
-class StringPool {
+class CLANG_ABI StringPool {
   llvm::SmallString<512> Buffer;
 
 public:
@@ -40,7 +41,7 @@ class StringPool {
 };
 
 /// Pool of filesystem paths backed by a StringPool
-class PathPool {
+class CLANG_ABI PathPool {
 public:
   /// Special root directory of a filesystem path.
   enum class RootDirKind {
@@ -82,7 +83,7 @@ class PathPool {
 };
 
 /// Stores file paths and produces serialization-friendly representation.
-class SerializablePathCollection {
+class CLANG_ABI SerializablePathCollection {
   std::string WorkDir;
   std::string SysRoot;
 
diff --git a/clang/include/clang/InstallAPI/Context.h b/clang/include/clang/InstallAPI/Context.h
index 8f88331a2803fc..15eb9a04fe9d26 100644
--- a/clang/include/clang/InstallAPI/Context.h
+++ b/clang/include/clang/InstallAPI/Context.h
@@ -14,6 +14,7 @@
 #include "clang/InstallAPI/DylibVerifier.h"
 #include "clang/InstallAPI/HeaderFile.h"
 #include "clang/InstallAPI/MachO.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 
 namespace clang {
@@ -23,7 +24,7 @@ class FrontendRecordsSlice;
 /// Struct used for generating validating InstallAPI.
 /// The attributes captured represent all necessary information
 /// to generate TextAPI output.
-struct InstallAPIContext {
+struct CLANG_ABI InstallAPIContext {
 
   /// Library attributes that are typically passed as linker inputs.
   BinaryAttrs BA;
@@ -93,7 +94,7 @@ struct InstallAPIContext {
 /// \param SearchPaths Fallback search paths if library was not found in earlier
 /// paths.
 /// \return The full path of the library.
-std::string findLibrary(StringRef InstallName, FileManager &FM,
+CLANG_ABI std::string findLibrary(StringRef InstallName, FileManager &FM,
                         ArrayRef<std::string> FrameworkSearchPaths,
                         ArrayRef<std::string> LibrarySearchPaths,
                         ArrayRef<std::string> SearchPaths);
diff --git a/clang/include/clang/InstallAPI/DirectoryScanner.h b/clang/include/clang/InstallAPI/DirectoryScanner.h
index 803328982ec878..2571364e99087b 100644
--- a/clang/include/clang/InstallAPI/DirectoryScanner.h
+++ b/clang/include/clang/InstallAPI/DirectoryScanner.h
@@ -14,6 +14,7 @@
 
 #include "clang/Basic/FileManager.h"
 #include "clang/InstallAPI/Library.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang::installapi {
 
@@ -24,7 +25,7 @@ enum ScanMode {
   ScanDylibs,
 };
 
-class DirectoryScanner {
+class CLANG_ABI DirectoryScanner {
 public:
   DirectoryScanner(FileManager &FM, ScanMode Mode = ScanMode::ScanFrameworks)
       : FM(FM), Mode(Mode) {}
diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h
index 333f0cff077fda..7815327c9fa68d 100644
--- a/clang/include/clang/InstallAPI/DylibVerifier.h
+++ b/clang/include/clang/InstallAPI/DylibVerifier.h
@@ -12,6 +12,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/InstallAPI/MachO.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace installapi {
@@ -42,14 +43,14 @@ using ZipperedDeclSources = std::vector<ZipperedDeclSource>;
 /// lifetime of InstallAPI.
 /// As declarations are collected during AST traversal, they are
 /// compared as symbols against what is available in the binary dylib.
-class DylibVerifier : llvm::MachO::RecordVisitor {
+class CLANG_ABI DylibVerifier : llvm::MachO::RecordVisitor {
 private:
   struct SymbolContext;
   struct DWARFContext;
 
 public:
   enum class Result { NoVerify, Ignore, Valid, Invalid };
-  struct VerifierContext {
+  struct CLANG_ABI VerifierContext {
     // Current target being verified against the AST.
     llvm::MachO::Target Target;
 
diff --git a/clang/include/clang/InstallAPI/FileList.h b/clang/include/clang/InstallAPI/FileList.h
index 913734b8dc7c88..ec789d5f01c205 100644
--- a/clang/include/clang/InstallAPI/FileList.h
+++ b/clang/include/clang/InstallAPI/FileList.h
@@ -16,13 +16,14 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/InstallAPI/HeaderFile.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 
 namespace clang {
 namespace installapi {
 
-class FileListReader {
+class CLANG_ABI FileListReader {
 public:
   /// Decode JSON input and append header input into destination container.
   /// Headers are loaded in the order they appear in the JSON input.
diff --git a/clang/include/clang/InstallAPI/Frontend.h b/clang/include/clang/InstallAPI/Frontend.h
index bc4e77de2b7256..1b7da7e0196cc9 100644
--- a/clang/include/clang/InstallAPI/Frontend.h
+++ b/clang/include/clang/InstallAPI/Frontend.h
@@ -19,6 +19,7 @@
 #include "clang/InstallAPI/Context.h"
 #include "clang/InstallAPI/DylibVerifier.h"
 #include "clang/InstallAPI/Visitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/MemoryBuffer.h"
 
@@ -27,7 +28,7 @@ namespace installapi {
 
 /// Create a buffer that contains all headers to scan
 /// for global symbols with.
-std::unique_ptr<llvm::MemoryBuffer> createInputBuffer(InstallAPIContext &Ctx);
+CLANG_ABI std::unique_ptr<llvm::MemoryBuffer> createInputBuffer(InstallAPIContext &Ctx);
 
 class InstallAPIAction : public ASTFrontendAction {
 public:
diff --git a/clang/include/clang/InstallAPI/FrontendRecords.h b/clang/include/clang/InstallAPI/FrontendRecords.h
index ef82398addd7ac..fefd7daac2825a 100644
--- a/clang/include/clang/InstallAPI/FrontendRecords.h
+++ b/clang/include/clang/InstallAPI/FrontendRecords.h
@@ -13,6 +13,7 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/InstallAPI/HeaderFile.h"
 #include "clang/InstallAPI/MachO.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace installapi {
@@ -27,7 +28,7 @@ struct FrontendAttrs {
 
 // Represents a collection of frontend records for a library that are tied to a
 // darwin target triple.
-class FrontendRecordsSlice : public llvm::MachO::RecordsSlice {
+class CLANG_ABI FrontendRecordsSlice : public llvm::MachO::RecordsSlice {
 public:
   FrontendRecordsSlice(const llvm::Triple &T)
       : llvm::MachO::RecordsSlice({T}) {}
diff --git a/clang/include/clang/InstallAPI/HeaderFile.h b/clang/include/clang/InstallAPI/HeaderFile.h
index 26843101e62eac..0e2e29b7f56d47 100644
--- a/clang/include/clang/InstallAPI/HeaderFile.h
+++ b/clang/include/clang/InstallAPI/HeaderFile.h
@@ -16,6 +16,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangStandard.h"
 #include "clang/InstallAPI/MachO.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Regex.h"
@@ -49,7 +50,7 @@ inline StringRef getName(const HeaderType T) {
   llvm_unreachable("unexpected header type");
 }
 
-class HeaderFile {
+class CLANG_ABI HeaderFile {
   /// Full input path to header.
   std::string FullPath;
   /// Access level of header.
@@ -113,7 +114,7 @@ class HeaderFile {
 };
 
 /// Glob that represents a pattern of header files to retreive.
-class HeaderGlob {
+class CLANG_ABI HeaderGlob {
 private:
   std::string GlobString;
   llvm::Regex Rule;
@@ -146,20 +147,20 @@ class HeaderGlob {
 ///
 /// \param FullPath Path to the header file which includes the library
 /// structure.
-std::optional<std::string> createIncludeHeaderName(const StringRef FullPath);
+CLANG_ABI std::optional<std::string> createIncludeHeaderName(const StringRef FullPath);
 using HeaderSeq = std::vector<HeaderFile>;
 
 /// Determine if Path is a header file.
 /// It does not touch the file system.
 ///
 /// \param  Path File path to file.
-bool isHeaderFile(StringRef Path);
+CLANG_ABI bool isHeaderFile(StringRef Path);
 
 /// Given input directory, collect all header files.
 ///
 /// \param FM FileManager for finding input files.
 /// \param Directory Path to directory file.
-llvm::Expected<PathSeq> enumerateFiles(clang::FileManager &FM,
+CLANG_ABI llvm::Expected<PathSeq> enumerateFiles(clang::FileManager &FM,
                                        StringRef Directory);
 
 } // namespace clang::installapi
diff --git a/clang/include/clang/InstallAPI/Library.h b/clang/include/clang/InstallAPI/Library.h
index 8373d424dd3642..6cf6112ca9951d 100644
--- a/clang/include/clang/InstallAPI/Library.h
+++ b/clang/include/clang/InstallAPI/Library.h
@@ -15,10 +15,11 @@
 
 #include "clang/InstallAPI/HeaderFile.h"
 #include "clang/InstallAPI/MachO.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang::installapi {
 
-class Library {
+class CLANG_ABI Library {
 public:
   Library(StringRef Directory) : BaseDirectory(Directory) {}
 
diff --git a/clang/include/clang/InstallAPI/Visitor.h b/clang/include/clang/InstallAPI/Visitor.h
index 3680ee566ca875..c2704281f80bbc 100644
--- a/clang/include/clang/InstallAPI/Visitor.h
+++ b/clang/include/clang/InstallAPI/Visitor.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/InstallAPI/Context.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/Twine.h"
 
 namespace clang {
@@ -25,7 +26,7 @@ struct AvailabilityInfo;
 namespace installapi {
 
 /// ASTVisitor for collecting declarations that represent global symbols.
-class InstallAPIVisitor final : public ASTConsumer,
+class CLANG_ABI InstallAPIVisitor final : public ASTConsumer,
                                 public RecursiveASTVisitor<InstallAPIVisitor> {
 public:
   InstallAPIVisitor(ASTContext &ASTCtx, InstallAPIContext &Ctx,
diff --git a/clang/include/clang/Interpreter/CodeCompletion.h b/clang/include/clang/Interpreter/CodeCompletion.h
index c64aa899759fd8..2b8beee0b5154b 100644
--- a/clang/include/clang/Interpreter/CodeCompletion.h
+++ b/clang/include/clang/Interpreter/CodeCompletion.h
@@ -12,6 +12,7 @@
 
 #ifndef LLVM_CLANG_INTERPRETER_CODE_COMPLETION_H
 #define LLVM_CLANG_INTERPRETER_CODE_COMPLETION_H
+#include "clang/Support/Compiler.h"
 #include <string>
 #include <vector>
 
@@ -23,7 +24,7 @@ namespace clang {
 class CodeCompletionResult;
 class CompilerInstance;
 
-struct ReplCodeCompleter {
+struct CLANG_ABI ReplCodeCompleter {
   ReplCodeCompleter() = default;
   std::string Prefix;
 
diff --git a/clang/include/clang/Interpreter/Interpreter.h b/clang/include/clang/Interpreter/Interpreter.h
index 1230a3a7016fae..2c76409ea3d233 100644
--- a/clang/include/clang/Interpreter/Interpreter.h
+++ b/clang/include/clang/Interpreter/Interpreter.h
@@ -18,6 +18,7 @@
 #include "clang/Interpreter/PartialTranslationUnit.h"
 #include "clang/Interpreter/Value.h"
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
@@ -43,7 +44,7 @@ class IncrementalExecutor;
 class IncrementalParser;
 
 /// Create a pre-configured \c CompilerInstance for incremental processing.
-class IncrementalCompilerBuilder {
+class CLANG_ABI IncrementalCompilerBuilder {
 public:
   IncrementalCompilerBuilder() {}
 
@@ -82,7 +83,7 @@ class IncrementalAction;
 class InProcessPrintingASTConsumer;
 
 /// Provides top-level interfaces for incremental compilation and execution.
-class Interpreter {
+class CLANG_ABI Interpreter {
   friend class Value;
   friend InProcessPrintingASTConsumer;
 
diff --git a/clang/include/clang/Lex/CodeCompletionHandler.h b/clang/include/clang/Lex/CodeCompletionHandler.h
index bd3e05a36bb33c..b7cc6ae668d409 100644
--- a/clang/include/clang/Lex/CodeCompletionHandler.h
+++ b/clang/include/clang/Lex/CodeCompletionHandler.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
 #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -22,7 +23,7 @@ class MacroInfo;
 
 /// Callback handler that receives notifications when performing code
 /// completion within the preprocessor.
-class CodeCompletionHandler {
+class CLANG_ABI CodeCompletionHandler {
 public:
   virtual ~CodeCompletionHandler();
 
diff --git a/clang/include/clang/Lex/DependencyDirectivesScanner.h b/clang/include/clang/Lex/DependencyDirectivesScanner.h
index 0e115906fbfe51..6f1b54636c8617 100644
--- a/clang/include/clang/Lex/DependencyDirectivesScanner.h
+++ b/clang/include/clang/Lex/DependencyDirectivesScanner.h
@@ -18,6 +18,7 @@
 #define LLVM_CLANG_LEX_DEPENDENCYDIRECTIVESSCANNER_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 
 namespace clang {
@@ -114,7 +115,7 @@ struct Directive {
 /// \returns false on success, true on error. If the diagnostic engine is not
 /// null, an appropriate error is reported using the given input location
 /// with the offset that corresponds to the \p Input buffer offset.
-bool scanSourceForDependencyDirectives(
+CLANG_ABI bool scanSourceForDependencyDirectives(
     StringRef Input, SmallVectorImpl<dependency_directives_scan::Token> &Tokens,
     SmallVectorImpl<dependency_directives_scan::Directive> &Directives,
     DiagnosticsEngine *Diags = nullptr,
@@ -130,7 +131,7 @@ bool scanSourceForDependencyDirectives(
 ///
 /// This is used primarily for testing purposes, during dependency scanning the
 /// \p Lexer uses the tokens directly, not their printed version.
-void printDependencyDirectivesAsSource(
+CLANG_ABI void printDependencyDirectivesAsSource(
     StringRef Source,
     ArrayRef<dependency_directives_scan::Directive> Directives,
     llvm::raw_ostream &OS);
diff --git a/clang/include/clang/Lex/DirectoryLookup.h b/clang/include/clang/Lex/DirectoryLookup.h
index 81680d3b271e08..2a1fb363dc8b9b 100644
--- a/clang/include/clang/Lex/DirectoryLookup.h
+++ b/clang/include/clang/Lex/DirectoryLookup.h
@@ -13,10 +13,11 @@
 #ifndef LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
 #define LLVM_CLANG_LEX_DIRECTORYLOOKUP_H
 
-#include "clang/Basic/LLVM.h"
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/ModuleMap.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class HeaderMap;
@@ -27,7 +28,7 @@ class Module;
 /// specifies the search order for directories in \#include directives.  It
 /// represents either a directory, a framework, or a headermap.
 ///
-class DirectoryLookup {
+class CLANG_ABI DirectoryLookup {
 public:
   enum LookupType_t {
     LT_NormalDir,
diff --git a/clang/include/clang/Lex/ExternalPreprocessorSource.h b/clang/include/clang/Lex/ExternalPreprocessorSource.h
index 51c11c3adf6e73..6c51ffc3936ba3 100644
--- a/clang/include/clang/Lex/ExternalPreprocessorSource.h
+++ b/clang/include/clang/Lex/ExternalPreprocessorSource.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H
 #define LLVM_CLANG_LEX_EXTERNALPREPROCESSORSOURCE_H
 
+#include "clang/Support/Compiler.h"
 #include <cassert>
 #include <cstdint>
   
@@ -26,7 +27,7 @@ class Module;
 ///
 /// This abstract class allows an external sources (such as the \c ASTReader)
 /// to provide additional preprocessing information.
-class ExternalPreprocessorSource {
+class CLANG_ABI ExternalPreprocessorSource {
 public:
   virtual ~ExternalPreprocessorSource();
 
diff --git a/clang/include/clang/Lex/HeaderMap.h b/clang/include/clang/Lex/HeaderMap.h
index 9d88b36bfd8e41..99b08e7e768e4e 100644
--- a/clang/include/clang/Lex/HeaderMap.h
+++ b/clang/include/clang/Lex/HeaderMap.h
@@ -16,6 +16,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Lex/HeaderMapTypes.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -28,7 +29,7 @@ struct HMapBucket;
 struct HMapHeader;
 
 /// Implementation for \a HeaderMap that doesn't depend on \a FileManager.
-class HeaderMapImpl {
+class CLANG_ABI HeaderMapImpl {
   std::unique_ptr<const llvm::MemoryBuffer> FileBuffer;
   bool NeedsBSwap;
   mutable llvm::StringMap<StringRef> ReverseMap;
@@ -81,7 +82,7 @@ class HeaderMapImpl {
 /// \#include file resolution process, it basically acts like a directory of
 /// symlinks to files.  Its advantages are that it is dense and more efficient
 /// to create and process than a directory of symlinks.
-class HeaderMap : private HeaderMapImpl {
+class CLANG_ABI HeaderMap : private HeaderMapImpl {
   HeaderMap(std::unique_ptr<const llvm::MemoryBuffer> File, bool BSwap)
       : HeaderMapImpl(std::move(File), BSwap) {}
 
diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index df75c192c700a0..8eb0b33c7e68f1 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -19,6 +19,7 @@
 #include "clang/Lex/ExternalPreprocessorSource.h"
 #include "clang/Lex/HeaderMap.h"
 #include "clang/Lex/ModuleMap.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
@@ -56,7 +57,7 @@ class TargetInfo;
 
 /// The preprocessor keeps track of this information for each
 /// file that is \#included.
-struct HeaderFileInfo {
+struct CLANG_ABI HeaderFileInfo {
   // TODO: Whether the file was included is not a property of the file itself.
   // It's a preprocessor state, move it there.
   /// True if this file has been included (or imported) **locally**.
@@ -156,7 +157,7 @@ struct HeaderFileInfo {
 
 /// An external source of header file information, which may supply
 /// information about header files already included.
-class ExternalHeaderFileInfoSource {
+class CLANG_ABI ExternalHeaderFileInfoSource {
 public:
   virtual ~ExternalHeaderFileInfoSource();
 
@@ -246,7 +247,7 @@ using SearchDirRange = llvm::iterator_range<SearchDirIterator>;
 
 /// Encapsulates the information needed to find the file referenced
 /// by a \#include or \#include_next, (sub-)framework lookup, etc.
-class HeaderSearch {
+class CLANG_ABI HeaderSearch {
   friend class DirectoryLookup;
 
   friend ConstSearchDirIterator;
@@ -973,7 +974,7 @@ class HeaderSearch {
 };
 
 /// Apply the header search options to get given HeaderSearch object.
-void ApplyHeaderSearchOptions(HeaderSearch &HS,
+CLANG_ABI void ApplyHeaderSearchOptions(HeaderSearch &HS,
                               const HeaderSearchOptions &HSOpts,
                               const LangOptions &Lang,
                               const llvm::Triple &triple);
diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h
index b6ecc7e5ded9e2..7419179e6bec6f 100644
--- a/clang/include/clang/Lex/Lexer.h
+++ b/clang/include/clang/Lex/Lexer.h
@@ -19,6 +19,7 @@
 #include "clang/Lex/DependencyDirectivesScanner.h"
 #include "clang/Lex/PreprocessorLexer.h"
 #include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <cassert>
@@ -75,7 +76,7 @@ struct PreambleBounds {
 /// stream of tokens.  This provides no support for file reading or buffering,
 /// or buffering/seeking of tokens, only forward lexing is supported.  It relies
 /// on the specified Preprocessor object to handle preprocessor directives, etc.
-class Lexer : public PreprocessorLexer {
+class CLANG_ABI Lexer : public PreprocessorLexer {
   friend class Preprocessor;
 
   void anchor() override;
diff --git a/clang/include/clang/Lex/LiteralSupport.h b/clang/include/clang/Lex/LiteralSupport.h
index 705021fcfa5b11..bdd60952a2b653 100644
--- a/clang/include/clang/Lex/LiteralSupport.h
+++ b/clang/include/clang/Lex/LiteralSupport.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
@@ -34,21 +35,21 @@ class SourceManager;
 class LangOptions;
 
 /// Copy characters from Input to Buf, expanding any UCNs.
-void expandUCNs(SmallVectorImpl<char> &Buf, StringRef Input);
+CLANG_ABI void expandUCNs(SmallVectorImpl<char> &Buf, StringRef Input);
 
 /// Return true if the token corresponds to a function local predefined macro,
 /// which expands to a string literal, that can be concatenated with other
 /// string literals (only in Microsoft mode).
-bool isFunctionLocalStringLiteralMacro(tok::TokenKind K, const LangOptions &LO);
+CLANG_ABI bool isFunctionLocalStringLiteralMacro(tok::TokenKind K, const LangOptions &LO);
 
 /// Return true if the token is a string literal, or a function local
 /// predefined macro, which expands to a string literal.
-bool tokenIsLikeStringLiteral(const Token &Tok, const LangOptions &LO);
+CLANG_ABI bool tokenIsLikeStringLiteral(const Token &Tok, const LangOptions &LO);
 
 /// NumericLiteralParser - This performs strict semantic analysis of the content
 /// of a ppnumber, classifying it as either integer, floating, or erroneous,
 /// determines the radix of the value and can convert it to a useful value.
-class NumericLiteralParser {
+class CLANG_ABI NumericLiteralParser {
   const SourceManager &SM;
   const LangOptions &LangOpts;
   DiagnosticsEngine &Diags;
@@ -193,7 +194,7 @@ class NumericLiteralParser {
 
 /// CharLiteralParser - Perform interpretation and semantic analysis of a
 /// character literal.
-class CharLiteralParser {
+class CLANG_ABI CharLiteralParser {
   uint64_t Value;
   tok::TokenKind Kind;
   bool IsMultiChar;
@@ -228,7 +229,7 @@ enum class StringLiteralEvalMethod {
 /// StringLiteralParser - This decodes string escape characters and performs
 /// wide string analysis and Translation Phase #6 (concatenation of string
 /// literals) (C99 5.1.1.2p1).
-class StringLiteralParser {
+class CLANG_ABI StringLiteralParser {
   const SourceManager &SM;
   const LangOptions &Features;
   const TargetInfo &Target;
diff --git a/clang/include/clang/Lex/MacroArgs.h b/clang/include/clang/Lex/MacroArgs.h
index 59676c30e0a598..f7a2b621b80f39 100644
--- a/clang/include/clang/Lex/MacroArgs.h
+++ b/clang/include/clang/Lex/MacroArgs.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/TrailingObjects.h"
 #include <vector>
@@ -26,7 +27,7 @@ namespace clang {
 
 /// MacroArgs - An instance of this class captures information about
 /// the formal arguments specified to a function-like macro invocation.
-class MacroArgs final
+class CLANG_ABI MacroArgs final
     : private llvm::TrailingObjects<MacroArgs, Token> {
 
   friend TrailingObjects;
diff --git a/clang/include/clang/Lex/MacroInfo.h b/clang/include/clang/Lex/MacroInfo.h
index 19a706216d5093..2b19046776b596 100644
--- a/clang/include/clang/Lex/MacroInfo.h
+++ b/clang/include/clang/Lex/MacroInfo.h
@@ -14,9 +14,10 @@
 #ifndef LLVM_CLANG_LEX_MACROINFO_H
 #define LLVM_CLANG_LEX_MACROINFO_H
 
-#include "clang/Lex/Token.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -36,7 +37,7 @@ class SourceManager;
 /// Encapsulates the data about a macro definition (e.g. its tokens).
 ///
 /// There's an instance of this class for every #define.
-class MacroInfo {
+class CLANG_ABI MacroInfo {
   //===--------------------------------------------------------------------===//
   // State set when the macro is defined.
 
@@ -310,7 +311,7 @@ class MacroInfo {
 /// history. Usually a macro definition (MacroInfo) is where a macro name
 /// becomes active (MacroDirective) but #pragma push_macro / pop_macro can
 /// create additional DefMacroDirectives for the same MacroInfo.
-class MacroDirective {
+class CLANG_ABI MacroDirective {
 public:
   enum Kind {
     MD_Define,
@@ -511,7 +512,7 @@ MacroDirective::DefInfo::getPreviousDefinition() {
 /// represent the macro override graph.
 ///
 /// These are stored in a FoldingSet in the preprocessor.
-class ModuleMacro : public llvm::FoldingSetNode {
+class CLANG_ABI ModuleMacro : public llvm::FoldingSetNode {
   friend class Preprocessor;
 
   /// The name defined by the macro.
diff --git a/clang/include/clang/Lex/ModuleLoader.h b/clang/include/clang/Lex/ModuleLoader.h
index f880a9091a2edc..3c56460481f283 100644
--- a/clang/include/clang/Lex/ModuleLoader.h
+++ b/clang/include/clang/Lex/ModuleLoader.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/StringRef.h"
@@ -79,7 +80,7 @@ class ModuleLoadResult {
 /// This abstract interface describes a module loader, which is responsible
 /// for resolving a module name (e.g., "std") to an actual module file, and
 /// then loading that module.
-class ModuleLoader {
+class CLANG_ABI ModuleLoader {
   // Building a module if true.
   bool BuildingModule;
 
diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index 2e28ff6823cb2a..bb28228a9af5b7 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Module.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -45,7 +46,7 @@ class SourceManager;
 
 /// A mechanism to observe the actions of the module map parser as it
 /// reads module map files.
-class ModuleMapCallbacks {
+class CLANG_ABI ModuleMapCallbacks {
   virtual void anchor();
 
 public:
@@ -71,7 +72,7 @@ class ModuleMapCallbacks {
   virtual void moduleMapAddUmbrellaHeader(FileEntryRef Header) {}
 };
 
-class ModuleMap {
+class CLANG_ABI ModuleMap {
   SourceManager &SourceMgr;
   DiagnosticsEngine &Diags;
   const LangOptions &LangOpts;
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
index 46cc564086f1c5..f483f3eda16e3e 100644
--- a/clang/include/clang/Lex/PPCallbacks.h
+++ b/clang/include/clang/Lex/PPCallbacks.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Pragma.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -33,7 +34,7 @@ struct LexEmbedParametersResult;
 /// preprocessor as it does its thing.
 ///
 /// Clients can define their hooks here to implement preprocessor level tools.
-class PPCallbacks {
+class CLANG_ABI PPCallbacks {
 public:
   virtual ~PPCallbacks();
 
@@ -467,7 +468,7 @@ class PPCallbacks {
 };
 
 /// Simple wrapper class for chaining callbacks.
-class PPChainedCallbacks : public PPCallbacks {
+class CLANG_ABI PPChainedCallbacks : public PPCallbacks {
   std::unique_ptr<PPCallbacks> First, Second;
 
 public:
diff --git a/clang/include/clang/Lex/PPConditionalDirectiveRecord.h b/clang/include/clang/Lex/PPConditionalDirectiveRecord.h
index d8c556ae253161..0b439a6bcf411d 100644
--- a/clang/include/clang/Lex/PPConditionalDirectiveRecord.h
+++ b/clang/include/clang/Lex/PPConditionalDirectiveRecord.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <vector>
 
@@ -22,7 +23,7 @@ namespace clang {
 
 /// Records preprocessor conditional directive regions and allows
 /// querying in which region source locations belong to.
-class PPConditionalDirectiveRecord : public PPCallbacks {
+class CLANG_ABI PPConditionalDirectiveRecord : public PPCallbacks {
   SourceManager &SourceMgr;
 
   SmallVector<SourceLocation, 6> CondDirectiveStack;
diff --git a/clang/include/clang/Lex/Pragma.h b/clang/include/clang/Lex/Pragma.h
index 67eca618f6c4ff..e4c09e2481a4a0 100644
--- a/clang/include/clang/Lex/Pragma.h
+++ b/clang/include/clang/Lex/Pragma.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
@@ -62,7 +63,7 @@ class Token;
 /// Note that the PragmaNamespace class can be used to subdivide pragmas, e.g.
 /// we treat "\#pragma STDC" and "\#pragma GCC" as namespaces that contain other
 /// pragmas.
-class PragmaHandler {
+class CLANG_ABI PragmaHandler {
   std::string Name;
 
 public:
@@ -81,7 +82,7 @@ class PragmaHandler {
 
 /// EmptyPragmaHandler - A pragma handler which takes no action, which can be
 /// used to ignore particular pragmas.
-class EmptyPragmaHandler : public PragmaHandler {
+class CLANG_ABI EmptyPragmaHandler : public PragmaHandler {
 public:
   explicit EmptyPragmaHandler(StringRef Name = StringRef());
 
@@ -93,7 +94,7 @@ class EmptyPragmaHandler : public PragmaHandler {
 /// allowing hierarchical pragmas to be defined.  Common examples of namespaces
 /// are "\#pragma GCC", "\#pragma STDC", and "\#pragma omp", but any namespaces
 /// may be (potentially recursively) defined.
-class PragmaNamespace : public PragmaHandler {
+class CLANG_ABI PragmaNamespace : public PragmaHandler {
   /// Handlers - This is a map of the handlers in this namespace with their name
   /// as key.
   llvm::StringMap<std::unique_ptr<PragmaHandler>> Handlers;
@@ -128,7 +129,7 @@ class PragmaNamespace : public PragmaHandler {
 /// deleting the leading and trailing double-quotes, replacing each escape
 /// sequence \" by a double-quote, and replacing each escape sequence \\ by a
 /// single backslash."
-void prepare_PragmaString(SmallVectorImpl<char> &StrVal);
+CLANG_ABI void prepare_PragmaString(SmallVectorImpl<char> &StrVal);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Lex/PreprocessingRecord.h b/clang/include/clang/Lex/PreprocessingRecord.h
index 437d8e4cc174ed..469727779e8bee 100644
--- a/clang/include/clang/Lex/PreprocessingRecord.h
+++ b/clang/include/clang/Lex/PreprocessingRecord.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
@@ -55,7 +56,7 @@ class Token;
 
   /// Base class that describes a preprocessed entity, which may be a
   /// preprocessor directive or macro expansion.
-  class PreprocessedEntity {
+  class CLANG_ABI PreprocessedEntity {
   public:
     /// The kind of preprocessed entity an object describes.
     enum EntityKind {
@@ -203,7 +204,7 @@ class Token;
 
   /// Record the location of an inclusion directive, such as an
   /// \c \#include or \c \#import statement.
-  class InclusionDirective : public PreprocessingDirective {
+  class CLANG_ABI InclusionDirective : public PreprocessingDirective {
   public:
     /// The kind of inclusion directives known to the
     /// preprocessor.
@@ -276,7 +277,7 @@ class Token;
 
   /// An abstract class that should be subclassed by any external source
   /// of preprocessing record entries.
-  class ExternalPreprocessingRecordSource {
+  class CLANG_ABI ExternalPreprocessingRecordSource {
   public:
     virtual ~ExternalPreprocessingRecordSource();
 
@@ -305,7 +306,7 @@ class Token;
   /// A record of the steps taken while preprocessing a source file,
   /// including the various preprocessing directives processed, macros
   /// expanded, etc.
-  class PreprocessingRecord : public PPCallbacks {
+  class CLANG_ABI PreprocessingRecord : public PPCallbacks {
     SourceManager &SourceMgr;
 
     /// Allocator used to store preprocessing objects.
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 4643b0213815f8..bb489179732a53 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -32,6 +32,7 @@
 #include "clang/Lex/PPEmbedParameters.h"
 #include "clang/Lex/Token.h"
 #include "clang/Lex/TokenLexer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
@@ -134,7 +135,7 @@ enum class EmbedResult {
 /// Lexers know only about tokens within a single source file, and don't
 /// know anything about preprocessor-level issues like the \#include stack,
 /// token expansion, etc.
-class Preprocessor {
+class CLANG_ABI Preprocessor {
   friend class VAOptDefinitionContext;
   friend class VariadicMacroScopeGuard;
 
@@ -3030,7 +3031,7 @@ class Preprocessor {
 
 /// Abstract base class that describes a handler that will receive
 /// source ranges for each of the comments encountered in the source file.
-class CommentHandler {
+class CLANG_ABI CommentHandler {
 public:
   virtual ~CommentHandler();
 
@@ -3041,7 +3042,7 @@ class CommentHandler {
 
 /// Abstract base class that describes a handler that will receive
 /// source ranges for empty lines encountered in the source file.
-class EmptylineHandler {
+class CLANG_ABI EmptylineHandler {
 public:
   virtual ~EmptylineHandler();
 
diff --git a/clang/include/clang/Lex/PreprocessorLexer.h b/clang/include/clang/Lex/PreprocessorLexer.h
index d71fe708ab20a2..3d3b06aec5dbd7 100644
--- a/clang/include/clang/Lex/PreprocessorLexer.h
+++ b/clang/include/clang/Lex/PreprocessorLexer.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/MultipleIncludeOpt.h"
 #include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include <cassert>
@@ -27,7 +28,7 @@ namespace clang {
 class FileEntry;
 class Preprocessor;
 
-class PreprocessorLexer {
+class CLANG_ABI PreprocessorLexer {
   virtual void anchor();
 
 protected:
diff --git a/clang/include/clang/Lex/ScratchBuffer.h b/clang/include/clang/Lex/ScratchBuffer.h
index f526f22cb723d5..9e02fb770e8a84 100644
--- a/clang/include/clang/Lex/ScratchBuffer.h
+++ b/clang/include/clang/Lex/ScratchBuffer.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_LEX_SCRATCHBUFFER_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class SourceManager;
@@ -21,7 +22,7 @@ namespace clang {
 /// ScratchBuffer - This class exposes a simple interface for the dynamic
 /// construction of tokens.  This is used for builtin macros (e.g. __LINE__) as
 /// well as token pasting, etc.
-class ScratchBuffer {
+class CLANG_ABI ScratchBuffer {
   SourceManager &SourceMgr;
   char *CurBuffer;
   SourceLocation BufferStartLoc;
diff --git a/clang/include/clang/Lex/Token.h b/clang/include/clang/Lex/Token.h
index 4f29fb7d114159..ec4edfbeba4b12 100644
--- a/clang/include/clang/Lex/Token.h
+++ b/clang/include/clang/Lex/Token.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <cassert>
@@ -33,7 +34,7 @@ class LangOptions;
 /// tokens that were parsed and semantically resolved, e.g.: "foo::MyClass<int>"
 /// can be represented by a single typename annotation token that carries
 /// information about the SourceRange of the tokens and the type object.
-class Token {
+class CLANG_ABI Token {
   /// The location of the token. This is actually a SourceLocation.
   SourceLocation::UIntTy Loc;
 
diff --git a/clang/include/clang/Lex/TokenConcatenation.h b/clang/include/clang/Lex/TokenConcatenation.h
index bd431725d496e6..7587a06ba7c463 100644
--- a/clang/include/clang/Lex/TokenConcatenation.h
+++ b/clang/include/clang/Lex/TokenConcatenation.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_LEX_TOKENCONCATENATION_H
 
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class Preprocessor;
@@ -27,7 +28,7 @@ namespace clang {
   /// other would cause the lexer to produce one "foobar" token.  Emitting "1"
   /// and ")" next to each other is safe.
   ///
-  class TokenConcatenation {
+  class CLANG_ABI TokenConcatenation {
     const Preprocessor &PP;
 
     enum AvoidConcatInfo {
diff --git a/clang/include/clang/Lex/TokenLexer.h b/clang/include/clang/Lex/TokenLexer.h
index 4d229ae6106743..72d9685144aca5 100644
--- a/clang/include/clang/Lex/TokenLexer.h
+++ b/clang/include/clang/Lex/TokenLexer.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_LEX_TOKENLEXER_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 
 namespace clang {
@@ -27,7 +28,7 @@ class VAOptExpansionContext;
 /// TokenLexer - This implements a lexer that returns tokens from a macro body
 /// or token stream instead of lexing from a character buffer.  This is used for
 /// macro expansion and _Pragma handling, for example.
-class TokenLexer {
+class CLANG_ABI TokenLexer {
   friend class Preprocessor;
 
   /// The macro we are expanding from. This is null if expanding a token stream.
diff --git a/clang/include/clang/Parse/ParseAST.h b/clang/include/clang/Parse/ParseAST.h
index 3a21f04f2ba34c..beedd8045e17d4 100644
--- a/clang/include/clang/Parse/ParseAST.h
+++ b/clang/include/clang/Parse/ParseAST.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_PARSE_PARSEAST_H
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class Preprocessor;
@@ -35,7 +36,7 @@ namespace clang {
   /// \param SkipFunctionBodies Whether to skip parsing of function bodies.
   /// This option can be used, for example, to speed up searches for
   /// declarations/definitions when indexing.
-  void ParseAST(Preprocessor &pp, ASTConsumer *C,
+  CLANG_ABI void ParseAST(Preprocessor &pp, ASTConsumer *C,
                 ASTContext &Ctx, bool PrintStats = false,
                 TranslationUnitKind TUKind = TU_Complete,
                 CodeCompleteConsumer *CompletionConsumer = nullptr,
@@ -43,7 +44,7 @@ namespace clang {
 
   /// Parse the main file known to the preprocessor, producing an
   /// abstract syntax tree.
-  void ParseAST(Sema &S, bool PrintStats = false,
+  CLANG_ABI void ParseAST(Sema &S, bool PrintStats = false,
                 bool SkipFunctionBodies = false);
 
 }  // end namespace clang
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 045ee754a242b3..22b519a2900ee1 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -21,6 +21,7 @@
 #include "clang/Sema/SemaCodeCompletion.h"
 #include "clang/Sema/SemaObjC.h"
 #include "clang/Sema/SemaOpenMP.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Frontend/OpenMP/OMPContext.h"
 #include "llvm/Support/SaveAndRestore.h"
@@ -55,7 +56,7 @@ namespace clang {
 /// parsing units of the grammar, productions are invoked to handle whatever has
 /// been read.
 ///
-class Parser : public CodeCompletionHandler {
+class CLANG_ABI Parser : public CodeCompletionHandler {
   friend class ColonProtectionRAIIObject;
   friend class ParsingOpenMPDirectiveRAII;
   friend class ParsingOpenACCDirectiveRAII;
@@ -1240,7 +1241,7 @@ class Parser : public CodeCompletionHandler {
 
 private:
   /// RAII object used to modify the scope flags for the current scope.
-  class ParseScopeFlags {
+  class CLANG_ABI ParseScopeFlags {
     Scope *CurScope;
     unsigned OldFlags = 0;
     ParseScopeFlags(const ParseScopeFlags &) = delete;
@@ -1331,7 +1332,7 @@ class Parser : public CodeCompletionHandler {
   /// (including such things in nested classes)."
   /// LateParsedDeclarations build the tree of those elements so they can
   /// be parsed after parsing the top-level class.
-  class LateParsedDeclaration {
+  class CLANG_ABI LateParsedDeclaration {
   public:
     virtual ~LateParsedDeclaration();
 
@@ -1344,7 +1345,7 @@ class Parser : public CodeCompletionHandler {
 
   /// Inner node of the LateParsedDeclaration tree that parses
   /// all its members recursively.
-  class LateParsedClass : public LateParsedDeclaration {
+  class CLANG_ABI LateParsedClass : public LateParsedDeclaration {
   public:
     LateParsedClass(Parser *P, ParsingClass *C);
     ~LateParsedClass() override;
@@ -1370,7 +1371,7 @@ class Parser : public CodeCompletionHandler {
   /// member declarations.
   /// FIXME: Perhaps we should change the name of LateParsedDeclaration to
   /// LateParsedTokens.
-  struct LateParsedAttribute : public LateParsedDeclaration {
+  struct CLANG_ABI LateParsedAttribute : public LateParsedDeclaration {
     Parser *Self;
     CachedTokens Toks;
     IdentifierInfo &AttrName;
@@ -1391,7 +1392,7 @@ class Parser : public CodeCompletionHandler {
   /// may reference member variables and so need to be parsed at the
   /// end of the class declaration after parsing all other member
   /// member declarations.
-  class LateParsedPragma : public LateParsedDeclaration {
+  class CLANG_ABI LateParsedPragma : public LateParsedDeclaration {
     Parser *Self = nullptr;
     AccessSpecifier AS = AS_none;
     CachedTokens Toks;
@@ -1430,7 +1431,7 @@ class Parser : public CodeCompletionHandler {
   /// Contains the lexed tokens of a member function definition
   /// which needs to be parsed at the end of the class declaration
   /// after parsing all other member declarations.
-  struct LexedMethod : public LateParsedDeclaration {
+  struct CLANG_ABI LexedMethod : public LateParsedDeclaration {
     Parser *Self;
     Decl *D;
     CachedTokens Toks;
@@ -1463,7 +1464,7 @@ class Parser : public CodeCompletionHandler {
   /// contains at least one entity whose parsing needs to be delayed
   /// until the class itself is completely-defined, such as a default
   /// argument (C++ [class.mem]p2).
-  struct LateParsedMethodDeclaration : public LateParsedDeclaration {
+  struct CLANG_ABI LateParsedMethodDeclaration : public LateParsedDeclaration {
     explicit LateParsedMethodDeclaration(Parser *P, Decl *M)
         : Self(P), Method(M), ExceptionSpecTokens(nullptr) {}
 
@@ -1489,7 +1490,7 @@ class Parser : public CodeCompletionHandler {
   /// LateParsedMemberInitializer - An initializer for a non-static class data
   /// member whose parsing must to be delayed until the class is completely
   /// defined (C++11 [class.mem]p2).
-  struct LateParsedMemberInitializer : public LateParsedDeclaration {
+  struct CLANG_ABI LateParsedMemberInitializer : public LateParsedDeclaration {
     LateParsedMemberInitializer(Parser *P, Decl *FD)
       : Self(P), Field(FD) { }
 
@@ -1576,7 +1577,7 @@ class Parser : public CodeCompletionHandler {
   /// Contains information about any template-specific
   /// information that has been parsed prior to parsing declaration
   /// specifiers.
-  struct ParsedTemplateInfo {
+  struct CLANG_ABI ParsedTemplateInfo {
     ParsedTemplateInfo() : Kind(NonTemplate), TemplateParams(nullptr) {}
 
     ParsedTemplateInfo(TemplateParameterLists *TemplateParams,
@@ -1780,7 +1781,7 @@ class Parser : public CodeCompletionHandler {
   DeclGroupPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
                                                 ParsedAttributes &prefixAttrs);
 
-  struct ObjCImplParsingDataRAII {
+  struct CLANG_ABI ObjCImplParsingDataRAII {
     Parser &P;
     Decl *Dcl;
     bool HasCFunction;
@@ -3935,7 +3936,7 @@ class Parser : public CodeCompletionHandler {
   void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) override;
   void CodeCompleteNaturalLanguage() override;
 
-  class GNUAsmQualifiers {
+  class CLANG_ABI GNUAsmQualifiers {
     unsigned Qualifiers = AQ_unspecified;
 
   public:
diff --git a/clang/include/clang/Parse/RAIIObjectsForParser.h b/clang/include/clang/Parse/RAIIObjectsForParser.h
index f4fa518ef27d01..81b430965c8e9a 100644
--- a/clang/include/clang/Parse/RAIIObjectsForParser.h
+++ b/clang/include/clang/Parse/RAIIObjectsForParser.h
@@ -19,6 +19,7 @@
 #include "clang/Sema/DelayedDiagnostic.h"
 #include "clang/Sema/ParsedTemplate.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   // TODO: move ParsingClassDefinition here.
@@ -417,7 +418,7 @@ namespace clang {
 
   /// RAII class that helps handle the parsing of an open/close delimiter
   /// pair, such as braces { ... } or parentheses ( ... ).
-  class BalancedDelimiterTracker : public GreaterThanIsOperatorScope {
+  class CLANG_ABI BalancedDelimiterTracker : public GreaterThanIsOperatorScope {
     Parser& P;
     tok::TokenKind Kind, Close, FinalToken;
     SourceLocation (Parser::*Consumer)();
diff --git a/clang/include/clang/Rewrite/Core/HTMLRewrite.h b/clang/include/clang/Rewrite/Core/HTMLRewrite.h
index 9edb514d566b9c..9d5daf9ba1df37 100644
--- a/clang/include/clang/Rewrite/Core/HTMLRewrite.h
+++ b/clang/include/clang/Rewrite/Core/HTMLRewrite.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_REWRITE_CORE_HTMLREWRITE_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include <string>
 
 namespace llvm {
@@ -35,13 +36,13 @@ namespace html {
   /// and HighlightMacros() to it so that to avoid re-lexing the file each time.
   /// The cache may outlive the rewriter as long as cached FileIDs and source
   /// locations continue to make sense for the translation unit as a whole.
-  RelexRewriteCacheRef instantiateRelexRewriteCache();
+  CLANG_ABI RelexRewriteCacheRef instantiateRelexRewriteCache();
 
   /// HighlightRange - Highlight a range in the source code with the specified
   /// start/end tags.  B/E must be in the same file.  This ensures that
   /// start/end tags are placed at the start/end of each line if the range is
   /// multiline.
-  void HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
+  CLANG_ABI void HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
                       const char *StartTag, const char *EndTag,
                       bool IsTokenRange = true);
 
@@ -56,37 +57,37 @@ namespace html {
 
   /// HighlightRange - This is the same as the above method, but takes
   /// decomposed file locations.
-  void HighlightRange(llvm::RewriteBuffer &RB, unsigned B, unsigned E,
+  CLANG_ABI void HighlightRange(llvm::RewriteBuffer &RB, unsigned B, unsigned E,
                       const char *BufferStart, const char *StartTag,
                       const char *EndTag);
 
   /// EscapeText - HTMLize a specified file so that special characters are
   /// are translated so that they are not interpreted as HTML tags.
-  void EscapeText(Rewriter& R, FileID FID,
+  CLANG_ABI void EscapeText(Rewriter& R, FileID FID,
                   bool EscapeSpaces = false, bool ReplaceTabs = false);
 
   /// EscapeText - HTMLized the provided string so that special characters
   ///  in 's' are not interpreted as HTML tags.  Unlike the version of
   ///  EscapeText that rewrites a file, this version by default replaces tabs
   ///  with spaces.
-  std::string EscapeText(StringRef s,
+  CLANG_ABI std::string EscapeText(StringRef s,
                          bool EscapeSpaces = false, bool ReplaceTabs = false);
 
-  void AddLineNumbers(Rewriter& R, FileID FID);
+  CLANG_ABI void AddLineNumbers(Rewriter& R, FileID FID);
 
-  void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID,
+  CLANG_ABI void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID,
                                          StringRef title);
 
   /// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
   /// information about keywords, comments, etc.
-  void SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP,
+  CLANG_ABI void SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP,
                        RelexRewriteCacheRef Cache = nullptr);
 
   /// HighlightMacros - This uses the macro table state from the end of the
   /// file, to reexpand macros and insert (into the HTML) information about the
   /// macro expansions.  This won't be perfectly perfect, but it will be
   /// reasonably close.
-  void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP,
+  CLANG_ABI void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP,
                        RelexRewriteCacheRef Cache = nullptr);
 
 } // end html namespace
diff --git a/clang/include/clang/Rewrite/Core/Rewriter.h b/clang/include/clang/Rewrite/Core/Rewriter.h
index 4e96f6fcca919c..a0607b70ea7798 100644
--- a/clang/include/clang/Rewrite/Core/Rewriter.h
+++ b/clang/include/clang/Rewrite/Core/Rewriter.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/RewriteBuffer.h"
 #include "llvm/ADT/StringRef.h"
 #include <map>
@@ -29,7 +30,7 @@ class SourceManager;
 /// Rewriter - This is the main interface to the rewrite buffers.  Its primary
 /// job is to dispatch high-level requests to the low-level RewriteBuffers that
 /// are involved.
-class Rewriter {
+class CLANG_ABI Rewriter {
   SourceManager *SourceMgr = nullptr;
   const LangOptions *LangOpts = nullptr;
   std::map<FileID, llvm::RewriteBuffer> RewriteBuffers;
diff --git a/clang/include/clang/Rewrite/Core/TokenRewriter.h b/clang/include/clang/Rewrite/Core/TokenRewriter.h
index 13ca2ddec30329..0d35352e7c41bf 100644
--- a/clang/include/clang/Rewrite/Core/TokenRewriter.h
+++ b/clang/include/clang/Rewrite/Core/TokenRewriter.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include <cassert>
 #include <list>
 #include <map>
@@ -27,7 +28,7 @@ class LangOptions;
 class ScratchBuffer;
 class SourceManager;
 
-  class TokenRewriter {
+  class CLANG_ABI TokenRewriter {
     /// TokenList - This is the list of raw tokens that make up this file.  Each
     /// of these tokens has a unique SourceLocation, which is a FileID.
     std::list<Token> TokenList;
diff --git a/clang/include/clang/Rewrite/Frontend/ASTConsumers.h b/clang/include/clang/Rewrite/Frontend/ASTConsumers.h
index 618b38050dc7c9..3ef8418cc243f3 100644
--- a/clang/include/clang/Rewrite/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Rewrite/Frontend/ASTConsumers.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_REWRITE_FRONTEND_ASTCONSUMERS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 #include <string>
 
@@ -26,11 +27,11 @@ class Preprocessor;
 
 // ObjC rewriter: attempts to rewrite ObjC constructs into pure C code.
 // This is considered experimental, and only works with Apple's ObjC runtime.
-std::unique_ptr<ASTConsumer>
+CLANG_ABI std::unique_ptr<ASTConsumer>
 CreateObjCRewriter(const std::string &InFile, std::unique_ptr<raw_ostream> OS,
                    DiagnosticsEngine &Diags, const LangOptions &LOpts,
                    bool SilenceRewriteMacroWarning);
-std::unique_ptr<ASTConsumer>
+CLANG_ABI std::unique_ptr<ASTConsumer>
 CreateModernObjCRewriter(const std::string &InFile,
                          std::unique_ptr<raw_ostream> OS,
                          DiagnosticsEngine &Diags, const LangOptions &LOpts,
@@ -38,7 +39,7 @@ CreateModernObjCRewriter(const std::string &InFile,
 
 /// CreateHTMLPrinter - Create an AST consumer which rewrites source code to
 /// HTML with syntax highlighting suitable for viewing in a web-browser.
-std::unique_ptr<ASTConsumer> CreateHTMLPrinter(std::unique_ptr<raw_ostream> OS,
+CLANG_ABI std::unique_ptr<ASTConsumer> CreateHTMLPrinter(std::unique_ptr<raw_ostream> OS,
                                                Preprocessor &PP,
                                                bool SyntaxHighlight = true,
                                                bool HighlightMacros = true);
diff --git a/clang/include/clang/Rewrite/Frontend/FixItRewriter.h b/clang/include/clang/Rewrite/Frontend/FixItRewriter.h
index f514f3628a559b..1e6e13bfa3c169 100644
--- a/clang/include/clang/Rewrite/Frontend/FixItRewriter.h
+++ b/clang/include/clang/Rewrite/Frontend/FixItRewriter.h
@@ -20,6 +20,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Edit/EditedSource.h"
 #include "clang/Rewrite/Core/Rewriter.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 #include <string>
 #include <utility>
@@ -30,7 +31,7 @@ namespace clang {
 class LangOptions;
 class SourceManager;
 
-class FixItOptions {
+class CLANG_ABI FixItOptions {
 public:
   FixItOptions() = default;
   virtual ~FixItOptions();
@@ -59,7 +60,7 @@ class FixItOptions {
   bool Silent = false;
 };
 
-class FixItRewriter : public DiagnosticConsumer {
+class CLANG_ABI FixItRewriter : public DiagnosticConsumer {
   /// The diagnostics machinery.
   DiagnosticsEngine &Diags;
 
diff --git a/clang/include/clang/Rewrite/Frontend/FrontendActions.h b/clang/include/clang/Rewrite/Frontend/FrontendActions.h
index 4e9d1941bce083..a439165c71dd68 100644
--- a/clang/include/clang/Rewrite/Frontend/FrontendActions.h
+++ b/clang/include/clang/Rewrite/Frontend/FrontendActions.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_REWRITE_FRONTEND_FRONTENDACTIONS_H
 
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -20,13 +21,13 @@ class FixItOptions;
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
 
-class HTMLPrintAction : public ASTFrontendAction {
+class CLANG_ABI HTMLPrintAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class FixItAction : public ASTFrontendAction {
+class CLANG_ABI FixItAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<FixItRewriter> Rewriter;
   std::unique_ptr<FixItOptions> FixItOpts;
@@ -47,7 +48,7 @@ class FixItAction : public ASTFrontendAction {
 
 /// Emits changes to temporary files and uses them for the original
 /// frontend action.
-class FixItRecompile : public WrapperFrontendAction {
+class CLANG_ABI FixItRecompile : public WrapperFrontendAction {
 public:
   FixItRecompile(std::unique_ptr<FrontendAction> WrappedAction)
     : WrapperFrontendAction(std::move(WrappedAction)) {}
@@ -56,23 +57,23 @@ class FixItRecompile : public WrapperFrontendAction {
   bool BeginInvocation(CompilerInstance &CI) override;
 };
 
-class RewriteObjCAction : public ASTFrontendAction {
+class CLANG_ABI RewriteObjCAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
 };
 
-class RewriteMacrosAction : public PreprocessorFrontendAction {
+class CLANG_ABI RewriteMacrosAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 };
 
-class RewriteTestAction : public PreprocessorFrontendAction {
+class CLANG_ABI RewriteTestAction : public PreprocessorFrontendAction {
 protected:
   void ExecuteAction() override;
 };
 
-class RewriteIncludesAction : public PreprocessorFrontendAction {
+class CLANG_ABI RewriteIncludesAction : public PreprocessorFrontendAction {
   std::shared_ptr<raw_ostream> OutputStream;
   class RewriteImportsListener;
 protected:
diff --git a/clang/include/clang/Rewrite/Frontend/Rewriters.h b/clang/include/clang/Rewrite/Frontend/Rewriters.h
index 3f9332219c3bea..4f24a65d8909b8 100644
--- a/clang/include/clang/Rewrite/Frontend/Rewriters.h
+++ b/clang/include/clang/Rewrite/Frontend/Rewriters.h
@@ -14,19 +14,20 @@
 #define LLVM_CLANG_REWRITE_FRONTEND_REWRITERS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class Preprocessor;
 class PreprocessorOutputOptions;
 
 /// RewriteMacrosInInput - Implement -rewrite-macros mode.
-void RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS);
+CLANG_ABI void RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS);
 
 /// DoRewriteTest - A simple test for the TokenRewriter class.
-void DoRewriteTest(Preprocessor &PP, raw_ostream *OS);
+CLANG_ABI void DoRewriteTest(Preprocessor &PP, raw_ostream *OS);
 
 /// RewriteIncludesInInput - Implement -frewrite-includes mode.
-void RewriteIncludesInInput(Preprocessor &PP, raw_ostream *OS,
+CLANG_ABI void RewriteIncludesInInput(Preprocessor &PP, raw_ostream *OS,
                             const PreprocessorOutputOptions &Opts);
 
 }  // end namespace clang
diff --git a/clang/include/clang/Sema/AnalysisBasedWarnings.h b/clang/include/clang/Sema/AnalysisBasedWarnings.h
index aafe227b84084c..c92d62d224a343 100644
--- a/clang/include/clang/Sema/AnalysisBasedWarnings.h
+++ b/clang/include/clang/Sema/AnalysisBasedWarnings.h
@@ -14,6 +14,7 @@
 #define LLVM_CLANG_SEMA_ANALYSISBASEDWARNINGS_H
 
 #include "clang/AST/Decl.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include <memory>
 
@@ -29,9 +30,9 @@ namespace sema {
 
 namespace sema {
 
-class AnalysisBasedWarnings {
+class CLANG_ABI AnalysisBasedWarnings {
 public:
-  class Policy {
+  class CLANG_ABI Policy {
     friend class AnalysisBasedWarnings;
     // The warnings to run.
     LLVM_PREFERRED_TYPE(bool)
diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h
index 0924dc27af82b5..6844155b765f05 100644
--- a/clang/include/clang/Sema/CodeCompleteConsumer.h
+++ b/clang/include/clang/Sema/CodeCompleteConsumer.h
@@ -19,6 +19,7 @@
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Sema/CodeCompleteOptions.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -158,11 +159,11 @@ enum SimplifiedTypeClass {
 };
 
 /// Determine the simplified type class of the given canonical type.
-SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T);
+CLANG_ABI SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T);
 
 /// Determine the type that this declaration will have if it is used
 /// as a type or in an expression.
-QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND);
+CLANG_ABI QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND);
 
 /// Determine the priority to be given to a macro code completion result
 /// with the given name.
@@ -173,17 +174,17 @@ QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND);
 ///
 /// \param PreferredTypeIsPointer Whether the preferred type for the context
 /// of this macro is a pointer type.
-unsigned getMacroUsagePriority(StringRef MacroName,
+CLANG_ABI unsigned getMacroUsagePriority(StringRef MacroName,
                                const LangOptions &LangOpts,
                                bool PreferredTypeIsPointer = false);
 
 /// Determine the libclang cursor kind associated with the given
 /// declaration.
-CXCursorKind getCursorKindForDecl(const Decl *D);
+CLANG_ABI CXCursorKind getCursorKindForDecl(const Decl *D);
 
 /// The context in which code completion occurred, so that the
 /// code-completion consumer can process the results accordingly.
-class CodeCompletionContext {
+class CLANG_ABI CodeCompletionContext {
 public:
   enum Kind {
     /// An unspecified code-completion context.
@@ -438,7 +439,7 @@ class CodeCompletionContext {
 };
 
 /// Get string representation of \p Kind, useful for debugging.
-llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind);
+CLANG_ABI llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind);
 
 /// A "string" used to describe how code completion can
 /// be performed for an entity.
@@ -447,7 +448,7 @@ llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind);
 /// used. For example, the code completion string for a function would show
 /// the syntax to call it, including the parentheses, placeholders for the
 /// arguments, etc.
-class CodeCompletionString {
+class CLANG_ABI CodeCompletionString {
 public:
   /// The different kinds of "chunks" that can occur within a code
   /// completion string.
@@ -527,7 +528,7 @@ class CodeCompletionString {
   };
 
   /// One piece of the code completion string.
-  struct Chunk {
+  struct CLANG_ABI Chunk {
     /// The kind of data stored in this piece of the code completion
     /// string.
     ChunkKind Kind = CK_Text;
@@ -648,7 +649,7 @@ class CodeCompletionString {
 };
 
 /// An allocator used specifically for the purpose of code completion.
-class CodeCompletionAllocator : public llvm::BumpPtrAllocator {
+class CLANG_ABI CodeCompletionAllocator : public llvm::BumpPtrAllocator {
 public:
   /// Copy the given string into this allocator.
   const char *CopyString(const Twine &String);
@@ -657,7 +658,7 @@ class CodeCompletionAllocator : public llvm::BumpPtrAllocator {
 /// Allocator for a cached set of global code completions.
 class GlobalCodeCompletionAllocator : public CodeCompletionAllocator {};
 
-class CodeCompletionTUInfo {
+class CLANG_ABI CodeCompletionTUInfo {
   llvm::DenseMap<const DeclContext *, StringRef> ParentNames;
   std::shared_ptr<GlobalCodeCompletionAllocator> AllocatorRef;
 
@@ -683,7 +684,7 @@ class CodeCompletionTUInfo {
 namespace clang {
 
 /// A builder class used to construct new code-completion strings.
-class CodeCompletionBuilder {
+class CLANG_ABI CodeCompletionBuilder {
 public:
   using Chunk = CodeCompletionString::Chunk;
 
@@ -758,7 +759,7 @@ class CodeCompletionBuilder {
 };
 
 /// Captures a result of code completion.
-class CodeCompletionResult {
+class CLANG_ABI CodeCompletionResult {
 public:
   /// Describes the kind of result generated.
   enum ResultKind {
@@ -997,7 +998,7 @@ class CodeCompletionResult {
   void computeCursorKindAndAvailability(bool Accessible = true);
 };
 
-bool operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y);
+CLANG_ABI bool operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y);
 
 inline bool operator>(const CodeCompletionResult &X,
                       const CodeCompletionResult &Y) {
@@ -1016,12 +1017,12 @@ inline bool operator>=(const CodeCompletionResult &X,
 
 /// Abstract interface for a consumer of code-completion
 /// information.
-class CodeCompleteConsumer {
+class CLANG_ABI CodeCompleteConsumer {
 protected:
   const CodeCompleteOptions CodeCompleteOpts;
 
 public:
-  class OverloadCandidate {
+  class CLANG_ABI OverloadCandidate {
   public:
     /// Describes the type of overload candidate.
     enum CandidateKind {
@@ -1242,24 +1243,24 @@ class CodeCompleteConsumer {
 
 /// Get the documentation comment used to produce
 /// CodeCompletionString::BriefComment for RK_Declaration.
-const RawComment *getCompletionComment(const ASTContext &Ctx,
+CLANG_ABI const RawComment *getCompletionComment(const ASTContext &Ctx,
                                        const NamedDecl *Decl);
 
 /// Get the documentation comment used to produce
 /// CodeCompletionString::BriefComment for RK_Pattern.
-const RawComment *getPatternCompletionComment(const ASTContext &Ctx,
+CLANG_ABI const RawComment *getPatternCompletionComment(const ASTContext &Ctx,
                                               const NamedDecl *Decl);
 
 /// Get the documentation comment used to produce
 /// CodeCompletionString::BriefComment for OverloadCandidate.
-const RawComment *
+CLANG_ABI const RawComment *
 getParameterComment(const ASTContext &Ctx,
                     const CodeCompleteConsumer::OverloadCandidate &Result,
                     unsigned ArgIndex);
 
 /// A simple code-completion consumer that prints the results it
 /// receives in a simple format.
-class PrintingCodeCompleteConsumer : public CodeCompleteConsumer {
+class CLANG_ABI PrintingCodeCompleteConsumer : public CodeCompleteConsumer {
   /// The raw output stream.
   raw_ostream &OS;
 
diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h
index 06243f2624876f..82aec69d96021e 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -32,6 +32,7 @@
 #include "clang/Lex/Token.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/ParsedAttr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Compiler.h"
@@ -71,7 +72,7 @@ namespace clang {
 /// If CXXScopeSpec refers to SomeType<T> then TemplateParamLists will contain
 /// a single element referring to template <class T>.
 
-class CXXScopeSpec {
+class CLANG_ABI CXXScopeSpec {
   SourceRange Range;
   NestedNameSpecifierLocBuilder Builder;
   ArrayRef<TemplateParameterList *> TemplateParamLists;
@@ -244,7 +245,7 @@ class CXXScopeSpec {
 ///
 /// "Declaration specifiers" encompasses storage-class-specifiers,
 /// type-specifiers, type-qualifiers, and function-specifiers.
-class DeclSpec {
+class CLANG_ABI DeclSpec {
 public:
   /// storage-class-specifier
   /// \note The order of these enumerators is important for diagnostics.
@@ -1025,7 +1026,7 @@ enum class UnqualifiedIdKind {
 };
 
 /// Represents a C++ unqualified-id that has been parsed.
-class UnqualifiedId {
+class CLANG_ABI UnqualifiedId {
 private:
   UnqualifiedId(const UnqualifiedId &Other) = delete;
   const UnqualifiedId &operator=(const UnqualifiedId &) = delete;
@@ -1248,7 +1249,7 @@ typedef SmallVector<Token, 4> CachedTokens;
 /// declarator that is parsed.
 ///
 /// This is intended to be a small value object.
-struct DeclaratorChunk {
+struct CLANG_ABI DeclaratorChunk {
   DeclaratorChunk() {};
 
   enum {
@@ -1900,7 +1901,7 @@ enum class ImplicitTypenameContext {
 ///
 /// Instances of this class should be a transient object that lives on the
 /// stack, not objects that are allocated in large quantities on the heap.
-class Declarator {
+class CLANG_ABI Declarator {
 
 private:
   const DeclSpec &DS;
@@ -2780,7 +2781,7 @@ struct FieldDeclarator {
 };
 
 /// Represents a C++11 virt-specifier-seq.
-class VirtSpecifiers {
+class CLANG_ABI VirtSpecifiers {
 public:
   enum Specifier {
     VS_None = 0,
diff --git a/clang/include/clang/Sema/DelayedDiagnostic.h b/clang/include/clang/Sema/DelayedDiagnostic.h
index 0105089a393f17..fa4c76a93a0243 100644
--- a/clang/include/clang/Sema/DelayedDiagnostic.h
+++ b/clang/include/clang/Sema/DelayedDiagnostic.h
@@ -30,6 +30,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -123,7 +124,7 @@ class AccessedEntity {
 
 /// A diagnostic message which has been conditionally emitted pending
 /// the complete parsing of the current declaration.
-class DelayedDiagnostic {
+class CLANG_ABI DelayedDiagnostic {
 public:
   enum DDKind : unsigned char { Availability, Access, ForbiddenType };
 
diff --git a/clang/include/clang/Sema/ExternalSemaSource.h b/clang/include/clang/Sema/ExternalSemaSource.h
index 11cd69df88d1c1..f9d109a1f504b2 100644
--- a/clang/include/clang/Sema/ExternalSemaSource.h
+++ b/clang/include/clang/Sema/ExternalSemaSource.h
@@ -16,6 +16,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Sema/TypoCorrection.h"
 #include "clang/Sema/Weak.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include <utility>
 
@@ -47,7 +48,7 @@ struct ExternalVTableUse {
 /// An abstract interface that should be implemented by
 /// external AST sources that also provide information for semantic
 /// analysis.
-class ExternalSemaSource : public ExternalASTSource {
+class CLANG_ABI ExternalSemaSource : public ExternalASTSource {
   /// LLVM-style RTTI.
   static char ID;
 
diff --git a/clang/include/clang/Sema/HLSLExternalSemaSource.h b/clang/include/clang/Sema/HLSLExternalSemaSource.h
index 3c7495e66055dc..94ef283ce3ffc3 100644
--- a/clang/include/clang/Sema/HLSLExternalSemaSource.h
+++ b/clang/include/clang/Sema/HLSLExternalSemaSource.h
@@ -12,6 +12,7 @@
 #ifndef CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
 #define CLANG_SEMA_HLSLEXTERNALSEMASOURCE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 
 #include "clang/Sema/ExternalSemaSource.h"
@@ -20,7 +21,7 @@ namespace clang {
 class NamespaceDecl;
 class Sema;
 
-class HLSLExternalSemaSource : public ExternalSemaSource {
+class CLANG_ABI HLSLExternalSemaSource : public ExternalSemaSource {
   Sema *SemaPtr = nullptr;
   NamespaceDecl *HLSLNamespace = nullptr;
 
diff --git a/clang/include/clang/Sema/IdentifierResolver.h b/clang/include/clang/Sema/IdentifierResolver.h
index 557f513146406f..817fceeeb9a27d 100644
--- a/clang/include/clang/Sema/IdentifierResolver.h
+++ b/clang/include/clang/Sema/IdentifierResolver.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_SEMA_IDENTIFIERRESOLVER_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <cassert>
 #include <cstddef>
@@ -35,12 +36,12 @@ class Scope;
 /// IdentifierResolver - Keeps track of shadowed decls on enclosing
 /// scopes.  It manages the shadowing chains of declaration names and
 /// implements efficient decl lookup based on a declaration name.
-class IdentifierResolver {
+class CLANG_ABI IdentifierResolver {
   /// IdDeclInfo - Keeps track of information about decls associated
   /// to a particular declaration name. IdDeclInfos are lazily
   /// constructed and assigned to a declaration name the first time a
   /// decl with that declaration name is shadowed in some scope.
-  class IdDeclInfo {
+  class CLANG_ABI IdDeclInfo {
   public:
     using DeclsTy = SmallVector<NamedDecl *, 2>;
 
@@ -66,7 +67,7 @@ class IdentifierResolver {
   /// iterator - Iterate over the decls of a specified declaration name.
   /// It will walk or not the parent declaration contexts depending on how
   /// it was instantiated.
-  class iterator {
+  class CLANG_ABI iterator {
   public:
     friend class IdentifierResolver;
 
diff --git a/clang/include/clang/Sema/Initialization.h b/clang/include/clang/Sema/Initialization.h
index 0455e1fa5016bb..a00b97c4af0fa7 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -27,6 +27,7 @@
 #include "clang/Basic/Specifiers.h"
 #include "clang/Sema/Overload.h"
 #include "clang/Sema/Ownership.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -44,7 +45,7 @@ class ObjCMethodDecl;
 class Sema;
 
 /// Describes an entity that is being initialized.
-class alignas(8) InitializedEntity {
+class CLANG_ABI alignas(8) InitializedEntity {
 public:
   /// Specifies the kind of entity being initialized.
   enum EntityKind {
@@ -799,7 +800,7 @@ class InitializationKind {
 
 /// Describes the sequence of initializations required to initialize
 /// a given object or reference with a set of arguments.
-class InitializationSequence {
+class CLANG_ABI InitializationSequence {
 public:
   /// Describes the kind of initialization sequence computed.
   enum SequenceKind {
@@ -945,7 +946,7 @@ class InitializationSequence {
   };
 
   /// A single step in the initialization sequence.
-  class Step {
+  class CLANG_ABI Step {
   public:
     /// The kind of conversion or initialization step we are taking.
     StepKind Kind;
diff --git a/clang/include/clang/Sema/Lookup.h b/clang/include/clang/Sema/Lookup.h
index b0a08a05ac6a0a..d55130632fabbe 100644
--- a/clang/include/clang/Sema/Lookup.h
+++ b/clang/include/clang/Sema/Lookup.h
@@ -25,6 +25,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Casting.h"
@@ -43,7 +44,7 @@ class CXXBasePaths;
 /// a single declaration, a set of overloaded functions, or an
 /// ambiguity. Use the getKind() method to determine which of these
 /// results occurred for a given lookup.
-class LookupResult {
+class CLANG_ABI LookupResult {
 public:
   enum LookupResultKind {
     /// No entity found met the criteria.
@@ -833,7 +834,7 @@ class LookupResult {
 /// This abstract class is meant to be subclassed by clients of \c
 /// Sema::LookupVisibleDecls(), each of which should override the \c
 /// FoundDecl() function to process declarations as they are found.
-class VisibleDeclConsumer {
+class CLANG_ABI VisibleDeclConsumer {
 public:
   /// Destroys the visible declaration consumer.
   virtual ~VisibleDeclConsumer();
@@ -866,7 +867,7 @@ class VisibleDeclConsumer {
 };
 
 /// A class for storing results from argument-dependent lookup.
-class ADLResult {
+class CLANG_ABI ADLResult {
 private:
   /// A map from canonical decls to the 'most recent' decl.
   llvm::MapVector<NamedDecl*, NamedDecl*> Decls;
diff --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
index 3d1906d8699265..af469a747d0f8a 100644
--- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h
+++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
@@ -14,6 +14,7 @@
 
 #include "clang/Sema/ExternalSemaSource.h"
 #include "clang/Sema/Weak.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <utility>
 
@@ -35,7 +36,7 @@ namespace clang {
 /// An abstract interface that should be implemented by
 /// external AST sources that also provide information for semantic
 /// analysis.
-class MultiplexExternalSemaSource : public ExternalSemaSource {
+class CLANG_ABI MultiplexExternalSemaSource : public ExternalSemaSource {
   /// LLVM-style RTTI.
   static char ID;
 
diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h
index c716a25bb673b8..60e8cce9c93dad 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -25,6 +25,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/SemaFixItUtils.h"
 #include "clang/Sema/TemplateDeduction.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -257,9 +258,9 @@ class Sema;
     ICR_HLSL_Dimension_Reduction_Conversion,
   };
 
-  ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);
+  CLANG_ABI ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind);
 
-  ImplicitConversionRank
+  CLANG_ABI ImplicitConversionRank
   GetDimensionConversionRank(ImplicitConversionRank Base,
                              ImplicitConversionKind Dimension);
 
@@ -289,7 +290,7 @@ class Sema;
   /// contains between zero and three conversions. If a particular
   /// conversion is not needed, it will be set to the identity conversion
   /// (ICK_Identity).
-  class StandardConversionSequence {
+  class CLANG_ABI StandardConversionSequence {
   public:
     /// First -- The first conversion can be an lvalue-to-rvalue
     /// conversion, array-to-pointer conversion, or
@@ -419,7 +420,7 @@ class Sema;
 
   /// UserDefinedConversionSequence - Represents a user-defined
   /// conversion sequence (C++ 13.3.3.1.2).
-  struct UserDefinedConversionSequence {
+  struct CLANG_ABI UserDefinedConversionSequence {
     /// Represents the standard conversion that occurs before
     /// the actual user-defined conversion.
     ///
@@ -464,7 +465,7 @@ class Sema;
   };
 
   /// Represents an ambiguous user-defined conversion sequence.
-  struct AmbiguousConversionSequence {
+  struct CLANG_ABI AmbiguousConversionSequence {
     using ConversionSet =
         SmallVector<std::pair<NamedDecl *, FunctionDecl *>, 4>;
 
@@ -564,7 +565,7 @@ class Sema;
   /// sequence, which may be a standard conversion sequence
   /// (C++ 13.3.3.1.1), user-defined conversion sequence (C++ 13.3.3.1.2),
   /// or an ellipsis conversion sequence (C++ 13.3.3.1.3).
-  class ImplicitConversionSequence {
+  class CLANG_ABI ImplicitConversionSequence {
   public:
     /// Kind - The kind of implicit conversion sequence. BadConversion
     /// specifies that there is no conversion from the source type to
@@ -869,7 +870,7 @@ class Sema;
       llvm::MutableArrayRef<ImplicitConversionSequence>;
 
   /// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
-  struct OverloadCandidate {
+  struct CLANG_ABI OverloadCandidate {
     /// Function - The actual function that this candidate
     /// represents. When NULL, this is a built-in candidate
     /// (C++ [over.oper]) or a surrogate for a conversion to a
@@ -1005,7 +1006,7 @@ class Sema;
 
   /// OverloadCandidateSet - A set of overload candidates, used in C++
   /// overload resolution (C++ 13.3).
-  class OverloadCandidateSet {
+  class CLANG_ABI OverloadCandidateSet {
   public:
     enum CandidateSetKind {
       /// Normal lookup.
@@ -1035,7 +1036,7 @@ class Sema;
 
     /// Information about operator rewrites to consider when adding operator
     /// functions to a candidate set.
-    struct OperatorRewriteInfo {
+    struct CLANG_ABI OperatorRewriteInfo {
       OperatorRewriteInfo()
           : OriginalOperator(OO_None), OpLoc(), AllowRewrittenCandidates(false) {}
       OperatorRewriteInfo(OverloadedOperatorKind Op, SourceLocation OpLoc,
@@ -1254,7 +1255,7 @@ class Sema;
 
   };
 
-  bool isBetterOverloadCandidate(Sema &S,
+  CLANG_ABI bool isBetterOverloadCandidate(Sema &S,
                                  const OverloadCandidate &Cand1,
                                  const OverloadCandidate &Cand2,
                                  SourceLocation Loc,
@@ -1298,7 +1299,7 @@ class Sema;
   // type of the next argument (that the user is typing) will be, this is as
   // good candidate as we can get, despite the fact that it takes one less
   // parameter.
-  bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function);
+  CLANG_ABI bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h
index 22cbd0d90ee432..8f6ef412df4d3e 100644
--- a/clang/include/clang/Sema/ParsedAttr.h
+++ b/clang/include/clang/Sema/ParsedAttr.h
@@ -20,6 +20,7 @@
 #include "clang/Basic/ParsedAttrInfo.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/Ownership.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Allocator.h"
@@ -100,7 +101,7 @@ struct PropertyData {
 } // namespace detail
 
 /// Wraps an identifier and optional source location for the identifier.
-struct IdentifierLoc {
+struct CLANG_ABI IdentifierLoc {
   SourceLocation Loc;
   IdentifierInfo *Ident;
 
@@ -122,7 +123,7 @@ using ArgsVector = llvm::SmallVector<ArgsUnion, 12U>;
 /// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
 /// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
 ///
-class ParsedAttr final
+class CLANG_ABI ParsedAttr final
     : public AttributeCommonInfo,
       private llvm::TrailingObjects<
           ParsedAttr, ArgsUnion, detail::AvailabilityData,
@@ -636,7 +637,7 @@ class AttributePool;
 ///
 /// Note that it's tolerably cheap to create and destroy one of
 /// these as long as you don't actually allocate anything in it.
-class AttributeFactory {
+class CLANG_ABI AttributeFactory {
 public:
   enum {
     AvailabilityAllocSize =
@@ -691,7 +692,7 @@ class AttributeFactory {
 };
 
 class ParsedAttributesView;
-class AttributePool {
+class CLANG_ABI AttributePool {
   friend class AttributeFactory;
   friend class ParsedAttributes;
   AttributeFactory &Factory;
@@ -1071,7 +1072,7 @@ class ParsedAttributes : public ParsedAttributesView {
 
 /// Consumes the attributes from `First` and `Second` and concatenates them into
 /// `Result`. Sets `Result.Range` to the combined range of `First` and `Second`.
-void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second,
+CLANG_ABI void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second,
                              ParsedAttributes &Result);
 
 /// These constants match the enumerated choices of
diff --git a/clang/include/clang/Sema/ParsedTemplate.h b/clang/include/clang/Sema/ParsedTemplate.h
index ac4dbbf294caf2..191dc1558efb70 100644
--- a/clang/include/clang/Sema/ParsedTemplate.h
+++ b/clang/include/clang/Sema/ParsedTemplate.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/TemplateKinds.h"
 #include "clang/Sema/DeclSpec.h"
 #include "clang/Sema/Ownership.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <cassert>
 #include <cstdlib>
@@ -26,7 +27,7 @@
 
 namespace clang {
   /// Represents the parsed form of a C++ template argument.
-  class ParsedTemplateArgument {
+  class CLANG_ABI ParsedTemplateArgument {
   public:
     /// Describes the kind of template argument that was parsed.
     enum KindType {
@@ -256,7 +257,7 @@ namespace clang {
   };
 
   /// Retrieves the range of the given template parameter lists.
-  SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params,
+  CLANG_ABI SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params,
                                      unsigned NumParams);
 } // end namespace clang
 
diff --git a/clang/include/clang/Sema/RISCVIntrinsicManager.h b/clang/include/clang/Sema/RISCVIntrinsicManager.h
index 2a3dd1e7c4697b..d4cd3255c19d6e 100644
--- a/clang/include/clang/Sema/RISCVIntrinsicManager.h
+++ b/clang/include/clang/Sema/RISCVIntrinsicManager.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_SEMA_RISCVINTRINSICMANAGER_H
 #define LLVM_CLANG_SEMA_RISCVINTRINSICMANAGER_H
 
+#include "clang/Support/Compiler.h"
 #include <cstdint>
 
 namespace clang {
@@ -22,7 +23,7 @@ class IdentifierInfo;
 class Preprocessor;
 
 namespace sema {
-class RISCVIntrinsicManager {
+class CLANG_ABI RISCVIntrinsicManager {
 public:
   enum class IntrinsicKind : uint8_t { RVV, SIFIVE_VECTOR };
 
diff --git a/clang/include/clang/Sema/Scope.h b/clang/include/clang/Sema/Scope.h
index 084db730342191..cf32b5597c18ca 100644
--- a/clang/include/clang/Sema/Scope.h
+++ b/clang/include/clang/Sema/Scope.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -38,7 +39,7 @@ class VarDecl;
 /// Scope - A scope is a transient data structure that is used while parsing the
 /// program.  It assists with resolving identifiers to the appropriate
 /// declaration.
-class Scope {
+class CLANG_ABI Scope {
 public:
   /// ScopeFlags - These are bitfields that are or'd together when creating a
   /// scope, which defines the sorts of things the scope contains.
diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h
index 958d65055fa9b2..da81b5c425bb17 100644
--- a/clang/include/clang/Sema/ScopeInfo.h
+++ b/clang/include/clang/Sema/ScopeInfo.h
@@ -23,6 +23,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/CleanupInfo.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/MapVector.h"
@@ -101,7 +102,7 @@ enum class FirstCoroutineStmtKind { CoReturn, CoAwait, CoYield };
 
 /// Retains information about a function, method, or block that is
 /// currently being parsed.
-class FunctionScopeInfo {
+class CLANG_ABI FunctionScopeInfo {
 protected:
   enum ScopeKind {
     SK_Function,
@@ -268,7 +269,7 @@ class FunctionScopeInfo {
   ///
   /// Objects are identified with only two Decls to make it reasonably fast to
   /// compare them.
-  class WeakObjectProfileTy {
+  class CLANG_ABI WeakObjectProfileTy {
     /// The base object decl, as described in the class documentation.
     ///
     /// The extra flag is "true" if the Base and Property are enough to uniquely
@@ -556,7 +557,7 @@ class FunctionScopeInfo {
   bool isPlainFunction() const { return Kind == SK_Function; }
 };
 
-class Capture {
+class CLANG_ABI Capture {
   // There are three categories of capture: capturing 'this', capturing
   // local variables, and C++1y initialized captures (which can have an
   // arbitrary initializer, and don't really capture in the traditional
@@ -695,7 +696,7 @@ class Capture {
   QualType getCaptureType() const { return CaptureType; }
 };
 
-class CapturingScopeInfo : public FunctionScopeInfo {
+class CLANG_ABI CapturingScopeInfo : public FunctionScopeInfo {
 protected:
   CapturingScopeInfo(const CapturingScopeInfo&) = default;
 
@@ -787,7 +788,7 @@ class CapturingScopeInfo : public FunctionScopeInfo {
 };
 
 /// Retains information about a block that is currently being parsed.
-class BlockScopeInfo final : public CapturingScopeInfo {
+class CLANG_ABI BlockScopeInfo final : public CapturingScopeInfo {
 public:
   BlockDecl *TheDecl;
 
@@ -813,7 +814,7 @@ class BlockScopeInfo final : public CapturingScopeInfo {
 };
 
 /// Retains information about a captured region.
-class CapturedRegionScopeInfo final : public CapturingScopeInfo {
+class CLANG_ABI CapturedRegionScopeInfo final : public CapturingScopeInfo {
 public:
   /// The CapturedDecl for this statement.
   CapturedDecl *TheCapturedDecl;
@@ -864,7 +865,7 @@ class CapturedRegionScopeInfo final : public CapturingScopeInfo {
   }
 };
 
-class LambdaScopeInfo final :
+class CLANG_ABI LambdaScopeInfo final :
     public CapturingScopeInfo, public InventedTemplateParameterInfo {
 public:
   /// The class that describes the lambda.
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 0faa5aed4eec3b..f27af5bc365061 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -65,6 +65,7 @@
 #include "clang/Sema/SemaBase.h"
 #include "clang/Sema/TypoCorrection.h"
 #include "clang/Sema/Weak.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
@@ -224,7 +225,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
 
 namespace threadSafety {
 class BeforeSet;
-void threadSafetyCleanup(BeforeSet *Cache);
+CLANG_ABI void threadSafetyCleanup(BeforeSet *Cache);
 } // namespace threadSafety
 
 // FIXME: No way to easily map from TemplateTypeParmTypes to
@@ -285,7 +286,7 @@ class FileNullabilityMap {
 /// The type is tied to a particular token, all functions that update or consume
 /// the type take a start location of the token they are looking at as a
 /// parameter. This avoids updating the type on hot paths in the parser.
-class PreferredTypeBuilder {
+class CLANG_ABI PreferredTypeBuilder {
 public:
   PreferredTypeBuilder(bool Enabled) : Enabled(Enabled) {}
 
@@ -459,7 +460,7 @@ enum class FunctionEffectMode : uint8_t {
 
 /// Sema - This implements semantic analysis and AST building for C.
 /// \nosubgrouping
-class Sema final : public SemaBase {
+class CLANG_ABI Sema final : public SemaBase {
   // Table of Contents
   // -----------------
   // 1. Semantic Analysis (Sema.cpp)
@@ -661,7 +662,7 @@ class Sema final : public SemaBase {
 
   /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
   /// time after they've been popped.
-  class PoppedFunctionScopeDeleter {
+  class CLANG_ABI PoppedFunctionScopeDeleter {
     Sema *Self;
 
   public:
@@ -983,7 +984,7 @@ class Sema final : public SemaBase {
 
   /// A class which encapsulates the logic for delaying diagnostics
   /// during parsing and other processing.
-  class DelayedDiagnostics {
+  class CLANG_ABI DelayedDiagnostics {
     /// The current pool of diagnostics into which delayed
     /// diagnostics should go.
     sema::DelayedDiagnosticPool *CurPool = nullptr;
@@ -1676,7 +1677,7 @@ class Sema final : public SemaBase {
 
   // RAII object to push / pop sentinel slots for all MS #pragma stacks.
   // Actions should be performed only if we enter / exit a C++ method body.
-  class PragmaStackSentinelRAII {
+  class CLANG_ABI PragmaStackSentinelRAII {
   public:
     PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
     ~PragmaStackSentinelRAII();
@@ -4958,7 +4959,7 @@ class Sema final : public SemaBase {
 
   /// Helper class that collects exception specifications for
   /// implicitly-declared special member functions.
-  class ImplicitExceptionSpecification {
+  class CLANG_ABI ImplicitExceptionSpecification {
     // Pointer to allow copying
     Sema *Self;
     // We order exception specifications thus:
@@ -7193,7 +7194,7 @@ class Sema final : public SemaBase {
 
   /// Abstract base class used for diagnosing integer constant
   /// expression violations.
-  class VerifyICEDiagnoser {
+  class CLANG_ABI VerifyICEDiagnoser {
   public:
     bool Suppress;
 
@@ -7822,7 +7823,7 @@ class Sema final : public SemaBase {
   }
 
   /// Abstract class used to diagnose incomplete types.
-  struct TypeDiagnoser {
+  struct CLANG_ABI TypeDiagnoser {
     TypeDiagnoser() {}
 
     virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
@@ -8012,7 +8013,7 @@ class Sema final : public SemaBase {
 
   /// RAII object used to temporarily allow the C++ 'this' expression
   /// to be used, with the given qualifiers on the current class type.
-  class CXXThisScopeRAII {
+  class CLANG_ABI CXXThisScopeRAII {
     Sema &S;
     QualType OldCXXThisTypeOverride;
     bool Enabled;
@@ -8831,7 +8832,7 @@ class Sema final : public SemaBase {
                                            SourceLocation ConvLocation,
                                            CXXConversionDecl *Conv, Expr *Src);
 
-  class LambdaScopeForCallOperatorInstantiationRAII
+  class CLANG_ABI LambdaScopeForCallOperatorInstantiationRAII
       : private FunctionScopeRAII {
   public:
     LambdaScopeForCallOperatorInstantiationRAII(
@@ -9454,7 +9455,7 @@ class Sema final : public SemaBase {
                              SourceLocation DeclLoc, ArrayRef<Module *> Modules,
                              MissingImportKind MIK, bool Recover);
 
-  struct TypoExprState {
+  struct CLANG_ABI TypoExprState {
     std::unique_ptr<TypoCorrectionConsumer> Consumer;
     TypoDiagnosticGenerator DiagHandler;
     TypoRecoveryCallback RecoveryHandler;
@@ -9995,7 +9996,7 @@ class Sema final : public SemaBase {
 
   /// Abstract base class used to perform a contextual implicit
   /// conversion from an expression to any type passing a filter.
-  class ContextualImplicitConverter {
+  class CLANG_ABI ContextualImplicitConverter {
   public:
     bool Suppress;
     bool SuppressConversion;
@@ -10047,7 +10048,7 @@ class Sema final : public SemaBase {
     virtual ~ContextualImplicitConverter() {}
   };
 
-  class ICEConvertDiagnoser : public ContextualImplicitConverter {
+  class CLANG_ABI ICEConvertDiagnoser : public ContextualImplicitConverter {
     bool AllowScopedEnumerations;
 
   public:
@@ -12618,7 +12619,7 @@ class Sema final : public SemaBase {
   /// A context in which code is being synthesized (where a source location
   /// alone is not sufficient to identify the context). This covers template
   /// instantiation and various forms of implicitly-generated functions.
-  struct CodeSynthesisContext {
+  struct CLANG_ABI CodeSynthesisContext {
     /// The kind of template instantiation we are performing
     enum SynthesisKind {
       /// We are instantiating a template declaration. The entity is
@@ -12803,7 +12804,7 @@ class Sema final : public SemaBase {
   ///
   /// Destruction of this object will pop the named instantiation off
   /// the stack.
-  struct InstantiatingTemplate {
+  struct CLANG_ABI InstantiatingTemplate {
     /// Note that we are instantiating a class template,
     /// function template, variable template, alias template,
     /// or a member thereof.
@@ -13505,7 +13506,7 @@ class Sema final : public SemaBase {
 
   /// Records and restores the CurFPFeatures state on entry/exit of compound
   /// statements.
-  class FPFeaturesStateRAII {
+  class CLANG_ABI FPFeaturesStateRAII {
   public:
     FPFeaturesStateRAII(Sema &S);
     ~FPFeaturesStateRAII();
@@ -15020,7 +15021,7 @@ class Sema final : public SemaBase {
   /// Implementations are in SemaFunctionEffects.cpp
   ///@{
 public:
-  struct FunctionEffectDiff {
+  struct CLANG_ABI FunctionEffectDiff {
     enum class Kind { Added, Removed, ConditionMismatch };
 
     FunctionEffect::Kind EffectKind;
@@ -15065,7 +15066,7 @@ class Sema final : public SemaBase {
         const CXXMethodDecl &NewMethod, const FunctionEffectsRef &NewFX) const;
   };
 
-  struct FunctionEffectDiffVector : public SmallVector<FunctionEffectDiff> {
+  struct CLANG_ABI FunctionEffectDiffVector : public SmallVector<FunctionEffectDiff> {
     /// Caller should short-circuit by checking for equality first.
     FunctionEffectDiffVector(const FunctionEffectsRef &Old,
                              const FunctionEffectsRef &New);
@@ -15113,7 +15114,7 @@ class Sema final : public SemaBase {
   ///@}
 };
 
-DeductionFailureInfo
+CLANG_ABI DeductionFailureInfo
 MakeDeductionFailureInfo(ASTContext &Context, TemplateDeductionResult TDK,
                          sema::TemplateDeductionInfo &Info);
 
@@ -15128,7 +15129,7 @@ struct LateParsedTemplate {
 };
 
 template <>
-void Sema::PragmaStack<Sema::AlignPackInfo>::Act(SourceLocation PragmaLocation,
+CLANG_ABI CLANG_ABI void Sema::PragmaStack<Sema::AlignPackInfo>::Act(SourceLocation PragmaLocation,
                                                  PragmaMsStackAction Action,
                                                  llvm::StringRef StackSlotLabel,
                                                  AlignPackInfo Value);
diff --git a/clang/include/clang/Sema/SemaAMDGPU.h b/clang/include/clang/Sema/SemaAMDGPU.h
index 3fdb39202610d0..4425c9384d269a 100644
--- a/clang/include/clang/Sema/SemaAMDGPU.h
+++ b/clang/include/clang/Sema/SemaAMDGPU.h
@@ -15,12 +15,13 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class AttributeCommonInfo;
 class ParsedAttr;
 
-class SemaAMDGPU : public SemaBase {
+class CLANG_ABI SemaAMDGPU : public SemaBase {
 public:
   SemaAMDGPU(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaARM.h b/clang/include/clang/Sema/SemaARM.h
index 8c4c56e2221301..53710a68600f2a 100644
--- a/clang/include/clang/Sema/SemaARM.h
+++ b/clang/include/clang/Sema/SemaARM.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <tuple>
 
@@ -28,7 +29,7 @@ namespace clang {
 class ParsedAttr;
 class TargetInfo;
 
-class SemaARM : public SemaBase {
+class CLANG_ABI SemaARM : public SemaBase {
 public:
   SemaARM(Sema &S);
 
@@ -81,7 +82,7 @@ class SemaARM : public SemaBase {
   void handleInterruptAttr(Decl *D, const ParsedAttr &AL);
 };
 
-SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD);
+CLANG_ABI SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD);
 
 } // namespace clang
 
diff --git a/clang/include/clang/Sema/SemaAVR.h b/clang/include/clang/Sema/SemaAVR.h
index d89ce054b864d3..da40f72125a5a3 100644
--- a/clang/include/clang/Sema/SemaAVR.h
+++ b/clang/include/clang/Sema/SemaAVR.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 
-class SemaAVR : public SemaBase {
+class CLANG_ABI SemaAVR : public SemaBase {
 public:
   SemaAVR(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaBPF.h b/clang/include/clang/Sema/SemaBPF.h
index d7577aea701227..d776e24aebfc6f 100644
--- a/clang/include/clang/Sema/SemaBPF.h
+++ b/clang/include/clang/Sema/SemaBPF.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 
-class SemaBPF : public SemaBase {
+class CLANG_ABI SemaBPF : public SemaBase {
 public:
   SemaBPF(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaBase.h b/clang/include/clang/Sema/SemaBase.h
index 0b05245ab9686b..9e4705417b422b 100644
--- a/clang/include/clang/Sema/SemaBase.h
+++ b/clang/include/clang/Sema/SemaBase.h
@@ -20,6 +20,7 @@
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/Ownership.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include <optional>
 #include <type_traits>
@@ -33,7 +34,7 @@ class DiagnosticsEngine;
 class LangOptions;
 class Sema;
 
-class SemaBase {
+class CLANG_ABI SemaBase {
 public:
   SemaBase(Sema &S);
 
@@ -52,7 +53,7 @@ class SemaBase {
   /// does) and, if the diagnostic comes from inside a template
   /// instantiation, printing the template instantiation stack as
   /// well.
-  class ImmediateDiagBuilder : public DiagnosticBuilder {
+  class CLANG_ABI ImmediateDiagBuilder : public DiagnosticBuilder {
     Sema &SemaRef;
     unsigned DiagID;
 
@@ -107,7 +108,7 @@ class SemaBase {
   /// diagnostic, or no diagnostic at all, according to an argument you pass to
   /// its constructor, thus simplifying the process of creating these "maybe
   /// deferred" diagnostics.
-  class SemaDiagnosticBuilder {
+  class CLANG_ABI SemaDiagnosticBuilder {
   public:
     enum Kind {
       /// Emit no diagnostics.
@@ -174,7 +175,7 @@ class SemaBase {
       return *this;
     }
 
-    friend const SemaDiagnosticBuilder &
+    friend CLANG_ABI const SemaDiagnosticBuilder &
     operator<<(const SemaDiagnosticBuilder &Diag, const PartialDiagnostic &PD);
 
     void AddFixItHint(const FixItHint &Hint) const;
diff --git a/clang/include/clang/Sema/SemaCUDA.h b/clang/include/clang/Sema/SemaCUDA.h
index 71f05e88fb539c..b8d6cb38903a40 100644
--- a/clang/include/clang/Sema/SemaCUDA.h
+++ b/clang/include/clang/Sema/SemaCUDA.h
@@ -22,6 +22,7 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/DenseSet.h"
@@ -42,7 +43,7 @@ enum class CXXSpecialMemberKind;
 class ParsedAttributesView;
 class Scope;
 
-class SemaCUDA : public SemaBase {
+class CLANG_ABI SemaCUDA : public SemaBase {
 public:
   SemaCUDA(Sema &S);
 
@@ -140,7 +141,7 @@ class SemaCUDA : public SemaBase {
     Decl *D = nullptr;
   } CurCUDATargetCtx;
 
-  struct CUDATargetContextRAII {
+  struct CLANG_ABI CUDATargetContextRAII {
     SemaCUDA &S;
     SemaCUDA::CUDATargetContext SavedCtx;
     CUDATargetContextRAII(SemaCUDA &S_, SemaCUDA::CUDATargetContextKind K,
diff --git a/clang/include/clang/Sema/SemaCodeCompletion.h b/clang/include/clang/Sema/SemaCodeCompletion.h
index 50409439389b06..9becc0e650b1a6 100644
--- a/clang/include/clang/Sema/SemaCodeCompletion.h
+++ b/clang/include/clang/Sema/SemaCodeCompletion.h
@@ -25,6 +25,7 @@
 #include "clang/Sema/Designator.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <optional>
 
@@ -34,7 +35,7 @@ class MacroInfo;
 class Scope;
 class TemplateName;
 
-class SemaCodeCompletion : public SemaBase {
+class CLANG_ABI SemaCodeCompletion : public SemaBase {
 public:
   SemaCodeCompletion(Sema &S, CodeCompleteConsumer *CompletionConsumer);
 
diff --git a/clang/include/clang/Sema/SemaConcept.h b/clang/include/clang/Sema/SemaConcept.h
index 4b1abccb7741a1..37ab32a628128f 100644
--- a/clang/include/clang/Sema/SemaConcept.h
+++ b/clang/include/clang/Sema/SemaConcept.h
@@ -14,9 +14,10 @@
 #define LLVM_CLANG_SEMA_SEMACONCEPT_H
 #include "clang/AST/ASTConcept.h"
 #include "clang/AST/ASTContext.h"
-#include "clang/AST/Expr.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/Expr.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
 #include <optional>
@@ -90,20 +91,20 @@ using NormalForm =
 // clauses where each clause is a disjunction of atomic constraints. For atomic
 // constraints A, B, and C, the constraint A  ∧ (B  ∨ C) is in conjunctive
 // normal form.
-NormalForm makeCNF(const NormalizedConstraint &Normalized);
+CLANG_ABI NormalForm makeCNF(const NormalizedConstraint &Normalized);
 
 // A constraint is in disjunctive normal form when it is a disjunction of
 // clauses where each clause is a conjunction of atomic constraints. For atomic
 // constraints A, B, and C, the disjunctive normal form of the constraint A
 //  ∧ (B  ∨ C) is (A  ∧ B)  ∨ (A  ∧ C).
-NormalForm makeDNF(const NormalizedConstraint &Normalized);
+CLANG_ABI NormalForm makeDNF(const NormalizedConstraint &Normalized);
 
 struct alignas(ConstraintAlignment) NormalizedConstraintPair;
 
 /// \brief A normalized constraint, as defined in C++ [temp.constr.normal], is
 /// either an atomic constraint, a conjunction of normalized constraints or a
 /// disjunction of normalized constraints.
-struct NormalizedConstraint {
+struct CLANG_ABI NormalizedConstraint {
   friend class Sema;
 
   enum CompoundConstraintKind { CCK_Conjunction, CCK_Disjunction };
@@ -172,7 +173,7 @@ struct alignas(ConstraintAlignment) NormalizedConstraintPair {
   NormalizedConstraint LHS, RHS;
 };
 
-struct alignas(ConstraintAlignment) FoldExpandedConstraint {
+struct CLANG_ABI alignas(ConstraintAlignment) FoldExpandedConstraint {
   enum class FoldOperatorKind { And, Or } Kind;
   NormalizedConstraint Constraint;
   const Expr *Pattern;
@@ -189,7 +190,7 @@ struct alignas(ConstraintAlignment) FoldExpandedConstraint {
                                           const FoldExpandedConstraint &B);
 };
 
-const NormalizedConstraint *getNormalizedAssociatedConstraints(
+CLANG_ABI const NormalizedConstraint *getNormalizedAssociatedConstraints(
     Sema &S, NamedDecl *ConstrainedDecl,
     ArrayRef<const Expr *> AssociatedConstraints);
 
diff --git a/clang/include/clang/Sema/SemaConsumer.h b/clang/include/clang/Sema/SemaConsumer.h
index 1c5962e9f055af..49042780f57468 100644
--- a/clang/include/clang/Sema/SemaConsumer.h
+++ b/clang/include/clang/Sema/SemaConsumer.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_SEMA_SEMACONSUMER_H
 
 #include "clang/AST/ASTConsumer.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
   class Sema;
@@ -22,7 +23,7 @@ namespace clang {
   /// An abstract interface that should be implemented by
   /// clients that read ASTs and then require further semantic
   /// analysis of the entities in those ASTs.
-  class SemaConsumer : public ASTConsumer {
+  class CLANG_ABI SemaConsumer : public ASTConsumer {
     virtual void anchor();
   public:
     SemaConsumer() {
diff --git a/clang/include/clang/Sema/SemaFixItUtils.h b/clang/include/clang/Sema/SemaFixItUtils.h
index df9bc429769438..5c0a1592d5822b 100644
--- a/clang/include/clang/Sema/SemaFixItUtils.h
+++ b/clang/include/clang/Sema/SemaFixItUtils.h
@@ -13,6 +13,7 @@
 #define LLVM_CLANG_SEMA_SEMAFIXITUTILS_H
 
 #include "clang/AST/Expr.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -29,7 +30,7 @@ class Sema;
 /// The class facilities generation and storage of conversion FixIts. Hints for
 /// new conversions are added using TryToFixConversion method. The default type
 /// conversion checker can be reset.
-struct ConversionFixItGenerator {
+struct CLANG_ABI ConversionFixItGenerator {
   /// Performs a simple check to see if From type can be converted to To type.
   static bool compareTypesSimple(CanQualType From,
                                  CanQualType To,
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index fa957abc9791af..7a0c8e19fa6834 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -19,6 +19,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/TargetParser/Triple.h"
 #include <initializer_list>
@@ -31,11 +32,11 @@ class Scope;
 
 // FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no
 // longer need to create builtin buffer types in HLSLExternalSemaSource.
-bool CreateHLSLAttributedResourceType(
+CLANG_ABI bool CreateHLSLAttributedResourceType(
     Sema &S, QualType Wrapped, ArrayRef<const Attr *> AttrList,
     QualType &ResType, HLSLAttributedResourceLocInfo *LocInfo = nullptr);
 
-class SemaHLSL : public SemaBase {
+class CLANG_ABI SemaHLSL : public SemaBase {
 public:
   SemaHLSL(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaHexagon.h b/clang/include/clang/Sema/SemaHexagon.h
index 82e811dfc42e48..98732acf825a59 100644
--- a/clang/include/clang/Sema/SemaHexagon.h
+++ b/clang/include/clang/Sema/SemaHexagon.h
@@ -15,9 +15,10 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
-class SemaHexagon : public SemaBase {
+class CLANG_ABI SemaHexagon : public SemaBase {
 public:
   SemaHexagon(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaInternal.h b/clang/include/clang/Sema/SemaInternal.h
index d994d1819b4423..26a74e7d028d2f 100644
--- a/clang/include/clang/Sema/SemaInternal.h
+++ b/clang/include/clang/Sema/SemaInternal.h
@@ -18,6 +18,7 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaDiagnostic.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -78,7 +79,7 @@ getDepthAndIndex(UnexpandedParameterPack UPP) {
   return getDepthAndIndex(UPP.first.get<NamedDecl *>());
 }
 
-class TypoCorrectionConsumer : public VisibleDeclConsumer {
+class CLANG_ABI TypoCorrectionConsumer : public VisibleDeclConsumer {
   typedef SmallVector<TypoCorrection, 1> TypoResultList;
   typedef llvm::StringMap<TypoResultList> TypoResultsMap;
   typedef std::map<unsigned, TypoResultsMap> TypoEditDistanceMap;
@@ -205,7 +206,7 @@ class TypoCorrectionConsumer : public VisibleDeclConsumer {
   }
 
 private:
-  class NamespaceSpecifierSet {
+  class CLANG_ABI NamespaceSpecifierSet {
     struct SpecifierInfo {
       DeclContext* DeclCtx;
       NestedNameSpecifier* NameSpecifier;
diff --git a/clang/include/clang/Sema/SemaLambda.h b/clang/include/clang/Sema/SemaLambda.h
index 3c9d22df70c0df..e8e5aa64a11526 100644
--- a/clang/include/clang/Sema/SemaLambda.h
+++ b/clang/include/clang/Sema/SemaLambda.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_SEMA_SEMALAMBDA_H
 
 #include "clang/AST/ASTLambda.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
@@ -31,7 +32,7 @@ class Sema;
 /// of the capture-capable lambda's LambdaScopeInfo.
 /// See Implementation for more detailed comments.
 
-std::optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
+CLANG_ABI std::optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
     ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
     ValueDecl *VarToCapture, Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaLoongArch.h b/clang/include/clang/Sema/SemaLoongArch.h
index 98a7e99e31572a..299e40d1e17deb 100644
--- a/clang/include/clang/Sema/SemaLoongArch.h
+++ b/clang/include/clang/Sema/SemaLoongArch.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class TargetInfo;
 
-class SemaLoongArch : public SemaBase {
+class CLANG_ABI SemaLoongArch : public SemaBase {
 public:
   SemaLoongArch(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaM68k.h b/clang/include/clang/Sema/SemaM68k.h
index dece033c22030a..d65b4296fddcbd 100644
--- a/clang/include/clang/Sema/SemaM68k.h
+++ b/clang/include/clang/Sema/SemaM68k.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 
-class SemaM68k : public SemaBase {
+class CLANG_ABI SemaM68k : public SemaBase {
 public:
   SemaM68k(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaMIPS.h b/clang/include/clang/Sema/SemaMIPS.h
index 41feeb69b80594..44dc6847693bb3 100644
--- a/clang/include/clang/Sema/SemaMIPS.h
+++ b/clang/include/clang/Sema/SemaMIPS.h
@@ -15,12 +15,13 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 class TargetInfo;
 
-class SemaMIPS : public SemaBase {
+class CLANG_ABI SemaMIPS : public SemaBase {
 public:
   SemaMIPS(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaMSP430.h b/clang/include/clang/Sema/SemaMSP430.h
index 30eb8eaf6aa1a3..a78ad3f3bfe381 100644
--- a/clang/include/clang/Sema/SemaMSP430.h
+++ b/clang/include/clang/Sema/SemaMSP430.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 
-class SemaMSP430 : public SemaBase {
+class CLANG_ABI SemaMSP430 : public SemaBase {
 public:
   SemaMSP430(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaNVPTX.h b/clang/include/clang/Sema/SemaNVPTX.h
index de47997d2f8bf1..aabdd1b7c9e8f2 100644
--- a/clang/include/clang/Sema/SemaNVPTX.h
+++ b/clang/include/clang/Sema/SemaNVPTX.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class TargetInfo;
 
-class SemaNVPTX : public SemaBase {
+class CLANG_ABI SemaNVPTX : public SemaBase {
 public:
   SemaNVPTX(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaObjC.h b/clang/include/clang/Sema/SemaObjC.h
index 9367c680953f71..f0e2dbf77cb312 100644
--- a/clang/include/clang/Sema/SemaObjC.h
+++ b/clang/include/clang/Sema/SemaObjC.h
@@ -29,6 +29,7 @@
 #include "clang/Sema/Redeclaration.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -49,7 +50,7 @@ class ParsedAttributesView;
 class Scope;
 struct SkipBodyInfo;
 
-class SemaObjC : public SemaBase {
+class CLANG_ABI SemaObjC : public SemaBase {
 public:
   SemaObjC(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h
index e253610a84b0bf..db61b084a9e86b 100644
--- a/clang/include/clang/Sema/SemaOpenACC.h
+++ b/clang/include/clang/Sema/SemaOpenACC.h
@@ -21,6 +21,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Compiler.h"
 #include <cassert>
@@ -32,7 +33,7 @@ namespace clang {
 class IdentifierInfo;
 class OpenACCClause;
 
-class SemaOpenACC : public SemaBase {
+class CLANG_ABI SemaOpenACC : public SemaBase {
 private:
   /// A collection of loop constructs in the compute construct scope that
   /// haven't had their 'parent' compute construct set yet. Entires will only be
@@ -673,7 +674,7 @@ class SemaOpenACC : public SemaBase {
   /// Helper type for the registration/assignment of constructs that need to
   /// 'know' about their parent constructs and hold a reference to them, such as
   /// Loop needing its parent construct.
-  class AssociatedStmtRAII {
+  class CLANG_ABI AssociatedStmtRAII {
     SemaOpenACC &SemaRef;
     ComputeConstructInfo OldActiveComputeConstructInfo;
     OpenACCDirectiveKind DirKind;
diff --git a/clang/include/clang/Sema/SemaOpenCL.h b/clang/include/clang/Sema/SemaOpenCL.h
index 04b2b617fb12fe..c393a0a2f34e05 100644
--- a/clang/include/clang/Sema/SemaOpenCL.h
+++ b/clang/include/clang/Sema/SemaOpenCL.h
@@ -15,11 +15,12 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 
-class SemaOpenCL : public SemaBase {
+class CLANG_ABI SemaOpenCL : public SemaBase {
 public:
   SemaOpenCL(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h
index 80ad30b0f99efc..60cf949e2c5658 100644
--- a/clang/include/clang/Sema/SemaOpenMP.h
+++ b/clang/include/clang/Sema/SemaOpenMP.h
@@ -28,6 +28,7 @@
 #include "clang/Sema/DeclSpec.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Frontend/OpenMP/OMP.h.inc"
 #include "llvm/Frontend/OpenMP/OMPConstants.h"
@@ -45,7 +46,7 @@ class DeclGroupRef;
 class ParsedAttr;
 class Scope;
 
-class SemaOpenMP : public SemaBase {
+class CLANG_ABI SemaOpenMP : public SemaBase {
 public:
   SemaOpenMP(Sema &S);
 
@@ -1445,7 +1446,7 @@ class SemaOpenMP : public SemaBase {
 
   /// Helper to keep information about the current `omp begin/end declare
   /// variant` nesting.
-  struct OMPDeclareVariantScope {
+  struct CLANG_ABI OMPDeclareVariantScope {
     /// The associated OpenMP context selector.
     OMPTraitInfo *TI;
 
diff --git a/clang/include/clang/Sema/SemaPPC.h b/clang/include/clang/Sema/SemaPPC.h
index f8edecc4fcb7bf..4d230205db207f 100644
--- a/clang/include/clang/Sema/SemaPPC.h
+++ b/clang/include/clang/Sema/SemaPPC.h
@@ -17,11 +17,12 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class TargetInfo;
 
-class SemaPPC : public SemaBase {
+class CLANG_ABI SemaPPC : public SemaBase {
 public:
   SemaPPC(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaPseudoObject.h b/clang/include/clang/Sema/SemaPseudoObject.h
index 4753987070b750..7f3a73a520679c 100644
--- a/clang/include/clang/Sema/SemaPseudoObject.h
+++ b/clang/include/clang/Sema/SemaPseudoObject.h
@@ -19,11 +19,12 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class Scope;
 
-class SemaPseudoObject : public SemaBase {
+class CLANG_ABI SemaPseudoObject : public SemaBase {
 public:
   SemaPseudoObject(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaRISCV.h b/clang/include/clang/Sema/SemaRISCV.h
index d7f17797283b86..8f48aefd3e06b0 100644
--- a/clang/include/clang/Sema/SemaRISCV.h
+++ b/clang/include/clang/Sema/SemaRISCV.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
@@ -29,7 +30,7 @@ class RISCVIntrinsicManager;
 class ParsedAttr;
 class TargetInfo;
 
-class SemaRISCV : public SemaBase {
+class CLANG_ABI SemaRISCV : public SemaBase {
 public:
   SemaRISCV(Sema &S);
 
@@ -54,7 +55,7 @@ class SemaRISCV : public SemaBase {
   std::unique_ptr<sema::RISCVIntrinsicManager> IntrinsicManager;
 };
 
-std::unique_ptr<sema::RISCVIntrinsicManager>
+CLANG_ABI std::unique_ptr<sema::RISCVIntrinsicManager>
 CreateRISCVIntrinsicManager(Sema &S);
 } // namespace clang
 
diff --git a/clang/include/clang/Sema/SemaSYCL.h b/clang/include/clang/Sema/SemaSYCL.h
index 27c42b54018307..7575a22d946aab 100644
--- a/clang/include/clang/Sema/SemaSYCL.h
+++ b/clang/include/clang/Sema/SemaSYCL.h
@@ -18,13 +18,14 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/Ownership.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
 
 namespace clang {
 class Decl;
 class ParsedAttr;
 
-class SemaSYCL : public SemaBase {
+class CLANG_ABI SemaSYCL : public SemaBase {
 public:
   SemaSYCL(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaSwift.h b/clang/include/clang/Sema/SemaSwift.h
index 8d8f1467054ac5..ed871b737da127 100644
--- a/clang/include/clang/Sema/SemaSwift.h
+++ b/clang/include/clang/Sema/SemaSwift.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class AttributeCommonInfo;
@@ -25,7 +26,7 @@ enum class ParameterABI;
 class ParsedAttr;
 class SwiftNameAttr;
 
-class SemaSwift : public SemaBase {
+class CLANG_ABI SemaSwift : public SemaBase {
 public:
   SemaSwift(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaSystemZ.h b/clang/include/clang/Sema/SemaSystemZ.h
index 1a3e29f7a9312a..38b5b6e471e309 100644
--- a/clang/include/clang/Sema/SemaSystemZ.h
+++ b/clang/include/clang/Sema/SemaSystemZ.h
@@ -15,9 +15,10 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
-class SemaSystemZ : public SemaBase {
+class CLANG_ABI SemaSystemZ : public SemaBase {
 public:
   SemaSystemZ(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaWasm.h b/clang/include/clang/Sema/SemaWasm.h
index 8841fdff230353..4fae3583fd2af4 100644
--- a/clang/include/clang/Sema/SemaWasm.h
+++ b/clang/include/clang/Sema/SemaWasm.h
@@ -15,12 +15,13 @@
 
 #include "clang/AST/ASTFwd.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 class TargetInfo;
 
-class SemaWasm : public SemaBase {
+class CLANG_ABI SemaWasm : public SemaBase {
 public:
   SemaWasm(Sema &S);
 
diff --git a/clang/include/clang/Sema/SemaX86.h b/clang/include/clang/Sema/SemaX86.h
index b5a23f1bede047..457439a886b3c4 100644
--- a/clang/include/clang/Sema/SemaX86.h
+++ b/clang/include/clang/Sema/SemaX86.h
@@ -16,12 +16,13 @@
 #include "clang/AST/ASTFwd.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Sema/SemaBase.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ParsedAttr;
 class TargetInfo;
 
-class SemaX86 : public SemaBase {
+class CLANG_ABI SemaX86 : public SemaBase {
 public:
   SemaX86(Sema &S);
 
diff --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h
index 6872d04cc4dfb9..9db649f411fe08 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -18,6 +18,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
@@ -362,7 +363,7 @@ enum class TemplateSubstitutionKind : char {
   /// A new instance of this class type will be created whenever we
   /// instantiate a new function declaration, which will have its own
   /// set of parameter declarations.
-  class LocalInstantiationScope {
+  class CLANG_ABI LocalInstantiationScope {
   public:
     /// A set of declarations.
     using DeclArgumentPack = SmallVector<VarDecl *, 4>;
@@ -565,7 +566,7 @@ enum class TemplateSubstitutionKind : char {
     bool isLambdaOrBlock() const { return InstantiatingLambdaOrBlock; }
   };
 
-  class TemplateDeclInstantiator
+  class CLANG_ABI TemplateDeclInstantiator
     : public DeclVisitor<TemplateDeclInstantiator, Decl *>
   {
     Sema &SemaRef;
diff --git a/clang/include/clang/Sema/TemplateDeduction.h b/clang/include/clang/Sema/TemplateDeduction.h
index 28b014fd84e4b3..894482066a71f1 100644
--- a/clang/include/clang/Sema/TemplateDeduction.h
+++ b/clang/include/clang/Sema/TemplateDeduction.h
@@ -14,14 +14,15 @@
 #ifndef LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H
 #define LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H
 
-#include "clang/Sema/Ownership.h"
-#include "clang/Sema/SemaConcept.h"
 #include "clang/AST/ASTConcept.h"
 #include "clang/AST/DeclAccessPair.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Sema/Ownership.h"
+#include "clang/Sema/SemaConcept.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include <cassert>
 #include <cstddef>
@@ -256,7 +257,7 @@ class TemplateDeductionInfo {
 
 /// A structure used to record information about a failed
 /// template argument deduction, for diagnosis.
-struct DeductionFailureInfo {
+struct CLANG_ABI DeductionFailureInfo {
   /// A Sema::TemplateDeductionResult.
   unsigned Result : 8;
 
@@ -309,7 +310,7 @@ struct DeductionFailureInfo {
 /// For now, assume that the candidates are non-matching specializations.
 /// TODO: In the future, we may need to unify/generalize this with
 /// OverloadCandidate.
-struct TemplateSpecCandidate {
+struct CLANG_ABI TemplateSpecCandidate {
   /// The declaration that was looked up, together with its access.
   /// Might be a UsingShadowDecl, but usually a FunctionTemplateDecl.
   DeclAccessPair FoundDecl;
@@ -335,7 +336,7 @@ struct TemplateSpecCandidate {
 /// used in template specializations.
 /// TODO: In the future, we may need to unify/generalize this with
 /// OverloadCandidateSet.
-class TemplateSpecCandidateSet {
+class CLANG_ABI TemplateSpecCandidateSet {
   SmallVector<TemplateSpecCandidate, 16> Candidates;
   SourceLocation Loc;
 
diff --git a/clang/include/clang/Sema/TemplateInstCallback.h b/clang/include/clang/Sema/TemplateInstCallback.h
index 9258a7f41ac126..10e30af1f6db14 100644
--- a/clang/include/clang/Sema/TemplateInstCallback.h
+++ b/clang/include/clang/Sema/TemplateInstCallback.h
@@ -15,12 +15,13 @@
 #define LLVM_CLANG_SEMA_TEMPLATEINSTCALLBACK_H
 
 #include "clang/Sema/Sema.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 /// This is a base class for callbacks that will be notified at every
 /// template instantiation.
-class TemplateInstantiationCallback {
+class CLANG_ABI TemplateInstantiationCallback {
 public:
   virtual ~TemplateInstantiationCallback() = default;
 
diff --git a/clang/include/clang/Sema/TypoCorrection.h b/clang/include/clang/Sema/TypoCorrection.h
index 09de164297e7ba..bb64edf87d1e73 100644
--- a/clang/include/clang/Sema/TypoCorrection.h
+++ b/clang/include/clang/Sema/TypoCorrection.h
@@ -20,6 +20,7 @@
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Casting.h"
@@ -39,7 +40,7 @@ class NestedNameSpecifier;
 class Sema;
 
 /// Simple class containing the result of Sema::CorrectTypo
-class TypoCorrection {
+class CLANG_ABI TypoCorrection {
 public:
   // "Distance" for unusable corrections
   static const unsigned InvalidDistance = std::numeric_limits<unsigned>::max();
@@ -278,7 +279,7 @@ class TypoCorrection {
 
 /// Base class for callback objects used by Sema::CorrectTypo to check
 /// the validity of a potential typo correction.
-class CorrectionCandidateCallback {
+class CLANG_ABI CorrectionCandidateCallback {
 public:
   static const unsigned InvalidDistance = TypoCorrection::InvalidDistance;
 
@@ -380,7 +381,7 @@ class DeclFilterCCC final : public CorrectionCandidateCallback {
 // Callback class to limit the allowed keywords and to only accept typo
 // corrections that are keywords or whose decls refer to functions (or template
 // functions) that accept the given number of arguments.
-class FunctionCallFilterCCC : public CorrectionCandidateCallback {
+class CLANG_ABI FunctionCallFilterCCC : public CorrectionCandidateCallback {
 public:
   FunctionCallFilterCCC(Sema &SemaRef, unsigned NumArgs,
                         bool HasExplicitTemplateArgs,
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h
index 4b79d4b7711905..21c750d13831de 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -24,6 +24,7 @@
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Serialization/SourceLocationEncoding.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Bitstream/BitCodes.h"
 #include "llvm/Support/MathExtras.h"
@@ -2086,7 +2087,7 @@ static_assert(std::is_standard_layout_v<ObjCCategoriesInfo> &&
 /// Different \ref DeclarationNames are mapped to different keys, but the
 /// same key can occasionally represent multiple names (for names that
 /// contain types, in particular).
-class DeclarationNameKey {
+class CLANG_ABI DeclarationNameKey {
   using NameKind = unsigned;
 
   NameKind Kind = 0;
diff --git a/clang/include/clang/Serialization/ASTDeserializationListener.h b/clang/include/clang/Serialization/ASTDeserializationListener.h
index ea96faa07c1917..0ee3461919df27 100644
--- a/clang/include/clang/Serialization/ASTDeserializationListener.h
+++ b/clang/include/clang/Serialization/ASTDeserializationListener.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Serialization/ASTBitCodes.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -27,7 +28,7 @@ class MacroInfo;
 class Module;
 class SourceLocation;
 
-class ASTDeserializationListener {
+class CLANG_ABI ASTDeserializationListener {
 public:
   virtual ~ASTDeserializationListener();
 
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index ee4e897b248882..4c3bc785e952a3 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -33,6 +33,7 @@
 #include "clang/Serialization/ModuleFileExtension.h"
 #include "clang/Serialization/ModuleManager.h"
 #include "clang/Serialization/SourceLocationEncoding.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -111,7 +112,7 @@ class VarDecl;
 /// listener to pass on specific information. Some of the listener methods can
 /// return true to indicate to the ASTReader that the information (and
 /// consequently the AST file) is invalid.
-class ASTReaderListener {
+class CLANG_ABI ASTReaderListener {
 public:
   virtual ~ASTReaderListener();
 
@@ -249,7 +250,7 @@ class ASTReaderListener {
 };
 
 /// Simple wrapper class for chaining listeners.
-class ChainedASTReaderListener : public ASTReaderListener {
+class CLANG_ABI ChainedASTReaderListener : public ASTReaderListener {
   std::unique_ptr<ASTReaderListener> First;
   std::unique_ptr<ASTReaderListener> Second;
 
@@ -298,7 +299,7 @@ class ChainedASTReaderListener : public ASTReaderListener {
 
 /// ASTReaderListener implementation to validate the information of
 /// the PCH file against an initialized Preprocessor.
-class PCHValidator : public ASTReaderListener {
+class CLANG_ABI PCHValidator : public ASTReaderListener {
   Preprocessor &PP;
   ASTReader &Reader;
 
@@ -329,7 +330,7 @@ class PCHValidator : public ASTReaderListener {
 /// ASTReader which is required to use a pch file. This is the replacement
 /// of PCHValidator or SimplePCHValidator when using a pch file without
 /// validating it.
-class SimpleASTReaderListener : public ASTReaderListener {
+class CLANG_ABI SimpleASTReaderListener : public ASTReaderListener {
   Preprocessor &PP;
 
 public:
@@ -368,7 +369,7 @@ struct DeclContextLookupTable;
 /// The AST reader provides lazy de-serialization of declarations, as
 /// required when traversing the AST. Only those AST nodes that are
 /// actually required will be de-serialized.
-class ASTReader
+class CLANG_ABI ASTReader
   : public ExternalPreprocessorSource,
     public ExternalPreprocessingRecordSource,
     public ExternalHeaderFileInfoSource,
diff --git a/clang/include/clang/Serialization/ASTRecordReader.h b/clang/include/clang/Serialization/ASTRecordReader.h
index 2561418b78ca7f..29c42f0c24ca60 100644
--- a/clang/include/clang/Serialization/ASTRecordReader.h
+++ b/clang/include/clang/Serialization/ASTRecordReader.h
@@ -19,6 +19,7 @@
 #include "clang/Lex/Token.h"
 #include "clang/Serialization/ASTReader.h"
 #include "clang/Serialization/SourceLocationEncoding.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
@@ -29,7 +30,7 @@ class OMPTraitInfo;
 class OMPChildren;
 
 /// An object for streaming information from a record.
-class ASTRecordReader
+class CLANG_ABI ASTRecordReader
     : public serialization::DataStreamBasicReader<ASTRecordReader> {
   using ModuleFile = serialization::ModuleFile;
   using LocSeq = SourceLocationSequence;
diff --git a/clang/include/clang/Serialization/ASTRecordWriter.h b/clang/include/clang/Serialization/ASTRecordWriter.h
index 0c8ac75fc40f40..07023e187a0bf8 100644
--- a/clang/include/clang/Serialization/ASTRecordWriter.h
+++ b/clang/include/clang/Serialization/ASTRecordWriter.h
@@ -19,6 +19,7 @@
 #include "clang/AST/OpenMPClause.h"
 #include "clang/Serialization/ASTWriter.h"
 #include "clang/Serialization/SourceLocationEncoding.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -26,7 +27,7 @@ class OpenACCClause;
 class TypeLoc;
 
 /// An object for streaming information to a record.
-class ASTRecordWriter
+class CLANG_ABI ASTRecordWriter
     : public serialization::DataStreamBasicWriter<ASTRecordWriter> {
   using LocSeq = SourceLocationSequence;
 
diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index 198dd01b8d07a0..0f9ee1c8a019c9 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -25,6 +25,7 @@
 #include "clang/Serialization/ASTDeserializationListener.h"
 #include "clang/Serialization/PCHContainerOperations.h"
 #include "clang/Serialization/SourceLocationEncoding.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -85,7 +86,7 @@ class FileInfo;
 /// representation of a given abstract syntax tree and its supporting
 /// data structures. This bitstream can be de-serialized via an
 /// instance of the ASTReader class.
-class ASTWriter : public ASTDeserializationListener,
+class CLANG_ABI ASTWriter : public ASTDeserializationListener,
                   public ASTMutationListener {
 public:
   friend class ASTDeclWriter;
@@ -926,7 +927,7 @@ class ASTWriter : public ASTDeserializationListener,
 
 /// AST and semantic-analysis consumer that generates a
 /// precompiled header from the parsed source code.
-class PCHGenerator : public SemaConsumer {
+class CLANG_ABI PCHGenerator : public SemaConsumer {
   void anchor() override;
 
   Preprocessor &PP;
@@ -973,7 +974,7 @@ class PCHGenerator : public SemaConsumer {
   bool hasEmittedPCH() const { return Buffer->IsComplete; }
 };
 
-class CXX20ModulesGenerator : public PCHGenerator {
+class CLANG_ABI CXX20ModulesGenerator : public PCHGenerator {
   void anchor() override;
 
 protected:
@@ -991,7 +992,7 @@ class CXX20ModulesGenerator : public PCHGenerator {
   void HandleTranslationUnit(ASTContext &Ctx) override;
 };
 
-class ReducedBMIGenerator : public CXX20ModulesGenerator {
+class CLANG_ABI ReducedBMIGenerator : public CXX20ModulesGenerator {
   void anchor() override;
 
 public:
@@ -1005,7 +1006,7 @@ class ReducedBMIGenerator : public CXX20ModulesGenerator {
 ///
 /// Generally, we can elide the definition of a declaration if it won't affect
 /// the ABI. e.g., the non-inline function bodies.
-bool CanElideDeclDef(const Decl *D);
+CLANG_ABI bool CanElideDeclDef(const Decl *D);
 
 /// A simple helper class to pack several bits in order into (a) 32 bit
 /// integer(s).
diff --git a/clang/include/clang/Serialization/GlobalModuleIndex.h b/clang/include/clang/Serialization/GlobalModuleIndex.h
index 93d674e4400345..ca7889c8321f8b 100644
--- a/clang/include/clang/Serialization/GlobalModuleIndex.h
+++ b/clang/include/clang/Serialization/GlobalModuleIndex.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_SERIALIZATION_GLOBALMODULEINDEX_H
 #define LLVM_CLANG_SERIALIZATION_GLOBALMODULEINDEX_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -51,7 +52,7 @@ namespace serialization {
 /// the global module index may know about module files that have not been
 /// imported, and can be queried to determine which modules the current
 /// translation could or should load to fix a problem.
-class GlobalModuleIndex {
+class CLANG_ABI GlobalModuleIndex {
   using ModuleFile = serialization::ModuleFile;
 
   /// Buffer containing the index file, which is lazily accessed so long
diff --git a/clang/include/clang/Serialization/InMemoryModuleCache.h b/clang/include/clang/Serialization/InMemoryModuleCache.h
index fc3ba334fc64d3..1ed985c52841b7 100644
--- a/clang/include/clang/Serialization/InMemoryModuleCache.h
+++ b/clang/include/clang/Serialization/InMemoryModuleCache.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_SERIALIZATION_INMEMORYMODULECACHE_H
 #define LLVM_CLANG_SERIALIZATION_INMEMORYMODULECACHE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -26,7 +27,7 @@ namespace clang {
 /// Critically, it ensures that a single process has a consistent view of each
 /// PCM.  This is used by \a CompilerInstance when building PCMs to ensure that
 /// each \a ModuleManager sees the same files.
-class InMemoryModuleCache : public llvm::RefCountedBase<InMemoryModuleCache> {
+class CLANG_ABI InMemoryModuleCache : public llvm::RefCountedBase<InMemoryModuleCache> {
   struct PCM {
     std::unique_ptr<llvm::MemoryBuffer> Buffer;
 
diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h
index 30e7f6b3e57bd8..53c10e662a07b9 100644
--- a/clang/include/clang/Serialization/ModuleFile.h
+++ b/clang/include/clang/Serialization/ModuleFile.h
@@ -20,6 +20,7 @@
 #include "clang/Serialization/ASTBitCodes.h"
 #include "clang/Serialization/ContinuousRangeMap.h"
 #include "clang/Serialization/ModuleFileExtension.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -121,7 +122,7 @@ class InputFile {
 /// of some sort loaded as the main file, all of which are specific formulations
 /// of the general notion of a "module". A module may depend on any number of
 /// other modules.
-class ModuleFile {
+class CLANG_ABI ModuleFile {
 public:
   ModuleFile(ModuleKind Kind, FileEntryRef File, unsigned Generation)
       : Kind(Kind), File(File), Generation(Generation) {}
diff --git a/clang/include/clang/Serialization/ModuleFileExtension.h b/clang/include/clang/Serialization/ModuleFileExtension.h
index 50ce401516275c..fc3449c16a5ad6 100644
--- a/clang/include/clang/Serialization/ModuleFileExtension.h
+++ b/clang/include/clang/Serialization/ModuleFileExtension.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_SERIALIZATION_MODULEFILEEXTENSION_H
 #define LLVM_CLANG_SERIALIZATION_MODULEFILEEXTENSION_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/ExtensibleRTTI.h"
 #include "llvm/Support/HashBuilder.h"
 #include "llvm/Support/MD5.h"
@@ -62,7 +63,7 @@ class ModuleFileExtensionWriter;
 /// the module file or precompiled header is loaded.
 ///
 /// Subclasses must use LLVM RTTI for open class hierarchies.
-class ModuleFileExtension
+class CLANG_ABI ModuleFileExtension
     : public llvm::RTTIExtends<ModuleFileExtension, llvm::RTTIRoot> {
 public:
   /// Discriminator for LLVM RTTI.
@@ -108,7 +109,7 @@ class ModuleFileExtension
 
 /// Abstract base class that writes a module file extension block into
 /// a module file.
-class ModuleFileExtensionWriter {
+class CLANG_ABI ModuleFileExtensionWriter {
   ModuleFileExtension *Extension;
 
 protected:
@@ -135,7 +136,7 @@ class ModuleFileExtensionWriter {
 /// a module file.
 ///
 /// Subclasses
-class ModuleFileExtensionReader {
+class CLANG_ABI ModuleFileExtensionReader {
   ModuleFileExtension *Extension;
 
 protected:
diff --git a/clang/include/clang/Serialization/ModuleManager.h b/clang/include/clang/Serialization/ModuleManager.h
index f898dab39f06d3..2231105b897d2d 100644
--- a/clang/include/clang/Serialization/ModuleManager.h
+++ b/clang/include/clang/Serialization/ModuleManager.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Serialization/ModuleFile.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/STLExtras.h"
@@ -43,7 +44,7 @@ class PCHContainerReader;
 namespace serialization {
 
 /// Manages the set of modules loaded by an AST reader.
-class ModuleManager {
+class CLANG_ABI ModuleManager {
   /// The chain of AST files, in the order in which we started to load
   /// them.
   SmallVector<std::unique_ptr<ModuleFile>, 2> Chain;
diff --git a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
index 06778d25d7e523..076516d2144c7a 100644
--- a/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
+++ b/clang/include/clang/Serialization/ObjectFilePCHContainerReader.h
@@ -10,11 +10,12 @@
 #define LLVM_CLANG_SERIALIZATION_OBJECTFILEPCHCONTAINERREADER_H
 
 #include "clang/Serialization/PCHContainerOperations.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 /// A PCHContainerReader implementation that uses LLVM to
 /// wraps Clang modules inside a COFF, ELF, or Mach-O container.
-class ObjectFilePCHContainerReader : public PCHContainerReader {
+class CLANG_ABI ObjectFilePCHContainerReader : public PCHContainerReader {
   ArrayRef<StringRef> getFormats() const override;
 
   /// Returns the serialized AST inside the PCH container Buffer.
diff --git a/clang/include/clang/Serialization/PCHContainerOperations.h b/clang/include/clang/Serialization/PCHContainerOperations.h
index c9a7e334ce6eb3..3e5ebd3b79b9f6 100644
--- a/clang/include/clang/Serialization/PCHContainerOperations.h
+++ b/clang/include/clang/Serialization/PCHContainerOperations.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_SERIALIZATION_PCHCONTAINEROPERATIONS_H
 
 #include "clang/Basic/Module.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/MemoryBufferRef.h"
@@ -33,7 +34,7 @@ struct PCHBuffer {
 /// This abstract interface provides operations for creating
 /// containers for serialized ASTs (precompiled headers and clang
 /// modules).
-class PCHContainerWriter {
+class CLANG_ABI PCHContainerWriter {
 public:
   virtual ~PCHContainerWriter() = 0;
   virtual llvm::StringRef getFormat() const = 0;
@@ -52,7 +53,7 @@ class PCHContainerWriter {
 /// This abstract interface provides operations for unwrapping
 /// containers for serialized ASTs (precompiled headers and clang
 /// modules).
-class PCHContainerReader {
+class CLANG_ABI PCHContainerReader {
 public:
   virtual ~PCHContainerReader() = 0;
   /// Equivalent to the format passed to -fmodule-format=
@@ -63,7 +64,7 @@ class PCHContainerReader {
 };
 
 /// Implements write operations for a raw pass-through PCH container.
-class RawPCHContainerWriter : public PCHContainerWriter {
+class CLANG_ABI RawPCHContainerWriter : public PCHContainerWriter {
   llvm::StringRef getFormat() const override { return "raw"; }
 
   /// Return an ASTConsumer that can be chained with a
@@ -77,14 +78,14 @@ class RawPCHContainerWriter : public PCHContainerWriter {
 };
 
 /// Implements read operations for a raw pass-through PCH container.
-class RawPCHContainerReader : public PCHContainerReader {
+class CLANG_ABI RawPCHContainerReader : public PCHContainerReader {
   llvm::ArrayRef<llvm::StringRef> getFormats() const override;
   /// Simply returns the buffer contained in Buffer.
   llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override;
 };
 
 /// A registry of PCHContainerWriter and -Reader objects for different formats.
-class PCHContainerOperations {
+class CLANG_ABI PCHContainerOperations {
   llvm::StringMap<std::unique_ptr<PCHContainerWriter>> Writers;
   llvm::StringMap<PCHContainerReader *> Readers;
   llvm::SmallVector<std::unique_ptr<PCHContainerReader>> OwnedReaders;
diff --git a/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h b/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h
index 6243bbd5d53bcd..4d81b9b054343d 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h
+++ b/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h
@@ -15,12 +15,13 @@
 #define LLVM_CLANG_STATICANALYZER_CHECKERS_MPIFUNCTIONCLASSIFIER_H
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace ento {
 namespace mpi {
 
-class MPIFunctionClassifier {
+class CLANG_ABI MPIFunctionClassifier {
 public:
   MPIFunctionClassifier(ASTContext &ASTCtx) { identifierInit(ASTCtx); }
 
diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Taint.h b/clang/include/clang/StaticAnalyzer/Checkers/Taint.h
index 3ec8dbfb09ee30..1d77cbee895720 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/Taint.h
+++ b/clang/include/clang/StaticAnalyzer/Checkers/Taint.h
@@ -15,6 +15,7 @@
 
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace ento {
@@ -27,100 +28,100 @@ using TaintTagType = unsigned;
 static constexpr TaintTagType TaintTagGeneric = 0;
 
 /// Create a new state in which the value of the statement is marked as tainted.
-[[nodiscard]] ProgramStateRef addTaint(ProgramStateRef State, const Stmt *S,
+[[nodiscard]] ProgramStateRef CLANG_ABI addTaint(ProgramStateRef State, const Stmt *S,
                                        const LocationContext *LCtx,
                                        TaintTagType Kind = TaintTagGeneric);
 
 /// Create a new state in which the value is marked as tainted.
-[[nodiscard]] ProgramStateRef addTaint(ProgramStateRef State, SVal V,
+[[nodiscard]] ProgramStateRef CLANG_ABI addTaint(ProgramStateRef State, SVal V,
                                        TaintTagType Kind = TaintTagGeneric);
 
 /// Create a new state in which the symbol is marked as tainted.
-[[nodiscard]] ProgramStateRef addTaint(ProgramStateRef State, SymbolRef Sym,
+[[nodiscard]] ProgramStateRef CLANG_ABI addTaint(ProgramStateRef State, SymbolRef Sym,
                                        TaintTagType Kind = TaintTagGeneric);
 
 /// Create a new state in which the pointer represented by the region
 /// is marked as tainted.
-[[nodiscard]] ProgramStateRef addTaint(ProgramStateRef State,
+[[nodiscard]] ProgramStateRef CLANG_ABI addTaint(ProgramStateRef State,
                                        const MemRegion *R,
                                        TaintTagType Kind = TaintTagGeneric);
 
-[[nodiscard]] ProgramStateRef removeTaint(ProgramStateRef State, SVal V);
+[[nodiscard]] ProgramStateRef CLANG_ABI removeTaint(ProgramStateRef State, SVal V);
 
-[[nodiscard]] ProgramStateRef removeTaint(ProgramStateRef State,
+[[nodiscard]] ProgramStateRef CLANG_ABI removeTaint(ProgramStateRef State,
                                           const MemRegion *R);
 
-[[nodiscard]] ProgramStateRef removeTaint(ProgramStateRef State, SymbolRef Sym);
+[[nodiscard]] ProgramStateRef CLANG_ABI removeTaint(ProgramStateRef State, SymbolRef Sym);
 
 /// Create a new state in a which a sub-region of a given symbol is tainted.
 /// This might be necessary when referring to regions that can not have an
 /// individual symbol, e.g. if they are represented by the default binding of
 /// a LazyCompoundVal.
 [[nodiscard]] ProgramStateRef
-addPartialTaint(ProgramStateRef State, SymbolRef ParentSym,
+CLANG_ABI addPartialTaint(ProgramStateRef State, SymbolRef ParentSym,
                 const SubRegion *SubRegion,
                 TaintTagType Kind = TaintTagGeneric);
 
 /// Check if the statement has a tainted value in the given state.
-bool isTainted(ProgramStateRef State, const Stmt *S,
+CLANG_ABI bool isTainted(ProgramStateRef State, const Stmt *S,
                const LocationContext *LCtx,
                TaintTagType Kind = TaintTagGeneric);
 
 /// Check if the value is tainted in the given state.
-bool isTainted(ProgramStateRef State, SVal V,
+CLANG_ABI bool isTainted(ProgramStateRef State, SVal V,
                TaintTagType Kind = TaintTagGeneric);
 
 /// Check if the symbol is tainted in the given state.
-bool isTainted(ProgramStateRef State, SymbolRef Sym,
+CLANG_ABI bool isTainted(ProgramStateRef State, SymbolRef Sym,
                TaintTagType Kind = TaintTagGeneric);
 
 /// Check if the pointer represented by the region is tainted in the given
 /// state.
-bool isTainted(ProgramStateRef State, const MemRegion *Reg,
+CLANG_ABI bool isTainted(ProgramStateRef State, const MemRegion *Reg,
                TaintTagType Kind = TaintTagGeneric);
 
 /// Returns the tainted Symbols for a given Statement and state.
-std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, const Stmt *S,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, const Stmt *S,
                                          const LocationContext *LCtx,
                                          TaintTagType Kind = TaintTagGeneric);
 
 /// Returns the tainted Symbols for a given SVal and state.
-std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, SVal V,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, SVal V,
                                          TaintTagType Kind = TaintTagGeneric);
 
 /// Returns the tainted Symbols for a SymbolRef and state.
-std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, SymbolRef Sym,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State, SymbolRef Sym,
                                          TaintTagType Kind = TaintTagGeneric);
 
 /// Returns the tainted (index, super/sub region, symbolic region) symbols
 /// for a given memory region.
-std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbols(ProgramStateRef State,
                                          const MemRegion *Reg,
                                          TaintTagType Kind = TaintTagGeneric);
 
-std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
                                              const Stmt *S,
                                              const LocationContext *LCtx,
                                              TaintTagType Kind,
                                              bool returnFirstOnly);
 
-std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State, SVal V,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State, SVal V,
                                              TaintTagType Kind,
                                              bool returnFirstOnly);
 
-std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
                                              SymbolRef Sym, TaintTagType Kind,
                                              bool returnFirstOnly);
 
-std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
+CLANG_ABI std::vector<SymbolRef> getTaintedSymbolsImpl(ProgramStateRef State,
                                              const MemRegion *Reg,
                                              TaintTagType Kind,
                                              bool returnFirstOnly);
 
-void printTaint(ProgramStateRef State, raw_ostream &Out, const char *nl = "\n",
+CLANG_ABI void printTaint(ProgramStateRef State, raw_ostream &Out, const char *nl = "\n",
                 const char *sep = "");
 
-LLVM_DUMP_METHOD void dumpTaint(ProgramStateRef State);
+LLVM_DUMP_METHOD void CLANG_ABI dumpTaint(ProgramStateRef State);
 } // namespace taint
 } // namespace ento
 } // namespace clang
diff --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
index 3a3c1a13d67dd5..e6a83eb69fba02 100644
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -16,6 +16,7 @@
 
 #include "clang/Analysis/PathDiagnostic.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -146,7 +147,7 @@ enum class CTUPhase1InliningKind { None, Small, All };
 /// and should be eventually converted into -analyzer-config flags. New analyzer
 /// options should not be implemented as frontend flags. Frontend flags still
 /// make sense for things that do not affect the actual analysis.
-class AnalyzerOptions : public RefCountedBase<AnalyzerOptions> {
+class CLANG_ABI AnalyzerOptions : public RefCountedBase<AnalyzerOptions> {
 public:
   using ConfigTable = llvm::StringMap<std::string>;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index ead96ce6891c39..144f9e3800013e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -26,6 +26,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableSet.h"
@@ -74,7 +75,7 @@ using DiagnosticForConsumerMapTy =
 ///
 /// If a PathDiagnosticEvent occurs in a different frame than the final
 /// diagnostic the hints can be used to summarize the effect of the call.
-class StackHintGenerator {
+class CLANG_ABI StackHintGenerator {
 public:
   virtual ~StackHintGenerator() = 0;
 
@@ -88,7 +89,7 @@ class StackHintGenerator {
 /// traversing the CallExpr associated with the call and checking if the given
 /// symbol is returned or is one of the arguments.
 /// The hint can be customized by redefining 'getMessageForX()' methods.
-class StackHintGeneratorForSymbol : public StackHintGenerator {
+class CLANG_ABI StackHintGeneratorForSymbol : public StackHintGenerator {
 private:
   SymbolRef Sym;
   std::string Msg;
@@ -116,7 +117,7 @@ class StackHintGeneratorForSymbol : public StackHintGenerator {
 
 /// This class provides an interface through which checkers can create
 /// individual bug reports.
-class BugReport {
+class CLANG_ABI BugReport {
 public:
   enum class Kind { Basic, PathSensitive };
 
@@ -248,7 +249,7 @@ class BugReport {
   virtual void Profile(llvm::FoldingSetNodeID& hash) const = 0;
 };
 
-class BasicBugReport : public BugReport {
+class CLANG_ABI BasicBugReport : public BugReport {
   PathDiagnosticLocation Location;
   const Decl *DeclWithIssue = nullptr;
 
@@ -286,7 +287,7 @@ class BasicBugReport : public BugReport {
   void Profile(llvm::FoldingSetNodeID& hash) const override;
 };
 
-class PathSensitiveBugReport : public BugReport {
+class CLANG_ABI PathSensitiveBugReport : public BugReport {
 public:
   using VisitorList = SmallVector<std::unique_ptr<BugReporterVisitor>, 8>;
   using visitor_iterator = VisitorList::iterator;
@@ -566,7 +567,7 @@ class BugReportEquivClass : public llvm::FoldingSetNode {
 // BugReporter and friends.
 //===----------------------------------------------------------------------===//
 
-class BugReporterData {
+class CLANG_ABI BugReporterData {
 public:
   virtual ~BugReporterData() = default;
 
@@ -582,7 +583,7 @@ class BugReporterData {
 /// and flush the corresponding diagnostics.
 ///
 /// The base class is used for generating path-insensitive
-class BugReporter {
+class CLANG_ABI BugReporter {
 private:
   BugReporterData& D;
 
@@ -676,7 +677,7 @@ class BugReporter {
 };
 
 /// GRBugReporter is used for generating path-sensitive reports.
-class PathSensitiveBugReporter final : public BugReporter {
+class CLANG_ABI PathSensitiveBugReporter final : public BugReporter {
   ExprEngine& Eng;
 
   BugReport *findReportInEquivalenceClass(
@@ -713,7 +714,7 @@ class PathSensitiveBugReporter final : public BugReporter {
 };
 
 
-class BugReporterContext {
+class CLANG_ABI BugReporterContext {
   PathSensitiveBugReporter &BR;
 
   virtual void anchor();
@@ -776,7 +777,7 @@ class DataTag : public ProgramPointTag {
 
 /// The tag upon which the TagVisitor reacts. Add these in order to display
 /// additional PathDiagnosticEventPieces along the path.
-class NoteTag : public DataTag {
+class CLANG_ABI NoteTag : public DataTag {
 public:
   using Callback = std::function<std::string(BugReporterContext &,
                                              PathSensitiveBugReport &)>;
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
index 56f7ca63d00621..b49d3212903904 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/STLExtras.h"
@@ -46,7 +47,7 @@ class PathDiagnosticPiece;
 using PathDiagnosticPieceRef = std::shared_ptr<PathDiagnosticPiece>;
 
 /// BugReporterVisitors are used to add custom diagnostics along a path.
-class BugReporterVisitor : public llvm::FoldingSetNode {
+class CLANG_ABI BugReporterVisitor : public llvm::FoldingSetNode {
 public:
   BugReporterVisitor() = default;
   BugReporterVisitor(const BugReporterVisitor &) = default;
@@ -170,7 +171,7 @@ class StoreHandler;
 /// Tracker aimes at providing a sensible set of default behaviors that can be
 /// used by any checker, while providing mechanisms to hook into any part of the
 /// tracking process and insert checker-specific logic.
-class Tracker : public llvm::RefCountedBase<Tracker> {
+class CLANG_ABI Tracker : public llvm::RefCountedBase<Tracker> {
 private:
   using ExpressionHandlerPtr = std::unique_ptr<ExpressionHandler>;
   using StoreHandlerPtr = std::unique_ptr<StoreHandler>;
@@ -296,7 +297,7 @@ class Tracker : public llvm::RefCountedBase<Tracker> {
 };
 
 /// Handles expressions during the tracking.
-class ExpressionHandler {
+class CLANG_ABI ExpressionHandler {
 private:
   Tracker &ParentTracker;
 
@@ -319,7 +320,7 @@ class ExpressionHandler {
 };
 
 /// Handles stores during the tracking.
-class StoreHandler {
+class CLANG_ABI StoreHandler {
 private:
   Tracker &ParentTracker;
 
@@ -345,7 +346,7 @@ class StoreHandler {
 };
 
 /// Visitor that tracks expressions and values.
-class TrackingBugReporterVisitor : public BugReporterVisitor {
+class CLANG_ABI TrackingBugReporterVisitor : public BugReporterVisitor {
 private:
   TrackerRef ParentTracker;
 
@@ -367,7 +368,7 @@ class TrackingBugReporterVisitor : public BugReporterVisitor {
 /// \return Whether or not the function was able to add visitors for this
 ///         statement. Note that returning \c true does not actually imply
 ///         that any visitors were added.
-bool trackExpressionValue(const ExplodedNode *N, const Expr *E,
+CLANG_ABI bool trackExpressionValue(const ExplodedNode *N, const Expr *E,
                           PathSensitiveBugReport &R, TrackingOptions Opts = {});
 
 /// Track how the value got stored into the given region and where it came
@@ -384,15 +385,15 @@ bool trackExpressionValue(const ExplodedNode *N, const Expr *E,
 ///        changes to its value in a nested stackframe could be pruned, and
 ///        this visitor can prevent that without polluting the bugpath too
 ///        much.
-void trackStoredValue(SVal V, const MemRegion *R,
+CLANG_ABI void trackStoredValue(SVal V, const MemRegion *R,
                       PathSensitiveBugReport &Report, TrackingOptions Opts = {},
                       const StackFrameContext *Origin = nullptr);
 
-const Expr *getDerefExpr(const Stmt *S);
+CLANG_ABI const Expr *getDerefExpr(const Stmt *S);
 
 } // namespace bugreporter
 
-class TrackConstraintBRVisitor final : public BugReporterVisitor {
+class CLANG_ABI TrackConstraintBRVisitor final : public BugReporterVisitor {
   const SmallString<64> Message;
   const DefinedSVal Constraint;
   const bool Assumption;
@@ -427,7 +428,7 @@ class TrackConstraintBRVisitor final : public BugReporterVisitor {
 
 /// \class NilReceiverBRVisitor
 /// Prints path notes when a message is sent to a nil receiver.
-class NilReceiverBRVisitor final : public BugReporterVisitor {
+class CLANG_ABI NilReceiverBRVisitor final : public BugReporterVisitor {
 public:
   void Profile(llvm::FoldingSetNodeID &ID) const override {
     static int x = 0;
@@ -444,7 +445,7 @@ class NilReceiverBRVisitor final : public BugReporterVisitor {
 };
 
 /// Visitor that tries to report interesting diagnostics from conditions.
-class ConditionBRVisitor final : public BugReporterVisitor {
+class CLANG_ABI ConditionBRVisitor final : public BugReporterVisitor {
   // FIXME: constexpr initialization isn't supported by MSVC2013.
   constexpr static llvm::StringLiteral GenericTrueMessage =
       "Assuming the condition is true";
@@ -524,7 +525,7 @@ class ConditionBRVisitor final : public BugReporterVisitor {
 /// Suppress reports that might lead to known false positives.
 ///
 /// Currently this suppresses reports based on locations of bugs.
-class LikelyFalsePositiveSuppressionBRVisitor final
+class CLANG_ABI LikelyFalsePositiveSuppressionBRVisitor final
     : public BugReporterVisitor {
 public:
   static void *getTag() {
@@ -550,7 +551,7 @@ class LikelyFalsePositiveSuppressionBRVisitor final
 ///
 /// As a result, BugReporter will not prune the path through the function even
 /// if the region's contents are not modified/accessed by the call.
-class UndefOrNullArgVisitor final : public BugReporterVisitor {
+class CLANG_ABI UndefOrNullArgVisitor final : public BugReporterVisitor {
   /// The interesting memory region this visitor is tracking.
   const MemRegion *R;
 
@@ -568,7 +569,7 @@ class UndefOrNullArgVisitor final : public BugReporterVisitor {
                                    PathSensitiveBugReport &BR) override;
 };
 
-class SuppressInlineDefensiveChecksVisitor final : public BugReporterVisitor {
+class CLANG_ABI SuppressInlineDefensiveChecksVisitor final : public BugReporterVisitor {
   /// The symbolic value for which we are tracking constraints.
   /// This value is constrained to null in the end of path.
   DefinedSVal V;
@@ -598,7 +599,7 @@ class SuppressInlineDefensiveChecksVisitor final : public BugReporterVisitor {
 };
 
 /// The visitor detects NoteTags and displays the event notes they contain.
-class TagVisitor : public BugReporterVisitor {
+class CLANG_ABI TagVisitor : public BugReporterVisitor {
 public:
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 
@@ -620,7 +621,7 @@ class CXXConstructorCall;
 ///
 /// For a minimal example, check out
 /// clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp.
-class NoStateChangeFuncVisitor : public BugReporterVisitor {
+class CLANG_ABI NoStateChangeFuncVisitor : public BugReporterVisitor {
 private:
   /// Frames modifying the state as defined in \c wasModifiedBeforeCallExit.
   /// This visitor generates a note only if a function does *not* change the
@@ -722,7 +723,7 @@ class NoStateChangeFuncVisitor : public BugReporterVisitor {
 /// for which  the region of interest \p RegionOfInterest was passed into,
 /// but not written inside, and it has caused an undefined read or a null
 /// pointer dereference outside.
-class NoStoreFuncVisitor final : public NoStateChangeFuncVisitor {
+class CLANG_ABI NoStoreFuncVisitor final : public NoStateChangeFuncVisitor {
   const SubRegion *RegionOfInterest;
   MemRegionManager &MmrMgr;
   const SourceManager &SM;
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugSuppression.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugSuppression.h
index 35ae06575eaa06..44977a7093b2a9 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugSuppression.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugSuppression.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_SUPPRESSION_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
@@ -26,7 +27,7 @@ namespace ento {
 class BugReport;
 class PathDiagnosticLocation;
 
-class BugSuppression {
+class CLANG_ABI BugSuppression {
 public:
   explicit BugSuppression(const ASTContext &ACtx) : ACtx(ACtx) {}
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
index e50afd6d0da7e5..64996592e2d164 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
@@ -16,6 +16,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/Support/Compiler.h"
 #include <string>
 
 namespace clang {
@@ -24,7 +25,7 @@ namespace ento {
 
 class BugReporter;
 
-class BugType {
+class CLANG_ABI BugType {
 private:
   const CheckerNameRef CheckerName;
   const std::string Description;
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h
index 45187433c069fd..6aff7adc920cfd 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h
@@ -10,20 +10,21 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_COMMONBUGCATEGORIES_H
 
 // Common strings used for the "category" of many static analyzer issues.
+#include "clang/Support/Compiler.h"
 namespace clang {
 namespace ento {
 namespace categories {
-extern const char *const AppleAPIMisuse;
-extern const char *const CoreFoundationObjectiveC;
-extern const char *const LogicError;
-extern const char *const MemoryRefCount;
-extern const char *const MemoryError;
-extern const char *const UnixAPI;
-extern const char *const CXXObjectLifecycle;
-extern const char *const CXXMoveSemantics;
-extern const char *const SecurityError;
-extern const char *const UnusedCode;
-extern const char *const TaintedData;
+CLANG_ABI extern const char *const AppleAPIMisuse;
+CLANG_ABI extern const char *const CoreFoundationObjectiveC;
+CLANG_ABI extern const char *const LogicError;
+CLANG_ABI extern const char *const MemoryRefCount;
+CLANG_ABI extern const char *const MemoryError;
+CLANG_ABI extern const char *const UnixAPI;
+CLANG_ABI extern const char *const CXXObjectLifecycle;
+CLANG_ABI extern const char *const CXXMoveSemantics;
+CLANG_ABI extern const char *const SecurityError;
+CLANG_ABI extern const char *const UnusedCode;
+CLANG_ABI extern const char *const TaintedData;
 } // namespace categories
 } // namespace ento
 } // namespace clang
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
index 439f37fa8604f6..5e83d0d02afc8e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/Z3CrosscheckVisitor.h
@@ -15,13 +15,14 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_Z3CROSSCHECKVISITOR_H
 
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang::ento {
 
 /// The bug visitor will walk all the nodes in a path and collect all the
 /// constraints. When it reaches the root node, will create a refutation
 /// manager and check if the constraints are satisfiable.
-class Z3CrosscheckVisitor final : public BugReporterVisitor {
+class CLANG_ABI Z3CrosscheckVisitor final : public BugReporterVisitor {
 public:
   struct Z3Result {
     std::optional<bool> IsSAT = std::nullopt;
@@ -53,7 +54,7 @@ class Z3CrosscheckVisitor final : public BugReporterVisitor {
 /// The oracle will decide if a report should be accepted or rejected based on
 /// the results of the Z3 solver and the statistics of the queries of a report
 /// equivalenece class.
-class Z3CrosscheckOracle {
+class CLANG_ABI Z3CrosscheckOracle {
 public:
   explicit Z3CrosscheckOracle(const AnalyzerOptions &Opts) : Opts(Opts) {}
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/Checker.h b/clang/include/clang/StaticAnalyzer/Core/Checker.h
index 2ec54a837c42c9..2f619182cdbd72 100644
--- a/clang/include/clang/StaticAnalyzer/Core/Checker.h
+++ b/clang/include/clang/StaticAnalyzer/Core/Checker.h
@@ -17,6 +17,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Casting.h"
 
 namespace clang {
@@ -484,7 +485,7 @@ class Call {
 
 } // end eval namespace
 
-class CheckerBase : public ProgramPointTag {
+class CLANG_ABI CheckerBase : public ProgramPointTag {
   CheckerNameRef Name;
   friend class ::clang::ento::CheckerManager;
 
@@ -498,11 +499,11 @@ class CheckerBase : public ProgramPointTag {
 };
 
 /// Dump checker name to stream.
-raw_ostream& operator<<(raw_ostream &Out, const CheckerBase &Checker);
+CLANG_ABI raw_ostream& operator<<(raw_ostream &Out, const CheckerBase &Checker);
 
 /// Tag that can use a checker name as a message provider
 /// (see SimpleProgramPointTag).
-class CheckerProgramPointTag : public SimpleProgramPointTag {
+class CLANG_ABI CheckerProgramPointTag : public SimpleProgramPointTag {
 public:
   CheckerProgramPointTag(StringRef CheckerName, StringRef Msg);
   CheckerProgramPointTag(const CheckerBase *Checker, StringRef Msg);
@@ -545,7 +546,7 @@ class EventDispatcher {
 };
 
 /// We dereferenced a location that may be null.
-struct ImplicitNullDerefEvent {
+struct CLANG_ABI ImplicitNullDerefEvent {
   SVal Location;
   bool IsLoad;
   ExplodedNode *SinkNode;
diff --git a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
index de40b96614dbc9..525d848afd9114 100644
--- a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -18,6 +18,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
@@ -123,7 +124,7 @@ enum class ObjCMessageVisitKind {
   MessageNil
 };
 
-class CheckerManager {
+class CLANG_ABI CheckerManager {
   ASTContext *Context = nullptr;
   const LangOptions LangOpts;
   const AnalyzerOptions &AOptions;
diff --git a/clang/include/clang/StaticAnalyzer/Core/CheckerRegistryData.h b/clang/include/clang/StaticAnalyzer/Core/CheckerRegistryData.h
index 43248d8e6bb8dd..9a05e8b5b8070c 100644
--- a/clang/include/clang/StaticAnalyzer/Core/CheckerRegistryData.h
+++ b/clang/include/clang/StaticAnalyzer/Core/CheckerRegistryData.h
@@ -21,6 +21,7 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_CHECKERREGISTRYDATA_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -41,7 +42,7 @@ using ShouldRegisterFunction = bool (*)(const CheckerManager &);
 
 /// Specifies a command line option. It may either belong to a checker or a
 /// package.
-struct CmdLineOption {
+struct CLANG_ABI CmdLineOption {
   StringRef OptionType;
   StringRef OptionName;
   StringRef DefaultValStr;
@@ -91,7 +92,7 @@ using CheckerInfoSet = llvm::SetVector<const CheckerInfo *>;
 
 /// Specifies a checker. Note that this isn't what we call a checker object,
 /// it merely contains everything required to create one.
-struct CheckerInfo {
+struct CLANG_ABI CheckerInfo {
   enum class StateFromCmdLine {
     // This checker wasn't explicitly enabled or disabled.
     State_Unspecified,
@@ -143,7 +144,7 @@ using StateFromCmdLine = CheckerInfo::StateFromCmdLine;
 
 /// Specifies a package. Each package option is implicitly an option for all
 /// checkers within the package.
-struct PackageInfo {
+struct CLANG_ABI PackageInfo {
   StringRef FullName;
   CmdLineOptionList CmdLineOptions;
 
@@ -190,7 +191,7 @@ binaryFind(CheckerOrPackageInfoList &Collection, StringRef FullName) {
 }
 } // namespace checker_registry
 
-struct CheckerRegistryData {
+struct CLANG_ABI CheckerRegistryData {
 public:
   CheckerInfoSet EnabledCheckers;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
index f1c50e721937bb..da9bb112acd892 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_APSINTTYPE_H
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_APSINTTYPE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include <tuple>
 
@@ -16,7 +17,7 @@ namespace clang {
 namespace ento {
 
 /// A record of the "type" of an APSInt, used for conversions.
-class APSIntType {
+class CLANG_ABI APSIntType {
   uint32_t BitWidth;
   bool IsUnsigned;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
index c76e9c0326afe7..ad17257f646a21 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
@@ -20,6 +20,7 @@
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -28,7 +29,7 @@ class CodeInjector;
 namespace ento {
   class CheckerManager;
 
-class AnalysisManager : public BugReporterData {
+class CLANG_ABI AnalysisManager : public BugReporterData {
   virtual void anchor();
   AnalysisDeclContextManager AnaCtxMgr;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
index ec503b41b381a5..c6f4f1e23190ae 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -19,9 +19,10 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/Type.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableList.h"
@@ -37,7 +38,7 @@ class CXXBaseSpecifier;
 
 namespace ento {
 
-class CompoundValData : public llvm::FoldingSetNode {
+class CLANG_ABI CompoundValData : public llvm::FoldingSetNode {
   QualType T;
   llvm::ImmutableList<SVal> L;
 
@@ -59,7 +60,7 @@ class CompoundValData : public llvm::FoldingSetNode {
   void Profile(llvm::FoldingSetNodeID& ID) { Profile(ID, T, L); }
 };
 
-class LazyCompoundValData : public llvm::FoldingSetNode {
+class CLANG_ABI LazyCompoundValData : public llvm::FoldingSetNode {
   StoreRef store;
   const TypedValueRegion *region;
 
@@ -83,7 +84,7 @@ class LazyCompoundValData : public llvm::FoldingSetNode {
   void Profile(llvm::FoldingSetNodeID& ID) { Profile(ID, store, region); }
 };
 
-class PointerToMemberData : public llvm::FoldingSetNode {
+class CLANG_ABI PointerToMemberData : public llvm::FoldingSetNode {
   const NamedDecl *D;
   llvm::ImmutableList<const CXXBaseSpecifier *> L;
 
@@ -110,7 +111,7 @@ class PointerToMemberData : public llvm::FoldingSetNode {
   }
 };
 
-class BasicValueFactory {
+class CLANG_ABI BasicValueFactory {
   using APSIntSetTy =
       llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt>>;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
index 46ff69e0c39681..ee28a2590768cb 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BLOCKCOUNTER_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/Allocator.h"
 
 namespace clang {
@@ -26,7 +27,7 @@ namespace ento {
 /// \class BlockCounter
 /// An abstract data type used to count the number of times a given
 /// block has been visited along a path analyzed by CoreEngine.
-class BlockCounter {
+class CLANG_ABI BlockCounter {
   void *Data;
 
   BlockCounter(void *D) : Data(D) {}
@@ -37,7 +38,7 @@ class BlockCounter {
   unsigned getNumVisited(const StackFrameContext *CallSite,
                          unsigned BlockID) const;
 
-  class Factory {
+  class CLANG_ABI Factory {
     void *F;
   public:
     Factory(llvm::BumpPtrAllocator& Alloc);
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
index a99c11766f1105..f3d1d37ac64767 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLDESCRIPTION_H
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Compiler.h"
 #include <optional>
@@ -29,7 +30,7 @@ namespace clang {
 namespace ento {
 /// A `CallDescription` is a pattern that can be used to _match_ calls
 /// based on the qualified name and the argument/parameter counts.
-class CallDescription {
+class CLANG_ABI CallDescription {
 public:
   enum class Mode {
     /// Match calls to functions from the C standard library. This also
@@ -259,7 +260,7 @@ using CDM = CallDescription::Mode;
 /// An immutable set of CallDescriptions.
 /// Checkers can efficiently decide if a given CallEvent matches any
 /// CallDescription in the set.
-class CallDescriptionSet {
+class CLANG_ABI CallDescriptionSet {
   CallDescriptionMap<bool /*unused*/> Impl = {};
 
 public:
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index 549c864dc91ef2..6a3500b18ed351 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -32,6 +32,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -150,7 +151,7 @@ class RuntimeDefinition {
 /// CallEventManager to be able to re-use CallEvent-sized memory blocks,
 /// subclasses of CallEvent may not add any data members to the base class.
 /// Use the "Data" and "Location" fields instead.
-class CallEvent {
+class CLANG_ABI CallEvent {
 public:
   using Kind = CallEventKind;
 
@@ -496,7 +497,7 @@ class CallEvent {
 
 /// Represents a call to any sort of function that might have a
 /// FunctionDecl.
-class AnyFunctionCall : public CallEvent {
+class CLANG_ABI AnyFunctionCall : public CallEvent {
 protected:
   AnyFunctionCall(const Expr *E, ProgramStateRef St,
                   const LocationContext *LCtx,
@@ -533,7 +534,7 @@ class AnyFunctionCall : public CallEvent {
 /// Represents a C function or static C++ member function call.
 ///
 /// Example: \c fun()
-class SimpleFunctionCall : public AnyFunctionCall {
+class CLANG_ABI SimpleFunctionCall : public AnyFunctionCall {
   friend class CallEventManager;
 
 protected:
@@ -571,7 +572,7 @@ class SimpleFunctionCall : public AnyFunctionCall {
 /// Represents a call to a block.
 ///
 /// Example: <tt>^{ statement-body }()</tt>
-class BlockCall : public CallEvent {
+class CLANG_ABI BlockCall : public CallEvent {
   friend class CallEventManager;
 
 protected:
@@ -674,7 +675,7 @@ class BlockCall : public CallEvent {
 
 /// Represents a non-static C++ member function call, no matter how
 /// it is written.
-class CXXInstanceCall : public AnyFunctionCall {
+class CLANG_ABI CXXInstanceCall : public AnyFunctionCall {
 protected:
   CXXInstanceCall(const CallExpr *CE, ProgramStateRef St,
                   const LocationContext *LCtx,
@@ -784,7 +785,7 @@ class CXXStaticOperatorCall : public SimpleFunctionCall {
 /// Represents a non-static C++ member function call.
 ///
 /// Example: \c obj.fun()
-class CXXMemberCall : public CXXInstanceCall {
+class CLANG_ABI CXXMemberCall : public CXXInstanceCall {
   friend class CallEventManager;
 
 protected:
@@ -827,7 +828,7 @@ class CXXMemberCall : public CXXInstanceCall {
 /// implemented as a non-static member function.
 ///
 /// Example: <tt>iter + 1</tt>
-class CXXMemberOperatorCall : public CXXInstanceCall {
+class CLANG_ABI CXXMemberOperatorCall : public CXXInstanceCall {
   friend class CallEventManager;
 
 protected:
@@ -887,7 +888,7 @@ class CXXMemberOperatorCall : public CXXInstanceCall {
 ///
 /// This can occur at the end of a scope (for automatic objects), at the end
 /// of a full-expression (for temporaries), or as part of a delete.
-class CXXDestructorCall : public CXXInstanceCall {
+class CLANG_ABI CXXDestructorCall : public CXXInstanceCall {
   friend class CallEventManager;
 
 protected:
@@ -945,7 +946,7 @@ class CXXDestructorCall : public CXXInstanceCall {
 
 /// Represents any constructor invocation. This includes regular constructors
 /// and inherited constructors.
-class AnyCXXConstructorCall : public AnyFunctionCall {
+class CLANG_ABI AnyCXXConstructorCall : public AnyFunctionCall {
 protected:
   AnyCXXConstructorCall(const Expr *E, const MemRegion *Target,
                         ProgramStateRef St, const LocationContext *LCtx,
@@ -1045,7 +1046,7 @@ class CXXConstructorCall : public AnyCXXConstructorCall {
 /// B b = X{};
 ///
 /// ... b.b is initialized to true.
-class CXXInheritedConstructorCall : public AnyCXXConstructorCall {
+class CLANG_ABI CXXInheritedConstructorCall : public AnyCXXConstructorCall {
   friend class CallEventManager;
 
 protected:
@@ -1240,7 +1241,7 @@ enum ObjCMessageKind { OCM_PropertyAccess, OCM_Subscript, OCM_Message };
 /// Represents any expression that calls an Objective-C method.
 ///
 /// This includes all of the kinds listed in ObjCMessageKind.
-class ObjCMethodCall : public CallEvent {
+class CLANG_ABI ObjCMethodCall : public CallEvent {
   friend class CallEventManager;
 
   const PseudoObjectExpr *getContainingPseudoObjectExpr() const;
@@ -1353,7 +1354,7 @@ class ObjCMethodCall : public CallEvent {
 /// memory blocks. The CallEvents created by CallEventManager are only valid
 /// for the lifetime of the OwnedCallEvent that holds them; right now these
 /// objects cannot be copied and ownership cannot be transferred.
-class CallEventManager {
+class CLANG_ABI CallEventManager {
   friend class CallEvent;
 
   llvm::BumpPtrAllocator &Alloc;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index 168983fd5cb686..c70b1fa23dada4 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -16,12 +16,13 @@
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
 namespace ento {
 
-class CheckerContext {
+class CLANG_ABI CheckerContext {
   ExprEngine &Eng;
   /// The current exploded(symbolic execution) graph node.
   ExplodedNode *Pred;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
index b4afaaeec9a4bd..87d1dc65e2a1ac 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
@@ -18,6 +18,7 @@
 #include "clang/AST/OperationKinds.h"
 #include "clang/AST/Stmt.h"
 #include "clang/Basic/OperatorKinds.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 #include <tuple>
 
@@ -30,10 +31,10 @@ class Preprocessor;
 
 namespace ento {
 
-bool containsMacro(const Stmt *S);
-bool containsEnum(const Stmt *S);
-bool containsStaticLocal(const Stmt *S);
-bool containsBuiltinOffsetOf(const Stmt *S);
+CLANG_ABI bool containsMacro(const Stmt *S);
+CLANG_ABI bool containsEnum(const Stmt *S);
+CLANG_ABI bool containsStaticLocal(const Stmt *S);
+CLANG_ABI bool containsBuiltinOffsetOf(const Stmt *S);
 template <class T> bool containsStmt(const Stmt *S) {
   if (isa<T>(S))
       return true;
@@ -45,7 +46,7 @@ template <class T> bool containsStmt(const Stmt *S) {
   return false;
 }
 
-std::pair<const clang::VarDecl *, const clang::Expr *>
+CLANG_ABI std::pair<const clang::VarDecl *, const clang::Expr *>
 parseAssignment(const Stmt *S);
 
 // Do not reorder! The getMostNullable method relies on the order.
@@ -65,13 +66,13 @@ enum class Nullability : char {
 };
 
 /// Get nullability annotation for a given type.
-Nullability getNullabilityAnnotation(QualType Type);
+CLANG_ABI Nullability getNullabilityAnnotation(QualType Type);
 
 /// Try to parse the value of a defined preprocessor macro. We can only parse
 /// simple expressions that consist of an optional minus sign token and then a
 /// token for an integer. If we cannot parse the value then std::nullopt is
 /// returned.
-std::optional<int> tryExpandAsInteger(StringRef Macro, const Preprocessor &PP);
+CLANG_ABI std::optional<int> tryExpandAsInteger(StringRef Macro, const Preprocessor &PP);
 
 class OperatorKind {
   union {
@@ -109,14 +110,14 @@ class OperatorKind {
   }
 };
 
-OperatorKind operationKindFromOverloadedOperator(OverloadedOperatorKind OOK,
+CLANG_ABI OperatorKind operationKindFromOverloadedOperator(OverloadedOperatorKind OOK,
                                                  bool IsBinary);
 
-std::optional<SVal> getPointeeVal(SVal PtrSVal, ProgramStateRef State);
+CLANG_ABI std::optional<SVal> getPointeeVal(SVal PtrSVal, ProgramStateRef State);
 
 /// Returns true if declaration \p D is in std namespace or any nested namespace
 /// or class scope.
-bool isWithinStdNamespace(const Decl *D);
+CLANG_ABI bool isWithinStdNamespace(const Decl *D);
 
 } // namespace ento
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
index 4de04bc4d397ac..dc19f6866e1707 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
@@ -17,6 +17,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/SaveAndRestore.h"
 #include <memory>
 #include <optional>
@@ -66,7 +67,7 @@ class ConditionTruthVal {
   bool isUnderconstrained() const { return !Val.has_value(); }
 };
 
-class ConstraintManager {
+class CLANG_ABI ConstraintManager {
 public:
   ConstraintManager() = default;
   virtual ~ConstraintManager();
@@ -184,11 +185,11 @@ class ConstraintManager {
                                   AssumeFunction &Assume);
 };
 
-std::unique_ptr<ConstraintManager>
+CLANG_ABI std::unique_ptr<ConstraintManager>
 CreateRangeConstraintManager(ProgramStateManager &statemgr,
                              ExprEngine *exprengine);
 
-std::unique_ptr<ConstraintManager>
+CLANG_ABI std::unique_ptr<ConstraintManager>
 CreateZ3ConstraintManager(ProgramStateManager &statemgr,
                           ExprEngine *exprengine);
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 0825ecbced3f5a..5cf150a0b443ed 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -24,6 +24,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/WorkList.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Casting.h"
@@ -47,7 +48,7 @@ class ExprEngine;
 //===----------------------------------------------------------------------===//
 /// CoreEngine - Implements the core logic of the graph-reachability analysis.
 /// It traverses the CFG and generates the ExplodedGraph.
-class CoreEngine {
+class CLANG_ABI CoreEngine {
   friend class CommonNodeBuilder;
   friend class EndOfFunctionNodeBuilder;
   friend class ExprEngine;
@@ -229,7 +230,7 @@ class NodeBuilderContext {
 /// be propagated to the next step / builder. They are the nodes which have been
 /// added to the builder (either as the input node set or as the newly
 /// constructed nodes) but did not have any outgoing transitions added.
-class NodeBuilder {
+class CLANG_ABI NodeBuilder {
   virtual void anchor();
 
 protected:
@@ -336,7 +337,7 @@ class NodeBuilder {
 
 /// \class NodeBuilderWithSinks
 /// This node builder keeps track of the generated sink nodes.
-class NodeBuilderWithSinks: public NodeBuilder {
+class CLANG_ABI NodeBuilderWithSinks: public NodeBuilder {
   void anchor() override;
 
 protected:
@@ -373,7 +374,7 @@ class NodeBuilderWithSinks: public NodeBuilder {
 /// This builder class is useful for generating nodes that resulted from
 /// visiting a statement. The main difference from its parent NodeBuilder is
 /// that it creates a statement specific ProgramPoint.
-class StmtNodeBuilder: public NodeBuilder {
+class CLANG_ABI StmtNodeBuilder: public NodeBuilder {
   NodeBuilder *EnclosingBldr;
 
 public:
@@ -425,7 +426,7 @@ class StmtNodeBuilder: public NodeBuilder {
 
 /// BranchNodeBuilder is responsible for constructing the nodes
 /// corresponding to the two branches of the if statement - true and false.
-class BranchNodeBuilder: public NodeBuilder {
+class CLANG_ABI BranchNodeBuilder: public NodeBuilder {
   const CFGBlock *DstT;
   const CFGBlock *DstF;
 
@@ -472,7 +473,7 @@ class BranchNodeBuilder: public NodeBuilder {
   }
 };
 
-class IndirectGotoNodeBuilder {
+class CLANG_ABI IndirectGotoNodeBuilder {
   CoreEngine& Eng;
   const CFGBlock *Src;
   const CFGBlock &DispatchBlock;
@@ -525,7 +526,7 @@ class IndirectGotoNodeBuilder {
   }
 };
 
-class SwitchNodeBuilder {
+class CLANG_ABI SwitchNodeBuilder {
   CoreEngine& Eng;
   const CFGBlock *Src;
   const Expr *Condition;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h
index 1a9bef06b15a44..a1838dc7945185 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h
@@ -18,24 +18,25 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace ento {
 
 /// \returns The stored dynamic extent for the region \p MR.
-DefinedOrUnknownSVal getDynamicExtent(ProgramStateRef State,
+CLANG_ABI DefinedOrUnknownSVal getDynamicExtent(ProgramStateRef State,
                                       const MemRegion *MR, SValBuilder &SVB);
 
 /// \returns The element extent of the type \p Ty.
-DefinedOrUnknownSVal getElementExtent(QualType Ty, SValBuilder &SVB);
+CLANG_ABI DefinedOrUnknownSVal getElementExtent(QualType Ty, SValBuilder &SVB);
 
 /// \returns The stored element count of the region \p MR.
-DefinedOrUnknownSVal getDynamicElementCount(ProgramStateRef State,
+CLANG_ABI DefinedOrUnknownSVal getDynamicElementCount(ProgramStateRef State,
                                             const MemRegion *MR,
                                             SValBuilder &SVB, QualType Ty);
 
 /// Set the dynamic extent \p Extent of the region \p MR.
-ProgramStateRef setDynamicExtent(ProgramStateRef State, const MemRegion *MR,
+CLANG_ABI ProgramStateRef setDynamicExtent(ProgramStateRef State, const MemRegion *MR,
                                  DefinedOrUnknownSVal Extent);
 
 /// Get the dynamic extent for a symbolic value that represents a buffer. If
@@ -51,11 +52,11 @@ ProgramStateRef setDynamicExtent(ProgramStateRef State, const MemRegion *MR,
 ///
 ///   char *bufptr;
 ///   (bufptr) // extent is unknown
-SVal getDynamicExtentWithOffset(ProgramStateRef State, SVal BufV);
+CLANG_ABI SVal getDynamicExtentWithOffset(ProgramStateRef State, SVal BufV);
 
 /// \returns The stored element count of the region represented by a symbolic
 /// value \p BufV.
-DefinedOrUnknownSVal getDynamicElementCountWithOffset(ProgramStateRef State,
+CLANG_ABI DefinedOrUnknownSVal getDynamicElementCountWithOffset(ProgramStateRef State,
                                                       SVal BufV, QualType Ty);
 
 } // namespace ento
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h
index 52d1526b1acf44..06c9b44c30ec66 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h
@@ -22,64 +22,65 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace ento {
 
 /// Get dynamic type information for the region \p MR.
-DynamicTypeInfo getDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR);
+CLANG_ABI DynamicTypeInfo getDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR);
 
 /// Get raw dynamic type information for the region \p MR.
 /// It might return null.
-const DynamicTypeInfo *getRawDynamicTypeInfo(ProgramStateRef State,
+CLANG_ABI const DynamicTypeInfo *getRawDynamicTypeInfo(ProgramStateRef State,
                                              const MemRegion *MR);
 
 /// Get dynamic type information stored in a class object represented by \p Sym.
-DynamicTypeInfo getClassObjectDynamicTypeInfo(ProgramStateRef State,
+CLANG_ABI DynamicTypeInfo getClassObjectDynamicTypeInfo(ProgramStateRef State,
                                               SymbolRef Sym);
 
 /// Get dynamic cast information from \p CastFromTy to \p CastToTy of \p MR.
-const DynamicCastInfo *getDynamicCastInfo(ProgramStateRef State,
+CLANG_ABI const DynamicCastInfo *getDynamicCastInfo(ProgramStateRef State,
                                           const MemRegion *MR,
                                           QualType CastFromTy,
                                           QualType CastToTy);
 
 /// Set dynamic type information of the region; return the new state.
-ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR,
+CLANG_ABI ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR,
                                    DynamicTypeInfo NewTy);
 
 /// Set dynamic type information of the region; return the new state.
-ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR,
+CLANG_ABI ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *MR,
                                    QualType NewTy, bool CanBeSubClassed = true);
 
 /// Set constraint on a type contained in a class object; return the new state.
-ProgramStateRef setClassObjectDynamicTypeInfo(ProgramStateRef State,
+CLANG_ABI ProgramStateRef setClassObjectDynamicTypeInfo(ProgramStateRef State,
                                               SymbolRef Sym,
                                               DynamicTypeInfo NewTy);
 
 /// Set constraint on a type contained in a class object; return the new state.
-ProgramStateRef setClassObjectDynamicTypeInfo(ProgramStateRef State,
+CLANG_ABI ProgramStateRef setClassObjectDynamicTypeInfo(ProgramStateRef State,
                                               SymbolRef Sym, QualType NewTy,
                                               bool CanBeSubClassed = true);
 
 /// Set dynamic type and cast information of the region; return the new state.
-ProgramStateRef setDynamicTypeAndCastInfo(ProgramStateRef State,
+CLANG_ABI ProgramStateRef setDynamicTypeAndCastInfo(ProgramStateRef State,
                                           const MemRegion *MR,
                                           QualType CastFromTy,
                                           QualType CastToTy,
                                           bool IsCastSucceeds);
 
 /// Removes the dead type informations from \p State.
-ProgramStateRef removeDeadTypes(ProgramStateRef State, SymbolReaper &SR);
+CLANG_ABI ProgramStateRef removeDeadTypes(ProgramStateRef State, SymbolReaper &SR);
 
 /// Removes the dead cast informations from \p State.
-ProgramStateRef removeDeadCasts(ProgramStateRef State, SymbolReaper &SR);
+CLANG_ABI ProgramStateRef removeDeadCasts(ProgramStateRef State, SymbolReaper &SR);
 
 /// Removes the dead Class object type informations from \p State.
-ProgramStateRef removeDeadClassObjectTypes(ProgramStateRef State,
+CLANG_ABI ProgramStateRef removeDeadClassObjectTypes(ProgramStateRef State,
                                            SymbolReaper &SR);
 
-void printDynamicTypeInfoJson(raw_ostream &Out, ProgramStateRef State,
+CLANG_ABI void printDynamicTypeInfoJson(raw_ostream &Out, ProgramStateRef State,
                               const char *NL = "\n", unsigned int Space = 0,
                               bool IsDot = false);
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
index 498e36e1431fa5..7dfb09b2b5e527 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
@@ -16,6 +16,7 @@
 #include "clang/Analysis/AnalysisDeclContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ImmutableMap.h"
 #include <utility>
 
@@ -32,7 +33,7 @@ class SymbolReaper;
 /// This allows the environment to manage context-sensitive bindings,
 /// which is essentially for modeling recursive function analysis, among
 /// other things.
-class EnvironmentEntry : public std::pair<const Stmt *,
+class CLANG_ABI EnvironmentEntry : public std::pair<const Stmt *,
                                           const StackFrameContext *> {
 public:
   EnvironmentEntry(const Stmt *s, const LocationContext *L);
@@ -53,7 +54,7 @@ class EnvironmentEntry : public std::pair<const Stmt *,
 };
 
 /// An immutable map from EnvironemntEntries to SVals.
-class Environment {
+class CLANG_ABI Environment {
 private:
   friend class EnvironmentManager;
 
@@ -96,7 +97,7 @@ class Environment {
                  unsigned int Space = 0, bool IsDot = false) const;
 };
 
-class EnvironmentManager {
+class CLANG_ABI EnvironmentManager {
 private:
   using FactoryTy = Environment::BindingsTy::Factory;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
index 2fb05ac46e8fad..ce573e8b6f84c7 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -25,6 +25,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DepthFirstIterator.h"
@@ -63,7 +64,7 @@ class ExplodedGraph;
 // ExplodedNode is not constified all over the engine because we need to add
 // successors to it at any time after creating it.
 
-class ExplodedNode : public llvm::FoldingSetNode {
+class CLANG_ABI ExplodedNode : public llvm::FoldingSetNode {
   friend class BranchNodeBuilder;
   friend class CoreEngine;
   friend class EndOfFunctionNodeBuilder;
@@ -81,7 +82,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
   /// store a flag rather than a node list, which ExplodedNode uses to mark
   /// whether a node is a sink. If the flag is set, the group is implicitly
   /// empty and no nodes may be added.
-  class NodeGroup {
+  class CLANG_ABI NodeGroup {
     // Conceptually a discriminated union. If the low bit is set, the node is
     // a sink. If the low bit is not set, the pointer refers to the storage
     // for the nodes in the group.
@@ -300,7 +301,7 @@ class ExplodedNode : public llvm::FoldingSetNode {
 using InterExplodedGraphMap =
     llvm::DenseMap<const ExplodedNode *, const ExplodedNode *>;
 
-class ExplodedGraph {
+class CLANG_ABI ExplodedGraph {
 protected:
   friend class CoreEngine;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index 04eacd1df7ffe2..d5fb84a5cc1a08 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -21,19 +21,20 @@
 #include "clang/Analysis/DomainSpecific/ObjCNoReturn.h"
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/Basic/LLVM.h"
-#include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/WorkList.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include <cassert>
 #include <optional>
@@ -121,7 +122,7 @@ struct EvalCallOptions {
   EvalCallOptions() {}
 };
 
-class ExprEngine {
+class CLANG_ABI ExprEngine {
   void anchor();
 
 public:
@@ -1004,7 +1005,7 @@ class ExprEngine {
 // from multiple translation units.
 struct ReplayWithoutInlining{};
 template <>
-struct ProgramStateTrait<ReplayWithoutInlining> :
+struct CLANG_ABI ProgramStateTrait<ReplayWithoutInlining> :
   public ProgramStatePartialTrait<const void*> {
   static void *GDMIndex();
 };
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
index 3ee0d229cfc299..2aa4f44807e0f2 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallBitVector.h"
@@ -29,7 +30,7 @@ namespace ento {
 using SetOfDecls = std::deque<Decl *>;
 using SetOfConstDecls = llvm::DenseSet<const Decl *>;
 
-class FunctionSummariesTy {
+class CLANG_ABI FunctionSummariesTy {
   class FunctionSummary {
   public:
     /// Marks the IDs of the basic blocks visited during the analyzes.
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h
index eb2b0b343428f6..563fd99ad672d4 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h
@@ -24,22 +24,23 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_LOOPUNROLLING_H
 
 #include "clang/Analysis/CFG.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/Support/Compiler.h"
 namespace clang {
 namespace ento {
 
 /// Returns if the given State indicates that is inside a completely unrolled
 /// loop.
-bool isUnrolledState(ProgramStateRef State);
+CLANG_ABI bool isUnrolledState(ProgramStateRef State);
 
 /// Updates the stack of loops contained by the ProgramState.
-ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
+CLANG_ABI ProgramStateRef updateLoopStack(const Stmt *LoopStmt, ASTContext &ASTCtx,
                                 ExplodedNode* Pred, unsigned maxVisitOnPath);
 
 /// Updates the given ProgramState. In current implementation it removes the top
 /// element of the stack of loops.
-ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State);
+CLANG_ABI ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State);
 
 } // end namespace ento
 } // end namespace clang
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h
index e75228f92a8e59..2c55009c70f1bd 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h
@@ -17,6 +17,7 @@
 
 #include "clang/Analysis/CFG.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace ento {
@@ -25,7 +26,7 @@ namespace ento {
 ///
 /// Widen the loop by invalidating anything that might be modified
 /// by the loop body in any iteration.
-ProgramStateRef getWidenedLoopState(ProgramStateRef PrevState,
+CLANG_ABI ProgramStateRef getWidenedLoopState(ProgramStateRef PrevState,
                                     const LocationContext *LCtx,
                                     unsigned BlockCount, const Stmt *LoopStmt);
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
index 0d9566285f5d4e..1bcbf505f905eb 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -28,6 +28,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerIntPair.h"
@@ -94,7 +95,7 @@ class RegionOffset {
 //===----------------------------------------------------------------------===//
 
 /// MemRegion - The root abstract class for all memory regions.
-class MemRegion : public llvm::FoldingSetNode {
+class CLANG_ABI MemRegion : public llvm::FoldingSetNode {
 public:
   enum Kind {
 #define REGION(Id, Parent) Id ## Kind,
@@ -205,7 +206,7 @@ class MemRegion : public llvm::FoldingSetNode {
 
 /// MemSpaceRegion - A memory region that represents a "memory space";
 ///  for example, the set of global variables, the stack frame, etc.
-class MemSpaceRegion : public MemRegion {
+class CLANG_ABI MemSpaceRegion : public MemRegion {
 protected:
   MemRegionManager &Mgr;
 
@@ -228,7 +229,7 @@ class MemSpaceRegion : public MemRegion {
 
 /// CodeSpaceRegion - The memory space that holds the executable code of
 /// functions and blocks.
-class CodeSpaceRegion : public MemSpaceRegion {
+class CLANG_ABI CodeSpaceRegion : public MemSpaceRegion {
   friend class MemRegionManager;
 
   CodeSpaceRegion(MemRegionManager &mgr)
@@ -242,7 +243,7 @@ class CodeSpaceRegion : public MemSpaceRegion {
   }
 };
 
-class GlobalsSpaceRegion : public MemSpaceRegion {
+class CLANG_ABI GlobalsSpaceRegion : public MemSpaceRegion {
   virtual void anchor();
 
 protected:
@@ -262,7 +263,7 @@ class GlobalsSpaceRegion : public MemSpaceRegion {
 ///
 /// Currently, only the static locals are placed there, so we know that these
 /// variables do not get invalidated by calls to other functions.
-class StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
+class CLANG_ABI StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
   friend class MemRegionManager;
 
   const CodeTextRegion *CR;
@@ -291,7 +292,7 @@ class StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
 /// invalidating a set of related global values as is done in
 /// RegionStoreManager::invalidateRegions (instead of finding all the dependent
 /// globals, we invalidate the whole parent region).
-class NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
+class CLANG_ABI NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
   void anchor() override;
 
 protected:
@@ -310,7 +311,7 @@ class NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
 
 /// The region containing globals which are defined in system/external
 /// headers and are considered modifiable by system calls (ex: errno).
-class GlobalSystemSpaceRegion : public NonStaticGlobalSpaceRegion {
+class CLANG_ABI GlobalSystemSpaceRegion : public NonStaticGlobalSpaceRegion {
   friend class MemRegionManager;
 
   GlobalSystemSpaceRegion(MemRegionManager &mgr)
@@ -329,7 +330,7 @@ class GlobalSystemSpaceRegion : public NonStaticGlobalSpaceRegion {
 /// (system or internal). Ex: Const global scalars would be modeled as part of
 /// this region. This region also includes most system globals since they have
 /// low chance of being modified.
-class GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion {
+class CLANG_ABI GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion {
   friend class MemRegionManager;
 
   GlobalImmutableSpaceRegion(MemRegionManager &mgr)
@@ -346,7 +347,7 @@ class GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion {
 /// The region containing globals which can be modified by calls to
 /// "internally" defined functions - (for now just) functions other then system
 /// calls.
-class GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion {
+class CLANG_ABI GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion {
   friend class MemRegionManager;
 
   GlobalInternalSpaceRegion(MemRegionManager &mgr)
@@ -360,7 +361,7 @@ class GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion {
   }
 };
 
-class HeapSpaceRegion : public MemSpaceRegion {
+class CLANG_ABI HeapSpaceRegion : public MemSpaceRegion {
   friend class MemRegionManager;
 
   HeapSpaceRegion(MemRegionManager &mgr)
@@ -374,7 +375,7 @@ class HeapSpaceRegion : public MemSpaceRegion {
   }
 };
 
-class UnknownSpaceRegion : public MemSpaceRegion {
+class CLANG_ABI UnknownSpaceRegion : public MemSpaceRegion {
   friend class MemRegionManager;
 
   UnknownSpaceRegion(MemRegionManager &mgr)
@@ -388,7 +389,7 @@ class UnknownSpaceRegion : public MemSpaceRegion {
   }
 };
 
-class StackSpaceRegion : public MemSpaceRegion {
+class CLANG_ABI StackSpaceRegion : public MemSpaceRegion {
   virtual void anchor();
 
   const StackFrameContext *SFC;
@@ -412,7 +413,7 @@ class StackSpaceRegion : public MemSpaceRegion {
   }
 };
 
-class StackLocalsSpaceRegion : public StackSpaceRegion {
+class CLANG_ABI StackLocalsSpaceRegion : public StackSpaceRegion {
   friend class MemRegionManager;
 
   StackLocalsSpaceRegion(MemRegionManager &mgr, const StackFrameContext *sfc)
@@ -426,7 +427,7 @@ class StackLocalsSpaceRegion : public StackSpaceRegion {
   }
 };
 
-class StackArgumentsSpaceRegion : public StackSpaceRegion {
+class CLANG_ABI StackArgumentsSpaceRegion : public StackSpaceRegion {
 private:
   friend class MemRegionManager;
 
@@ -443,7 +444,7 @@ class StackArgumentsSpaceRegion : public StackSpaceRegion {
 
 /// SubRegion - A region that subsets another larger region.  Most regions
 ///  are subclasses of SubRegion.
-class SubRegion : public MemRegion {
+class CLANG_ABI SubRegion : public MemRegion {
   virtual void anchor();
 
 protected:
@@ -475,7 +476,7 @@ class SubRegion : public MemRegion {
 
 /// AllocaRegion - A region that represents an untyped blob of bytes created
 ///  by a call to 'alloca'.
-class AllocaRegion : public SubRegion {
+class CLANG_ABI AllocaRegion : public SubRegion {
   friend class MemRegionManager;
 
   // Block counter. Used to distinguish different pieces of memory allocated by
@@ -508,7 +509,7 @@ class AllocaRegion : public SubRegion {
 };
 
 /// TypedRegion - An abstract class representing regions that are typed.
-class TypedRegion : public SubRegion {
+class CLANG_ABI TypedRegion : public SubRegion {
   void anchor() override;
 
 protected:
@@ -532,7 +533,7 @@ class TypedRegion : public SubRegion {
 };
 
 /// TypedValueRegion - An abstract class representing regions having a typed value.
-class TypedValueRegion : public TypedRegion {
+class CLANG_ABI TypedValueRegion : public TypedRegion {
   void anchor() override;
 
 protected:
@@ -563,7 +564,7 @@ class TypedValueRegion : public TypedRegion {
   }
 };
 
-class CodeTextRegion : public TypedRegion {
+class CLANG_ABI CodeTextRegion : public TypedRegion {
   void anchor() override;
 
 protected:
@@ -581,7 +582,7 @@ class CodeTextRegion : public TypedRegion {
 };
 
 /// FunctionCodeRegion - A region that represents code texts of function.
-class FunctionCodeRegion : public CodeTextRegion {
+class CLANG_ABI FunctionCodeRegion : public CodeTextRegion {
   friend class MemRegionManager;
 
   const NamedDecl *FD;
@@ -628,7 +629,7 @@ class FunctionCodeRegion : public CodeTextRegion {
 ///  which correspond to "code+data".  The distinction is important, because
 ///  like a closure a block captures the values of externally referenced
 ///  variables.
-class BlockCodeRegion : public CodeTextRegion {
+class CLANG_ABI BlockCodeRegion : public CodeTextRegion {
   friend class MemRegionManager;
 
   const BlockDecl *BD;
@@ -675,7 +676,7 @@ class BlockCodeRegion : public CodeTextRegion {
 ///  which correspond to "code+data".  The distinction is important, because
 ///  like a closure a block captures the values of externally referenced
 ///  variables.
-class BlockDataRegion : public TypedRegion {
+class CLANG_ABI BlockDataRegion : public TypedRegion {
   friend class MemRegionManager;
 
   const BlockCodeRegion *BC;
@@ -777,7 +778,7 @@ class BlockDataRegion : public TypedRegion {
 ///  either a real region, a NULL pointer, etc.  It essentially is used to
 ///  map the concept of symbolic values into the domain of regions.  Symbolic
 ///  regions do not need to be typed.
-class SymbolicRegion : public SubRegion {
+class CLANG_ABI SymbolicRegion : public SubRegion {
   friend class MemRegionManager;
 
   const SymbolRef sym;
@@ -826,7 +827,7 @@ class SymbolicRegion : public SubRegion {
 };
 
 /// StringRegion - Region associated with a StringLiteral.
-class StringRegion : public TypedValueRegion {
+class CLANG_ABI StringRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   const StringLiteral *Str;
@@ -860,7 +861,7 @@ class StringRegion : public TypedValueRegion {
 };
 
 /// The region associated with an ObjCStringLiteral.
-class ObjCStringRegion : public TypedValueRegion {
+class CLANG_ABI ObjCStringRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   const ObjCStringLiteral *Str;
@@ -897,7 +898,7 @@ class ObjCStringRegion : public TypedValueRegion {
 /// CompoundLiteralRegion - A memory region representing a compound literal.
 ///   Compound literals are essentially temporaries that are stack allocated
 ///   or in the global constant pool.
-class CompoundLiteralRegion : public TypedValueRegion {
+class CLANG_ABI CompoundLiteralRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   const CompoundLiteralExpr *CL;
@@ -931,7 +932,7 @@ class CompoundLiteralRegion : public TypedValueRegion {
   }
 };
 
-class DeclRegion : public TypedValueRegion {
+class CLANG_ABI DeclRegion : public TypedValueRegion {
 protected:
   DeclRegion(const MemRegion *sReg, Kind k) : TypedValueRegion(sReg, k) {
     assert(classof(this));
@@ -947,7 +948,7 @@ class DeclRegion : public TypedValueRegion {
   }
 };
 
-class VarRegion : public DeclRegion {
+class CLANG_ABI VarRegion : public DeclRegion {
   friend class MemRegionManager;
 
 protected:
@@ -979,7 +980,7 @@ class VarRegion : public DeclRegion {
   }
 };
 
-class NonParamVarRegion : public VarRegion {
+class CLANG_ABI NonParamVarRegion : public VarRegion {
   friend class MemRegionManager;
 
   const VarDecl *VD;
@@ -1031,7 +1032,7 @@ class NonParamVarRegion : public VarRegion {
 // implementing stack frame creations for functions without decl (functions
 // passed by unknown function pointer) methods of `ParamVarRegion` must be
 // updated.
-class ParamVarRegion : public VarRegion {
+class CLANG_ABI ParamVarRegion : public VarRegion {
   friend class MemRegionManager;
 
   const Expr *OriginExpr;
@@ -1071,7 +1072,7 @@ class ParamVarRegion : public VarRegion {
 /// CXXThisRegion - Represents the region for the implicit 'this' parameter
 ///  in a call to a C++ method.  This region doesn't represent the object
 ///  referred to by 'this', but rather 'this' itself.
-class CXXThisRegion : public TypedValueRegion {
+class CLANG_ABI CXXThisRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   CXXThisRegion(const PointerType *thisPointerTy,
@@ -1103,7 +1104,7 @@ class CXXThisRegion : public TypedValueRegion {
   const PointerType *ThisPointerTy;
 };
 
-class FieldRegion : public DeclRegion {
+class CLANG_ABI FieldRegion : public DeclRegion {
   friend class MemRegionManager;
 
   const FieldDecl *FD;
@@ -1143,7 +1144,7 @@ class FieldRegion : public DeclRegion {
   }
 };
 
-class ObjCIvarRegion : public DeclRegion {
+class CLANG_ABI ObjCIvarRegion : public DeclRegion {
   friend class MemRegionManager;
 
   const ObjCIvarDecl *IVD;
@@ -1175,7 +1176,7 @@ class ObjCIvarRegion : public DeclRegion {
 // Auxiliary data classes for use with MemRegions.
 //===----------------------------------------------------------------------===//
 
-class RegionRawOffset {
+class CLANG_ABI RegionRawOffset {
   friend class ElementRegion;
 
   const MemRegion *Region;
@@ -1196,7 +1197,7 @@ class RegionRawOffset {
 };
 
 /// ElementRegion is used to represent both array elements and casts.
-class ElementRegion : public TypedValueRegion {
+class CLANG_ABI ElementRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   QualType ElementType;
@@ -1235,7 +1236,7 @@ class ElementRegion : public TypedValueRegion {
 };
 
 // C++ temporary object associated with an expression.
-class CXXTempObjectRegion : public TypedValueRegion {
+class CLANG_ABI CXXTempObjectRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   Expr const *Ex;
@@ -1269,7 +1270,7 @@ class CXXTempObjectRegion : public TypedValueRegion {
 
 // C++ temporary object that have lifetime extended to lifetime of the
 // variable. Usually they represent temporary bounds to reference variables.
-class CXXLifetimeExtendedObjectRegion : public TypedValueRegion {
+class CLANG_ABI CXXLifetimeExtendedObjectRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   Expr const *Ex;
@@ -1308,7 +1309,7 @@ class CXXLifetimeExtendedObjectRegion : public TypedValueRegion {
 
 // CXXBaseObjectRegion represents a base object within a C++ object. It is
 // identified by the base class declaration and the region of its parent object.
-class CXXBaseObjectRegion : public TypedValueRegion {
+class CLANG_ABI CXXBaseObjectRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> Data;
@@ -1347,7 +1348,7 @@ class CXXBaseObjectRegion : public TypedValueRegion {
 // region of its parent object. It is a bit counter-intuitive (but not otherwise
 // unseen) that this region represents a larger segment of memory that its
 // super-region.
-class CXXDerivedObjectRegion : public TypedValueRegion {
+class CLANG_ABI CXXDerivedObjectRegion : public TypedValueRegion {
   friend class MemRegionManager;
 
   const CXXRecordDecl *DerivedD;
@@ -1401,7 +1402,7 @@ LLVM_ATTRIBUTE_RETURNS_NONNULL const RegionTy *MemRegion::castAs() const {
 // MemRegionManager - Factory object for creating regions.
 //===----------------------------------------------------------------------===//
 
-class MemRegionManager {
+class CLANG_ABI MemRegionManager {
   ASTContext &Ctx;
   llvm::BumpPtrAllocator& A;
 
@@ -1626,7 +1627,7 @@ inline ASTContext &MemRegion::getContext() const {
 //===----------------------------------------------------------------------===//
 
 /// Information about invalidation for a particular region/symbol.
-class RegionAndSymbolInvalidationTraits {
+class CLANG_ABI RegionAndSymbolInvalidationTraits {
   using StorageTypeForKinds = unsigned char;
 
   llvm::DenseMap<const MemRegion *, StorageTypeForKinds> MRTraitsMap;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index eef7a54f03bf11..907f30d4691b6e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -20,6 +20,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableMap.h"
 #include "llvm/Support/Allocator.h"
@@ -68,7 +69,7 @@ template <typename T> struct ProgramStateTrait {
 ///  ProgramState is intended to be used as a functional object; that is,
 ///  once it is created and made "persistent" in a FoldingSet, its
 ///  values will never change.
-class ProgramState : public llvm::FoldingSetNode {
+class CLANG_ABI ProgramState : public llvm::FoldingSetNode {
 public:
   typedef llvm::ImmutableSet<llvm::APSInt*>                IntSetTy;
   typedef llvm::ImmutableMap<void*, void*>                 GenericDataMap;
@@ -484,8 +485,8 @@ class ProgramState : public llvm::FoldingSetNode {
   void dump() const;
 
 private:
-  friend void ProgramStateRetain(const ProgramState *state);
-  friend void ProgramStateRelease(const ProgramState *state);
+  friend CLANG_ABI void ProgramStateRetain(const ProgramState *state);
+  friend CLANG_ABI void ProgramStateRelease(const ProgramState *state);
 
   SVal wrapSymbolicRegion(SVal Base) const;
 };
@@ -494,9 +495,9 @@ class ProgramState : public llvm::FoldingSetNode {
 // ProgramStateManager - Factory object for ProgramStates.
 //===----------------------------------------------------------------------===//
 
-class ProgramStateManager {
+class CLANG_ABI ProgramStateManager {
   friend class ProgramState;
-  friend void ProgramStateRelease(const ProgramState *state);
+  friend CLANG_ABI void ProgramStateRelease(const ProgramState *state);
 private:
   /// Eng - The ExprEngine that owns this state manager.
   ExprEngine *Eng; /* Can be null. */
@@ -882,7 +883,7 @@ CB ProgramState::scanReachableSymbols(
 /// A utility class that visits the reachable symbols using a custom
 /// SymbolVisitor. Terminates recursive traversal when the visitor function
 /// returns false.
-class ScanReachableSymbols {
+class CLANG_ABI ScanReachableSymbols {
   typedef llvm::DenseSet<const void*> VisitedItems;
 
   VisitedItems visited;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
index 0ea26bf2e509bc..886c7dfa56c8d0 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
@@ -10,14 +10,15 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_PROGRAMSTATE_FWD_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 
 namespace clang {
 namespace ento {
   class ProgramState;
   class ProgramStateManager;
-  void ProgramStateRetain(const ProgramState *state);
-  void ProgramStateRelease(const ProgramState *state);
+  CLANG_ABI void ProgramStateRetain(const ProgramState *state);
+  CLANG_ABI void ProgramStateRelease(const ProgramState *state);
 }
 }
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
index 49ea006e27aa54..64385e17b451d0 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
@@ -16,6 +16,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/Support/Allocator.h"
 
@@ -26,7 +27,7 @@ namespace ento {
 /// A Range represents the closed range [from, to].  The caller must
 /// guarantee that from <= to.  Note that Range is immutable, so as not
 /// to subvert RangeSet's immutability.
-class Range {
+class CLANG_ABI Range {
 public:
   Range(const llvm::APSInt &From, const llvm::APSInt &To) : Impl(&From, &To) {
     assert(From <= To);
@@ -68,7 +69,7 @@ class Range {
 ///
 /// Empty set corresponds to an overly constrained symbol meaning that there
 /// are no possible values for that symbol.
-class RangeSet {
+class CLANG_ABI RangeSet {
 public:
   class Factory;
 
@@ -118,7 +119,7 @@ class RangeSet {
 
   bool isEmpty() const { return Impl->empty(); }
 
-  class Factory {
+  class CLANG_ABI Factory {
   public:
     Factory(BasicValueFactory &BV) : ValueFactory(BV) {}
 
@@ -402,9 +403,9 @@ class RangeSet {
 };
 
 using ConstraintMap = llvm::ImmutableMap<SymbolRef, RangeSet>;
-ConstraintMap getConstraintMap(ProgramStateRef State);
+CLANG_ABI ConstraintMap getConstraintMap(ProgramStateRef State);
 
-class RangedConstraintManager : public SimpleConstraintManager {
+class CLANG_ABI RangedConstraintManager : public SimpleConstraintManager {
 public:
   RangedConstraintManager(ExprEngine *EE, SValBuilder &SB)
       : SimpleConstraintManager(EE, SB) {}
@@ -486,13 +487,13 @@ class RangedConstraintManager : public SimpleConstraintManager {
 /// functions where we can work only with symbols. Use the other function
 /// (simplifyToSVal) if you are interested in a simplification that may yield
 /// a concrete constant value.
-SymbolRef simplify(ProgramStateRef State, SymbolRef Sym);
+CLANG_ABI SymbolRef simplify(ProgramStateRef State, SymbolRef Sym);
 
 /// Try to simplify a given symbolic expression's associated `SVal` based on the
 /// constraints in State. This is very similar to `simplify`, but this function
 /// always returns the simplified SVal. The simplified SVal might be a single
 /// constant (i.e. `ConcreteInt`).
-SVal simplifyToSVal(ProgramStateRef State, SymbolRef Sym);
+CLANG_ABI SVal simplifyToSVal(ProgramStateRef State, SymbolRef Sym);
 
 } // namespace ento
 } // namespace clang
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
index ec2b2b24569480..2abd36077e64fe 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -27,6 +27,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ImmutableList.h"
 #include <cstdint>
 #include <optional>
@@ -50,7 +51,7 @@ class ConditionTruthVal;
 class ProgramStateManager;
 class StoreRef;
 
-class SValBuilder {
+class CLANG_ABI SValBuilder {
   virtual void anchor();
 
 protected:
@@ -410,7 +411,7 @@ class SValBuilder {
                                const StackFrameContext *SFC);
 };
 
-SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
+CLANG_ABI SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
                                      ASTContext &context,
                                      ProgramStateManager &stateMgr);
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index a054a819a15a85..293c3b1ba985c7 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -18,6 +18,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableList.h"
@@ -52,7 +53,7 @@ class TypedValueRegion;
 /// SVal - This represents a symbolic expression, which can be either
 ///  an L-value or an R-value.
 ///
-class SVal {
+class CLANG_ABI SVal {
 public:
   enum SValKind : unsigned char {
 #define BASIC_SVAL(Id, Parent) Id##Kind,
@@ -234,7 +235,7 @@ class DefinedSVal : public DefinedOrUnknownSVal {
       : DefinedOrUnknownSVal(Kind, Data) {}
 };
 
-class NonLoc : public DefinedSVal {
+class CLANG_ABI NonLoc : public DefinedSVal {
 protected:
   NonLoc(SValKind Kind, const void *Data) : DefinedSVal(Kind, Data) {}
 
@@ -251,7 +252,7 @@ class NonLoc : public DefinedSVal {
   }
 };
 
-class Loc : public DefinedSVal {
+class CLANG_ABI Loc : public DefinedSVal {
 protected:
   Loc(SValKind Kind, const void *Data) : DefinedSVal(Kind, Data) {}
 
@@ -332,7 +333,7 @@ class LocAsInteger : public NonLoc {
 /// which represents a concrete r-value of an initializer-list or a string.
 /// Internally, it contains an llvm::ImmutableList of SVal's stored inside the
 /// literal.
-class CompoundVal : public NonLoc {
+class CLANG_ABI CompoundVal : public NonLoc {
   friend class ento::SValBuilder;
 
   explicit CompoundVal(const CompoundValData *D) : NonLoc(CompoundValKind, D) {
@@ -382,7 +383,7 @@ class CompoundVal : public NonLoc {
 ///
 /// NOTE: LazyCompoundVal::getRegion() itself is also immaterial (see the actual
 /// method docs for details).
-class LazyCompoundVal : public NonLoc {
+class CLANG_ABI LazyCompoundVal : public NonLoc {
   friend class ento::SValBuilder;
 
   explicit LazyCompoundVal(const LazyCompoundValData *D)
@@ -427,7 +428,7 @@ class LazyCompoundVal : public NonLoc {
 /// This list is required to accumulate the pointer-to-member cast history to
 /// figure out the correct subobject field. In particular, implicit casts grow
 /// this list and explicit casts like static_cast shrink this list.
-class PointerToMember : public NonLoc {
+class CLANG_ABI PointerToMember : public NonLoc {
   friend class ento::SValBuilder;
 
 public:
@@ -478,7 +479,7 @@ class GotoLabel : public Loc {
   static bool classof(SVal V) { return V.getKind() == GotoLabelKind; }
 };
 
-class MemRegionVal : public Loc {
+class CLANG_ABI MemRegionVal : public Loc {
 public:
   explicit MemRegionVal(const MemRegion *r) : Loc(MemRegionValKind, r) {
     assert(r);
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
index 725140e073c617..a1e41c18def9b6 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
@@ -15,12 +15,13 @@
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
 namespace ento {
 
-class SimpleConstraintManager : public ConstraintManager {
+class CLANG_ABI SimpleConstraintManager : public ConstraintManager {
   ExprEngine *EE;
   SValBuilder &SVB;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index 332855a3c9c45e..42836843288084 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -14,13 +14,14 @@
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H
 
 #include "clang/AST/Type.h"
+#include "clang/Basic/LLVM.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
-#include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallVector.h"
@@ -50,7 +51,7 @@ class SymbolReaper;
 
 using InvalidatedSymbols = llvm::DenseSet<SymbolRef>;
 
-class StoreManager {
+class CLANG_ABI StoreManager {
 protected:
   SValBuilder &svalBuilder;
   ProgramStateManager &StateMgr;
@@ -253,7 +254,7 @@ class StoreManager {
   virtual void printJson(raw_ostream &Out, Store S, const char *NL,
                          unsigned int Space, bool IsDot) const = 0;
 
-  class BindingsHandler {
+  class CLANG_ABI BindingsHandler {
   public:
     virtual ~BindingsHandler();
 
@@ -262,7 +263,7 @@ class StoreManager {
                                const MemRegion *region, SVal val) = 0;
   };
 
-  class FindUniqueBinding : public BindingsHandler {
+  class CLANG_ABI FindUniqueBinding : public BindingsHandler {
     SymbolRef Sym;
     const MemRegion* Binding = nullptr;
     bool First = true;
@@ -318,7 +319,7 @@ inline StoreRef &StoreRef::operator=(StoreRef const &newStore) {
 }
 
 // FIXME: Do we need to pass ProgramStateManager anymore?
-std::unique_ptr<StoreManager>
+CLANG_ABI std::unique_ptr<StoreManager>
 CreateRegionStoreManager(ProgramStateManager &StMgr);
 
 } // namespace ento
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
index a2dd05cfdf4c9a..325229a075bf24 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STOREREF_H
 
+#include "clang/Support/Compiler.h"
 #include <cassert>
 
 namespace clang {
@@ -26,7 +27,7 @@ class StoreManager;
 ///  different types to represent the locations and values.
 using Store = const void *;
 
-class StoreRef {
+class CLANG_ABI StoreRef {
   Store store;
   StoreManager &mgr;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
index 862a30c0e73633..ccc1af985e5dc5 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h
@@ -15,6 +15,7 @@
 
 #include "clang/AST/Type.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator_range.h"
@@ -27,7 +28,7 @@ class MemRegion;
 
 /// Symbolic value. These values used to capture symbolic execution of
 /// the program.
-class SymExpr : public llvm::FoldingSetNode {
+class CLANG_ABI SymExpr : public llvm::FoldingSetNode {
   virtual void anchor();
 
 public:
@@ -68,7 +69,7 @@ class SymExpr : public llvm::FoldingSetNode {
   /// For SymbolData, it's the symbol itself; for expressions, it's the
   /// expression symbol and all the operands in it. Note, SymbolDerived is
   /// treated as SymbolData - the iterator will NOT visit the parent region.
-  class symbol_iterator {
+  class CLANG_ABI symbol_iterator {
     SmallVector<const SymExpr *, 5> itr;
 
     void expand();
@@ -116,7 +117,7 @@ using SymbolID = unsigned;
 
 /// A symbol representing data which can be stored in a memory location
 /// (region).
-class SymbolData : public SymExpr {
+class CLANG_ABI SymbolData : public SymExpr {
   const SymbolID Sym;
 
   void anchor() override;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
index 3b64d38ee2b233..dfbb7b945c631e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
@@ -21,6 +21,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -39,7 +40,7 @@ class BasicValueFactory;
 class StoreManager;
 
 ///A symbol representing the value stored at a MemRegion.
-class SymbolRegionValue : public SymbolData {
+class CLANG_ABI SymbolRegionValue : public SymbolData {
   const TypedValueRegion *R;
 
 public:
@@ -76,7 +77,7 @@ class SymbolRegionValue : public SymbolData {
 
 /// A symbol representing the result of an expression in the case when we do
 /// not know anything about what the expression is.
-class SymbolConjured : public SymbolData {
+class CLANG_ABI SymbolConjured : public SymbolData {
   const Stmt *S;
   QualType T;
   unsigned Count;
@@ -132,7 +133,7 @@ class SymbolConjured : public SymbolData {
 
 /// A symbol representing the value of a MemRegion whose parent region has
 /// symbolic value.
-class SymbolDerived : public SymbolData {
+class CLANG_ABI SymbolDerived : public SymbolData {
   SymbolRef parentSymbol;
   const TypedValueRegion *R;
 
@@ -176,7 +177,7 @@ class SymbolDerived : public SymbolData {
 /// SymbolExtent - Represents the extent (size in bytes) of a bounded region.
 ///  Clients should not ask the SymbolManager for a region's extent. Always use
 ///  SubRegion::getExtent instead -- the value returned may not be a symbol.
-class SymbolExtent : public SymbolData {
+class CLANG_ABI SymbolExtent : public SymbolData {
   const SubRegion *R;
 
 public:
@@ -213,7 +214,7 @@ class SymbolExtent : public SymbolData {
 ///  Metadata symbols remain live as long as they are marked as in use before
 ///  dead-symbol sweeping AND their associated regions are still alive.
 ///  Intended for use by checkers.
-class SymbolMetadata : public SymbolData {
+class CLANG_ABI SymbolMetadata : public SymbolData {
   const MemRegion* R;
   const Stmt *S;
   QualType T;
@@ -276,7 +277,7 @@ class SymbolMetadata : public SymbolData {
 };
 
 /// Represents a cast expression.
-class SymbolCast : public SymExpr {
+class CLANG_ABI SymbolCast : public SymExpr {
   const SymExpr *Operand;
 
   /// Type of the operand.
@@ -326,7 +327,7 @@ class SymbolCast : public SymExpr {
 };
 
 /// Represents a symbolic expression involving a unary operator.
-class UnarySymExpr : public SymExpr {
+class CLANG_ABI UnarySymExpr : public SymExpr {
   const SymExpr *Operand;
   UnaryOperator::Opcode Op;
   QualType T;
@@ -375,7 +376,7 @@ class UnarySymExpr : public SymExpr {
 };
 
 /// Represents a symbolic expression involving a binary operator
-class BinarySymExpr : public SymExpr {
+class CLANG_ABI BinarySymExpr : public SymExpr {
   BinaryOperator::Opcode Op;
   QualType T;
 
@@ -479,7 +480,7 @@ using IntSymExpr = BinarySymExprImpl<const llvm::APSInt &, const SymExpr *,
 using SymSymExpr = BinarySymExprImpl<const SymExpr *, const SymExpr *,
                                      SymExpr::Kind::SymSymExprKind>;
 
-class SymbolManager {
+class CLANG_ABI SymbolManager {
   using DataSetTy = llvm::FoldingSet<SymExpr>;
   using SymbolDependTy =
       llvm::DenseMap<SymbolRef, std::unique_ptr<SymbolRefSmallVectorTy>>;
@@ -570,7 +571,7 @@ class SymbolManager {
 };
 
 /// A class responsible for cleaning up unused symbols.
-class SymbolReaper {
+class CLANG_ABI SymbolReaper {
   enum SymbolStatus {
     NotProcessed,
     HaveMarkedDependents
@@ -663,7 +664,7 @@ class SymbolReaper {
   void markDependentsLive(SymbolRef sym);
 };
 
-class SymbolVisitor {
+class CLANG_ABI SymbolVisitor {
 protected:
   ~SymbolVisitor() = default;
 
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
index 7beb7ddf5bce6f..16dc341ee7b479 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
@@ -16,6 +16,7 @@
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
+#include "clang/Support/Compiler.h"
 #include <cassert>
 
 namespace clang {
@@ -57,7 +58,7 @@ class WorkListUnit {
   unsigned getIndex() const { return blockIdx; }
 };
 
-class WorkList {
+class CLANG_ABI WorkList {
   BlockCounter CurrentCounter;
 public:
   virtual ~WorkList();
diff --git a/clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h b/clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
index f3b1c1f2064598..c93b5a1d39aaa5 100644
--- a/clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
+++ b/clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/ASTConsumer.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include <functional>
 #include <memory>
 
@@ -27,7 +28,7 @@ namespace ento {
 class PathDiagnosticConsumer;
 class CheckerRegistry;
 
-class AnalysisASTConsumer : public ASTConsumer {
+class CLANG_ABI AnalysisASTConsumer : public ASTConsumer {
 public:
   virtual void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) = 0;
 
@@ -48,7 +49,7 @@ class AnalysisASTConsumer : public ASTConsumer {
 /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
 /// analysis passes.  (The set of analyses run is controlled by command-line
 /// options.)
-std::unique_ptr<AnalysisASTConsumer>
+CLANG_ABI std::unique_ptr<AnalysisASTConsumer>
 CreateAnalysisConsumer(CompilerInstance &CI);
 
 } // namespace ento
diff --git a/clang/include/clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h b/clang/include/clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h
index a30c241e13502b..0d53190c3ebc0a 100644
--- a/clang/include/clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h
+++ b/clang/include/clang/StaticAnalyzer/Frontend/AnalyzerHelpFlags.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYZERHELPFLAGS_H
 #define LLVM_CLANG_STATICANALYZER_FRONTEND_ANALYZERHELPFLAGS_H
 
+#include "clang/Support/Compiler.h"
 namespace llvm {
 class raw_ostream;
 } // namespace llvm
@@ -19,10 +20,10 @@ class CompilerInstance;
 
 namespace ento {
 
-void printCheckerHelp(llvm::raw_ostream &OS, CompilerInstance &CI);
-void printEnabledCheckerList(llvm::raw_ostream &OS, CompilerInstance &CI);
-void printAnalyzerConfigList(llvm::raw_ostream &OS);
-void printCheckerConfigList(llvm::raw_ostream &OS, CompilerInstance &CI);
+CLANG_ABI void printCheckerHelp(llvm::raw_ostream &OS, CompilerInstance &CI);
+CLANG_ABI void printEnabledCheckerList(llvm::raw_ostream &OS, CompilerInstance &CI);
+CLANG_ABI void printAnalyzerConfigList(llvm::raw_ostream &OS);
+CLANG_ABI void printCheckerConfigList(llvm::raw_ostream &OS, CompilerInstance &CI);
 
 } // namespace ento
 } // namespace clang
diff --git a/clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h b/clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
index 43dbfb15851519..62f8600656e47a 100644
--- a/clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
+++ b/clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
@@ -20,6 +20,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/StaticAnalyzer/Core/CheckerRegistryData.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 // FIXME: move this information to an HTML file in docs/.
@@ -86,7 +87,7 @@ class CheckerManager;
 /// For example, the checker "core.builtin.NoReturnFunctionChecker" will be
 /// included if initializeManager() is called with an option of "core",
 /// "core.builtin", or the full name "core.builtin.NoReturnFunctionChecker".
-class CheckerRegistry {
+class CLANG_ABI CheckerRegistry {
 public:
   CheckerRegistry(CheckerRegistryData &Data, ArrayRef<std::string> Plugins,
                   DiagnosticsEngine &Diags, AnalyzerOptions &AnOpts,
diff --git a/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h b/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
index 31b1c245200ec8..5eb11461340b2a 100644
--- a/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
+++ b/clang/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
 
 #include "clang/Frontend/FrontendAction.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -23,7 +24,7 @@ namespace ento {
 // AST Consumer Actions
 //===----------------------------------------------------------------------===//
 
-class AnalysisAction : public ASTFrontendAction {
+class CLANG_ABI AnalysisAction : public ASTFrontendAction {
 protected:
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
                                                  StringRef InFile) override;
@@ -37,7 +38,7 @@ class AnalysisAction : public ASTFrontendAction {
 /// separate compiler instance that reuses the ASTContext and othen information
 /// from the main translation unit that is being compiled. After a model file is
 /// parsed, the function definitions will be collected into a StringMap.
-class ParseModelFileAction : public ASTFrontendAction {
+class CLANG_ABI ParseModelFileAction : public ASTFrontendAction {
 public:
   ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies);
   bool isModelParsingAction() const override { return true; }
diff --git a/clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h b/clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
index 7b7087622bc2f0..b36c9089b7ed6b 100644
--- a/clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
+++ b/clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_STATICANALYZER_FRONTEND_MODELCONSUMER_H
 
 #include "clang/AST/ASTConsumer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringMap.h"
 
 namespace clang {
@@ -28,7 +29,7 @@ namespace ento {
 ///
 /// This consumer collects the bodies of function definitions into a StringMap
 /// from a model file.
-class ModelConsumer : public ASTConsumer {
+class CLANG_ABI ModelConsumer : public ASTConsumer {
 public:
   ModelConsumer(llvm::StringMap<Stmt *> &Bodies);
 
diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index 4819fc144f4dc7..def9bbbf1e1221 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -9,6 +9,7 @@
 #ifndef CLANG_SUPPORT_RISCVVINTRINSICUTILS_H
 #define CLANG_SUPPORT_RISCVVINTRINSICUTILS_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
 #include "llvm/ADT/SmallVector.h"
@@ -167,7 +168,7 @@ class Policy {
 
 // PrototypeDescriptor is used to compute type info of arguments or return
 // value.
-struct PrototypeDescriptor {
+struct CLANG_ABI PrototypeDescriptor {
   constexpr PrototypeDescriptor() = default;
   constexpr PrototypeDescriptor(
       BaseTypeModifier PT,
@@ -198,7 +199,7 @@ struct PrototypeDescriptor {
   parsePrototypeDescriptor(llvm::StringRef PrototypeStr);
 };
 
-llvm::SmallVector<PrototypeDescriptor>
+CLANG_ABI llvm::SmallVector<PrototypeDescriptor>
 parsePrototypes(llvm::StringRef Prototypes);
 
 // Basic type of vector type.
@@ -233,7 +234,7 @@ enum ScalarTypeKind : uint8_t {
 };
 
 // Exponential LMUL
-struct LMULType {
+struct CLANG_ABI LMULType {
   int Log2LMUL;
   LMULType(int Log2LMUL);
   // Return the C/C++ string representation of LMUL
@@ -248,7 +249,7 @@ using RVVTypes = std::vector<RVVTypePtr>;
 class RVVTypeCache;
 
 // This class is compact representation of a valid and invalid RVVType.
-class RVVType {
+class CLANG_ABI RVVType {
   friend class RVVTypeCache;
 
   BasicType BT;
@@ -352,7 +353,7 @@ class RVVType {
 
 // This class is used to manage RVVType, RVVType should only created by this
 // class, also provided thread-safe cache capability.
-class RVVTypeCache {
+class CLANG_ABI RVVTypeCache {
 private:
   std::unordered_map<uint64_t, RVVType> LegalTypes;
   std::set<uint64_t> IllegalTypes;
@@ -379,7 +380,7 @@ enum PolicyScheme : uint8_t {
 // TODO refactor RVVIntrinsic class design after support all intrinsic
 // combination. This represents an instantiation of an intrinsic with a
 // particular type and prototype
-class RVVIntrinsic {
+class CLANG_ABI RVVIntrinsic {
 
 private:
   std::string BuiltinName; // Builtin name
@@ -562,7 +563,7 @@ struct RVVIntrinsicRecord {
   uint8_t MaskedPolicyScheme : 2;
 };
 
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
                               const RVVIntrinsicRecord &RVVInstrRecord);
 
 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
diff --git a/clang/include/clang/Tooling/ASTDiff/ASTDiff.h b/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
index 6b351e25db201a..d80db45ac6e605 100644
--- a/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
+++ b/clang/include/clang/Tooling/ASTDiff/ASTDiff.h
@@ -19,6 +19,7 @@
 #ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
 #define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ASTDiff/ASTDiffInternal.h"
 #include <optional>
 
@@ -35,7 +36,7 @@ enum ChangeKind {
 };
 
 /// Represents a Clang AST node, alongside some additional information.
-struct Node {
+struct CLANG_ABI Node {
   NodeId Parent, LeftMostDescendant, RightMostDescendant;
   int Depth, Height, Shift = 0;
   DynTypedNode ASTNode;
@@ -51,7 +52,7 @@ struct Node {
 
 /// SyntaxTree objects represent subtrees of the AST.
 /// They can be constructed from any Decl or Stmt.
-class SyntaxTree {
+class CLANG_ABI SyntaxTree {
 public:
   /// Constructs a tree from a translation unit.
   SyntaxTree(ASTContext &AST);
@@ -107,7 +108,7 @@ struct ComparisonOptions {
   }
 };
 
-class ASTDiff {
+class CLANG_ABI ASTDiff {
 public:
   ASTDiff(SyntaxTree &Src, SyntaxTree &Dst, const ComparisonOptions &Options);
   ~ASTDiff();
diff --git a/clang/include/clang/Tooling/AllTUsExecution.h b/clang/include/clang/Tooling/AllTUsExecution.h
index 03cfc9c67f5c5f..5c19a5fa51c92b 100644
--- a/clang/include/clang/Tooling/AllTUsExecution.h
+++ b/clang/include/clang/Tooling/AllTUsExecution.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_TOOLING_ALLTUSEXECUTION_H
 #define LLVM_CLANG_TOOLING_ALLTUSEXECUTION_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/Execution.h"
 #include <optional>
@@ -23,7 +24,7 @@ namespace tooling {
 
 /// Executes given frontend actions on all files/TUs in the compilation
 /// database.
-class AllTUsToolExecutor : public ToolExecutor {
+class CLANG_ABI AllTUsToolExecutor : public ToolExecutor {
 public:
   static const char *ExecutorName;
 
@@ -70,8 +71,8 @@ class AllTUsToolExecutor : public ToolExecutor {
   unsigned ThreadCount;
 };
 
-extern llvm::cl::opt<unsigned> ExecutorConcurrency;
-extern llvm::cl::opt<std::string> Filter;
+CLANG_ABI extern llvm::cl::opt<unsigned> ExecutorConcurrency;
+CLANG_ABI extern llvm::cl::opt<std::string> Filter;
 
 } // end namespace tooling
 } // end namespace clang
diff --git a/clang/include/clang/Tooling/ArgumentsAdjusters.h b/clang/include/clang/Tooling/ArgumentsAdjusters.h
index bf0886034324ab..e174a0b46a6815 100644
--- a/clang/include/clang/Tooling/ArgumentsAdjusters.h
+++ b/clang/include/clang/Tooling/ArgumentsAdjusters.h
@@ -17,6 +17,7 @@
 #define LLVM_CLANG_TOOLING_ARGUMENTSADJUSTERS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <functional>
 #include <string>
@@ -37,36 +38,36 @@ using ArgumentsAdjuster = std::function<CommandLineArguments(
 
 /// Gets an argument adjuster that converts input command line arguments
 /// to the "syntax check only" variant.
-ArgumentsAdjuster getClangSyntaxOnlyAdjuster();
+CLANG_ABI ArgumentsAdjuster getClangSyntaxOnlyAdjuster();
 
 /// Gets an argument adjuster which removes output-related command line
 /// arguments.
-ArgumentsAdjuster getClangStripOutputAdjuster();
+CLANG_ABI ArgumentsAdjuster getClangStripOutputAdjuster();
 
 /// Gets an argument adjuster which removes dependency-file
 /// related command line arguments.
-ArgumentsAdjuster getClangStripDependencyFileAdjuster();
+CLANG_ABI ArgumentsAdjuster getClangStripDependencyFileAdjuster();
 
 enum class ArgumentInsertPosition { BEGIN, END };
 
 /// Gets an argument adjuster which inserts \p Extra arguments in the
 /// specified position.
-ArgumentsAdjuster getInsertArgumentAdjuster(const CommandLineArguments &Extra,
+CLANG_ABI ArgumentsAdjuster getInsertArgumentAdjuster(const CommandLineArguments &Extra,
                                             ArgumentInsertPosition Pos);
 
 /// Gets an argument adjuster which inserts an \p Extra argument in the
 /// specified position.
-ArgumentsAdjuster getInsertArgumentAdjuster(
+CLANG_ABI ArgumentsAdjuster getInsertArgumentAdjuster(
     const char *Extra,
     ArgumentInsertPosition Pos = ArgumentInsertPosition::END);
 
 /// Gets an argument adjuster which strips plugin related command line
 /// arguments.
-ArgumentsAdjuster getStripPluginsAdjuster();
+CLANG_ABI ArgumentsAdjuster getStripPluginsAdjuster();
 
 /// Gets an argument adjuster which adjusts the arguments in sequence
 /// with the \p First adjuster and then with the \p Second one.
-ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First,
+CLANG_ABI ArgumentsAdjuster combineAdjusters(ArgumentsAdjuster First,
                                    ArgumentsAdjuster Second);
 
 } // namespace tooling
diff --git a/clang/include/clang/Tooling/CommonOptionsParser.h b/clang/include/clang/Tooling/CommonOptionsParser.h
index 5e2cdc6ac45894..6c9de7ed515a9a 100644
--- a/clang/include/clang/Tooling/CommonOptionsParser.h
+++ b/clang/include/clang/Tooling/CommonOptionsParser.h
@@ -26,6 +26,7 @@
 #ifndef LLVM_CLANG_TOOLING_COMMONOPTIONSPARSER_H
 #define LLVM_CLANG_TOOLING_COMMONOPTIONSPARSER_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/Support/CommandLine.h"
@@ -67,7 +68,7 @@ namespace tooling {
 ///       newFrontendActionFactory<clang::SyntaxOnlyAction>().get());
 /// }
 /// \endcode
-class CommonOptionsParser {
+class CLANG_ABI CommonOptionsParser {
 
 protected:
   /// Parses command-line, initializes a compilation database.
@@ -120,7 +121,7 @@ class CommonOptionsParser {
   ArgumentsAdjuster Adjuster;
 };
 
-class ArgumentsAdjustingCompilations : public CompilationDatabase {
+class CLANG_ABI ArgumentsAdjustingCompilations : public CompilationDatabase {
 public:
   ArgumentsAdjustingCompilations(
       std::unique_ptr<CompilationDatabase> Compilations)
diff --git a/clang/include/clang/Tooling/CompilationDatabase.h b/clang/include/clang/Tooling/CompilationDatabase.h
index 36fe0812ebe974..0acbae06d66663 100644
--- a/clang/include/clang/Tooling/CompilationDatabase.h
+++ b/clang/include/clang/Tooling/CompilationDatabase.h
@@ -28,6 +28,7 @@
 #define LLVM_CLANG_TOOLING_COMPILATIONDATABASE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
@@ -84,7 +85,7 @@ struct CompileCommand {
 /// Many implementations are enumerable, allowing all command lines to be
 /// retrieved. These can be used to run clang tools over a subset of the files
 /// in a project.
-class CompilationDatabase {
+class CLANG_ABI CompilationDatabase {
 public:
   virtual ~CompilationDatabase();
 
@@ -151,7 +152,7 @@ class CompilationDatabase {
 ///
 /// Useful when we want a tool to behave more like a compiler invocation.
 /// This compilation database is not enumerable: getAllFiles() returns {}.
-class FixedCompilationDatabase : public CompilationDatabase {
+class CLANG_ABI FixedCompilationDatabase : public CompilationDatabase {
 public:
   /// Creates a FixedCompilationDatabase from the arguments after "--".
   ///
@@ -218,31 +219,31 @@ class FixedCompilationDatabase : public CompilationDatabase {
 /// to certain flags (-x, -std etc).
 ///
 /// The output command will always end in {"--", Filename}.
-tooling::CompileCommand transferCompileCommand(tooling::CompileCommand,
+CLANG_ABI tooling::CompileCommand transferCompileCommand(tooling::CompileCommand,
                                                StringRef Filename);
 
 /// Returns a wrapped CompilationDatabase that defers to the provided one,
 /// but getCompileCommands() will infer commands for unknown files.
 /// The return value of getAllFiles() or getAllCompileCommands() is unchanged.
 /// See InterpolatingCompilationDatabase.cpp for details on heuristics.
-std::unique_ptr<CompilationDatabase>
+CLANG_ABI std::unique_ptr<CompilationDatabase>
     inferMissingCompileCommands(std::unique_ptr<CompilationDatabase>);
 
 /// Returns a wrapped CompilationDatabase that will add -target and -mode flags
 /// to commandline when they can be deduced from argv[0] of commandline returned
 /// by underlying database.
-std::unique_ptr<CompilationDatabase>
+CLANG_ABI std::unique_ptr<CompilationDatabase>
 inferTargetAndDriverMode(std::unique_ptr<CompilationDatabase> Base);
 
 /// Returns a wrapped CompilationDatabase that will transform argv[0] to an
 /// absolute path, if it currently is a plain tool name, looking it up in
 /// PATH.
-std::unique_ptr<CompilationDatabase>
+CLANG_ABI std::unique_ptr<CompilationDatabase>
 inferToolLocation(std::unique_ptr<CompilationDatabase> Base);
 
 /// Returns a wrapped CompilationDatabase that will expand all rsp(response)
 /// files on commandline returned by underlying database.
-std::unique_ptr<CompilationDatabase>
+CLANG_ABI std::unique_ptr<CompilationDatabase>
 expandResponseFiles(std::unique_ptr<CompilationDatabase> Base,
                     llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
 
diff --git a/clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h b/clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h
index 8c58ad926a402a..4a5cc0a8a77df0 100644
--- a/clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h
+++ b/clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
 #define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/Support/Registry.h"
 
@@ -25,7 +26,7 @@ namespace tooling {
 /// static CompilationDatabasePluginRegistry::Add<MyDatabasePlugin>
 /// X("my-compilation-database", "Reads my own compilation database");
 /// \endcode
-class CompilationDatabasePlugin {
+class CLANG_ABI CompilationDatabasePlugin {
 public:
   virtual ~CompilationDatabasePlugin();
 
diff --git a/clang/include/clang/Tooling/Core/Diagnostic.h b/clang/include/clang/Tooling/Core/Diagnostic.h
index 4553380bcf00eb..76cc18b455c38e 100644
--- a/clang/include/clang/Tooling/Core/Diagnostic.h
+++ b/clang/include/clang/Tooling/Core/Diagnostic.h
@@ -18,6 +18,7 @@
 
 #include "Replacement.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -27,7 +28,7 @@ namespace clang {
 namespace tooling {
 
 /// Represents a range within a specific source file.
-struct FileByteRange {
+struct CLANG_ABI FileByteRange {
   FileByteRange() = default;
 
   FileByteRange(const SourceManager &Sources, CharSourceRange Range);
@@ -39,7 +40,7 @@ struct FileByteRange {
 
 /// Represents the diagnostic message with the error message associated
 /// and the information on the location of the problem.
-struct DiagnosticMessage {
+struct CLANG_ABI DiagnosticMessage {
   DiagnosticMessage(llvm::StringRef Message = "");
 
   /// Constructs a diagnostic message with anoffset to the diagnostic
@@ -65,7 +66,7 @@ struct DiagnosticMessage {
 
 /// Represents the diagnostic with the level of severity and possible
 /// fixes to be applied.
-struct Diagnostic {
+struct CLANG_ABI Diagnostic {
   enum Level {
     Remark = DiagnosticsEngine::Remark,
     Warning = DiagnosticsEngine::Warning,
@@ -112,7 +113,7 @@ struct TranslationUnitDiagnostics {
 
 /// Get the first fix to apply for this diagnostic.
 /// \returns nullptr if no fixes are attached to the diagnostic.
-const llvm::StringMap<Replacements> *selectFirstFix(const Diagnostic& D);
+CLANG_ABI const llvm::StringMap<Replacements> *selectFirstFix(const Diagnostic& D);
 
 } // end namespace tooling
 } // end namespace clang
diff --git a/clang/include/clang/Tooling/Core/Replacement.h b/clang/include/clang/Tooling/Core/Replacement.h
index f9452111e147f1..9408c3e0869d9a 100644
--- a/clang/include/clang/Tooling/Core/Replacement.h
+++ b/clang/include/clang/Tooling/Core/Replacement.h
@@ -20,6 +20,7 @@
 
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
@@ -80,7 +81,7 @@ class Range {
 ///
 /// Represents a SourceManager independent replacement of a range of text in a
 /// specific file.
-class Replacement {
+class CLANG_ABI Replacement {
 public:
   /// Creates an invalid (not applicable) replacement.
   Replacement();
@@ -151,7 +152,7 @@ enum class replacement_error {
 
 /// Carries extra error information in replacement-related llvm::Error,
 /// e.g. fail applying replacements and replacements conflict.
-class ReplacementError : public llvm::ErrorInfo<ReplacementError> {
+class CLANG_ABI ReplacementError : public llvm::ErrorInfo<ReplacementError> {
 public:
   ReplacementError(replacement_error Err) : Err(Err) {}
 
@@ -198,10 +199,10 @@ class ReplacementError : public llvm::ErrorInfo<ReplacementError> {
 };
 
 /// Less-than operator between two Replacements.
-bool operator<(const Replacement &LHS, const Replacement &RHS);
+CLANG_ABI bool operator<(const Replacement &LHS, const Replacement &RHS);
 
 /// Equal-to operator between two Replacements.
-bool operator==(const Replacement &LHS, const Replacement &RHS);
+CLANG_ABI bool operator==(const Replacement &LHS, const Replacement &RHS);
 inline bool operator!=(const Replacement &LHS, const Replacement &RHS) {
   return !(LHS == RHS);
 }
@@ -209,7 +210,7 @@ inline bool operator!=(const Replacement &LHS, const Replacement &RHS) {
 /// Maintains a set of replacements that are conflict-free.
 /// Two replacements are considered conflicts if they overlap or have the same
 /// offset (i.e. order-dependent).
-class Replacements {
+class CLANG_ABI Replacements {
 private:
   using ReplacementsImpl = std::set<Replacement>;
 
@@ -319,7 +320,7 @@ class Replacements {
 /// other applications.
 ///
 /// \returns true if all replacements apply. false otherwise.
-bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite);
+CLANG_ABI bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite);
 
 /// Applies all replacements in \p Replaces to \p Code.
 ///
@@ -328,7 +329,7 @@ bool applyAllReplacements(const Replacements &Replaces, Rewriter &Rewrite);
 /// replacements applied; otherwise, an llvm::Error carrying llvm::StringError
 /// is returned (the Error message can be converted to string using
 /// `llvm::toString()` and 'std::error_code` in the `Error` should be ignored).
-llvm::Expected<std::string> applyAllReplacements(StringRef Code,
+CLANG_ABI llvm::Expected<std::string> applyAllReplacements(StringRef Code,
                                                  const Replacements &Replaces);
 
 /// Collection of Replacements generated from a single translation unit.
@@ -347,14 +348,14 @@ struct TranslationUnitReplacements {
 ///
 /// \return The new ranges after \p Replaces are applied. The new ranges will be
 /// sorted and non-overlapping.
-std::vector<Range>
+CLANG_ABI std::vector<Range>
 calculateRangesAfterReplacements(const Replacements &Replaces,
                                  const std::vector<Range> &Ranges);
 
 /// If there are multiple <File, Replacements> pairs with the same file
 /// entry, we only keep one pair and discard the rest.
 /// If a file does not exist, its corresponding replacements will be ignored.
-std::map<std::string, Replacements> groupReplacementsByFile(
+CLANG_ABI std::map<std::string, Replacements> groupReplacementsByFile(
     FileManager &FileMgr,
     const std::map<std::string, Replacements> &FileToReplaces);
 
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
index d12814e7c9253e..b2d21f0126514d 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Lex/DependencyDirectivesScanner.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/Allocator.h"
@@ -150,9 +151,9 @@ using CachedRealPath = llvm::ErrorOr<std::string>;
 ///
 /// It is sharded based on the hash of the key to reduce the lock contention for
 /// the worker threads.
-class DependencyScanningFilesystemSharedCache {
+class CLANG_ABI DependencyScanningFilesystemSharedCache {
 public:
-  struct CacheShard {
+  struct CLANG_ABI CacheShard {
     /// The mutex that needs to be locked before mutation of any member.
     mutable std::mutex CacheLock;
 
@@ -334,7 +335,7 @@ class EntryRef {
 /// This is not a thread safe VFS. A single instance is meant to be used only in
 /// one thread. Multiple instances are allowed to service multiple threads
 /// running in parallel.
-class DependencyScanningWorkerFilesystem
+class CLANG_ABI DependencyScanningWorkerFilesystem
     : public llvm::RTTIExtends<DependencyScanningWorkerFilesystem,
                                llvm::vfs::ProxyFileSystem> {
 public:
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
index 4a343f2872d8d9..8d207828157642 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
 #define LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h"
 #include "llvm/ADT/BitmaskEnum.h"
 
@@ -71,7 +72,7 @@ enum class ScanningOptimizations {
 
 /// The dependency scanning service contains shared configuration and state that
 /// is used by the individual dependency scanning workers.
-class DependencyScanningService {
+class CLANG_ABI DependencyScanningService {
 public:
   DependencyScanningService(
       ScanningMode Mode, ScanningOutputFormat Format,
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
index 012237e0278f4a..9874d134ec4c8e 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGTOOL_H
 #define LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGTOOL_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
 #include "clang/Tooling/DependencyScanning/ModuleDepCollector.h"
@@ -75,7 +76,7 @@ struct P1689Rule {
 
 /// The high-level implementation of the dependency discovery tool that runs on
 /// an individual worker thread.
-class DependencyScanningTool {
+class CLANG_ABI DependencyScanningTool {
 public:
   /// Construct a dependency scanning tool.
   DependencyScanningTool(DependencyScanningService &Service,
@@ -150,7 +151,7 @@ class DependencyScanningTool {
   DependencyScanningWorker Worker;
 };
 
-class FullDependencyConsumer : public DependencyConsumer {
+class CLANG_ABI FullDependencyConsumer : public DependencyConsumer {
 public:
   FullDependencyConsumer(const llvm::DenseSet<ModuleID> &AlreadySeen)
       : AlreadySeen(AlreadySeen) {}
@@ -197,7 +198,7 @@ class FullDependencyConsumer : public DependencyConsumer {
 
 /// A simple dependency action controller that uses a callback. If no callback
 /// is provided, it is assumed that looking up module outputs is unreachable.
-class CallbackActionController : public DependencyActionController {
+class CLANG_ABI CallbackActionController : public DependencyActionController {
 public:
   virtual ~CallbackActionController();
 
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
index da6e0401411a34..a1d36b41e54817 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
@@ -13,6 +13,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Frontend/PCHContainerOperations.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
 #include "clang/Tooling/DependencyScanning/ModuleDepCollector.h"
 #include "llvm/Support/Error.h"
@@ -37,7 +38,7 @@ struct Command {
   std::vector<std::string> Arguments;
 };
 
-class DependencyConsumer {
+class CLANG_ABI DependencyConsumer {
 public:
   virtual ~DependencyConsumer() {}
 
@@ -63,7 +64,7 @@ class DependencyConsumer {
 
 /// Dependency scanner callbacks that are used during scanning to influence the
 /// behaviour of the scan - for example, to customize the scanned invocations.
-class DependencyActionController {
+class CLANG_ABI DependencyActionController {
 public:
   virtual ~DependencyActionController();
 
@@ -77,7 +78,7 @@ class DependencyActionController {
 /// The worker computes the dependencies for the input files by preprocessing
 /// sources either using a fast mode where the source files are minimized, or
 /// using the regular processing run.
-class DependencyScanningWorker {
+class CLANG_ABI DependencyScanningWorker {
 public:
   DependencyScanningWorker(DependencyScanningService &Service,
                            llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
diff --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
index 3de19d756da00d..dea2de08633ff8 100644
--- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -17,6 +17,7 @@
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/PPCallbacks.h"
 #include "clang/Serialization/ASTReader.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/Hashing.h"
@@ -107,7 +108,7 @@ enum class ModuleOutputKind {
   DiagnosticSerializationFile,
 };
 
-struct ModuleDeps {
+struct CLANG_ABI ModuleDeps {
   /// The identifier of the module.
   ModuleID ID;
 
@@ -162,7 +163,7 @@ class ModuleDepCollector;
 /// during preprocessing. At the end of the main file, it also collects
 /// transitive modular dependencies and passes everything to the
 /// \c DependencyConsumer of the parent \c ModuleDepCollector.
-class ModuleDepCollectorPP final : public PPCallbacks {
+class CLANG_ABI ModuleDepCollectorPP final : public PPCallbacks {
 public:
   ModuleDepCollectorPP(ModuleDepCollector &MDC) : MDC(MDC) {}
 
@@ -215,7 +216,7 @@ class ModuleDepCollectorPP final : public PPCallbacks {
 
 /// Collects modular and non-modular dependencies of the main file by attaching
 /// \c ModuleDepCollectorPP to the preprocessor.
-class ModuleDepCollector final : public DependencyCollector {
+class CLANG_ABI ModuleDepCollector final : public DependencyCollector {
 public:
   ModuleDepCollector(std::unique_ptr<DependencyOutputOptions> Opts,
                      CompilerInstance &ScanInstance, DependencyConsumer &C,
@@ -314,7 +315,7 @@ class ModuleDepCollector final : public DependencyCollector {
 };
 
 /// Resets codegen options that don't affect modules/PCH.
-void resetBenignCodeGenOptions(frontend::ActionKind ProgramAction,
+CLANG_ABI void resetBenignCodeGenOptions(frontend::ActionKind ProgramAction,
                                const LangOptions &LangOpts,
                                CodeGenOptions &CGOpts);
 
diff --git a/clang/include/clang/Tooling/Execution.h b/clang/include/clang/Tooling/Execution.h
index ca6f22c5da3bff..fc23983b3dbe75 100644
--- a/clang/include/clang/Tooling/Execution.h
+++ b/clang/include/clang/Tooling/Execution.h
@@ -27,6 +27,7 @@
 #ifndef LLVM_CLANG_TOOLING_EXECUTION_H
 #define LLVM_CLANG_TOOLING_EXECUTION_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/Error.h"
@@ -36,14 +37,14 @@
 namespace clang {
 namespace tooling {
 
-extern llvm::cl::opt<std::string> ExecutorName;
+CLANG_ABI extern llvm::cl::opt<std::string> ExecutorName;
 
 /// An abstraction for the result of a tool execution. For example, the
 /// underlying result can be in-memory or on-disk.
 ///
 /// Results should be string key-value pairs. For example, a refactoring tool
 /// can use source location as key and a replacement in YAML format as value.
-class ToolResults {
+class CLANG_ABI ToolResults {
 public:
   virtual ~ToolResults() = default;
   virtual void addResult(StringRef Key, StringRef Value) = 0;
@@ -56,7 +57,7 @@ class ToolResults {
 /// Stores the key-value results in memory. It maintains the lifetime of
 /// the result. Clang tools using this class are expected to generate a small
 /// set of different results, or a large set of duplicated results.
-class InMemoryToolResults : public ToolResults {
+class CLANG_ABI InMemoryToolResults : public ToolResults {
 public:
   InMemoryToolResults() : Strings(Arena) {}
   void addResult(StringRef Key, StringRef Value) override;
@@ -74,7 +75,7 @@ class InMemoryToolResults : public ToolResults {
 
 /// The context of an execution, including the information about
 /// compilation and results.
-class ExecutionContext {
+class CLANG_ABI ExecutionContext {
 public:
   virtual ~ExecutionContext() {}
 
@@ -108,7 +109,7 @@ class ExecutionContext {
 ///  `ToolExecutorPluginRegistry`. CLI tools can use
 ///  `createExecutorFromCommandLineArgs` to create a specific registered
 ///  executor according to the command-line arguments.
-class ToolExecutor {
+class CLANG_ABI ToolExecutor {
 public:
   virtual ~ToolExecutor() {}
 
@@ -148,7 +149,7 @@ class ToolExecutor {
 
 /// Interface for factories that create specific executors. This is also
 /// used as a plugin to be registered into ToolExecutorPluginRegistry.
-class ToolExecutorPlugin {
+class CLANG_ABI ToolExecutorPlugin {
 public:
   virtual ~ToolExecutorPlugin() {}
 
@@ -168,13 +169,13 @@ class ToolExecutorPlugin {
 ///
 /// By default, this creates a `StandaloneToolExecutor` ("standalone") if
 /// `--executor` is not provided.
-llvm::Expected<std::unique_ptr<ToolExecutor>>
+CLANG_ABI llvm::Expected<std::unique_ptr<ToolExecutor>>
 createExecutorFromCommandLineArgs(int &argc, const char **argv,
                                   llvm::cl::OptionCategory &Category,
                                   const char *Overview = nullptr);
 
 namespace internal {
-llvm::Expected<std::unique_ptr<ToolExecutor>>
+CLANG_ABI llvm::Expected<std::unique_ptr<ToolExecutor>>
 createExecutorFromCommandLineArgsImpl(int &argc, const char **argv,
                                       llvm::cl::OptionCategory &Category,
                                       const char *Overview = nullptr);
diff --git a/clang/include/clang/Tooling/FileMatchTrie.h b/clang/include/clang/Tooling/FileMatchTrie.h
index 6f5c8dab7b7562..91ca81c7d1d474 100644
--- a/clang/include/clang/Tooling/FileMatchTrie.h
+++ b/clang/include/clang/Tooling/FileMatchTrie.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_TOOLING_FILEMATCHTRIE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
 
@@ -23,7 +24,7 @@ namespace tooling {
 
 class FileMatchTrieNode;
 
-struct PathComparator {
+struct CLANG_ABI PathComparator {
   virtual ~PathComparator() = default;
 
   virtual bool equivalent(StringRef FileA, StringRef FileB) const = 0;
@@ -53,7 +54,7 @@ struct PathComparator {
 /// 0  equivalent files: Continue with the next suffix length.
 /// 1  equivalent file:  Best match found, return it.
 /// >1 equivalent files: Match is ambiguous, return error.
-class FileMatchTrie {
+class CLANG_ABI FileMatchTrie {
 public:
   FileMatchTrie();
 
diff --git a/clang/include/clang/Tooling/FixIt.h b/clang/include/clang/Tooling/FixIt.h
index 1624c2d6be3675..45e4798780ac4a 100644
--- a/clang/include/clang/Tooling/FixIt.h
+++ b/clang/include/clang/Tooling/FixIt.h
@@ -20,13 +20,14 @@
 #define LLVM_CLANG_TOOLING_FIXIT_H
 
 #include "clang/AST/ASTContext.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace tooling {
 namespace fixit {
 
 namespace internal {
-StringRef getText(CharSourceRange Range, const ASTContext &Context);
+CLANG_ABI StringRef getText(CharSourceRange Range, const ASTContext &Context);
 
 /// Returns the token CharSourceRange corresponding to \p Range.
 inline CharSourceRange getSourceRange(const SourceRange &Range) {
diff --git a/clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h b/clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h
index 34ec2d80d06af4..9bdbb65008602a 100644
--- a/clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h
+++ b/clang/include/clang/Tooling/Inclusions/HeaderAnalysis.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H
 
 #include "clang/Basic/FileEntry.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <optional>
 
@@ -27,18 +28,18 @@ namespace tooling {
 ///
 /// This function can be expensive as it may scan the source code to find out
 /// dont-include-me pattern heuristically.
-bool isSelfContainedHeader(FileEntryRef FE, const SourceManager &SM,
+CLANG_ABI bool isSelfContainedHeader(FileEntryRef FE, const SourceManager &SM,
                            const HeaderSearch &HeaderInfo);
 
 /// This scans the given source code to see if it contains #import(s).
-bool codeContainsImports(llvm::StringRef Code);
+CLANG_ABI bool codeContainsImports(llvm::StringRef Code);
 
 /// If Text begins an Include-What-You-Use directive, returns it.
 /// Given "// IWYU pragma: keep", returns "keep".
 /// Input is a null-terminated char* as provided by SM.getCharacterData().
 /// (This should not be StringRef as we do *not* want to scan for its length).
 /// For multi-line comments, we return only the first line.
-std::optional<llvm::StringRef> parseIWYUPragma(const char *Text);
+CLANG_ABI std::optional<llvm::StringRef> parseIWYUPragma(const char *Text);
 
 } // namespace tooling
 } // namespace clang
diff --git a/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h b/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
index d5439dd2c84eb7..4dc78da422766d 100644
--- a/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
+++ b/clang/include/clang/Tooling/Inclusions/HeaderIncludes.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_INCLUSIONS_HEADERINCLUDES_H
 
 #include "clang/Basic/SourceManager.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Inclusions/IncludeStyle.h"
 #include "llvm/Support/Path.h"
@@ -25,7 +26,7 @@ namespace tooling {
 /// priorities for headers.
 /// FIXME(ioeric): move this class into implementation file when clang-format's
 /// include sorting functions are also moved here.
-class IncludeCategoryManager {
+class CLANG_ABI IncludeCategoryManager {
 public:
   IncludeCategoryManager(const IncludeStyle &Style, StringRef FileName);
 
@@ -49,7 +50,7 @@ enum class IncludeDirective { Include, Import };
 
 /// Generates replacements for inserting or deleting #include directives in a
 /// file.
-class HeaderIncludes {
+class CLANG_ABI HeaderIncludes {
 public:
   HeaderIncludes(llvm::StringRef FileName, llvm::StringRef Code,
                  const IncludeStyle &Style);
diff --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
index d167b7e45467fe..faa67bbcf78239 100644
--- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_INCLUSIONS_INCLUDESTYLE_H
 #define LLVM_CLANG_TOOLING_INCLUSIONS_INCLUDESTYLE_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <string>
 #include <vector>
@@ -177,20 +178,20 @@ namespace llvm {
 namespace yaml {
 
 template <>
-struct MappingTraits<clang::tooling::IncludeStyle::IncludeCategory> {
+struct CLANG_ABI MappingTraits<clang::tooling::IncludeStyle::IncludeCategory> {
   static void mapping(IO &IO,
                       clang::tooling::IncludeStyle::IncludeCategory &Category);
 };
 
 template <>
-struct ScalarEnumerationTraits<
+struct CLANG_ABI ScalarEnumerationTraits<
     clang::tooling::IncludeStyle::IncludeBlocksStyle> {
   static void
   enumeration(IO &IO, clang::tooling::IncludeStyle::IncludeBlocksStyle &Value);
 };
 
 template <>
-struct ScalarEnumerationTraits<
+struct CLANG_ABI ScalarEnumerationTraits<
     clang::tooling::IncludeStyle::MainIncludeCharDiscriminator> {
   static void enumeration(
       IO &IO,
diff --git a/clang/include/clang/Tooling/Inclusions/StandardLibrary.h b/clang/include/clang/Tooling/Inclusions/StandardLibrary.h
index 147f505ade0584..0314da5a67e865 100644
--- a/clang/include/clang/Tooling/Inclusions/StandardLibrary.h
+++ b/clang/include/clang/Tooling/Inclusions/StandardLibrary.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_TOOLING_INCLUSIONS_STANDARDLIBRARY_H
 #define LLVM_CLANG_TOOLING_INCLUSIONS_STANDARDLIBRARY_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/StringRef.h"
@@ -37,7 +38,7 @@ enum class Lang { C = 0, CXX, LastValue = CXX };
 // Lightweight class, in fact just an index into a table.
 // C++ and C Library compatibility headers are considered different: e.g.
 // "<cstdio>" and "<stdio.h>" (and their symbols) are treated differently.
-class Header {
+class CLANG_ABI Header {
 public:
   static std::vector<Header> all(Lang L = Lang::CXX);
   // Name should contain the angle brackets, e.g. "<vector>".
@@ -67,7 +68,7 @@ class Header {
 // and ::printf are not treated as the same symbol.
 // The symbols do not contain macros right now, we don't have a reliable index
 // for them.
-class Symbol {
+class CLANG_ABI Symbol {
 public:
   static std::vector<Symbol> all(Lang L = Lang::CXX);
   /// \p Scope should have the trailing "::", for example:
@@ -102,7 +103,7 @@ class Symbol {
 //
 // For non-top-level decls (std::vector<int>::iterator), returns the top-level
 // symbol (std::vector).
-class Recognizer {
+class CLANG_ABI Recognizer {
 public:
   Recognizer();
   std::optional<Symbol> operator()(const Decl *D);
diff --git a/clang/include/clang/Tooling/JSONCompilationDatabase.h b/clang/include/clang/Tooling/JSONCompilationDatabase.h
index 96582457c63d58..4127bcf3ed661b 100644
--- a/clang/include/clang/Tooling/JSONCompilationDatabase.h
+++ b/clang/include/clang/Tooling/JSONCompilationDatabase.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_TOOLING_JSONCOMPILATIONDATABASE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/FileMatchTrie.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -58,7 +59,7 @@ namespace tooling {
 /// JSON compilation databases can for example be generated in CMake projects
 /// by setting the flag -DCMAKE_EXPORT_COMPILE_COMMANDS.
 enum class JSONCommandLineSyntax { Windows, Gnu, AutoDetect };
-class JSONCompilationDatabase : public CompilationDatabase {
+class CLANG_ABI JSONCompilationDatabase : public CompilationDatabase {
 public:
   /// Loads a JSON compilation database from the specified file.
   ///
diff --git a/clang/include/clang/Tooling/Refactoring.h b/clang/include/clang/Tooling/Refactoring.h
index b82b09f0f92dbd..ca121b59fe1002 100644
--- a/clang/include/clang/Tooling/Refactoring.h
+++ b/clang/include/clang/Tooling/Refactoring.h
@@ -18,6 +18,7 @@
 #ifndef LLVM_CLANG_TOOLING_REFACTORING_H
 #define LLVM_CLANG_TOOLING_REFACTORING_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Tooling.h"
 #include <map>
@@ -34,7 +35,7 @@ namespace tooling {
 /// This is a refactoring specific version of \see ClangTool. FrontendActions
 /// passed to run() and runAndSave() should add replacements to
 /// getReplacements().
-class RefactoringTool : public ClangTool {
+class CLANG_ABI RefactoringTool : public ClangTool {
 public:
   /// \see ClangTool::ClangTool.
   RefactoringTool(const CompilationDatabase &Compilations,
@@ -89,7 +90,7 @@ class RefactoringTool : public ClangTool {
 /// "include/clang/Format/Format.h" for all possible style forms.
 ///
 /// \returns true if all replacements applied and formatted. false otherwise.
-bool formatAndApplyAllReplacements(
+CLANG_ABI bool formatAndApplyAllReplacements(
     const std::map<std::string, Replacements> &FileToReplaces,
     Rewriter &Rewrite, StringRef Style = "file");
 
diff --git a/clang/include/clang/Tooling/Refactoring/ASTSelection.h b/clang/include/clang/Tooling/Refactoring/ASTSelection.h
index ae778acb5e0175..b64e3933d15a9f 100644
--- a/clang/include/clang/Tooling/Refactoring/ASTSelection.h
+++ b/clang/include/clang/Tooling/Refactoring/ASTSelection.h
@@ -13,6 +13,7 @@
 #include "clang/AST/Stmt.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include <optional>
 #include <vector>
@@ -49,7 +50,7 @@ enum class SourceSelectionKind {
 /// a selection kind. The kind might be none as the node itself might not
 /// actually be selected, e.g. a statement in macro whose child is in a macro
 /// argument.
-struct SelectedASTNode {
+struct CLANG_ABI SelectedASTNode {
   DynTypedNode Node;
   SourceSelectionKind SelectionKind;
   std::vector<SelectedASTNode> Children;
@@ -68,7 +69,7 @@ struct SelectedASTNode {
 ///
 /// \returns std::nullopt if no nodes are selected in the AST, or a selected AST
 /// node that corresponds to the TranslationUnitDecl otherwise.
-std::optional<SelectedASTNode> findSelectedASTNodes(const ASTContext &Context,
+CLANG_ABI std::optional<SelectedASTNode> findSelectedASTNodes(const ASTContext &Context,
                                                     SourceRange SelectionRange);
 
 /// An AST selection value that corresponds to a selection of a set of
@@ -93,7 +94,7 @@ std::optional<SelectedASTNode> findSelectedASTNodes(const ASTContext &Context,
 ///
 /// A \c CodeRangeASTSelection value stores references to the full
 /// \c SelectedASTNode tree and should not outlive it.
-class CodeRangeASTSelection {
+class CLANG_ABI CodeRangeASTSelection {
 public:
   CodeRangeASTSelection(CodeRangeASTSelection &&) = default;
   CodeRangeASTSelection &operator=(CodeRangeASTSelection &&) = default;
diff --git a/clang/include/clang/Tooling/Refactoring/AtomicChange.h b/clang/include/clang/Tooling/Refactoring/AtomicChange.h
index 92f322ef7d80b5..e06106e6cf2e55 100644
--- a/clang/include/clang/Tooling/Refactoring/AtomicChange.h
+++ b/clang/include/clang/Tooling/Refactoring/AtomicChange.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/SourceManager.h"
 #include "clang/Format/Format.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/Any.h"
 #include "llvm/ADT/StringRef.h"
@@ -34,7 +35,7 @@ namespace tooling {
 ///
 /// Calling setError on an AtomicChange stores the error message and marks it as
 /// bad, i.e. none of its source edits will be applied.
-class AtomicChange {
+class CLANG_ABI AtomicChange {
 public:
   /// Creates an atomic change around \p KeyPosition with the key being a
   /// concatenation of the file name and the offset of \p KeyPosition.
@@ -181,7 +182,7 @@ struct ApplyChangesSpec {
 /// otherwise, an llvm::Error carrying llvm::StringError is returned (the Error
 /// message can be converted to string with `llvm::toString()` and the
 /// error_code should be ignored).
-llvm::Expected<std::string>
+CLANG_ABI llvm::Expected<std::string>
 applyAtomicChanges(llvm::StringRef FilePath, llvm::StringRef Code,
                    llvm::ArrayRef<AtomicChange> Changes,
                    const ApplyChangesSpec &Spec);
diff --git a/clang/include/clang/Tooling/Refactoring/Extract/Extract.h b/clang/include/clang/Tooling/Refactoring/Extract/Extract.h
index 695ca3879c1024..3c00d131f6c236 100644
--- a/clang/include/clang/Tooling/Refactoring/Extract/Extract.h
+++ b/clang/include/clang/Tooling/Refactoring/Extract/Extract.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_EXTRACT_H
 #define LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_EXTRACT_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/ASTSelection.h"
 #include "clang/Tooling/Refactoring/RefactoringActionRules.h"
 #include <optional>
@@ -18,7 +19,7 @@ namespace tooling {
 
 /// An "Extract Function" refactoring moves code into a new function that's
 /// then called from the place where the original code was.
-class ExtractFunction final : public SourceChangeRefactoringRule {
+class CLANG_ABI ExtractFunction final : public SourceChangeRefactoringRule {
 public:
   /// Initiates the extract function refactoring operation.
   ///
diff --git a/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h b/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h
index be44518d4bcecc..02a61407b84eef 100644
--- a/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h
+++ b/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_SOURCEEXTRACTION_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 
@@ -21,7 +22,7 @@ class Stmt;
 namespace tooling {
 
 /// Determines which semicolons should be inserted during extraction.
-class ExtractionSemicolonPolicy {
+class CLANG_ABI ExtractionSemicolonPolicy {
 public:
   bool isNeededInExtractedFunction() const {
     return IsNeededInExtractedFunction;
diff --git a/clang/include/clang/Tooling/Refactoring/Lookup.h b/clang/include/clang/Tooling/Refactoring/Lookup.h
index dcb40b7eee66c3..67169f0329cdca 100644
--- a/clang/include/clang/Tooling/Refactoring/Lookup.h
+++ b/clang/include/clang/Tooling/Refactoring/Lookup.h
@@ -15,6 +15,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include <string>
 
 namespace clang {
@@ -38,7 +39,7 @@ namespace tooling {
 /// \param ReplacementString The replacement nested name. Must be fully
 ///                          qualified including a leading "::".
 /// \returns The new name to be inserted in place of the current nested name.
-std::string replaceNestedName(const NestedNameSpecifier *Use,
+CLANG_ABI std::string replaceNestedName(const NestedNameSpecifier *Use,
                               SourceLocation UseLoc,
                               const DeclContext *UseContext,
                               const NamedDecl *FromDecl,
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringAction.h b/clang/include/clang/Tooling/Refactoring/RefactoringAction.h
index b362f655965e6b..003694d47eef25 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringAction.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringAction.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGACTION_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/RefactoringActionRules.h"
 #include <vector>
 
@@ -36,7 +37,7 @@ namespace tooling {
 ///   - tool vs editor: some refactoring operation can be initiated in the
 ///     editor when a declaration is selected, or in a tool when the name of
 ///     the declaration is passed using a command-line argument.
-class RefactoringAction {
+class CLANG_ABI RefactoringAction {
 public:
   virtual ~RefactoringAction() {}
 
@@ -55,7 +56,7 @@ class RefactoringAction {
 };
 
 /// Returns the list of all the available refactoring actions.
-std::vector<std::unique_ptr<RefactoringAction>> createRefactoringActions();
+CLANG_ABI std::vector<std::unique_ptr<RefactoringAction>> createRefactoringActions();
 
 } // end namespace tooling
 } // end namespace clang
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringActionRule.h b/clang/include/clang/Tooling/Refactoring/RefactoringActionRule.h
index c6a6c4f6093a34..5f87412b4504ba 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringActionRule.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringActionRule.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGACTIONRULE_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -31,7 +32,7 @@ struct RefactoringDescriptor {
 /// A common refactoring action rule interface that defines the 'invoke'
 /// function that performs the refactoring operation (either fully or
 /// partially).
-class RefactoringActionRuleBase {
+class CLANG_ABI RefactoringActionRuleBase {
 public:
   virtual ~RefactoringActionRuleBase() {}
 
@@ -50,7 +51,7 @@ class RefactoringActionRuleBase {
 /// action rule (SourceChangeRefactoringRule, etc) that, in addition to invoking
 /// the action, describes the requirements that determine when the action can be
 /// initiated.
-class RefactoringActionRule : public RefactoringActionRuleBase {
+class CLANG_ABI RefactoringActionRule : public RefactoringActionRuleBase {
 public:
   /// Returns true when the rule has a source selection requirement that has
   /// to be fulfilled before refactoring can be performed.
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h b/clang/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
index 1a318da3acca19..df816a050673f2 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGACTIONRULEREQUIREMENTS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/ASTSelection.h"
 #include "clang/Tooling/Refactoring/RefactoringDiagnostic.h"
 #include "clang/Tooling/Refactoring/RefactoringOption.h"
@@ -57,7 +58,7 @@ class SourceRangeSelectionRequirement : public SourceSelectionRequirement {
 ///
 /// The requirement will be evaluated only once during the initiation and
 /// search of matching refactoring action rules.
-class ASTSelectionRequirement : public SourceRangeSelectionRequirement {
+class CLANG_ABI ASTSelectionRequirement : public SourceRangeSelectionRequirement {
 public:
   Expected<SelectedASTNode> evaluate(RefactoringRuleContext &Context) const;
 };
@@ -71,14 +72,14 @@ class ASTSelectionRequirement : public SourceRangeSelectionRequirement {
 /// of matching refactoring action rules.
 ///
 /// \see CodeRangeASTSelection
-class CodeRangeASTSelectionRequirement : public ASTSelectionRequirement {
+class CLANG_ABI CodeRangeASTSelectionRequirement : public ASTSelectionRequirement {
 public:
   Expected<CodeRangeASTSelection>
   evaluate(RefactoringRuleContext &Context) const;
 };
 
 /// A base class for any requirement that requires some refactoring options.
-class RefactoringOptionsRequirement : public RefactoringActionRuleRequirement {
+class CLANG_ABI RefactoringOptionsRequirement : public RefactoringActionRuleRequirement {
 public:
   virtual ~RefactoringOptionsRequirement() {}
 
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringActionRules.h b/clang/include/clang/Tooling/Refactoring/RefactoringActionRules.h
index 5cb051d5343389..56bb9aa807486c 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringActionRules.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringActionRules.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGACTIONRULES_H
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGACTIONRULES_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/RefactoringActionRule.h"
 #include "clang/Tooling/Refactoring/RefactoringActionRulesInternal.h"
 
@@ -49,7 +50,7 @@ using RefactoringActionRules =
 ///
 /// This action rule is typically used for local refactorings that replace
 /// source in a single AST unit.
-class SourceChangeRefactoringRule : public RefactoringActionRuleBase {
+class CLANG_ABI SourceChangeRefactoringRule : public RefactoringActionRuleBase {
 public:
   void invoke(RefactoringResultConsumer &Consumer,
               RefactoringRuleContext &Context) final {
@@ -71,7 +72,7 @@ class SourceChangeRefactoringRule : public RefactoringActionRuleBase {
 /// This action rule is typically used for an interactive rename that allows
 /// users to specify the new name and the set of selected occurrences during
 /// the refactoring.
-class FindSymbolOccurrencesRefactoringRule : public RefactoringActionRuleBase {
+class CLANG_ABI FindSymbolOccurrencesRefactoringRule : public RefactoringActionRuleBase {
 public:
   void invoke(RefactoringResultConsumer &Consumer,
               RefactoringRuleContext &Context) final {
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringOption.h b/clang/include/clang/Tooling/Refactoring/RefactoringOption.h
index b022c5d61b038d..c08832298956eb 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringOption.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringOption.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTION_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include <memory>
 #include <type_traits>
 
@@ -23,7 +24,7 @@ class RefactoringOptionVisitor;
 ///
 /// Refactoring options can be specified using command-line arguments when
 /// the clang-refactor tool is used.
-class RefactoringOption {
+class CLANG_ABI RefactoringOption {
 public:
   virtual ~RefactoringOption() {}
 
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringOptionVisitor.h b/clang/include/clang/Tooling/Refactoring/RefactoringOptionVisitor.h
index 3234b0976a8e74..5a42997f605b0e 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringOptionVisitor.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringOptionVisitor.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 #include <type_traits>
 
@@ -23,7 +24,7 @@ class RefactoringOption;
 ///
 /// A valid refactoring option type must have a corresponding \c visit
 /// declaration in this interface.
-class RefactoringOptionVisitor {
+class CLANG_ABI RefactoringOptionVisitor {
 public:
   virtual ~RefactoringOptionVisitor() {}
 
diff --git a/clang/include/clang/Tooling/Refactoring/RefactoringResultConsumer.h b/clang/include/clang/Tooling/Refactoring/RefactoringResultConsumer.h
index 016eff80ca7bbb..c2234b2a6a8fbb 100644
--- a/clang/include/clang/Tooling/Refactoring/RefactoringResultConsumer.h
+++ b/clang/include/clang/Tooling/Refactoring/RefactoringResultConsumer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGRESULTCONSUMER_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/AtomicChange.h"
 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
 #include "llvm/Support/Error.h"
@@ -21,7 +22,7 @@ namespace tooling {
 /// be produced by refactoring actions.
 ///
 /// A valid refactoring result must be handled by a \c handle method.
-class RefactoringResultConsumer {
+class CLANG_ABI RefactoringResultConsumer {
 public:
   virtual ~RefactoringResultConsumer() {}
 
diff --git a/clang/include/clang/Tooling/Refactoring/Rename/RenamingAction.h b/clang/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
index 43a8d56e4e7176..4d8ecf65c50b08 100644
--- a/clang/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
+++ b/clang/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_RENAMINGACTION_H
 #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_RENAMINGACTION_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Refactoring/AtomicChange.h"
 #include "clang/Tooling/Refactoring/RefactoringActionRules.h"
@@ -26,7 +27,7 @@ class ASTConsumer;
 
 namespace tooling {
 
-class RenamingAction {
+class CLANG_ABI RenamingAction {
 public:
   RenamingAction(const std::vector<std::string> &NewNames,
                  const std::vector<std::string> &PrevNames,
@@ -45,7 +46,7 @@ class RenamingAction {
   bool PrintLocations;
 };
 
-class RenameOccurrences final : public SourceChangeRefactoringRule {
+class CLANG_ABI RenameOccurrences final : public SourceChangeRefactoringRule {
 public:
   static Expected<RenameOccurrences> initiate(RefactoringRuleContext &Context,
                                               SourceRange SelectionRange,
@@ -66,7 +67,7 @@ class RenameOccurrences final : public SourceChangeRefactoringRule {
   std::string NewName;
 };
 
-class QualifiedRenameRule final : public SourceChangeRefactoringRule {
+class CLANG_ABI QualifiedRenameRule final : public SourceChangeRefactoringRule {
 public:
   static Expected<QualifiedRenameRule> initiate(RefactoringRuleContext &Context,
                                                 std::string OldQualifiedName,
@@ -90,12 +91,12 @@ class QualifiedRenameRule final : public SourceChangeRefactoringRule {
 
 /// Returns source replacements that correspond to the rename of the given
 /// symbol occurrences.
-llvm::Expected<std::vector<AtomicChange>>
+CLANG_ABI llvm::Expected<std::vector<AtomicChange>>
 createRenameReplacements(const SymbolOccurrences &Occurrences,
                          const SourceManager &SM, const SymbolName &NewName);
 
 /// Rename all symbols identified by the given USRs.
-class QualifiedRenamingAction {
+class CLANG_ABI QualifiedRenamingAction {
 public:
   QualifiedRenamingAction(
       const std::vector<std::string> &NewNames,
diff --git a/clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h b/clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
index aff965edb07c33..00feeb75df4da6 100644
--- a/clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
+++ b/clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include <vector>
@@ -36,7 +37,7 @@ class SymbolName;
 ///
 /// We have to replace the text in both range 0 and range 1 when renaming the
 /// Objective-C method 'selectorPiece1:selectorPiece2'.
-class SymbolOccurrence {
+class CLANG_ABI SymbolOccurrence {
 public:
   enum OccurrenceKind {
     /// This occurrence is an exact match and can be renamed automatically.
diff --git a/clang/include/clang/Tooling/Refactoring/Rename/USRFinder.h b/clang/include/clang/Tooling/Refactoring/Rename/USRFinder.h
index a7ffa855688813..278285a357f169 100644
--- a/clang/include/clang/Tooling/Refactoring/Rename/USRFinder.h
+++ b/clang/include/clang/Tooling/Refactoring/Rename/USRFinder.h
@@ -17,6 +17,7 @@
 
 #include "clang/AST/AST.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/Support/Compiler.h"
 #include <string>
 #include <vector>
 
@@ -31,17 +32,17 @@ namespace tooling {
 
 // Given an AST context and a point, returns a NamedDecl identifying the symbol
 // at the point. Returns null if nothing is found at the point.
-const NamedDecl *getNamedDeclAt(const ASTContext &Context,
+CLANG_ABI const NamedDecl *getNamedDeclAt(const ASTContext &Context,
                                 const SourceLocation Point);
 
 // Given an AST context and a fully qualified name, returns a NamedDecl
 // identifying the symbol with a matching name. Returns null if nothing is
 // found for the name.
-const NamedDecl *getNamedDeclFor(const ASTContext &Context,
+CLANG_ABI const NamedDecl *getNamedDeclFor(const ASTContext &Context,
                                  const std::string &Name);
 
 // Converts a Decl into a USR.
-std::string getUSRForDecl(const Decl *Decl);
+CLANG_ABI std::string getUSRForDecl(const Decl *Decl);
 
 } // end namespace tooling
 } // end namespace clang
diff --git a/clang/include/clang/Tooling/Refactoring/Rename/USRFindingAction.h b/clang/include/clang/Tooling/Refactoring/Rename/USRFindingAction.h
index e81b5c2345c95f..8d7c826977c3e3 100644
--- a/clang/include/clang/Tooling/Refactoring/Rename/USRFindingAction.h
+++ b/clang/include/clang/Tooling/Refactoring/Rename/USRFindingAction.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRFINDINGACTION_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <string>
@@ -34,13 +35,13 @@ namespace tooling {
 ///
 /// - A constructor is canonicalized to its class.
 /// - A destructor is canonicalized to its class.
-const NamedDecl *getCanonicalSymbolDeclaration(const NamedDecl *FoundDecl);
+CLANG_ABI const NamedDecl *getCanonicalSymbolDeclaration(const NamedDecl *FoundDecl);
 
 /// Returns the set of USRs that correspond to the given declaration.
-std::vector<std::string> getUSRsForDeclaration(const NamedDecl *ND,
+CLANG_ABI std::vector<std::string> getUSRsForDeclaration(const NamedDecl *ND,
                                                ASTContext &Context);
 
-struct USRFindingAction {
+struct CLANG_ABI USRFindingAction {
   USRFindingAction(ArrayRef<unsigned> SymbolOffsets,
                    ArrayRef<std::string> QualifiedNames, bool Force)
       : SymbolOffsets(SymbolOffsets), QualifiedNames(QualifiedNames),
diff --git a/clang/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h b/clang/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h
index c3ffb4421e0048..3825cedbb121a7 100644
--- a/clang/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h
+++ b/clang/include/clang/Tooling/Refactoring/Rename/USRLocFinder.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_USRLOCFINDER_H
 
 #include "clang/AST/AST.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Refactoring/AtomicChange.h"
 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
@@ -34,7 +35,7 @@ namespace tooling {
 /// \param TranslationUnitDecl The translation unit declaration.
 ///
 /// \return Atomic changes for renaming.
-std::vector<tooling::AtomicChange>
+CLANG_ABI std::vector<tooling::AtomicChange>
 createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
                           llvm::StringRef NewName, Decl *TranslationUnitDecl);
 
@@ -43,7 +44,7 @@ createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
 ///
 /// \return SymbolOccurrences that can be converted to AtomicChanges when
 /// renaming.
-SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
+CLANG_ABI SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
                                        StringRef PrevName, Decl *Decl);
 
 } // end namespace tooling
diff --git a/clang/include/clang/Tooling/RefactoringCallbacks.h b/clang/include/clang/Tooling/RefactoringCallbacks.h
index ac3f28dce80cbd..37cf987adfc359 100644
--- a/clang/include/clang/Tooling/RefactoringCallbacks.h
+++ b/clang/include/clang/Tooling/RefactoringCallbacks.h
@@ -29,6 +29,7 @@
 #define LLVM_CLANG_TOOLING_REFACTORINGCALLBACKS_H
 
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring.h"
 
 namespace clang {
@@ -37,7 +38,7 @@ namespace tooling {
 /// Base class for RefactoringCallbacks.
 ///
 /// Collects \c tooling::Replacements while running.
-class RefactoringCallback : public ast_matchers::MatchFinder::MatchCallback {
+class CLANG_ABI RefactoringCallback : public ast_matchers::MatchFinder::MatchCallback {
 public:
   RefactoringCallback();
   Replacements &getReplacements();
@@ -50,7 +51,7 @@ class RefactoringCallback : public ast_matchers::MatchFinder::MatchCallback {
 /// tooling::RefactoringTool.
 ///
 /// Runs AST matchers and stores the \c tooling::Replacements in a map.
-class ASTMatchRefactorer {
+class CLANG_ABI ASTMatchRefactorer {
 public:
   explicit ASTMatchRefactorer(
     std::map<std::string, Replacements> &FileToReplaces);
@@ -75,7 +76,7 @@ class ASTMatchRefactorer {
 
 /// Replace the text of the statement bound to \c FromId with the text in
 /// \c ToText.
-class ReplaceStmtWithText : public RefactoringCallback {
+class CLANG_ABI ReplaceStmtWithText : public RefactoringCallback {
 public:
   ReplaceStmtWithText(StringRef FromId, StringRef ToText);
   void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
@@ -91,7 +92,7 @@ class ReplaceStmtWithText : public RefactoringCallback {
 /// Expressions of the form ${NodeName} in \c ToTemplate will be
 /// replaced by the text of the node bound to ${NodeName}. The string
 /// "$$" will be replaced by "$".
-class ReplaceNodeWithTemplate : public RefactoringCallback {
+class CLANG_ABI ReplaceNodeWithTemplate : public RefactoringCallback {
 public:
   static llvm::Expected<std::unique_ptr<ReplaceNodeWithTemplate>>
   create(StringRef FromId, StringRef ToTemplate);
@@ -110,7 +111,7 @@ class ReplaceNodeWithTemplate : public RefactoringCallback {
 
 /// Replace the text of the statement bound to \c FromId with the text of
 /// the statement bound to \c ToId.
-class ReplaceStmtWithStmt : public RefactoringCallback {
+class CLANG_ABI ReplaceStmtWithStmt : public RefactoringCallback {
 public:
   ReplaceStmtWithStmt(StringRef FromId, StringRef ToId);
   void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
@@ -123,7 +124,7 @@ class ReplaceStmtWithStmt : public RefactoringCallback {
 /// Replace an if-statement bound to \c Id with the outdented text of its
 /// body, choosing the consequent or the alternative based on whether
 /// \c PickTrueBranch is true.
-class ReplaceIfStmtWithItsBody : public RefactoringCallback {
+class CLANG_ABI ReplaceIfStmtWithItsBody : public RefactoringCallback {
 public:
   ReplaceIfStmtWithItsBody(StringRef Id, bool PickTrueBranch);
   void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
diff --git a/clang/include/clang/Tooling/StandaloneExecution.h b/clang/include/clang/Tooling/StandaloneExecution.h
index cdbe65a95b9d27..42c5ca07dfe752 100644
--- a/clang/include/clang/Tooling/StandaloneExecution.h
+++ b/clang/include/clang/Tooling/StandaloneExecution.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_TOOLING_STANDALONEEXECUTION_H
 #define LLVM_CLANG_TOOLING_STANDALONEEXECUTION_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/Execution.h"
 #include <optional>
@@ -28,7 +29,7 @@ namespace tooling {
 ///   - `getClangStripOutputAdjuster()`
 ///   - `getClangSyntaxOnlyAdjuster()`
 ///   - `getClangStripDependencyFileAdjuster()`
-class StandaloneToolExecutor : public ToolExecutor {
+class CLANG_ABI StandaloneToolExecutor : public ToolExecutor {
 public:
   static const char *ExecutorName;
 
diff --git a/clang/include/clang/Tooling/Syntax/BuildTree.h b/clang/include/clang/Tooling/Syntax/BuildTree.h
index 273d03ddc23305..5bb8ce5c82c4f0 100644
--- a/clang/include/clang/Tooling/Syntax/BuildTree.h
+++ b/clang/include/clang/Tooling/Syntax/BuildTree.h
@@ -12,6 +12,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Syntax/Nodes.h"
 #include "clang/Tooling/Syntax/TokenBufferTokenManager.h"
 #include "clang/Tooling/Syntax/Tree.h"
@@ -22,7 +23,7 @@ namespace syntax {
 /// Build a syntax tree for the main file.
 /// This usually covers the whole TranslationUnitDecl, but can be restricted by
 /// the ASTContext's traversal scope.
-syntax::TranslationUnit *
+CLANG_ABI syntax::TranslationUnit *
 buildSyntaxTree(Arena &A, TokenBufferTokenManager &TBTM, ASTContext &Context);
 
 // Create syntax trees from subtrees not backed by the source code.
@@ -30,24 +31,24 @@ buildSyntaxTree(Arena &A, TokenBufferTokenManager &TBTM, ASTContext &Context);
 // Synthesis of Leafs
 /// Create `Leaf` from token with `Spelling` and assert it has the desired
 /// `TokenKind`.
-syntax::Leaf *createLeaf(syntax::Arena &A, TokenBufferTokenManager &TBTM,
+CLANG_ABI syntax::Leaf *createLeaf(syntax::Arena &A, TokenBufferTokenManager &TBTM,
                          tok::TokenKind K, StringRef Spelling);
 
 /// Infer the token spelling from its `TokenKind`, then create `Leaf` from
 /// this token
-syntax::Leaf *createLeaf(syntax::Arena &A, TokenBufferTokenManager &TBTM,
+CLANG_ABI syntax::Leaf *createLeaf(syntax::Arena &A, TokenBufferTokenManager &TBTM,
                          tok::TokenKind K);
 
 // Synthesis of Trees
 /// Creates the concrete syntax node according to the specified `NodeKind` `K`.
 /// Returns it as a pointer to the base class `Tree`.
-syntax::Tree *
+CLANG_ABI syntax::Tree *
 createTree(syntax::Arena &A,
            ArrayRef<std::pair<syntax::Node *, syntax::NodeRole>> Children,
            syntax::NodeKind K);
 
 // Synthesis of Syntax Nodes
-syntax::EmptyStatement *createEmptyStatement(syntax::Arena &A,
+CLANG_ABI syntax::EmptyStatement *createEmptyStatement(syntax::Arena &A,
                                              TokenBufferTokenManager &TBTM);
 
 /// Creates a completely independent copy of `N` with its macros expanded.
@@ -56,7 +57,7 @@ syntax::EmptyStatement *createEmptyStatement(syntax::Arena &A,
 /// * Detached, i.e. `Parent == NextSibling == nullptr` and
 /// `Role == Detached`.
 /// * Synthesized, i.e. `Original == false`.
-syntax::Node *deepCopyExpandingMacros(syntax::Arena &A,
+CLANG_ABI syntax::Node *deepCopyExpandingMacros(syntax::Arena &A,
                                       TokenBufferTokenManager &TBTM,
                                       const syntax::Node *N);
 } // namespace syntax
diff --git a/clang/include/clang/Tooling/Syntax/Mutations.h b/clang/include/clang/Tooling/Syntax/Mutations.h
index 6db9c88ca00009..6ed95034d3e4d5 100644
--- a/clang/include/clang/Tooling/Syntax/Mutations.h
+++ b/clang/include/clang/Tooling/Syntax/Mutations.h
@@ -11,6 +11,7 @@
 #ifndef LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
 #define LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "clang/Tooling/Syntax/Nodes.h"
 #include "clang/Tooling/Syntax/TokenBufferTokenManager.h"
@@ -21,7 +22,7 @@ namespace syntax {
 
 /// Computes textual replacements required to mimic the tree modifications made
 /// to the syntax tree.
-tooling::Replacements computeReplacements(const TokenBufferTokenManager &TBTM,
+CLANG_ABI tooling::Replacements computeReplacements(const TokenBufferTokenManager &TBTM,
                                           const syntax::TranslationUnit &TU);
 
 /// Removes a statement or replaces it with an empty statement where one is
@@ -30,7 +31,7 @@ tooling::Replacements computeReplacements(const TokenBufferTokenManager &TBTM,
 /// One can remove `foo();` completely and to remove `bar();` we would need to
 /// replace it with an empty statement.
 /// EXPECTS: S->canModify() == true
-void removeStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM,
+CLANG_ABI void removeStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM,
                      syntax::Statement *S);
 
 } // namespace syntax
diff --git a/clang/include/clang/Tooling/Syntax/Nodes.h b/clang/include/clang/Tooling/Syntax/Nodes.h
index c4f31900d0ce06..f44a679380cad6 100644
--- a/clang/include/clang/Tooling/Syntax/Nodes.h
+++ b/clang/include/clang/Tooling/Syntax/Nodes.h
@@ -22,6 +22,7 @@
 #define LLVM_CLANG_TOOLING_SYNTAX_NODES_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Syntax/Tree.h"
 namespace clang {
 namespace syntax {
@@ -34,7 +35,7 @@ enum class NodeKind : uint16_t {
 #include "clang/Tooling/Syntax/Nodes.inc"
 };
 /// For debugging purposes.
-raw_ostream &operator<<(raw_ostream &OS, NodeKind K);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, NodeKind K);
 
 /// A relation between a parent and child node, e.g. 'left-hand-side of
 /// a binary expression'. Used for implementing accessors.
@@ -107,13 +108,13 @@ enum class NodeRole : uint8_t {
   Declarators
 };
 /// For debugging purposes.
-raw_ostream &operator<<(raw_ostream &OS, NodeRole R);
+CLANG_ABI raw_ostream &operator<<(raw_ostream &OS, NodeRole R);
 
 #include "clang/Tooling/Syntax/NodeClasses.inc"
 
 /// Models a `nested-name-specifier`. C++ [expr.prim.id.qual]
 /// e.g. the `std::vector<int>::` in `std::vector<int>::size`.
-class NestedNameSpecifier final : public List {
+class CLANG_ABI NestedNameSpecifier final : public List {
 public:
   NestedNameSpecifier() : List(NodeKind::NestedNameSpecifier) {}
   static bool classof(const Node *N);
@@ -143,7 +144,7 @@ class UnknownExpression final : public Expression {
 ///     delimited_list(expression, ',')
 /// Note: This construct is a simplification of the grammar rule for
 /// `expression-list`, that is used in the definition of `call-expression`
-class CallArguments final : public List {
+class CLANG_ABI CallArguments final : public List {
 public:
   CallArguments() : List(NodeKind::CallArguments) {}
   static bool classof(const Node *N);
@@ -152,7 +153,7 @@ class CallArguments final : public List {
 };
 
 /// An abstract class for prefix and postfix unary operators.
-class UnaryOperatorExpression : public Expression {
+class CLANG_ABI UnaryOperatorExpression : public Expression {
 public:
   UnaryOperatorExpression(NodeKind K) : Expression(K) {}
   static bool classof(const Node *N);
@@ -195,7 +196,7 @@ class PostfixUnaryOperatorExpression final : public UnaryOperatorExpression {
 ///   a bitor 1
 ///   a |= b
 ///   a and_eq b
-class BinaryOperatorExpression final : public Expression {
+class CLANG_ABI BinaryOperatorExpression final : public Expression {
 public:
   BinaryOperatorExpression() : Expression(NodeKind::BinaryOperatorExpression) {}
   static bool classof(const Node *N);
@@ -235,7 +236,7 @@ class EmptyStatement final : public Statement {
 };
 
 /// switch (<cond>) <body>
-class SwitchStatement final : public Statement {
+class CLANG_ABI SwitchStatement final : public Statement {
 public:
   SwitchStatement() : Statement(NodeKind::SwitchStatement) {}
   static bool classof(const Node *N);
@@ -244,7 +245,7 @@ class SwitchStatement final : public Statement {
 };
 
 /// case <value>: <body>
-class CaseStatement final : public Statement {
+class CLANG_ABI CaseStatement final : public Statement {
 public:
   CaseStatement() : Statement(NodeKind::CaseStatement) {}
   static bool classof(const Node *N);
@@ -254,7 +255,7 @@ class CaseStatement final : public Statement {
 };
 
 /// default: <body>
-class DefaultStatement final : public Statement {
+class CLANG_ABI DefaultStatement final : public Statement {
 public:
   DefaultStatement() : Statement(NodeKind::DefaultStatement) {}
   static bool classof(const Node *N);
@@ -264,7 +265,7 @@ class DefaultStatement final : public Statement {
 
 /// if (cond) <then-statement> else <else-statement>
 /// FIXME: add condition that models 'expression  or variable declaration'
-class IfStatement final : public Statement {
+class CLANG_ABI IfStatement final : public Statement {
 public:
   IfStatement() : Statement(NodeKind::IfStatement) {}
   static bool classof(const Node *N);
@@ -275,7 +276,7 @@ class IfStatement final : public Statement {
 };
 
 /// for (<init>; <cond>; <increment>) <body>
-class ForStatement final : public Statement {
+class CLANG_ABI ForStatement final : public Statement {
 public:
   ForStatement() : Statement(NodeKind::ForStatement) {}
   static bool classof(const Node *N);
@@ -284,7 +285,7 @@ class ForStatement final : public Statement {
 };
 
 /// while (<cond>) <body>
-class WhileStatement final : public Statement {
+class CLANG_ABI WhileStatement final : public Statement {
 public:
   WhileStatement() : Statement(NodeKind::WhileStatement) {}
   static bool classof(const Node *N);
@@ -293,7 +294,7 @@ class WhileStatement final : public Statement {
 };
 
 /// continue;
-class ContinueStatement final : public Statement {
+class CLANG_ABI ContinueStatement final : public Statement {
 public:
   ContinueStatement() : Statement(NodeKind::ContinueStatement) {}
   static bool classof(const Node *N);
@@ -301,7 +302,7 @@ class ContinueStatement final : public Statement {
 };
 
 /// break;
-class BreakStatement final : public Statement {
+class CLANG_ABI BreakStatement final : public Statement {
 public:
   BreakStatement() : Statement(NodeKind::BreakStatement) {}
   static bool classof(const Node *N);
@@ -310,7 +311,7 @@ class BreakStatement final : public Statement {
 
 /// return <expr>;
 /// return;
-class ReturnStatement final : public Statement {
+class CLANG_ABI ReturnStatement final : public Statement {
 public:
   ReturnStatement() : Statement(NodeKind::ReturnStatement) {}
   static bool classof(const Node *N);
@@ -319,7 +320,7 @@ class ReturnStatement final : public Statement {
 };
 
 /// for (<decl> : <init>) <body>
-class RangeBasedForStatement final : public Statement {
+class CLANG_ABI RangeBasedForStatement final : public Statement {
 public:
   RangeBasedForStatement() : Statement(NodeKind::RangeBasedForStatement) {}
   static bool classof(const Node *N);
@@ -329,7 +330,7 @@ class RangeBasedForStatement final : public Statement {
 
 /// Expression in a statement position, e.g. functions calls inside compound
 /// statements or inside a loop body.
-class ExpressionStatement final : public Statement {
+class CLANG_ABI ExpressionStatement final : public Statement {
 public:
   ExpressionStatement() : Statement(NodeKind::ExpressionStatement) {}
   static bool classof(const Node *N);
@@ -337,7 +338,7 @@ class ExpressionStatement final : public Statement {
 };
 
 /// { statement1; statement2; … }
-class CompoundStatement final : public Statement {
+class CLANG_ABI CompoundStatement final : public Statement {
 public:
   CompoundStatement() : Statement(NodeKind::CompoundStatement) {}
   static bool classof(const Node *N);
@@ -373,7 +374,7 @@ class EmptyDeclaration final : public Declaration {
 
 /// static_assert(<condition>, <message>)
 /// static_assert(<condition>)
-class StaticAssertDeclaration final : public Declaration {
+class CLANG_ABI StaticAssertDeclaration final : public Declaration {
 public:
   StaticAssertDeclaration() : Declaration(NodeKind::StaticAssertDeclaration) {}
   static bool classof(const Node *N);
@@ -390,7 +391,7 @@ class LinkageSpecificationDeclaration final : public Declaration {
   static bool classof(const Node *N);
 };
 
-class DeclaratorList final : public List {
+class CLANG_ABI DeclaratorList final : public List {
 public:
   DeclaratorList() : List(NodeKind::DeclaratorList) {}
   static bool classof(const Node *N);
@@ -402,7 +403,7 @@ class DeclaratorList final : public List {
 /// Groups multiple declarators (e.g. variables, typedefs, etc.) together. All
 /// grouped declarators share the same declaration specifiers (e.g. 'int' or
 /// 'typedef').
-class SimpleDeclaration final : public Declaration {
+class CLANG_ABI SimpleDeclaration final : public Declaration {
 public:
   SimpleDeclaration() : Declaration(NodeKind::SimpleDeclaration) {}
   static bool classof(const Node *N);
@@ -411,7 +412,7 @@ class SimpleDeclaration final : public Declaration {
 };
 
 /// template <template-parameters> <declaration>
-class TemplateDeclaration final : public Declaration {
+class CLANG_ABI TemplateDeclaration final : public Declaration {
 public:
   TemplateDeclaration() : Declaration(NodeKind::TemplateDeclaration) {}
   static bool classof(const Node *N);
@@ -424,7 +425,7 @@ class TemplateDeclaration final : public Declaration {
 ///     template struct X<int>
 ///     template void foo<int>()
 ///     template int var<double>
-class ExplicitTemplateInstantiation final : public Declaration {
+class CLANG_ABI ExplicitTemplateInstantiation final : public Declaration {
 public:
   ExplicitTemplateInstantiation()
       : Declaration(NodeKind::ExplicitTemplateInstantiation) {}
@@ -500,7 +501,7 @@ class SimpleDeclarator final : public Declarator {
 /// Declarator inside parentheses.
 /// E.g. `(***a)` from `int (***a) = nullptr;`
 /// See comment of Declarator for more details.
-class ParenDeclarator final : public Declarator {
+class CLANG_ABI ParenDeclarator final : public Declarator {
 public:
   ParenDeclarator() : Declarator(NodeKind::ParenDeclarator) {}
   static bool classof(const Node *N);
@@ -512,7 +513,7 @@ class ParenDeclarator final : public Declarator {
 /// E.g:
 ///   `[10]` in `int a[10];`
 ///   `[static 10]` in `void f(int xs[static 10]);`
-class ArraySubscript final : public Tree {
+class CLANG_ABI ArraySubscript final : public Tree {
 public:
   ArraySubscript() : Tree(NodeKind::ArraySubscript) {}
   static bool classof(const Node *N);
@@ -524,7 +525,7 @@ class ArraySubscript final : public Tree {
 
 /// Trailing return type after the parameter list, including the arrow token.
 /// E.g. `-> int***`.
-class TrailingReturnType final : public Tree {
+class CLANG_ABI TrailingReturnType final : public Tree {
 public:
   TrailingReturnType() : Tree(NodeKind::TrailingReturnType) {}
   static bool classof(const Node *N);
@@ -537,7 +538,7 @@ class TrailingReturnType final : public Tree {
 
 /// Models a `parameter-declaration-list` which appears within
 /// `parameters-and-qualifiers`. See C++ [dcl.fct]
-class ParameterDeclarationList final : public List {
+class CLANG_ABI ParameterDeclarationList final : public List {
 public:
   ParameterDeclarationList() : List(NodeKind::ParameterDeclarationList) {}
   static bool classof(const Node *N);
@@ -557,7 +558,7 @@ class ParameterDeclarationList final : public List {
 ///  `() throw()` in `int foo() throw();`
 ///
 /// (!) override doesn't belong here.
-class ParametersAndQualifiers final : public Tree {
+class CLANG_ABI ParametersAndQualifiers final : public Tree {
 public:
   ParametersAndQualifiers() : Tree(NodeKind::ParametersAndQualifiers) {}
   static bool classof(const Node *N);
diff --git a/clang/include/clang/Tooling/Syntax/TokenBufferTokenManager.h b/clang/include/clang/Tooling/Syntax/TokenBufferTokenManager.h
index 6522af584e9abb..a1b1fd930d3734 100644
--- a/clang/include/clang/Tooling/Syntax/TokenBufferTokenManager.h
+++ b/clang/include/clang/Tooling/Syntax/TokenBufferTokenManager.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_CLANG_TOOLING_SYNTAX_TOKEN_BUFFER_TOKEN_MANAGER_H
 #define LLVM_CLANG_TOOLING_SYNTAX_TOKEN_BUFFER_TOKEN_MANAGER_H
 
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Syntax/TokenManager.h"
 #include "clang/Tooling/Syntax/Tokens.h"
 
@@ -17,7 +18,7 @@ namespace syntax {
 
 /// A TokenBuffer-powered token manager.
 /// It tracks the underlying token buffers, source manager, etc.
-class TokenBufferTokenManager : public TokenManager {
+class CLANG_ABI TokenBufferTokenManager : public TokenManager {
 public:
   TokenBufferTokenManager(const TokenBuffer &Tokens,
                           const LangOptions &LangOpts, SourceManager &SourceMgr)
diff --git a/clang/include/clang/Tooling/Syntax/TokenManager.h b/clang/include/clang/Tooling/Syntax/TokenManager.h
index 6f0d11ce0d6b97..f0a9c9019f8206 100644
--- a/clang/include/clang/Tooling/Syntax/TokenManager.h
+++ b/clang/include/clang/Tooling/Syntax/TokenManager.h
@@ -19,6 +19,7 @@
 #ifndef LLVM_CLANG_TOOLING_SYNTAX_TOKEN_MANAGER_H
 #define LLVM_CLANG_TOOLING_SYNTAX_TOKEN_MANAGER_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 #include <cstdint>
 
@@ -26,7 +27,7 @@ namespace clang {
 namespace syntax {
 
 /// Defines interfaces for operating "Token" in the clang syntax-tree.
-class TokenManager {
+class CLANG_ABI TokenManager {
 public:
   virtual ~TokenManager() = default;
 
diff --git a/clang/include/clang/Tooling/Syntax/Tokens.h b/clang/include/clang/Tooling/Syntax/Tokens.h
index f71b8d67bfea4f..d91461d4bc3bdd 100644
--- a/clang/include/clang/Tooling/Syntax/Tokens.h
+++ b/clang/include/clang/Tooling/Syntax/Tokens.h
@@ -32,6 +32,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TokenKinds.h"
 #include "clang/Lex/Token.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -47,7 +48,7 @@ namespace syntax {
 
 /// A half-open character range inside a particular file, the start offset is
 /// included and the end offset is excluded from the range.
-struct FileRange {
+struct CLANG_ABI FileRange {
   /// EXPECTS: File.isValid() && Begin <= End.
   FileRange(FileID File, unsigned BeginOffset, unsigned EndOffset);
   /// EXPECTS: BeginLoc.isValid() && BeginLoc.isFileID().
@@ -95,12 +96,12 @@ struct FileRange {
 };
 
 /// For debugging purposes.
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const FileRange &R);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const FileRange &R);
 
 /// A token coming directly from a file or from a macro invocation. Has just
 /// enough information to locate the token in the source code.
 /// Can represent both expanded and spelled tokens.
-class Token {
+class CLANG_ABI Token {
 public:
   Token(SourceLocation Location, unsigned Length, tok::TokenKind Kind);
   /// EXPECTS: clang::Token is not an annotation token.
@@ -143,7 +144,7 @@ class Token {
   tok::TokenKind Kind;
 };
 /// For debugging purposes. Equivalent to a call to Token::str().
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Token &T);
+CLANG_ABI llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Token &T);
 
 /// A list of tokens obtained by preprocessing a text buffer and operations to
 /// map between the expanded and spelled tokens, i.e. TokenBuffer has
@@ -171,7 +172,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Token &T);
 /// the spelled tokens of a file using the tokenize() helper.
 ///
 /// FIXME: allow mappings into macro arguments.
-class TokenBuffer {
+class CLANG_ABI TokenBuffer {
 public:
   TokenBuffer(const SourceManager &SourceMgr) : SourceMgr(&SourceMgr) {}
 
@@ -319,7 +320,7 @@ class TokenBuffer {
   ///   FOO    // invocation #1, tokens = {'1','+','2'}, macroTokens = {'FOO'}.
   ///   BAR(1) // invocation #2, tokens = {'a', '+', '1'},
   ///                            macroTokens = {'BAR', '(', '1', ')'}.
-  struct Mapping {
+  struct CLANG_ABI Mapping {
     // Positions in the corresponding spelled token stream. The corresponding
     // range is never empty.
     unsigned BeginSpelled = 0;
@@ -380,17 +381,17 @@ class TokenBuffer {
 
 /// The spelled tokens that overlap or touch a spelling location Loc.
 /// This always returns 0-2 tokens.
-llvm::ArrayRef<syntax::Token>
+CLANG_ABI llvm::ArrayRef<syntax::Token>
 spelledTokensTouching(SourceLocation Loc, const syntax::TokenBuffer &Tokens);
-llvm::ArrayRef<syntax::Token>
+CLANG_ABI llvm::ArrayRef<syntax::Token>
 spelledTokensTouching(SourceLocation Loc, llvm::ArrayRef<syntax::Token> Tokens);
 
 /// The identifier token that overlaps or touches a spelling location Loc.
 /// If there is none, returns nullptr.
-const syntax::Token *
+CLANG_ABI const syntax::Token *
 spelledIdentifierTouching(SourceLocation Loc,
                           llvm::ArrayRef<syntax::Token> Tokens);
-const syntax::Token *
+CLANG_ABI const syntax::Token *
 spelledIdentifierTouching(SourceLocation Loc,
                           const syntax::TokenBuffer &Tokens);
 
@@ -402,20 +403,20 @@ spelledIdentifierTouching(SourceLocation Loc,
 /// results from what one might expect when running a C++ frontend, e.g.
 /// preprocessor does not run at all.
 /// The result will *not* have a 'eof' token at the end.
-std::vector<syntax::Token> tokenize(FileID FID, const SourceManager &SM,
+CLANG_ABI std::vector<syntax::Token> tokenize(FileID FID, const SourceManager &SM,
                                     const LangOptions &LO);
 /// Similar to one above, instead of whole file tokenizes a part of it. Note
 /// that, the first token might be incomplete if FR.startOffset is not at the
 /// beginning of a token, and the last token returned will start before the
 /// FR.endOffset but might end after it.
-std::vector<syntax::Token>
+CLANG_ABI std::vector<syntax::Token>
 tokenize(const FileRange &FR, const SourceManager &SM, const LangOptions &LO);
 
 /// Collects tokens for the main file while running the frontend action. An
 /// instance of this object should be created on
 /// FrontendAction::BeginSourceFile() and the results should be consumed after
 /// FrontendAction::Execute() finishes.
-class TokenCollector {
+class CLANG_ABI TokenCollector {
 public:
   /// Adds the hooks to collect the tokens. Should be called before the
   /// preprocessing starts, i.e. as a part of BeginSourceFile() or
diff --git a/clang/include/clang/Tooling/Syntax/Tree.h b/clang/include/clang/Tooling/Syntax/Tree.h
index a80b7bf2a3de84..9763e5a0c7dfe8 100644
--- a/clang/include/clang/Tooling/Syntax/Tree.h
+++ b/clang/include/clang/Tooling/Syntax/Tree.h
@@ -22,6 +22,7 @@
 #define LLVM_CLANG_TOOLING_SYNTAX_TREE_H
 
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Syntax/TokenManager.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/Support/Allocator.h"
@@ -51,7 +52,7 @@ enum class NodeRole : uint8_t;
 
 /// A node in a syntax tree. Each node is either a Leaf (representing tokens) or
 /// a Tree (representing language constructrs).
-class Node {
+class CLANG_ABI Node {
 protected:
   /// Newly created nodes are detached from a tree, parent and sibling links are
   /// set when the node is added as a child to another one.
@@ -129,7 +130,7 @@ class Node {
 
 /// A leaf node points to a single token.
 // FIXME: add TokenKind field (borrow some bits from the Node::kind).
-class Leaf final : public Node {
+class CLANG_ABI Leaf final : public Node {
 public:
   Leaf(TokenManager::Key K);
   static bool classof(const Node *N);
@@ -141,7 +142,7 @@ class Leaf final : public Node {
 };
 
 /// A node that has children and represents a syntactic language construct.
-class Tree : public Node {
+class CLANG_ABI Tree : public Node {
   /// Iterator over children (common base for const/non-const).
   /// Not invalidated by tree mutations (holds a stable node pointer).
   template <typename DerivedT, typename NodeT>
@@ -251,7 +252,7 @@ class Tree : public Node {
 ///
 /// This type models the following grammar construct:
 /// delimited-list(element, delimiter, termination, canBeEmpty)
-class List : public Tree {
+class CLANG_ABI List : public Tree {
 public:
   template <typename Element> struct ElementAndDelimiter {
     Element *element;
diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h
index 070706e8fa6d11..a3204f05bffb76 100644
--- a/clang/include/clang/Tooling/Tooling.h
+++ b/clang/include/clang/Tooling/Tooling.h
@@ -34,6 +34,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/PCHContainerOperations.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -69,7 +70,7 @@ class CompilationDatabase;
 /// files as its inputs.
 /// Returns nullptr if there are no such jobs or multiple of them. Note that
 /// offloading jobs are ignored.
-const llvm::opt::ArgStringList *
+CLANG_ABI const llvm::opt::ArgStringList *
 getCC1Arguments(DiagnosticsEngine *Diagnostics,
                 driver::Compilation *Compilation);
 
@@ -77,7 +78,7 @@ getCC1Arguments(DiagnosticsEngine *Diagnostics,
 ///
 /// If your tool is based on FrontendAction, you should be deriving from
 /// FrontendActionFactory instead.
-class ToolAction {
+class CLANG_ABI ToolAction {
 public:
   virtual ~ToolAction();
 
@@ -95,7 +96,7 @@ class ToolAction {
 /// created for each translation unit processed by ClangTool.  This class is
 /// also a ToolAction which uses the FrontendActions created by create() to
 /// process each translation unit.
-class FrontendActionFactory : public ToolAction {
+class CLANG_ABI FrontendActionFactory : public ToolAction {
 public:
   ~FrontendActionFactory() override;
 
@@ -161,7 +162,7 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
 ///                         clang modules.
 ///
 /// \return - True if 'ToolAction' was successfully executed.
-bool runToolOnCode(std::unique_ptr<FrontendAction> ToolAction, const Twine &Code,
+CLANG_ABI bool runToolOnCode(std::unique_ptr<FrontendAction> ToolAction, const Twine &Code,
                    const Twine &FileName = "input.cc",
                    std::shared_ptr<PCHContainerOperations> PCHContainerOps =
                        std::make_shared<PCHContainerOperations>());
@@ -183,7 +184,7 @@ using FileContentMappings = std::vector<std::pair<std::string, std::string>>;
 ///                          clang modules.
 ///
 /// \return - True if 'ToolAction' was successfully executed.
-bool runToolOnCodeWithArgs(
+CLANG_ABI bool runToolOnCodeWithArgs(
     std::unique_ptr<FrontendAction> ToolAction, const Twine &Code,
     const std::vector<std::string> &Args, const Twine &FileName = "input.cc",
     const Twine &ToolName = "clang-tool",
@@ -192,7 +193,7 @@ bool runToolOnCodeWithArgs(
     const FileContentMappings &VirtualMappedFiles = FileContentMappings());
 
 // Similar to the overload except this takes a VFS.
-bool runToolOnCodeWithArgs(
+CLANG_ABI bool runToolOnCodeWithArgs(
     std::unique_ptr<FrontendAction> ToolAction, const Twine &Code,
     llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
     const std::vector<std::string> &Args, const Twine &FileName = "input.cc",
@@ -208,7 +209,7 @@ bool runToolOnCodeWithArgs(
 /// clang modules.
 ///
 /// \return The resulting AST or null if an error occurred.
-std::unique_ptr<ASTUnit>
+CLANG_ABI std::unique_ptr<ASTUnit>
 buildASTFromCode(StringRef Code, StringRef FileName = "input.cc",
                  std::shared_ptr<PCHContainerOperations> PCHContainerOps =
                      std::make_shared<PCHContainerOperations>());
@@ -226,7 +227,7 @@ buildASTFromCode(StringRef Code, StringRef FileName = "input.cc",
 /// \param Adjuster A function to filter the command line arguments as specified.
 ///
 /// \return The resulting AST or null if an error occurred.
-std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
+CLANG_ABI std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
     StringRef Code, const std::vector<std::string> &Args,
     StringRef FileName = "input.cc", StringRef ToolName = "clang-tool",
     std::shared_ptr<PCHContainerOperations> PCHContainerOps =
@@ -236,7 +237,7 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
     DiagnosticConsumer *DiagConsumer = nullptr);
 
 /// Utility to run a FrontendAction in a single clang invocation.
-class ToolInvocation {
+class CLANG_ABI ToolInvocation {
 public:
   /// Create a tool invocation.
   ///
@@ -308,7 +309,7 @@ class ToolInvocation {
 /// command line arguments before the arguments are used to run
 /// a frontend action. One could install an additional command line
 /// arguments adjuster by calling the appendArgumentsAdjuster() method.
-class ClangTool {
+class CLANG_ABI ClangTool {
 public:
   /// Constructs a clang tool to run over a list of files.
   ///
@@ -474,10 +475,10 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
 /// does by removing "./" and computing native paths.
 ///
 /// \param File Either an absolute or relative path.
-std::string getAbsolutePath(StringRef File);
+CLANG_ABI std::string getAbsolutePath(StringRef File);
 
 /// An overload of getAbsolutePath that works over the provided \p FS.
-llvm::Expected<std::string> getAbsolutePath(llvm::vfs::FileSystem &FS,
+CLANG_ABI llvm::Expected<std::string> getAbsolutePath(llvm::vfs::FileSystem &FS,
                                             StringRef File);
 
 /// Changes CommandLine to contain implicit flags that would have been
@@ -500,17 +501,17 @@ llvm::Expected<std::string> getAbsolutePath(llvm::vfs::FileSystem &FS,
 /// \note This will not set \c CommandLine[0] to \c InvokedAs. The tooling
 /// infrastructure expects that CommandLine[0] is a tool path relative to which
 /// the builtin headers can be found.
-void addTargetAndModeForProgramName(std::vector<std::string> &CommandLine,
+CLANG_ABI void addTargetAndModeForProgramName(std::vector<std::string> &CommandLine,
                                     StringRef InvokedAs);
 
 /// Helper function that expands response files in command line.
-void addExpandedResponseFiles(std::vector<std::string> &CommandLine,
+CLANG_ABI void addExpandedResponseFiles(std::vector<std::string> &CommandLine,
                               llvm::StringRef WorkingDir,
                               llvm::cl::TokenizerCallback Tokenizer,
                               llvm::vfs::FileSystem &FS);
 
 /// Creates a \c CompilerInvocation.
-CompilerInvocation *newInvocation(DiagnosticsEngine *Diagnostics,
+CLANG_ABI CompilerInvocation *newInvocation(DiagnosticsEngine *Diagnostics,
                                   ArrayRef<const char *> CC1Args,
                                   const char *const BinaryName);
 
diff --git a/clang/include/clang/Tooling/Transformer/Parsing.h b/clang/include/clang/Tooling/Transformer/Parsing.h
index 177eca6a044d71..548b1c8f8721db 100644
--- a/clang/include/clang/Tooling/Transformer/Parsing.h
+++ b/clang/include/clang/Tooling/Transformer/Parsing.h
@@ -18,6 +18,7 @@
 
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Transformer/RangeSelector.h"
 #include "llvm/Support/Error.h"
 #include <functional>
@@ -32,7 +33,7 @@ namespace transformer {
 /// string. Additionally, the \c charRange combinator is not supported, because
 /// there is no representation of values of type \c CharSourceRange in this
 /// (little) language.
-llvm::Expected<RangeSelector> parseRangeSelector(llvm::StringRef Input);
+CLANG_ABI llvm::Expected<RangeSelector> parseRangeSelector(llvm::StringRef Input);
 
 } // namespace transformer
 } // namespace clang
diff --git a/clang/include/clang/Tooling/Transformer/RangeSelector.h b/clang/include/clang/Tooling/Transformer/RangeSelector.h
index 462a9da8f10ebb..945e1a00908a70 100644
--- a/clang/include/clang/Tooling/Transformer/RangeSelector.h
+++ b/clang/include/clang/Tooling/Transformer/RangeSelector.h
@@ -17,6 +17,7 @@
 
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Transformer/MatchConsumer.h"
 #include "llvm/Support/Error.h"
 #include <functional>
@@ -32,10 +33,10 @@ inline RangeSelector charRange(CharSourceRange R) {
 }
 
 /// Selects from the start of \p Begin and to the end of \p End.
-RangeSelector enclose(RangeSelector Begin, RangeSelector End);
+CLANG_ABI RangeSelector enclose(RangeSelector Begin, RangeSelector End);
 
 /// Convenience version of \c range where end-points are bound nodes.
-RangeSelector encloseNodes(std::string BeginID, std::string EndID);
+CLANG_ABI RangeSelector encloseNodes(std::string BeginID, std::string EndID);
 
 /// DEPRECATED. Use `enclose`.
 inline RangeSelector range(RangeSelector Begin, RangeSelector End) {
@@ -48,13 +49,13 @@ inline RangeSelector range(std::string BeginID, std::string EndID) {
 }
 
 /// Selects the (empty) range [B,B) when \p Selector selects the range [B,E).
-RangeSelector before(RangeSelector Selector);
+CLANG_ABI RangeSelector before(RangeSelector Selector);
 
 /// Selects the point immediately following \p Selector. That is, the
 /// (empty) range [E,E), when \p Selector selects either
 /// * the CharRange [B,E) or
 /// * the TokenRange [B,E'] where the token at E' spans the range [E',E).
-RangeSelector after(RangeSelector Selector);
+CLANG_ABI RangeSelector after(RangeSelector Selector);
 
 /// Selects the range between `R1` and `R2.
 inline RangeSelector between(RangeSelector R1, RangeSelector R2) {
@@ -63,15 +64,15 @@ inline RangeSelector between(RangeSelector R1, RangeSelector R2) {
 
 /// Selects a node, including trailing semicolon, if any (for declarations and
 /// non-expression statements). \p ID is the node's binding in the match result.
-RangeSelector node(std::string ID);
+CLANG_ABI RangeSelector node(std::string ID);
 
 /// Selects a node, including trailing semicolon (always). Useful for selecting
 /// expression statements. \p ID is the node's binding in the match result.
-RangeSelector statement(std::string ID);
+CLANG_ABI RangeSelector statement(std::string ID);
 
 /// Given a \c MemberExpr, selects the member token. \p ID is the node's
 /// binding in the match result.
-RangeSelector member(std::string ID);
+CLANG_ABI RangeSelector member(std::string ID);
 
 /// Given a node with a "name", (like \c NamedDecl, \c DeclRefExpr, \c
 /// CxxCtorInitializer, and \c TypeLoc) selects the name's token.  Only selects
@@ -80,33 +81,33 @@ RangeSelector member(std::string ID);
 /// it selects only `baz`.
 ///
 /// \param ID is the node's binding in the match result.
-RangeSelector name(std::string ID);
+CLANG_ABI RangeSelector name(std::string ID);
 
 // Given a \c CallExpr (bound to \p ID), selects the arguments' source text (all
 // source between the call's parentheses).
-RangeSelector callArgs(std::string ID);
+CLANG_ABI RangeSelector callArgs(std::string ID);
 
 // Given a \c CXXConstructExpr (bound to \p ID), selects the
 // arguments' source text. Depending on the syntactic form of the construct,
 // this is the range between parentheses or braces.
-RangeSelector constructExprArgs(std::string ID);
+CLANG_ABI RangeSelector constructExprArgs(std::string ID);
 
 // Given a \c CompoundStmt (bound to \p ID), selects the source of the
 // statements (all source between the braces).
-RangeSelector statements(std::string ID);
+CLANG_ABI RangeSelector statements(std::string ID);
 
 // Given a \c InitListExpr (bound to \p ID), selects the range of the elements
 // (all source between the braces).
-RangeSelector initListElements(std::string ID);
+CLANG_ABI RangeSelector initListElements(std::string ID);
 
 /// Given an \IfStmt (bound to \p ID), selects the range of the else branch,
 /// starting from the \c else keyword.
-RangeSelector elseBranch(std::string ID);
+CLANG_ABI RangeSelector elseBranch(std::string ID);
 
 /// Selects the range from which `S` was expanded (possibly along with other
 /// source), if `S` is an expansion, and `S` itself, otherwise.  Corresponds to
 /// `SourceManager::getExpansionRange`.
-RangeSelector expansion(RangeSelector S);
+CLANG_ABI RangeSelector expansion(RangeSelector S);
 } // namespace transformer
 } // namespace clang
 
diff --git a/clang/include/clang/Tooling/Transformer/RewriteRule.h b/clang/include/clang/Tooling/Transformer/RewriteRule.h
index 50f460d65e7ddb..f060099c8b0c37 100644
--- a/clang/include/clang/Tooling/Transformer/RewriteRule.h
+++ b/clang/include/clang/Tooling/Transformer/RewriteRule.h
@@ -18,6 +18,7 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/ASTMatchers/ASTMatchersInternal.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/AtomicChange.h"
 #include "clang/Tooling/Transformer/MatchConsumer.h"
 #include "clang/Tooling/Transformer/RangeSelector.h"
@@ -118,7 +119,7 @@ struct ASTEdit {
 };
 
 /// Generates a single (specified) edit.
-EditGenerator edit(ASTEdit E);
+CLANG_ABI EditGenerator edit(ASTEdit E);
 
 /// Lifts a list of `ASTEdit`s into an `EditGenerator`.
 ///
@@ -129,7 +130,7 @@ EditGenerator edit(ASTEdit E);
 /// fail in the case of conflicting edits -- conflict handling is left to
 /// clients.  We recommend use of the \c AtomicChange or \c Replacements classes
 /// for assistance in detecting such conflicts.
-EditGenerator editList(llvm::SmallVector<ASTEdit, 1> Edits);
+CLANG_ABI EditGenerator editList(llvm::SmallVector<ASTEdit, 1> Edits);
 
 /// Generates no edits.
 inline EditGenerator noEdits() { return editList({}); }
@@ -137,11 +138,11 @@ inline EditGenerator noEdits() { return editList({}); }
 /// Generates a single, no-op edit anchored at the start location of the
 /// specified range. A `noopEdit` may be preferred over `noEdits` to associate a
 /// diagnostic `Explanation` with the rule.
-EditGenerator noopEdit(RangeSelector Anchor);
+CLANG_ABI EditGenerator noopEdit(RangeSelector Anchor);
 
 /// Generates a single, no-op edit with the associated note anchored at the
 /// start location of the specified range.
-ASTEdit note(RangeSelector Anchor, TextGenerator Note);
+CLANG_ABI ASTEdit note(RangeSelector Anchor, TextGenerator Note);
 
 /// Version of `ifBound` specialized to `ASTEdit`.
 inline EditGenerator ifBound(std::string ID, ASTEdit TrueEdit,
@@ -158,7 +159,7 @@ inline EditGenerator ifBound(std::string ID, ASTEdit TrueEdit) {
 
 /// Flattens a list of generators into a single generator whose elements are the
 /// concatenation of the results of the argument generators.
-EditGenerator flattenVector(SmallVector<EditGenerator, 2> Generators);
+CLANG_ABI EditGenerator flattenVector(SmallVector<EditGenerator, 2> Generators);
 
 namespace detail {
 /// Helper function to construct an \c EditGenerator. Overloaded for common
@@ -176,10 +177,10 @@ template <typename... Ts> EditGenerator flatten(Ts &&...Edits) {
 // Every rewrite rule is triggered by a match against some AST node.
 // Transformer guarantees that this ID is bound to the triggering node whenever
 // a rewrite rule is applied.
-extern const char RootID[];
+CLANG_ABI extern const char RootID[];
 
 /// Replaces a portion of the source text with \p Replacement.
-ASTEdit changeTo(RangeSelector Target, TextGenerator Replacement);
+CLANG_ABI ASTEdit changeTo(RangeSelector Target, TextGenerator Replacement);
 /// DEPRECATED: use \c changeTo.
 inline ASTEdit change(RangeSelector Target, TextGenerator Replacement) {
   return changeTo(std::move(Target), std::move(Replacement));
@@ -212,11 +213,11 @@ inline ASTEdit insertAfter(RangeSelector S, TextGenerator Replacement) {
 }
 
 /// Removes the source selected by \p S.
-ASTEdit remove(RangeSelector S);
+CLANG_ABI ASTEdit remove(RangeSelector S);
 
 /// Adds an include directive for the given header to the file of `Target`. The
 /// particular location specified by `Target` is ignored.
-ASTEdit addInclude(RangeSelector Target, StringRef Header,
+CLANG_ABI ASTEdit addInclude(RangeSelector Target, StringRef Header,
                    IncludeFormat Format = IncludeFormat::Quoted);
 
 /// Adds an include directive for the given header to the file associated with
@@ -302,7 +303,7 @@ using RewriteRule = RewriteRuleWith<void>;
 
 namespace detail {
 
-RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
+CLANG_ABI RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
                      EditGenerator Edits);
 
 template <typename MetadataT>
@@ -316,8 +317,8 @@ RewriteRuleWith<MetadataT> makeRule(ast_matchers::internal::DynTypedMatcher M,
 }
 
 inline EditGenerator makeEditGenerator(EditGenerator Edits) { return Edits; }
-EditGenerator makeEditGenerator(llvm::SmallVector<ASTEdit, 1> Edits);
-EditGenerator makeEditGenerator(ASTEdit Edit);
+CLANG_ABI EditGenerator makeEditGenerator(llvm::SmallVector<ASTEdit, 1> Edits);
+CLANG_ABI EditGenerator makeEditGenerator(ASTEdit Edit);
 
 } // namespace detail
 
@@ -331,7 +332,7 @@ RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
       std::move(M), detail::makeEditGenerator(std::forward<EditsT>(Edits)));
 }
 
-RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
+CLANG_ABI RewriteRule makeRule(ast_matchers::internal::DynTypedMatcher M,
                      std::initializer_list<ASTEdit> Edits);
 /// @}
 
@@ -366,7 +367,7 @@ RewriteRuleWith<MetadataT> makeRule(ast_matchers::internal::DynTypedMatcher M,
 ///   addInclude(R, "path/to/bar_header.h");
 ///   addInclude(R, "vector", IncludeFormat::Angled);
 /// \endcode
-void addInclude(RewriteRuleBase &Rule, llvm::StringRef Header,
+CLANG_ABI void addInclude(RewriteRuleBase &Rule, llvm::StringRef Header,
                 IncludeFormat Format = IncludeFormat::Quoted);
 
 /// Applies the first rule whose pattern matches; other rules are ignored.  If
@@ -423,7 +424,7 @@ applyFirst(ArrayRef<RewriteRuleWith<MetadataT>> Rules) {
 }
 
 template <>
-RewriteRuleWith<void> applyFirst(ArrayRef<RewriteRuleWith<void>> Rules);
+CLANG_ABI RewriteRuleWith<void> applyFirst(ArrayRef<RewriteRuleWith<void>> Rules);
 
 template <typename MetadataT>
 RewriteRuleWith<MetadataT>
@@ -463,7 +464,7 @@ stripMetadata(RewriteRuleWith<MetadataT> Rule) {
 /// ```
 /// Here, we find the function `f`, change its name to `newName` and change all
 /// appearances of `x` in its body to `3`.
-EditGenerator rewriteDescendants(std::string NodeId, RewriteRule Rule);
+CLANG_ABI EditGenerator rewriteDescendants(std::string NodeId, RewriteRule Rule);
 
 /// The following three functions are a low-level part of the RewriteRule
 /// API. We expose them for use in implementing the fixtures that interpret
@@ -489,19 +490,19 @@ namespace detail {
 /// auto Edits = rewriteDescendants(*Node, InlineX, Results);
 /// ```
 /// @{
-llvm::Expected<SmallVector<Edit, 1>>
+CLANG_ABI llvm::Expected<SmallVector<Edit, 1>>
 rewriteDescendants(const Decl &Node, RewriteRule Rule,
                    const ast_matchers::MatchFinder::MatchResult &Result);
 
-llvm::Expected<SmallVector<Edit, 1>>
+CLANG_ABI llvm::Expected<SmallVector<Edit, 1>>
 rewriteDescendants(const Stmt &Node, RewriteRule Rule,
                    const ast_matchers::MatchFinder::MatchResult &Result);
 
-llvm::Expected<SmallVector<Edit, 1>>
+CLANG_ABI llvm::Expected<SmallVector<Edit, 1>>
 rewriteDescendants(const TypeLoc &Node, RewriteRule Rule,
                    const ast_matchers::MatchFinder::MatchResult &Result);
 
-llvm::Expected<SmallVector<Edit, 1>>
+CLANG_ABI llvm::Expected<SmallVector<Edit, 1>>
 rewriteDescendants(const DynTypedNode &Node, RewriteRule Rule,
                    const ast_matchers::MatchFinder::MatchResult &Result);
 /// @}
@@ -510,7 +511,7 @@ rewriteDescendants(const DynTypedNode &Node, RewriteRule Rule,
 /// Only supports Rules whose cases' matchers share the same base "kind"
 /// (`Stmt`, `Decl`, etc.)  Deprecated: use `buildMatchers` instead, which
 /// supports mixing matchers of different kinds.
-ast_matchers::internal::DynTypedMatcher
+CLANG_ABI ast_matchers::internal::DynTypedMatcher
 buildMatcher(const RewriteRuleBase &Rule);
 
 /// Builds a set of matchers that cover the rule.
@@ -520,18 +521,18 @@ buildMatcher(const RewriteRuleBase &Rule);
 /// nodes carry no source location information and are therefore not relevant
 /// for rewriting. If any such matchers are included, will return an empty
 /// vector.
-std::vector<ast_matchers::internal::DynTypedMatcher>
+CLANG_ABI std::vector<ast_matchers::internal::DynTypedMatcher>
 buildMatchers(const RewriteRuleBase &Rule);
 
 /// Gets the beginning location of the source matched by a rewrite rule. If the
 /// match occurs within a macro expansion, returns the beginning of the
 /// expansion point. `Result` must come from the matching of a rewrite rule.
-SourceLocation
+CLANG_ABI SourceLocation
 getRuleMatchLoc(const ast_matchers::MatchFinder::MatchResult &Result);
 
 /// Returns the index of the \c Case of \c Rule that was selected in the match
 /// result. Assumes a matcher built with \c buildMatcher.
-size_t findSelectedCase(const ast_matchers::MatchFinder::MatchResult &Result,
+CLANG_ABI size_t findSelectedCase(const ast_matchers::MatchFinder::MatchResult &Result,
                         const RewriteRuleBase &Rule);
 } // namespace detail
 } // namespace transformer
diff --git a/clang/include/clang/Tooling/Transformer/SourceCode.h b/clang/include/clang/Tooling/Transformer/SourceCode.h
index 004c614b0b9d93..04bfff1bb4b39c 100644
--- a/clang/include/clang/Tooling/Transformer/SourceCode.h
+++ b/clang/include/clang/Tooling/Transformer/SourceCode.h
@@ -16,6 +16,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/TokenKinds.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
@@ -23,7 +24,7 @@ namespace tooling {
 
 /// Extends \p Range to include the token \p Terminator, if it immediately
 /// follows the end of the range. Otherwise, returns \p Range unchanged.
-CharSourceRange maybeExtendRange(CharSourceRange Range,
+CLANG_ABI CharSourceRange maybeExtendRange(CharSourceRange Range,
                                  tok::TokenKind Terminator,
                                  ASTContext &Context);
 
@@ -46,10 +47,10 @@ CharSourceRange getExtendedRange(const T &Node, tok::TokenKind Next,
 /// Note that parsing comments is disabled by default. In order to select a
 /// range containing associated comments, you may need to invoke the tool with
 /// `-fparse-all-comments`.
-CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context);
+CLANG_ABI CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context);
 
 /// Returns the source-code text in the specified range.
-StringRef getText(CharSourceRange Range, const ASTContext &Context);
+CLANG_ABI StringRef getText(CharSourceRange Range, const ASTContext &Context);
 
 /// Returns the source-code text corresponding to \p Node.
 template <typename T>
@@ -88,13 +89,13 @@ StringRef getExtendedText(const T &Node, tok::TokenKind Next,
 
 /// Determines whether \p Range is one that can be edited by a rewrite;
 /// generally, one that starts and ends within a particular file.
-llvm::Error validateEditRange(const CharSourceRange &Range,
+CLANG_ABI llvm::Error validateEditRange(const CharSourceRange &Range,
                               const SourceManager &SM);
 
 /// Determines whether \p Range is one that can be read from. If
 /// `AllowSystemHeaders` is false, a range that falls within a system header
 /// fails validation.
-llvm::Error validateRange(const CharSourceRange &Range, const SourceManager &SM,
+CLANG_ABI llvm::Error validateRange(const CharSourceRange &Range, const SourceManager &SM,
                           bool AllowSystemHeaders);
 
 /// Attempts to resolve the given range to one that can be edited by a rewrite;
@@ -109,7 +110,7 @@ llvm::Error validateRange(const CharSourceRange &Range, const SourceManager &SM,
 ///    foo(DO_NOTHING(3))
 /// will be rewritten to
 ///    foo(6)
-std::optional<CharSourceRange>
+CLANG_ABI std::optional<CharSourceRange>
 getFileRangeForEdit(const CharSourceRange &EditRange, const SourceManager &SM,
                     const LangOptions &LangOpts,
                     bool IncludeMacroExpansion = true);
@@ -129,7 +130,7 @@ getFileRangeForEdit(const CharSourceRange &EditRange, const ASTContext &Context,
 ///    #define DO_NOTHING(x) x
 ///    foo(DO_NOTHING(3))
 /// the returned range will hold the source text `DO_NOTHING(3)`.
-std::optional<CharSourceRange> getFileRange(const CharSourceRange &EditRange,
+CLANG_ABI std::optional<CharSourceRange> getFileRange(const CharSourceRange &EditRange,
                                             const SourceManager &SM,
                                             const LangOptions &LangOpts,
                                             bool IncludeMacroExpansion);
diff --git a/clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h b/clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
index 22fc644dfac5c0..3c99fbf58ded8b 100644
--- a/clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
+++ b/clang/include/clang/Tooling/Transformer/SourceCodeBuilders.h
@@ -16,6 +16,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
+#include "clang/Support/Compiler.h"
 #include <string>
 
 namespace clang {
@@ -25,12 +26,12 @@ namespace tooling {
 /// @{
 /// Ignores implicit object-construction expressions in addition to the normal
 /// implicit expressions that are ignored.
-const Expr *reallyIgnoreImplicit(const Expr &E);
+CLANG_ABI const Expr *reallyIgnoreImplicit(const Expr &E);
 
 /// Determines whether printing this expression in *any* expression requires
 /// parentheses to preserve its meaning. This analyses is necessarily
 /// conservative because it lacks information about the target context.
-bool mayEverNeedParens(const Expr &E);
+CLANG_ABI bool mayEverNeedParens(const Expr &E);
 
 /// Determines whether printing this expression to the left of a dot or arrow
 /// operator requires a parentheses to preserve its meaning. Given that
@@ -42,7 +43,7 @@ inline bool needParensBeforeDotOrArrow(const Expr &E) {
 
 /// Determines whether printing this expression to the right of a unary operator
 /// requires a parentheses to preserve its meaning.
-bool needParensAfterUnaryOperator(const Expr &E);
+CLANG_ABI bool needParensAfterUnaryOperator(const Expr &E);
 
 // Recognizes known types (and sugared versions thereof) that overload the `*`
 // and `->` operator. Below is the list of currently included types, but it is
@@ -51,7 +52,7 @@ bool needParensAfterUnaryOperator(const Expr &E);
 // * std::unique_ptr, std::shared_ptr, std::weak_ptr,
 // * std::optional, absl::optional, llvm::Optional,
 // * absl::StatusOr, llvm::Expected.
-bool isKnownPointerLikeType(QualType Ty, ASTContext &Context);
+CLANG_ABI bool isKnownPointerLikeType(QualType Ty, ASTContext &Context);
 /// @}
 
 /// \name Basic code-string generation utilities.
@@ -59,17 +60,17 @@ bool isKnownPointerLikeType(QualType Ty, ASTContext &Context);
 
 /// Builds source for an expression, adding parens if needed for unambiguous
 /// parsing.
-std::optional<std::string> buildParens(const Expr &E,
+CLANG_ABI std::optional<std::string> buildParens(const Expr &E,
                                        const ASTContext &Context);
 
 /// Builds idiomatic source for the dereferencing of `E`: prefix with `*` but
 /// simplify when it already begins with `&`.  \returns empty string on failure.
-std::optional<std::string> buildDereference(const Expr &E,
+CLANG_ABI std::optional<std::string> buildDereference(const Expr &E,
                                             const ASTContext &Context);
 
 /// Builds idiomatic source for taking the address of `E`: prefix with `&` but
 /// simplify when it already begins with `*`.  \returns empty string on failure.
-std::optional<std::string> buildAddressOf(const Expr &E,
+CLANG_ABI std::optional<std::string> buildAddressOf(const Expr &E,
                                           const ASTContext &Context);
 
 /// Adds a dot to the end of the given expression, but adds parentheses when
@@ -80,7 +81,7 @@ std::optional<std::string> buildAddressOf(const Expr &E,
 ///  `a+b` becomes `(a+b).`
 ///
 /// DEPRECATED. Use `buildAccess`.
-std::optional<std::string> buildDot(const Expr &E, const ASTContext &Context);
+CLANG_ABI std::optional<std::string> buildDot(const Expr &E, const ASTContext &Context);
 
 /// Adds an arrow to the end of the given expression, but adds parentheses
 /// when needed by the syntax, and simplifies to `.` when possible, e.g.:
@@ -90,7 +91,7 @@ std::optional<std::string> buildDot(const Expr &E, const ASTContext &Context);
 ///  `a+b` becomes `(a+b)->`
 ///
 /// DEPRECATED. Use `buildAccess`.
-std::optional<std::string> buildArrow(const Expr &E, const ASTContext &Context);
+CLANG_ABI std::optional<std::string> buildArrow(const Expr &E, const ASTContext &Context);
 
 /// Specifies how to classify pointer-like types -- like values or like pointers
 /// -- with regard to generating member-access syntax.
@@ -110,7 +111,7 @@ enum class PLTClass : bool {
 ///  `a+b` becomes `(a+b)->` or `(a+b).`, depending on `E`'s type
 ///  `&a` becomes `a.`
 ///  `*a` becomes `a->`
-std::optional<std::string>
+CLANG_ABI std::optional<std::string>
 buildAccess(const Expr &E, ASTContext &Context,
             PLTClass Classification = PLTClass::Pointer);
 /// @}
diff --git a/clang/include/clang/Tooling/Transformer/Stencil.h b/clang/include/clang/Tooling/Transformer/Stencil.h
index 249f95b7391dfe..ea64870c0cb09b 100644
--- a/clang/include/clang/Tooling/Transformer/Stencil.h
+++ b/clang/include/clang/Tooling/Transformer/Stencil.h
@@ -23,6 +23,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Transformer/MatchConsumer.h"
 #include "clang/Tooling/Transformer/RangeSelector.h"
 #include "llvm/ADT/StringRef.h"
@@ -50,14 +51,14 @@ namespace detail {
 /// so that user doesn't need to specify which factory function to use. This
 /// pattern gives benefits similar to implicit constructors, while maintaing a
 /// higher degree of explicitness.
-Stencil makeStencil(llvm::StringRef Text);
-Stencil makeStencil(RangeSelector Selector);
+CLANG_ABI Stencil makeStencil(llvm::StringRef Text);
+CLANG_ABI Stencil makeStencil(RangeSelector Selector);
 inline Stencil makeStencil(Stencil S) { return S; }
 } // namespace detail
 
 /// Constructs the string representing the concatenation of the given \p
 /// Parts. If only one element is passed in \p Parts, returns that element.
-Stencil catVector(std::vector<Stencil> Parts);
+CLANG_ABI Stencil catVector(std::vector<Stencil> Parts);
 
 /// Concatenates 0+ stencil pieces into a single stencil. Arguments can be raw
 /// text, ranges in the matched code (\p RangeSelector) or other `Stencil`s.
@@ -73,41 +74,41 @@ template <typename... Ts> Stencil cat(Ts &&... Parts) {
 /// parentheses if it may parse differently depending on context. For example, a
 /// binary operation is always wrapped, while a variable reference is never
 /// wrapped.
-Stencil expression(llvm::StringRef Id);
+CLANG_ABI Stencil expression(llvm::StringRef Id);
 
 /// Constructs an idiomatic dereferencing of the expression bound to \p ExprId.
 /// \p ExprId is wrapped in parentheses, if needed.
-Stencil deref(llvm::StringRef ExprId);
+CLANG_ABI Stencil deref(llvm::StringRef ExprId);
 
 /// If \p ExprId is of pointer type, constructs an idiomatic dereferencing of
 /// the expression bound to \p ExprId, including wrapping it in parentheses, if
 /// needed. Otherwise, generates the original expression source.
-Stencil maybeDeref(llvm::StringRef ExprId);
+CLANG_ABI Stencil maybeDeref(llvm::StringRef ExprId);
 
 /// Constructs an expression that idiomatically takes the address of the
 /// expression bound to \p ExprId. \p ExprId is wrapped in parentheses, if
 /// needed.
-Stencil addressOf(llvm::StringRef ExprId);
+CLANG_ABI Stencil addressOf(llvm::StringRef ExprId);
 
 /// If \p ExprId is not a pointer type, constructs an expression that
 /// idiomatically takes the address of the expression bound to \p ExprId,
 /// including wrapping \p ExprId in parentheses, if needed. Otherwise, generates
 /// the original expression source.
-Stencil maybeAddressOf(llvm::StringRef ExprId);
+CLANG_ABI Stencil maybeAddressOf(llvm::StringRef ExprId);
 
 /// Constructs a `MemberExpr` that accesses the named member (\p Member) of the
 /// object bound to \p BaseId. The access is constructed idiomatically: if \p
 /// BaseId is bound to `e` and \p Member identifies member `m`, then returns
 /// `e->m`, when e is a pointer, `e2->m` when e = `*e2` and `e.m` otherwise.
 /// Additionally, `e` is wrapped in parentheses, if needed.
-Stencil access(llvm::StringRef BaseId, Stencil Member);
+CLANG_ABI Stencil access(llvm::StringRef BaseId, Stencil Member);
 inline Stencil access(llvm::StringRef BaseId, llvm::StringRef Member) {
   return access(BaseId, detail::makeStencil(Member));
 }
 
 /// Chooses between the two stencil parts, based on whether \p ID is bound in
 /// the match.
-Stencil ifBound(llvm::StringRef Id, Stencil TrueStencil, Stencil FalseStencil);
+CLANG_ABI Stencil ifBound(llvm::StringRef Id, Stencil TrueStencil, Stencil FalseStencil);
 
 /// Chooses between the two strings, based on whether \p ID is bound in the
 /// match.
@@ -146,12 +147,12 @@ inline Stencil ifBound(llvm::StringRef Id, llvm::StringRef TrueText,
 ///          ...
 ///          {"bool", cat("false")}},
 ///         cat("{}"))
-Stencil selectBound(std::vector<std::pair<std::string, Stencil>> CaseStencils,
+CLANG_ABI Stencil selectBound(std::vector<std::pair<std::string, Stencil>> CaseStencils,
                     Stencil DefaultStencil = nullptr);
 
 /// Wraps a \c MatchConsumer in a \c Stencil, so that it can be used in a \c
 /// Stencil.  This supports user-defined extensions to the \c Stencil language.
-Stencil run(MatchConsumer<std::string> C);
+CLANG_ABI Stencil run(MatchConsumer<std::string> C);
 
 /// Produces a human-readable rendering of the node bound to `Id`, suitable for
 /// diagnostics and debugging. This operator can be applied to any node, but is
@@ -160,12 +161,12 @@ Stencil run(MatchConsumer<std::string> C);
 /// * Types. represented based on their structure. Note that namespace
 ///   qualifiers are always printed, with the anonymous namespace represented
 ///   explicitly. No desugaring or canonicalization is applied.
-Stencil describe(llvm::StringRef Id);
+CLANG_ABI Stencil describe(llvm::StringRef Id);
 
 /// For debug use only; semantics are not guaranteed.
 ///
 /// \returns the string resulting from calling the node's print() method.
-Stencil dPrint(llvm::StringRef Id);
+CLANG_ABI Stencil dPrint(llvm::StringRef Id);
 } // namespace transformer
 } // namespace clang
 #endif // LLVM_CLANG_TOOLING_TRANSFORMER_STENCIL_H_
diff --git a/clang/include/clang/Tooling/Transformer/Transformer.h b/clang/include/clang/Tooling/Transformer/Transformer.h
index 71b1fe81b9518a..b0555fec970243 100644
--- a/clang/include/clang/Tooling/Transformer/Transformer.h
+++ b/clang/include/clang/Tooling/Transformer/Transformer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLING_TRANSFORMER_TRANSFORMER_H_
 
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Refactoring/AtomicChange.h"
 #include "clang/Tooling/Transformer/RewriteRule.h"
 #include "llvm/Support/Error.h"
@@ -22,7 +23,7 @@ namespace tooling {
 namespace detail {
 /// Implementation details of \c Transformer with type erasure around
 /// \c RewriteRule<T> as well as the corresponding consumers.
-class TransformerImpl {
+class CLANG_ABI TransformerImpl {
 public:
   virtual ~TransformerImpl() = default;
 
@@ -60,7 +61,7 @@ template <> struct TransformerResult<void> {
 
 /// Handles the matcher and callback registration for a single `RewriteRule`, as
 /// defined by the arguments of the constructor.
-class Transformer : public ast_matchers::MatchFinder::MatchCallback {
+class CLANG_ABI Transformer : public ast_matchers::MatchFinder::MatchCallback {
 public:
   /// Provides the set of changes to the consumer.  The callback is free to move
   /// or destructively consume the changes as needed.

>From 015c2619844bd18561d1ebd83a539c47f0640cb1 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 14 Oct 2024 18:45:29 +0100
Subject: [PATCH 3/5] Auto generated visibility macros for clang internal
 headers

---
 clang/lib/AST/ByteCode/FunctionPointer.h   |  3 ++-
 clang/lib/AST/ByteCode/MemberPointer.h     |  3 ++-
 clang/lib/AST/ByteCode/Pointer.h           |  5 +++--
 clang/lib/AST/ByteCode/Program.h           |  3 ++-
 clang/lib/Format/FormatToken.h             | 11 ++++++-----
 clang/lib/Format/FormatTokenLexer.h        |  3 ++-
 clang/lib/Format/Macros.h                  |  7 ++++---
 clang/lib/Format/MatchFilePath.h           |  3 ++-
 clang/lib/Format/QualifierAlignmentFixer.h | 13 +++++++------
 clang/lib/Format/TokenAnnotator.h          |  3 ++-
 clang/lib/Format/UnwrappedLineParser.h     |  7 ++++---
 11 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/clang/lib/AST/ByteCode/FunctionPointer.h b/clang/lib/AST/ByteCode/FunctionPointer.h
index e2b45b2344fdce..b1c2995016f5bf 100644
--- a/clang/lib/AST/ByteCode/FunctionPointer.h
+++ b/clang/lib/AST/ByteCode/FunctionPointer.h
@@ -11,13 +11,14 @@
 
 #include "Function.h"
 #include "Primitives.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 class ASTContext;
 class APValue;
 namespace interp {
 
-class FunctionPointer final {
+class CLANG_ABI FunctionPointer final {
 private:
   const Function *Func;
   uint64_t Offset;
diff --git a/clang/lib/AST/ByteCode/MemberPointer.h b/clang/lib/AST/ByteCode/MemberPointer.h
index b17ce256e75e29..bbac43bdd36138 100644
--- a/clang/lib/AST/ByteCode/MemberPointer.h
+++ b/clang/lib/AST/ByteCode/MemberPointer.h
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_AST_INTERP_MEMBER_POINTER_H
 
 #include "Pointer.h"
+#include "clang/Support/Compiler.h"
 #include <optional>
 
 namespace clang {
@@ -19,7 +20,7 @@ namespace interp {
 class Context;
 class FunctionPointer;
 
-class MemberPointer final {
+class CLANG_ABI MemberPointer final {
 private:
   Pointer Base;
   const ValueDecl *Dcl = nullptr;
diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h
index 72e255dba13f6b..69fbc935aaa102 100644
--- a/clang/lib/AST/ByteCode/Pointer.h
+++ b/clang/lib/AST/ByteCode/Pointer.h
@@ -20,6 +20,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
@@ -41,7 +42,7 @@ struct BlockPointer {
   unsigned Base;
 };
 
-struct IntPointer {
+struct CLANG_ABI IntPointer {
   const Descriptor *Desc;
   uint64_t Value;
 
@@ -80,7 +81,7 @@ enum class Storage { Block, Int, Fn };
 ///                      │
 ///                      │
 ///                     Base
-class Pointer {
+class CLANG_ABI Pointer {
 private:
   static constexpr unsigned PastEndMark = ~0u;
   static constexpr unsigned RootPtrMark = ~0u;
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h
index f676672fb7ced5..1e47881fe76ce0 100644
--- a/clang/lib/AST/ByteCode/Program.h
+++ b/clang/lib/AST/ByteCode/Program.h
@@ -18,6 +18,7 @@
 #include "PrimType.h"
 #include "Record.h"
 #include "Source.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
@@ -36,7 +37,7 @@ namespace interp {
 class Context;
 
 /// The program contains and links the bytecode for all functions.
-class Program final {
+class CLANG_ABI Program final {
 public:
   Program(Context &Ctx) : Ctx(Ctx) {}
 
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
index 7d342a7dcca01d..8076bf05639fa4 100644
--- a/clang/lib/Format/FormatToken.h
+++ b/clang/lib/Format/FormatToken.h
@@ -19,6 +19,7 @@
 #include "clang/Basic/OperatorPrecedence.h"
 #include "clang/Format/Format.h"
 #include "clang/Lex/Lexer.h"
+#include "clang/Support/Compiler.h"
 #include <unordered_set>
 
 namespace clang {
@@ -220,7 +221,7 @@ enum TokenType : uint8_t {
 };
 
 /// Determines the name of a token type.
-const char *getTokenTypeName(TokenType Type);
+CLANG_ABI const char *getTokenTypeName(TokenType Type);
 
 // Represents what type of block a set of braces open.
 enum BraceBlockKind { BK_Unknown, BK_Block, BK_BracedInit };
@@ -297,7 +298,7 @@ class AnnotatedLine;
 
 /// A wrapper around a \c Token storing information about the
 /// whitespace characters preceding it.
-struct FormatToken {
+struct CLANG_ABI FormatToken {
   FormatToken()
       : HasUnescapedNewline(false), IsMultiline(false), IsFirst(false),
         MustBreakBefore(false), MustBreakBeforeFinalized(false),
@@ -931,7 +932,7 @@ struct FormatToken {
 class ContinuationIndenter;
 struct LineState;
 
-class TokenRole {
+class CLANG_ABI TokenRole {
 public:
   TokenRole(const FormatStyle &Style) : Style(Style) {}
   virtual ~TokenRole();
@@ -969,7 +970,7 @@ class TokenRole {
   const FormatStyle &Style;
 };
 
-class CommaSeparatedList : public TokenRole {
+class CLANG_ABI CommaSeparatedList : public TokenRole {
 public:
   CommaSeparatedList(const FormatStyle &Style)
       : TokenRole(Style), HasNestedBracedList(false) {}
@@ -1981,7 +1982,7 @@ inline bool continuesLineComment(const FormatToken &FormatTok,
 }
 
 // Returns \c true if \c Current starts a new parameter.
-bool startsNextParameter(const FormatToken &Current, const FormatStyle &Style);
+CLANG_ABI bool startsNextParameter(const FormatToken &Current, const FormatStyle &Style);
 
 } // namespace format
 } // namespace clang
diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h
index 71389d2ade2b73..accc8a6c935ea1 100644
--- a/clang/lib/Format/FormatTokenLexer.h
+++ b/clang/lib/Format/FormatTokenLexer.h
@@ -17,6 +17,7 @@
 
 #include "Encoding.h"
 #include "FormatToken.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/StringSet.h"
@@ -32,7 +33,7 @@ enum LexerState {
   TOKEN_STASHED,
 };
 
-class FormatTokenLexer {
+class CLANG_ABI FormatTokenLexer {
 public:
   FormatTokenLexer(const SourceManager &SourceMgr, FileID ID, unsigned Column,
                    const FormatStyle &Style, encoding::Encoding Encoding,
diff --git a/clang/lib/Format/Macros.h b/clang/lib/Format/Macros.h
index e05f734b0db8a8..b11bed0cefac44 100644
--- a/clang/lib/Format/Macros.h
+++ b/clang/lib/Format/Macros.h
@@ -41,6 +41,7 @@
 #include <list>
 
 #include "FormatToken.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseMap.h"
 
 namespace clang {
@@ -77,7 +78,7 @@ struct UnwrappedLineNode;
 /// Call      : A(id)
 /// Expansion : id+x
 ///
-class MacroExpander {
+class CLANG_ABI MacroExpander {
 public:
   using ArgsList = ArrayRef<SmallVector<FormatToken *, 8>>;
 
@@ -170,7 +171,7 @@ class MacroExpander {
 /// -> public:
 /// ->   void x();
 /// -> })
-class MacroCallReconstructor {
+class CLANG_ABI MacroCallReconstructor {
 public:
   /// Create an Reconstructor whose resulting \p UnwrappedLine will start at
   /// \p Level, using the map from name identifier token to the corresponding
@@ -327,7 +328,7 @@ class MacroCallReconstructor {
   // Stack of macro calls for which we're in the middle of an expansion.
   SmallVector<Expansion> ActiveExpansions;
 
-  struct MacroCallState {
+  struct CLANG_ABI MacroCallState {
     MacroCallState(ReconstructedLine *Line, FormatToken *ParentLastToken,
                    FormatToken *MacroCallLParen);
 
diff --git a/clang/lib/Format/MatchFilePath.h b/clang/lib/Format/MatchFilePath.h
index 482dab7c748e51..b8cf5fa12eb6e9 100644
--- a/clang/lib/Format/MatchFilePath.h
+++ b/clang/lib/Format/MatchFilePath.h
@@ -9,12 +9,13 @@
 #ifndef LLVM_CLANG_LIB_FORMAT_MATCHFILEPATH_H
 #define LLVM_CLANG_LIB_FORMAT_MATCHFILEPATH_H
 
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace format {
 
-bool matchFilePath(llvm::StringRef Pattern, llvm::StringRef FilePath);
+CLANG_ABI bool matchFilePath(llvm::StringRef Pattern, llvm::StringRef FilePath);
 
 } // end namespace format
 } // end namespace clang
diff --git a/clang/lib/Format/QualifierAlignmentFixer.h b/clang/lib/Format/QualifierAlignmentFixer.h
index a0a0d597ebf30c..a8afddc51d2aca 100644
--- a/clang/lib/Format/QualifierAlignmentFixer.h
+++ b/clang/lib/Format/QualifierAlignmentFixer.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_QUALIFIERALIGNMENTFIXER_H
 
 #include "TokenAnalyzer.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace format {
@@ -24,24 +25,24 @@ typedef std::function<std::pair<tooling::Replacements, unsigned>(
     const Environment &)>
     AnalyzerPass;
 
-void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
+CLANG_ABI void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
                                       SmallVectorImpl<AnalyzerPass> &Passes);
 
-void prepareLeftRightOrderingForQualifierAlignmentFixer(
+CLANG_ABI void prepareLeftRightOrderingForQualifierAlignmentFixer(
     const std::vector<std::string> &Order, std::vector<std::string> &LeftOrder,
     std::vector<std::string> &RightOrder,
     std::vector<tok::TokenKind> &Qualifiers);
 
 // Is the Token a simple or qualifier type
-bool isQualifierOrType(const FormatToken *Tok, const LangOptions &LangOpts);
-bool isConfiguredQualifierOrType(const FormatToken *Tok,
+CLANG_ABI bool isQualifierOrType(const FormatToken *Tok, const LangOptions &LangOpts);
+CLANG_ABI bool isConfiguredQualifierOrType(const FormatToken *Tok,
                                  const std::vector<tok::TokenKind> &Qualifiers,
                                  const LangOptions &LangOpts);
 
 // Is the Token likely a Macro
-bool isPossibleMacro(const FormatToken *Tok);
+CLANG_ABI bool isPossibleMacro(const FormatToken *Tok);
 
-class LeftRightQualifierAlignmentFixer : public TokenAnalyzer {
+class CLANG_ABI LeftRightQualifierAlignmentFixer : public TokenAnalyzer {
   std::string Qualifier;
   bool RightAlign;
   SmallVector<tok::TokenKind, 8> QualifierTokens;
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h
index 5a02030e5ba7f9..5314d572e5ea45 100644
--- a/clang/lib/Format/TokenAnnotator.h
+++ b/clang/lib/Format/TokenAnnotator.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_TOKENANNOTATOR_H
 
 #include "UnwrappedLineParser.h"
+#include "clang/Support/Compiler.h"
 
 namespace clang {
 namespace format {
@@ -210,7 +211,7 @@ class AnnotatedLine {
 
 /// Determines extra information about the tokens comprising an
 /// \c UnwrappedLine.
-class TokenAnnotator {
+class CLANG_ABI TokenAnnotator {
 public:
   TokenAnnotator(const FormatStyle &Style, const AdditionalKeywords &Keywords)
       : Style(Style), IsCpp(Style.isCpp()),
diff --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h
index b7daf8d9f44012..087bd298ce40de 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_UNWRAPPEDLINEPARSER_H
 
 #include "Macros.h"
+#include "clang/Support/Compiler.h"
 #include <stack>
 
 namespace clang {
@@ -89,7 +90,7 @@ struct UnwrappedLine {
 /// for each parsed unwrapped line, and then \c finishRun to indicate
 /// that the set of unwrapped lines before is one coherent view of the
 /// code snippet to be formatted.
-class UnwrappedLineConsumer {
+class CLANG_ABI UnwrappedLineConsumer {
 public:
   virtual ~UnwrappedLineConsumer() {}
   virtual void consumeUnwrappedLine(const UnwrappedLine &Line) = 0;
@@ -98,7 +99,7 @@ class UnwrappedLineConsumer {
 
 class FormatTokenSource;
 
-class UnwrappedLineParser {
+class CLANG_ABI UnwrappedLineParser {
 public:
   UnwrappedLineParser(SourceManager &SourceMgr, const FormatStyle &Style,
                       const AdditionalKeywords &Keywords,
@@ -416,7 +417,7 @@ struct UnwrappedLineNode {
   SmallVector<UnwrappedLine, 0> Children;
 };
 
-std::ostream &operator<<(std::ostream &Stream, const UnwrappedLine &Line);
+CLANG_ABI std::ostream &operator<<(std::ostream &Stream, const UnwrappedLine &Line);
 
 } // end namespace format
 } // end namespace clang

>From d6924b95019e36f2fd5d7f2577988a722ea3da5d Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 14 Oct 2024 19:03:42 +0100
Subject: [PATCH 4/5] Auto generated visibility macros for clang source files

---
 clang/lib/AST/ByteCode/Compiler.cpp           |   5 +-
 clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 461 +++++++++---------
 clang/lib/CodeGen/CGExprAgg.cpp               |   3 +-
 clang/lib/CodeGen/CGExprComplex.cpp           |   3 +-
 clang/lib/CodeGen/CGExprScalar.cpp            |   3 +-
 clang/lib/CodeGen/CGStmt.cpp                  |   3 +-
 clang/lib/CodeGen/CodeGenFunction.cpp         |   3 +-
 clang/lib/CodeGen/CodeGenPGO.cpp              |   3 +-
 clang/lib/CodeGen/CoverageMappingGen.cpp      |   5 +-
 clang/lib/Format/Format.cpp                   |   7 +-
 clang/lib/Tooling/AllTUsExecution.cpp         |   5 +-
 clang/lib/Tooling/Execution.cpp               |   3 +-
 clang/lib/Tooling/Transformer/RewriteRule.cpp |   3 +-
 13 files changed, 260 insertions(+), 247 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 51115907629d67..12e6c792f79b4e 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -16,6 +16,7 @@
 #include "PrimType.h"
 #include "Program.h"
 #include "clang/AST/Attr.h"
+#include "clang/Support/Compiler.h"
 
 using namespace clang;
 using namespace clang::interp;
@@ -6406,8 +6407,8 @@ bool Compiler<Emitter>::emitDestruction(const Descriptor *Desc,
 namespace clang {
 namespace interp {
 
-template class Compiler<ByteCodeEmitter>;
-template class Compiler<EvalEmitter>;
+template class CLANG_EXPORT_TEMPLATE Compiler<ByteCodeEmitter>;
+template class CLANG_EXPORT_TEMPLATE Compiler<EvalEmitter>;
 
 } // namespace interp
 } // namespace clang
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 46dd44e6f2b24f..cb936e41051e4b 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -20,6 +20,7 @@
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Lex/Lexer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/SmallString.h"
@@ -733,362 +734,362 @@ std::shared_ptr<llvm::Regex> createAndVerifyRegex(StringRef Regex,
 }
 } // end namespace internal
 
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAutoreleasePoolStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAutoreleasePoolStmt>
     autoreleasePoolStmt;
-const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TranslationUnitDecl>
     translationUnitDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TypedefNameDecl>
     typedefNameDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasDecl> typeAliasDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TypeAliasTemplateDecl>
     typeAliasTemplateDecl;
-const internal::VariadicAllOfMatcher<Decl> decl;
-const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl> decompositionDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl> bindingDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
+CLANG_ABI const internal::VariadicAllOfMatcher<Decl> decl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, DecompositionDecl> decompositionDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, BindingDecl> bindingDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, LinkageSpecDecl>
     linkageSpecDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, NamedDecl> namedDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, LabelDecl> labelDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceDecl> namespaceDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, NamespaceAliasDecl>
     namespaceAliasDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, RecordDecl> recordDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXRecordDecl> cxxRecordDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ClassTemplateDecl>
     classTemplateDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl,
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl,
                                             ClassTemplateSpecializationDecl>
     classTemplateSpecializationDecl;
-const internal::VariadicDynCastAllOfMatcher<
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<
     Decl, ClassTemplatePartialSpecializationDecl>
     classTemplatePartialSpecializationDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, DeclaratorDecl>
     declaratorDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ParmVarDecl> parmVarDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, AccessSpecDecl>
     accessSpecDecl;
-const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
-const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer;
-const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
-const internal::VariadicAllOfMatcher<TemplateArgumentLoc> templateArgumentLoc;
-const internal::VariadicAllOfMatcher<TemplateName> templateName;
-const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl>
+CLANG_ABI const internal::VariadicAllOfMatcher<CXXBaseSpecifier> cxxBaseSpecifier;
+CLANG_ABI const internal::VariadicAllOfMatcher<CXXCtorInitializer> cxxCtorInitializer;
+CLANG_ABI const internal::VariadicAllOfMatcher<TemplateArgument> templateArgument;
+CLANG_ABI const internal::VariadicAllOfMatcher<TemplateArgumentLoc> templateArgumentLoc;
+CLANG_ABI const internal::VariadicAllOfMatcher<TemplateName> templateName;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, NonTypeTemplateParmDecl>
     nonTypeTemplateParmDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTypeParmDecl>
     templateTypeParmDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTemplateParmDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TemplateTemplateParmDecl>
     templateTemplateParmDecl;
 
-const internal::VariadicAllOfMatcher<LambdaCapture> lambdaCapture;
-const internal::VariadicAllOfMatcher<QualType> qualType;
-const internal::VariadicAllOfMatcher<Type> type;
-const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
+CLANG_ABI const internal::VariadicAllOfMatcher<LambdaCapture> lambdaCapture;
+CLANG_ABI const internal::VariadicAllOfMatcher<QualType> qualType;
+CLANG_ABI const internal::VariadicAllOfMatcher<Type> type;
+CLANG_ABI const internal::VariadicAllOfMatcher<TypeLoc> typeLoc;
 
-const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<TypeLoc, QualifiedTypeLoc>
     qualifiedTypeLoc;
-const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<TypeLoc, PointerTypeLoc>
     pointerTypeLoc;
-const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<TypeLoc, ReferenceTypeLoc>
     referenceTypeLoc;
-const internal::VariadicDynCastAllOfMatcher<TypeLoc,
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<TypeLoc,
                                             TemplateSpecializationTypeLoc>
     templateSpecializationTypeLoc;
-const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<TypeLoc, ElaboratedTypeLoc>
     elaboratedTypeLoc;
 
-const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryExprOrTypeTraitExpr>
     unaryExprOrTypeTraitExpr;
-const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ValueDecl> valueDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXConstructorDecl>
     cxxConstructorDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXDestructorDecl>
     cxxDestructorDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, EnumDecl> enumDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, EnumConstantDecl>
     enumConstantDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, TagDecl> tagDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXMethodDecl> cxxMethodDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXConversionDecl>
     cxxConversionDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl> conceptDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ConceptDecl> conceptDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> fieldDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, IndirectFieldDecl>
     indirectFieldDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> functionDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, FunctionTemplateDecl>
     functionTemplateDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
-const internal::VariadicAllOfMatcher<Stmt> stmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, FriendDecl> friendDecl;
+CLANG_ABI const internal::VariadicAllOfMatcher<Stmt> stmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DeclStmt> declStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, MemberExpr> memberExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedMemberExpr>
     unresolvedMemberExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDependentScopeMemberExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDependentScopeMemberExpr>
     cxxDependentScopeMemberExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CallExpr> callExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, LambdaExpr> lambdaExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXMemberCallExpr>
     cxxMemberCallExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCMessageExpr>
     objcMessageExpr;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCInterfaceDecl>
     objcInterfaceDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCImplementationDecl>
     objcImplementationDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCProtocolDecl>
     objcProtocolDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryDecl>
     objcCategoryDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCCategoryImplDecl>
     objcCategoryImplDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCMethodDecl>
     objcMethodDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, BlockDecl>
     blockDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCIvarDecl> objcIvarDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, ObjCPropertyDecl>
     objcPropertyDecl;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtThrowStmt>
     objcThrowStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtTryStmt> objcTryStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtCatchStmt>
     objcCatchStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCAtFinallyStmt>
     objcFinallyStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ExprWithCleanups>
     exprWithCleanups;
-const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, InitListExpr> initListExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStdInitializerListExpr>
     cxxStdInitializerListExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitValueInitExpr>
     implicitValueInitExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ParenListExpr> parenListExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, SubstNonTypeTemplateParmExpr>
     substNonTypeTemplateParmExpr;
-const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl> usingEnumDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, UsingDecl> usingDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, UsingEnumDecl> usingEnumDecl;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, UsingDirectiveDecl>
     usingDirectiveDecl;
-const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, UnresolvedLookupExpr>
     unresolvedLookupExpr;
-const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingValueDecl>
     unresolvedUsingValueDecl;
-const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, UnresolvedUsingTypenameDecl>
     unresolvedUsingTypenameDecl;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr> constantExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ConstantExpr> constantExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ParenExpr> parenExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstructExpr>
     cxxConstructExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXUnresolvedConstructExpr>
     cxxUnresolvedConstructExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThisExpr> cxxThisExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBindTemporaryExpr>
     cxxBindTemporaryExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, MaterializeTemporaryExpr>
     materializeTemporaryExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNewExpr> cxxNewExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDeleteExpr> cxxDeleteExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNoexceptExpr>
     cxxNoexceptExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ArraySubscriptExpr>
     arraySubscriptExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitIndexExpr>
     arrayInitIndexExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ArrayInitLoopExpr>
     arrayInitLoopExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDefaultArgExpr>
     cxxDefaultArgExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXOperatorCallExpr>
     cxxOperatorCallExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXRewrittenBinaryOperator>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXRewrittenBinaryOperator>
     cxxRewrittenBinaryOperator;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr> cxxFoldExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr> objcIvarRefExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFoldExpr> cxxFoldExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, Expr> expr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DeclRefExpr> declRefExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCIvarRefExpr> objcIvarRefExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, BlockExpr> blockExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, IfStmt> ifStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt>
     cxxForRangeStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt> coreturnStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, WhileStmt> whileStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DoStmt> doStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, BreakStmt> breakStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ContinueStmt> continueStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CoreturnStmt> coreturnStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ReturnStmt> returnStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, GotoStmt> gotoStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, LabelStmt> labelStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, AddrLabelExpr> addrLabelExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchStmt> switchStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, SwitchCase> switchCase;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CaseStmt> caseStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DefaultStmt> defaultStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundStmt> compoundStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CoroutineBodyStmt>
     coroutineBodyStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXCatchStmt> cxxCatchStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTryStmt> cxxTryStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXThrowExpr> cxxThrowExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, NullStmt> nullStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, AsmStmt> asmStmt;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXBoolLiteralExpr>
     cxxBoolLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral> objcStringLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, StringLiteral> stringLiteral;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ObjCStringLiteral> objcStringLiteral;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CharacterLiteral>
     characterLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, IntegerLiteral>
     integerLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral> imaginaryLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral> floatLiteral;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral> imaginaryLiteral;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
     fixedPointLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, UserDefinedLiteral>
     userDefinedLiteral;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CompoundLiteralExpr>
     compoundLiteralExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXNullPtrLiteralExpr>
     cxxNullPtrLiteralExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr> chooseExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ChooseExpr> chooseExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ConvertVectorExpr>
     convertVectorExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CoawaitExpr>
     coawaitExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DependentCoawaitExpr>
     dependentCoawaitExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CoyieldExpr>
     coyieldExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, GNUNullExpr> gnuNullExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr>
     genericSelectionExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, AtomicExpr> atomicExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, StmtExpr> stmtExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryOperator>
     binaryOperator;
-const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
+CLANG_ABI const internal::MapAnyOfMatcher<BinaryOperator, CXXOperatorCallExpr,
                                 CXXRewrittenBinaryOperator>
     binaryOperation;
-const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation;
-const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
+CLANG_ABI const internal::MapAnyOfMatcher<CallExpr, CXXConstructExpr> invocation;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, UnaryOperator> unaryOperator;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ConditionalOperator>
     conditionalOperator;
-const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, BinaryConditionalOperator>
     binaryConditionalOperator;
-const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, OpaqueValueExpr>
     opaqueValueExpr;
-const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, StaticAssertDecl>
     staticAssertDecl;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXReinterpretCastExpr>
     cxxReinterpretCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXStaticCastExpr>
     cxxStaticCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXDynamicCastExpr>
     cxxDynamicCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXConstCastExpr>
     cxxConstCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CStyleCastExpr>
     cStyleCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ExplicitCastExpr>
     explicitCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, ImplicitCastExpr>
     implicitCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CastExpr> castExpr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXFunctionalCastExpr>
     cxxFunctionalCastExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CXXTemporaryObjectExpr>
     cxxTemporaryObjectExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, PredefinedExpr>
     predefinedExpr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, DesignatedInitExpr>
     designatedInitExpr;
-const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     eachOf = {internal::DynTypedMatcher::VO_EachOf};
-const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     anyOf = {internal::DynTypedMatcher::VO_AnyOf};
-const internal::VariadicOperatorMatcherFunc<
+CLANG_ABI const internal::VariadicOperatorMatcherFunc<
     2, std::numeric_limits<unsigned>::max()>
     allOf = {internal::DynTypedMatcher::VO_AllOf};
-const internal::VariadicOperatorMatcherFunc<1, 1> optionally = {
+CLANG_ABI const internal::VariadicOperatorMatcherFunc<1, 1> optionally = {
     internal::DynTypedMatcher::VO_Optionally};
-const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
+CLANG_ABI const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
                                  internal::hasAnyNameFunc>
     hasAnyName = {};
 
-const internal::VariadicFunction<internal::HasOpNameMatcher, StringRef,
+CLANG_ABI const internal::VariadicFunction<internal::HasOpNameMatcher, StringRef,
                                  internal::hasAnyOperatorNameFunc>
     hasAnyOperatorName = {};
-const internal::VariadicFunction<internal::HasOverloadOpNameMatcher, StringRef,
+CLANG_ABI const internal::VariadicFunction<internal::HasOverloadOpNameMatcher, StringRef,
                                  internal::hasAnyOverloadedOperatorNameFunc>
     hasAnyOverloadedOperatorName = {};
-const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>, StringRef,
+CLANG_ABI const internal::VariadicFunction<internal::Matcher<ObjCMessageExpr>, StringRef,
                                  internal::hasAnySelectorFunc>
     hasAnySelector = {};
-const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {};
-const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<internal::HasMatcher> has = {};
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<internal::HasDescendantMatcher>
     hasDescendant = {};
-const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach =
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<internal::ForEachMatcher> forEach =
     {};
-const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<internal::ForEachDescendantMatcher>
     forEachDescendant = {};
-const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<
     internal::HasParentMatcher,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
     hasParent = {};
-const internal::ArgumentAdaptingMatcherFunc<
+CLANG_ABI const internal::ArgumentAdaptingMatcherFunc<
     internal::HasAncestorMatcher,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>,
     internal::TypeList<Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr>>
     hasAncestor = {};
-const internal::VariadicOperatorMatcherFunc<1, 1> unless = {
+CLANG_ABI const internal::VariadicOperatorMatcherFunc<1, 1> unless = {
     internal::DynTypedMatcher::VO_UnaryNot};
-const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier;
-const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
+CLANG_ABI const internal::VariadicAllOfMatcher<NestedNameSpecifier> nestedNameSpecifier;
+CLANG_ABI const internal::VariadicAllOfMatcher<NestedNameSpecifierLoc>
     nestedNameSpecifierLoc;
-const internal::VariadicAllOfMatcher<Attr> attr;
-const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
+CLANG_ABI const internal::VariadicAllOfMatcher<Attr> attr;
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, CUDAKernelCallExpr>
     cudaKernelCallExpr;
-const AstTypeMatcher<BuiltinType> builtinType;
-const AstTypeMatcher<ArrayType> arrayType;
-const AstTypeMatcher<ComplexType> complexType;
-const AstTypeMatcher<ConstantArrayType> constantArrayType;
-const AstTypeMatcher<DeducedTemplateSpecializationType>
+CLANG_ABI const AstTypeMatcher<BuiltinType> builtinType;
+CLANG_ABI const AstTypeMatcher<ArrayType> arrayType;
+CLANG_ABI const AstTypeMatcher<ComplexType> complexType;
+CLANG_ABI const AstTypeMatcher<ConstantArrayType> constantArrayType;
+CLANG_ABI const AstTypeMatcher<DeducedTemplateSpecializationType>
     deducedTemplateSpecializationType;
-const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
-const AstTypeMatcher<DependentSizedExtVectorType> dependentSizedExtVectorType;
-const AstTypeMatcher<IncompleteArrayType> incompleteArrayType;
-const AstTypeMatcher<VariableArrayType> variableArrayType;
-const AstTypeMatcher<AtomicType> atomicType;
-const AstTypeMatcher<AutoType> autoType;
-const AstTypeMatcher<DecltypeType> decltypeType;
-const AstTypeMatcher<FunctionType> functionType;
-const AstTypeMatcher<FunctionProtoType> functionProtoType;
-const AstTypeMatcher<ParenType> parenType;
-const AstTypeMatcher<BlockPointerType> blockPointerType;
-const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
-const AstTypeMatcher<MemberPointerType> memberPointerType;
-const AstTypeMatcher<PointerType> pointerType;
-const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType;
-const AstTypeMatcher<ReferenceType> referenceType;
-const AstTypeMatcher<LValueReferenceType> lValueReferenceType;
-const AstTypeMatcher<RValueReferenceType> rValueReferenceType;
-const AstTypeMatcher<TypedefType> typedefType;
-const AstTypeMatcher<EnumType> enumType;
-const AstTypeMatcher<TemplateSpecializationType> templateSpecializationType;
-const AstTypeMatcher<UnaryTransformType> unaryTransformType;
-const AstTypeMatcher<RecordType> recordType;
-const AstTypeMatcher<TagType> tagType;
-const AstTypeMatcher<ElaboratedType> elaboratedType;
-const AstTypeMatcher<UsingType> usingType;
-const AstTypeMatcher<SubstTemplateTypeParmType> substTemplateTypeParmType;
-const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType;
-const AstTypeMatcher<InjectedClassNameType> injectedClassNameType;
-const AstTypeMatcher<DecayedType> decayedType;
+CLANG_ABI const AstTypeMatcher<DependentSizedArrayType> dependentSizedArrayType;
+CLANG_ABI const AstTypeMatcher<DependentSizedExtVectorType> dependentSizedExtVectorType;
+CLANG_ABI const AstTypeMatcher<IncompleteArrayType> incompleteArrayType;
+CLANG_ABI const AstTypeMatcher<VariableArrayType> variableArrayType;
+CLANG_ABI const AstTypeMatcher<AtomicType> atomicType;
+CLANG_ABI const AstTypeMatcher<AutoType> autoType;
+CLANG_ABI const AstTypeMatcher<DecltypeType> decltypeType;
+CLANG_ABI const AstTypeMatcher<FunctionType> functionType;
+CLANG_ABI const AstTypeMatcher<FunctionProtoType> functionProtoType;
+CLANG_ABI const AstTypeMatcher<ParenType> parenType;
+CLANG_ABI const AstTypeMatcher<BlockPointerType> blockPointerType;
+CLANG_ABI const AstTypeMatcher<MacroQualifiedType> macroQualifiedType;
+CLANG_ABI const AstTypeMatcher<MemberPointerType> memberPointerType;
+CLANG_ABI const AstTypeMatcher<PointerType> pointerType;
+CLANG_ABI const AstTypeMatcher<ObjCObjectPointerType> objcObjectPointerType;
+CLANG_ABI const AstTypeMatcher<ReferenceType> referenceType;
+CLANG_ABI const AstTypeMatcher<LValueReferenceType> lValueReferenceType;
+CLANG_ABI const AstTypeMatcher<RValueReferenceType> rValueReferenceType;
+CLANG_ABI const AstTypeMatcher<TypedefType> typedefType;
+CLANG_ABI const AstTypeMatcher<EnumType> enumType;
+CLANG_ABI const AstTypeMatcher<TemplateSpecializationType> templateSpecializationType;
+CLANG_ABI const AstTypeMatcher<UnaryTransformType> unaryTransformType;
+CLANG_ABI const AstTypeMatcher<RecordType> recordType;
+CLANG_ABI const AstTypeMatcher<TagType> tagType;
+CLANG_ABI const AstTypeMatcher<ElaboratedType> elaboratedType;
+CLANG_ABI const AstTypeMatcher<UsingType> usingType;
+CLANG_ABI const AstTypeMatcher<SubstTemplateTypeParmType> substTemplateTypeParmType;
+CLANG_ABI const AstTypeMatcher<TemplateTypeParmType> templateTypeParmType;
+CLANG_ABI const AstTypeMatcher<InjectedClassNameType> injectedClassNameType;
+CLANG_ABI const AstTypeMatcher<DecayedType> decayedType;
 AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasElementType,
                                  AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType,
                                                                  ComplexType));
@@ -1099,11 +1100,11 @@ AST_TYPELOC_TRAVERSE_MATCHER_DEF(
     AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType,
                                     PointerType, ReferenceType));
 
-const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
     ompExecutableDirective;
-const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<OMPClause, OMPDefaultClause>
     ompDefaultClause;
-const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
+CLANG_ABI const internal::VariadicDynCastAllOfMatcher<Decl, CXXDeductionGuideDecl>
     cxxDeductionGuideDecl;
 
 } // end namespace ast_matchers
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 74d4c5ea7bcaa4..7554efe95c1685 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -22,6 +22,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalVariable.h"
@@ -36,7 +37,7 @@ using namespace CodeGen;
 //===----------------------------------------------------------------------===//
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 namespace {
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index fef26e7b4ccdbd..5393bdd64876d2 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -15,6 +15,7 @@
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Instructions.h"
@@ -29,7 +30,7 @@ using namespace CodeGen;
 //===----------------------------------------------------------------------===//
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 typedef CodeGenFunction::ComplexPairTy ComplexPairTy;
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 7529d4465f2c34..446fa279488bc6 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -29,6 +29,7 @@
 #include "clang/AST/StmtVisitor.h"
 #include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/IR/CFG.h"
 #include "llvm/IR/Constants.h"
@@ -56,7 +57,7 @@ using llvm::Value;
 //===----------------------------------------------------------------------===//
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 namespace {
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 41dc91c578c800..1b81db8d0904fe 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -24,6 +24,7 @@
 #include "clang/Basic/PrettyStackTrace.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
@@ -44,7 +45,7 @@ using namespace CodeGen;
 //===----------------------------------------------------------------------===//
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 void CodeGenFunction::EmitStopPoint(const Stmt *S) {
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index f3023c7a20c405..9ee114f681cfd9 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -35,6 +35,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/CGFunctionInfo.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DataLayout.h"
@@ -54,7 +55,7 @@ using namespace clang;
 using namespace CodeGen;
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 /// shouldEmitLifetimeMarkers - Decide whether we need emit the life-time
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 820bb521ccf850..9630955cb86ac1 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -15,6 +15,7 @@
 #include "CoverageMappingGen.h"
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/StmtVisitor.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/Support/CommandLine.h"
@@ -24,7 +25,7 @@
 #include <optional>
 
 namespace llvm {
-extern cl::opt<bool> EnableSingleByteCoverage;
+CLANG_ABI extern cl::opt<bool> EnableSingleByteCoverage;
 } // namespace llvm
 
 static llvm::cl::opt<bool>
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 07015834bc84f3..9541ebe543bf67 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -17,6 +17,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Lex/Lexer.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
@@ -33,7 +34,7 @@
 #define COVMAP_V3
 
 namespace llvm {
-cl::opt<bool>
+CLANG_ABI cl::opt<bool>
     EnableSingleByteCoverage("enable-single-byte-coverage",
                              llvm::cl::ZeroOrMore,
                              llvm::cl::desc("Enable single byte coverage"),
@@ -47,7 +48,7 @@ static llvm::cl::opt<bool> EmptyLineCommentCoverage(
     llvm::cl::init(true), llvm::cl::Hidden);
 
 namespace llvm::coverage {
-cl::opt<bool> SystemHeadersCoverage(
+CLANG_ABI cl::opt<bool> SystemHeadersCoverage(
     "system-headers-coverage",
     cl::desc("Enable collecting coverage from system headers"), cl::init(false),
     cl::Hidden);
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 148270795c562f..c1c2ef39b55ed9 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -21,6 +21,7 @@
 #include "SortJavaScriptImports.h"
 #include "UnwrappedLineFormatter.h"
 #include "UsingDeclarationsSorter.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
 
@@ -3919,7 +3920,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
   return LangOpts;
 }
 
-const char *StyleOptionHelpDescription =
+CLANG_ABI const char *StyleOptionHelpDescription =
     "Set coding style. <string> can be:\n"
     "1. A preset: LLVM, GNU, Google, Chromium, Microsoft,\n"
     "   Mozilla, WebKit.\n"
@@ -3992,9 +3993,9 @@ FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) {
 }
 
 // Update StyleOptionHelpDescription above when changing this.
-const char *DefaultFormatStyle = "file";
+CLANG_ABI const char *DefaultFormatStyle = "file";
 
-const char *DefaultFallbackStyle = "LLVM";
+CLANG_ABI const char *DefaultFallbackStyle = "LLVM";
 
 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
 loadAndParseConfigFile(StringRef ConfigFile, llvm::vfs::FileSystem *FS,
diff --git a/clang/lib/Tooling/AllTUsExecution.cpp b/clang/lib/Tooling/AllTUsExecution.cpp
index 9cad8680447be9..50d85c6d56fb9b 100644
--- a/clang/lib/Tooling/AllTUsExecution.cpp
+++ b/clang/lib/Tooling/AllTUsExecution.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Tooling/AllTUsExecution.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ToolExecutorPluginRegistry.h"
 #include "llvm/Support/Regex.h"
 #include "llvm/Support/ThreadPool.h"
@@ -55,7 +56,7 @@ class ThreadSafeToolResults : public ToolResults {
 
 } // namespace
 
-llvm::cl::opt<std::string>
+CLANG_ABI llvm::cl::opt<std::string>
     Filter("filter",
            llvm::cl::desc("Only process files that match this filter. "
                           "This flag only applies to all-TUs."),
@@ -148,7 +149,7 @@ llvm::Error AllTUsToolExecutor::execute(
   return llvm::Error::success();
 }
 
-llvm::cl::opt<unsigned> ExecutorConcurrency(
+CLANG_ABI llvm::cl::opt<unsigned> ExecutorConcurrency(
     "execute-concurrency",
     llvm::cl::desc("The number of threads used to process all files in "
                    "parallel. Set to 0 for hardware concurrency. "
diff --git a/clang/lib/Tooling/Execution.cpp b/clang/lib/Tooling/Execution.cpp
index 247b260b97edcc..7789904c1d6956 100644
--- a/clang/lib/Tooling/Execution.cpp
+++ b/clang/lib/Tooling/Execution.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Tooling/Execution.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/ToolExecutorPluginRegistry.h"
 #include "clang/Tooling/Tooling.h"
 
@@ -15,7 +16,7 @@ LLVM_INSTANTIATE_REGISTRY(clang::tooling::ToolExecutorPluginRegistry)
 namespace clang {
 namespace tooling {
 
-llvm::cl::opt<std::string>
+CLANG_ABI llvm::cl::opt<std::string>
     ExecutorName("executor", llvm::cl::desc("The name of the executor to use."),
                  llvm::cl::init("standalone"));
 
diff --git a/clang/lib/Tooling/Transformer/RewriteRule.cpp b/clang/lib/Tooling/Transformer/RewriteRule.cpp
index eefddc34940487..0b904064d6291e 100644
--- a/clang/lib/Tooling/Transformer/RewriteRule.cpp
+++ b/clang/lib/Tooling/Transformer/RewriteRule.cpp
@@ -12,6 +12,7 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Basic/SourceLocation.h"
+#include "clang/Support/Compiler.h"
 #include "clang/Tooling/Transformer/SourceCode.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Errc.h"
@@ -29,7 +30,7 @@ using ast_matchers::internal::DynTypedMatcher;
 
 using MatchResult = MatchFinder::MatchResult;
 
-const char transformer::RootID[] = "___root___";
+CLANG_ABI const char transformer::RootID[] = "___root___";
 
 static Expected<SmallVector<transformer::Edit, 1>>
 translateEdits(const MatchResult &Result, ArrayRef<ASTEdit> ASTEdits) {

>From 22b9f802aefb3fb643848795094a17794c1b217e Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Mon, 14 Oct 2024 19:13:15 +0100
Subject: [PATCH 5/5] Auto generated visibility macros for members only of
 AST/TypeLoc.h

---
 clang/include/clang/AST/TypeLoc.h | 63 ++++++++++++++++---------------
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h
index 62ca52e508ba20..f38d560ff786e5 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -22,6 +22,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Support/Compiler.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Compiler.h"
@@ -122,11 +123,11 @@ class TypeLoc {
   explicit operator bool() const { return Ty; }
 
   /// Returns the size of type source info data block for the given type.
-  static unsigned getFullDataSizeForType(QualType Ty);
+  CLANG_ABI static unsigned getFullDataSizeForType(QualType Ty);
 
   /// Returns the alignment of type source info data block for
   /// the given type.
-  static unsigned getLocalAlignmentForType(QualType Ty);
+  CLANG_ABI static unsigned getLocalAlignmentForType(QualType Ty);
 
   /// Get the type for which this source info wrapper provides
   /// information.
@@ -144,10 +145,10 @@ class TypeLoc {
   }
 
   /// Get the begin source location.
-  SourceLocation getBeginLoc() const;
+  CLANG_ABI SourceLocation getBeginLoc() const;
 
   /// Get the end source location.
-  SourceLocation getEndLoc() const;
+  CLANG_ABI SourceLocation getEndLoc() const;
 
   /// Get the full source range.
   SourceRange getSourceRange() const LLVM_READONLY {
@@ -182,15 +183,15 @@ class TypeLoc {
   ///   QualifiedTypeLoc
   ///   AtomicTypeLoc
   ///   AttributedTypeLoc, for those type attributes that behave as qualifiers
-  TypeLoc findExplicitQualifierLoc() const;
+  CLANG_ABI TypeLoc findExplicitQualifierLoc() const;
 
   /// Get the typeloc of an AutoType whose type will be deduced for a variable
   /// with an initializer of this type. This looks through declarators like
   /// pointer types, but not through decltype or typedefs.
-  AutoTypeLoc getContainedAutoTypeLoc() const;
+  CLANG_ABI AutoTypeLoc getContainedAutoTypeLoc() const;
 
   /// Get the SourceLocation of the template keyword (if any).
-  SourceLocation getTemplateKeywordLoc() const;
+  CLANG_ABI SourceLocation getTemplateKeywordLoc() const;
 
   /// Initializes this to state that every location in this
   /// type is the given location.
@@ -218,7 +219,7 @@ class TypeLoc {
   }
 
   /// Copies the other type loc into this one.
-  void copy(TypeLoc other);
+  CLANG_ABI void copy(TypeLoc other);
 
   friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS) {
     return LHS.Ty == RHS.Ty && LHS.Data == RHS.Data;
@@ -230,21 +231,21 @@ class TypeLoc {
 
   /// Find the location of the nullability specifier (__nonnull,
   /// __nullable, or __null_unspecifier), if there is one.
-  SourceLocation findNullabilityLoc() const;
+  CLANG_ABI SourceLocation findNullabilityLoc() const;
 
-  void dump() const;
-  void dump(llvm::raw_ostream &, const ASTContext &) const;
+  CLANG_ABI void dump() const;
+  CLANG_ABI void dump(llvm::raw_ostream &, const ASTContext &) const;
 
 private:
   static bool isKind(const TypeLoc&) {
     return true;
   }
 
-  static void initializeImpl(ASTContext &Context, TypeLoc TL,
+  CLANG_ABI static void initializeImpl(ASTContext &Context, TypeLoc TL,
                              SourceLocation Loc);
-  static TypeLoc getNextTypeLocImpl(TypeLoc TL);
-  static TypeLoc IgnoreParensImpl(TypeLoc TL);
-  static SourceRange getLocalSourceRangeImpl(TypeLoc TL);
+  CLANG_ABI static TypeLoc getNextTypeLocImpl(TypeLoc TL);
+  CLANG_ABI static TypeLoc IgnoreParensImpl(TypeLoc TL);
+  CLANG_ABI static SourceRange getLocalSourceRangeImpl(TypeLoc TL);
 };
 
 inline TypeSourceInfo::TypeSourceInfo(QualType ty, size_t DataSize) : Ty(ty) {
@@ -551,7 +552,7 @@ class TypeSpecTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
 private:
   friend class TypeLoc;
 
-  static bool isKind(const TypeLoc &TL);
+  CLANG_ABI static bool isKind(const TypeLoc &TL);
 };
 
 struct BuiltinLocInfo {
@@ -642,7 +643,7 @@ class BuiltinTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
       getWrittenBuiltinSpecs().Width = static_cast<unsigned>(written);
   }
 
-  TypeSpecifierType getWrittenTypeSpec() const;
+  CLANG_ABI TypeSpecifierType getWrittenTypeSpec() const;
 
   bool hasWrittenTypeSpec() const {
     return getWrittenTypeSpec() != TST_unspecified;
@@ -732,7 +733,7 @@ class TagTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
   TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
 
   /// True if the tag was defined in this type specifier.
-  bool isDefinition() const;
+  CLANG_ABI bool isDefinition() const;
 };
 
 /// Wrapper for source info for record types.
@@ -829,7 +830,7 @@ class ObjCTypeParamTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
     return llvm::ArrayRef(getProtocolLocArray(), getNumProtocols());
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 
   unsigned getExtraLocalDataSize() const {
     if (!this->getNumProtocols()) return 0;
@@ -906,7 +907,7 @@ class AttributedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
     return dyn_cast_or_null<T>(getAttr());
   }
 
-  SourceRange getLocalSourceRange() const;
+  CLANG_ABI SourceRange getLocalSourceRange() const;
 
   void initializeLocal(ASTContext &Context, SourceLocation loc) {
     setAttr(nullptr);
@@ -933,7 +934,7 @@ class BTFTagAttributedTypeLoc
     return dyn_cast_or_null<T>(getAttr());
   }
 
-  SourceRange getLocalSourceRange() const;
+  CLANG_ABI SourceRange getLocalSourceRange() const;
 
   void initializeLocal(ASTContext &Context, SourceLocation loc) {}
 
@@ -1092,7 +1093,7 @@ class ObjCObjectTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
     return SourceRange(start, end);
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 
   unsigned getExtraLocalDataSize() const {
     return this->getNumTypeArgs() * sizeof(TypeSourceInfo *)
@@ -1174,7 +1175,7 @@ class CountAttributedTypeLoc final
   bool isCountInBytes() const { return getTypePtr()->isCountInBytes(); }
   bool isOrNull() const { return getTypePtr()->isOrNull(); }
 
-  SourceRange getLocalSourceRange() const;
+  CLANG_ABI SourceRange getLocalSourceRange() const;
 };
 
 struct MacroQualifiedLocInfo {
@@ -1764,7 +1765,7 @@ class TemplateSpecializationTypeLoc :
                       getArgInfos(), Loc);
   }
 
-  static void initializeArgLocs(ASTContext &Context,
+  CLANG_ABI static void initializeArgLocs(ASTContext &Context,
                                 ArrayRef<TemplateArgument> Args,
                                 TemplateArgumentLocInfo *ArgInfos,
                                 SourceLocation Loc);
@@ -2075,7 +2076,7 @@ class TypeOfExprTypeLoc : public TypeofLikeTypeLoc<TypeOfExprTypeLoc,
   // Reimplemented to account for GNU/C++ extension
   //     typeof unary-expression
   // where there are no parentheses.
-  SourceRange getLocalSourceRange() const;
+  CLANG_ABI SourceRange getLocalSourceRange() const;
 };
 
 class TypeOfTypeLoc
@@ -2093,7 +2094,7 @@ class TypeOfTypeLoc
     this->getLocalData()->UnmodifiedTInfo = TI;
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 };
 
 // decltype(expression) abc;
@@ -2197,7 +2198,7 @@ class UnaryTransformTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
     setRParenLoc(Range.getEnd());
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 };
 
 class DeducedTypeLoc
@@ -2318,7 +2319,7 @@ class AutoTypeLoc
     memcpy(Data, Loc.Data, size);
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 };
 
 class DeducedTemplateSpecializationTypeLoc
@@ -2387,7 +2388,7 @@ class ElaboratedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
       return getQualifierLoc().getSourceRange();
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 
   TypeLoc getNamedTypeLoc() const { return getInnerTypeLoc(); }
 
@@ -2468,7 +2469,7 @@ class DependentNameTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
     memcpy(Data, Loc.Data, size);
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 };
 
 struct DependentTemplateSpecializationLocInfo : DependentNameLocInfo {
@@ -2582,7 +2583,7 @@ class DependentTemplateSpecializationTypeLoc :
     memcpy(Data, Loc.Data, size);
   }
 
-  void initializeLocal(ASTContext &Context, SourceLocation Loc);
+  CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
 
   unsigned getExtraLocalDataSize() const {
     return getNumArgs() * sizeof(TemplateArgumentLocInfo);



More information about the cfe-commits mailing list