diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h --- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h @@ -50,7 +50,7 @@ /// /// FIXME: Figure out whether carrying information from one TU to another is /// useful/necessary. -class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { +class LLVM_EXTERNAL_VISIBILITY ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback { public: /// Initializes the check with \p CheckName and \p Context. /// diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.h b/clang-tools-extra/clang-tidy/ClangTidyModule.h --- a/clang-tools-extra/clang-tidy/ClangTidyModule.h +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.h @@ -24,7 +24,7 @@ /// /// All clang-tidy modules register their check factories with an instance of /// this object. -class ClangTidyCheckFactories { +class LLVM_EXTERNAL_VISIBILITY ClangTidyCheckFactories { public: using CheckFactory = std::function( llvm::StringRef Name, ClangTidyContext *Context)>; @@ -81,7 +81,7 @@ /// A clang-tidy module groups a number of \c ClangTidyChecks and gives /// them a prefixed name. -class ClangTidyModule { +class LLVM_EXTERNAL_VISIBILITY ClangTidyModule { public: virtual ~ClangTidyModule() {} diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -23,6 +23,17 @@ # Must go below project(..) include(GNUInstallDirs) +# When building shared objects for each target there are some internal APIs +# that are used across shared objects which we can't hide. +if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND + (NOT (WIN32 OR CYGWIN) OR (MINGW AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND + NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND + NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET) + # Set default visibility to hidden, so we don't export all the Target classes + # in libLLVM.so. + set(CMAKE_CXX_VISIBILITY_PRESET hidden) +endif() + if(CLANG_BUILT_STANDALONE) set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") set(CMAKE_CXX_STANDARD_REQUIRED YES) diff --git a/clang/include/clang-c/FatalErrorHandler.h b/clang/include/clang-c/FatalErrorHandler.h --- a/clang/include/clang-c/FatalErrorHandler.h +++ b/clang/include/clang-c/FatalErrorHandler.h @@ -11,6 +11,7 @@ #define LLVM_CLANG_C_FATAL_ERROR_HANDLER_H #include "clang-c/ExternC.h" +#include "clang-c/Platform.h" LLVM_CLANG_C_EXTERN_C_BEGIN @@ -18,14 +19,14 @@ * Installs error handler that prints error message to stderr and calls abort(). * Replaces currently installed error handler (if any). */ -void clang_install_aborting_llvm_fatal_error_handler(void); +CINDEX_LINKAGE void clang_install_aborting_llvm_fatal_error_handler(void); /** * Removes currently installed error handler (if any). * If no error handler is intalled, the default strategy is to print error * message to stderr and call exit(1). */ -void clang_uninstall_llvm_fatal_error_handler(void); +CINDEX_LINKAGE void clang_uninstall_llvm_fatal_error_handler(void); LLVM_CLANG_C_EXTERN_C_END diff --git a/clang/include/clang/APINotes/APINotesYAMLCompiler.h b/clang/include/clang/APINotes/APINotesYAMLCompiler.h --- a/clang/include/clang/APINotes/APINotesYAMLCompiler.h +++ b/clang/include/clang/APINotes/APINotesYAMLCompiler.h @@ -17,7 +17,7 @@ /// 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); +LLVM_EXTERNAL_VISIBILITY bool parseAndDumpAPINotes(llvm::StringRef YI, llvm::raw_ostream &OS); } // namespace api_notes } // namespace clang diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h --- a/clang/include/clang/APINotes/Types.h +++ b/clang/include/clang/APINotes/Types.h @@ -48,7 +48,7 @@ /// Describes API notes data for any entity. /// /// This is used as the base of all API notes. -class CommonEntityInfo { +class LLVM_EXTERNAL_VISIBILITY CommonEntityInfo { public: /// Message to use when this entity is unavailable. std::string UnavailableMsg; @@ -127,7 +127,7 @@ } /// Describes API notes for types. -class CommonTypeInfo : public CommonEntityInfo { +class LLVM_EXTERNAL_VISIBILITY CommonTypeInfo : public CommonEntityInfo { /// The Swift type to which a given type is bridged. /// /// Reflects the swift_bridge attribute. @@ -194,7 +194,7 @@ } /// Describes API notes data for an Objective-C class or protocol. -class ObjCContextInfo : public CommonTypeInfo { +class LLVM_EXTERNAL_VISIBILITY ObjCContextInfo : public CommonTypeInfo { /// Whether this class has a default nullability. unsigned HasDefaultNullability : 1; @@ -301,7 +301,7 @@ } /// API notes for a variable/property. -class VariableInfo : public CommonEntityInfo { +class LLVM_EXTERNAL_VISIBILITY VariableInfo : public CommonEntityInfo { /// Whether this property has been audited for nullability. unsigned NullabilityAudited : 1; @@ -356,7 +356,7 @@ } /// Describes API notes data for an Objective-C property. -class ObjCPropertyInfo : public VariableInfo { +class LLVM_EXTERNAL_VISIBILITY ObjCPropertyInfo : public VariableInfo { unsigned SwiftImportAsAccessorsSpecified : 1; unsigned SwiftImportAsAccessors : 1; @@ -412,7 +412,7 @@ } /// Describes a function or method parameter. -class ParamInfo : public VariableInfo { +class LLVM_EXTERNAL_VISIBILITY ParamInfo : public VariableInfo { /// Whether noescape was specified. unsigned NoEscapeSpecified : 1; @@ -480,7 +480,7 @@ } /// API notes for a function or method. -class FunctionInfo : public CommonEntityInfo { +class LLVM_EXTERNAL_VISIBILITY FunctionInfo : public CommonEntityInfo { private: static constexpr const uint64_t NullabilityKindMask = 0x3; static constexpr const unsigned NullabilityKindSize = 2; @@ -599,7 +599,7 @@ } /// Describes API notes data for an Objective-C method. -class ObjCMethodInfo : public FunctionInfo { +class LLVM_EXTERNAL_VISIBILITY ObjCMethodInfo : public FunctionInfo { public: /// Whether this is a designated initializer of its class. unsigned DesignatedInit : 1; @@ -636,25 +636,25 @@ } /// Describes API notes data for a global variable. -class GlobalVariableInfo : public VariableInfo { +class LLVM_EXTERNAL_VISIBILITY GlobalVariableInfo : public VariableInfo { public: GlobalVariableInfo() {} }; /// Describes API notes data for a global function. -class GlobalFunctionInfo : public FunctionInfo { +class LLVM_EXTERNAL_VISIBILITY GlobalFunctionInfo : public FunctionInfo { public: GlobalFunctionInfo() {} }; /// Describes API notes data for an enumerator. -class EnumConstantInfo : public CommonEntityInfo { +class LLVM_EXTERNAL_VISIBILITY EnumConstantInfo : public CommonEntityInfo { public: EnumConstantInfo() {} }; /// Describes API notes data for a tag. -class TagInfo : public CommonTypeInfo { +class LLVM_EXTERNAL_VISIBILITY TagInfo : public CommonTypeInfo { unsigned HasFlagEnum : 1; unsigned IsFlagEnum : 1; @@ -701,7 +701,7 @@ } /// Describes API notes data for a typedef. -class TypedefInfo : public CommonTypeInfo { +class LLVM_EXTERNAL_VISIBILITY TypedefInfo : public CommonTypeInfo { public: std::optional SwiftWrapper; diff --git a/clang/include/clang/ARCMigrate/ARCMT.h b/clang/include/clang/ARCMigrate/ARCMT.h --- a/clang/include/clang/ARCMigrate/ARCMT.h +++ b/clang/include/clang/ARCMigrate/ARCMT.h @@ -37,7 +37,7 @@ /// the pre-migration ARC diagnostics. /// /// \returns false if no error is produced, true otherwise. -bool +LLVM_EXTERNAL_VISIBILITY bool checkForManualIssues(CompilerInvocation &CI, const FrontendInputFile &Input, std::shared_ptr PCHContainerOps, DiagnosticConsumer *DiagClient, @@ -48,7 +48,7 @@ /// applies automatic modifications to source files to conform to ARC. /// /// \returns false if no error is produced, true otherwise. -bool +LLVM_EXTERNAL_VISIBILITY bool applyTransformations(CompilerInvocation &origCI, const FrontendInputFile &Input, std::shared_ptr PCHContainerOps, @@ -65,7 +65,7 @@ /// the pre-migration ARC diagnostics. /// /// \returns false if no error is produced, true otherwise. -bool migrateWithTemporaryFiles( +LLVM_EXTERNAL_VISIBILITY bool migrateWithTemporaryFiles( CompilerInvocation &origCI, const FrontendInputFile &Input, std::shared_ptr PCHContainerOps, DiagnosticConsumer *DiagClient, StringRef outputDir, @@ -75,7 +75,7 @@ /// migrateWithTemporaryFiles produced. /// /// \returns false if no error is produced, true otherwise. -bool getFileRemappings(std::vector > &remap, +LLVM_EXTERNAL_VISIBILITY bool getFileRemappings(std::vector > &remap, StringRef outputDir, DiagnosticConsumer *DiagClient); @@ -83,17 +83,17 @@ /// info. /// /// \returns false if no error is produced, true otherwise. -bool getFileRemappingsFromFileList( +LLVM_EXTERNAL_VISIBILITY bool getFileRemappingsFromFileList( std::vector > &remap, ArrayRef remapFiles, DiagnosticConsumer *DiagClient); typedef void (*TransformFn)(MigrationPass &pass); -std::vector getAllTransformations(LangOptions::GCMode OrigGCMode, +LLVM_EXTERNAL_VISIBILITY std::vector getAllTransformations(LangOptions::GCMode OrigGCMode, bool NoFinalizeRemoval); -class MigrationProcess { +class LLVM_EXTERNAL_VISIBILITY MigrationProcess { CompilerInvocation OrigCI; std::shared_ptr PCHContainerOps; DiagnosticConsumer *DiagClient; diff --git a/clang/include/clang/ARCMigrate/ARCMTActions.h b/clang/include/clang/ARCMigrate/ARCMTActions.h --- a/clang/include/clang/ARCMigrate/ARCMTActions.h +++ b/clang/include/clang/ARCMigrate/ARCMTActions.h @@ -16,7 +16,7 @@ namespace clang { namespace arcmt { -class CheckAction : public WrapperFrontendAction { +class LLVM_EXTERNAL_VISIBILITY CheckAction : public WrapperFrontendAction { protected: bool BeginInvocation(CompilerInstance &CI) override; @@ -24,7 +24,7 @@ CheckAction(std::unique_ptr WrappedAction); }; -class ModifyAction : public WrapperFrontendAction { +class LLVM_EXTERNAL_VISIBILITY ModifyAction : public WrapperFrontendAction { protected: bool BeginInvocation(CompilerInstance &CI) override; @@ -32,7 +32,7 @@ ModifyAction(std::unique_ptr WrappedAction); }; -class MigrateSourceAction : public ASTFrontendAction { +class LLVM_EXTERNAL_VISIBILITY MigrateSourceAction : public ASTFrontendAction { FileRemapper Remapper; protected: bool BeginInvocation(CompilerInstance &CI) override; @@ -40,7 +40,7 @@ StringRef InFile) override; }; -class MigrateAction : public WrapperFrontendAction { +class LLVM_EXTERNAL_VISIBILITY MigrateAction : public WrapperFrontendAction { std::string MigrateDir; std::string PlistOut; bool EmitPremigrationARCErrors; @@ -55,7 +55,7 @@ }; /// Migrates to modern ObjC syntax. -class ObjCMigrateAction : public WrapperFrontendAction { +class LLVM_EXTERNAL_VISIBILITY 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 --- a/clang/include/clang/ARCMigrate/FileRemapper.h +++ b/clang/include/clang/ARCMigrate/FileRemapper.h @@ -29,7 +29,7 @@ namespace arcmt { -class FileRemapper { +class LLVM_EXTERNAL_VISIBILITY FileRemapper { // FIXME: Reuse the same FileManager for multiple ASTContexts. std::unique_ptr FileMgr; diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -41,7 +41,7 @@ class QualType; /// Symbolic representation of typeid(T) for some type T. -class TypeInfoLValue { +class LLVM_EXTERNAL_VISIBILITY TypeInfoLValue { const Type *T; public: @@ -62,7 +62,7 @@ }; /// Symbolic representation of a dynamic allocation. -class DynamicAllocLValue { +class LLVM_EXTERNAL_VISIBILITY DynamicAllocLValue { unsigned Index; public: @@ -119,7 +119,7 @@ /// 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 LLVM_EXTERNAL_VISIBILITY APValue { typedef llvm::APFixedPoint APFixedPoint; typedef llvm::APSInt APSInt; typedef llvm::APFloat APFloat; @@ -694,7 +694,7 @@ } // end namespace clang. namespace llvm { -template<> struct DenseMapInfo { +template<> struct LLVM_EXTERNAL_VISIBILITY DenseMapInfo { 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 --- a/clang/include/clang/AST/ASTConcept.h +++ b/clang/include/clang/AST/ASTConcept.h @@ -25,7 +25,7 @@ /// The result of a constraint satisfaction check, containing the necessary /// information to diagnose an unsatisfied constraint. -class ConstraintSatisfaction : public llvm::FoldingSetNode { +class LLVM_EXTERNAL_VISIBILITY 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; @@ -81,7 +81,7 @@ /// necessary information to diagnose an unsatisfied constraint. /// /// This is safe to store in an AST node, as opposed to ConstraintSatisfaction. -struct ASTConstraintSatisfaction final : +struct LLVM_EXTERNAL_VISIBILITY ASTConstraintSatisfaction final : llvm::TrailingObjects { std::size_t NumRecords; @@ -109,7 +109,7 @@ /// \brief Common data class for constructs that reference concepts with /// template arguments. -class ConceptReference { +class LLVM_EXTERNAL_VISIBILITY ConceptReference { protected: // \brief The optional nested name specifier used when naming the concept. NestedNameSpecifierLoc NestedNameSpec; @@ -177,7 +177,7 @@ } }; -class TypeConstraint : public ConceptReference { +class LLVM_EXTERNAL_VISIBILITY TypeConstraint : public ConceptReference { /// \brief The immediately-declared constraint expression introduced by this /// type-constraint. Expr *ImmediatelyDeclaredConstraint = nullptr; diff --git a/clang/include/clang/AST/ASTConsumer.h b/clang/include/clang/AST/ASTConsumer.h --- a/clang/include/clang/AST/ASTConsumer.h +++ b/clang/include/clang/AST/ASTConsumer.h @@ -13,6 +13,8 @@ #ifndef LLVM_CLANG_AST_ASTCONSUMER_H #define LLVM_CLANG_AST_ASTCONSUMER_H +#include "llvm/Support/Compiler.h" + namespace clang { class ASTContext; class CXXMethodDecl; @@ -30,7 +32,7 @@ /// 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 LLVM_EXTERNAL_VISIBILITY 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 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -149,7 +149,7 @@ RequiredByEnum, }; -struct TypeInfo { +struct LLVM_EXTERNAL_VISIBILITY TypeInfo { uint64_t Width = 0; unsigned Align = 0; AlignRequirementKind AlignRequirement; @@ -163,7 +163,7 @@ } }; -struct TypeInfoChars { +struct LLVM_EXTERNAL_VISIBILITY TypeInfoChars { CharUnits Width; CharUnits Align; AlignRequirementKind AlignRequirement; @@ -179,7 +179,7 @@ /// 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 { +class LLVM_EXTERNAL_VISIBILITY ASTContext : public RefCountedBase { friend class NestedNameSpecifier; mutable SmallVector Types; @@ -3363,7 +3363,7 @@ }; /// Insertion operator for diagnostics. -const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, +LLVM_EXTERNAL_VISIBILITY 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 --- a/clang/include/clang/AST/ASTContextAllocate.h +++ b/clang/include/clang/AST/ASTContextAllocate.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_AST_ASTCONTEXTALLOCATE_H #include +#include "llvm/Support/Compiler.h" namespace clang { @@ -23,15 +24,15 @@ } // namespace clang // Defined in ASTContext.h -void *operator new(size_t Bytes, const clang::ASTContext &C, +LLVM_EXTERNAL_VISIBILITY void *operator new(size_t Bytes, const clang::ASTContext &C, size_t Alignment = 8); -void *operator new[](size_t Bytes, const clang::ASTContext &C, +LLVM_EXTERNAL_VISIBILITY 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); +LLVM_EXTERNAL_VISIBILITY void operator delete(void *Ptr, const clang::ASTContext &C, size_t); +LLVM_EXTERNAL_VISIBILITY 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 --- a/clang/include/clang/AST/ASTDiagnostic.h +++ b/clang/include/clang/AST/ASTDiagnostic.h @@ -23,7 +23,7 @@ /// diagnostics. It is meant to be used as the argument to /// \c DiagnosticsEngine::SetArgToStringFn(), where the cookie is an \c /// ASTContext pointer. - void FormatASTNodeDiagnosticArgument( + LLVM_EXTERNAL_VISIBILITY void FormatASTNodeDiagnosticArgument( DiagnosticsEngine::ArgumentKind Kind, intptr_t Val, StringRef Modifier, @@ -35,7 +35,7 @@ /// Returns a desugared version of the QualType, and marks ShouldAKA as true /// whenever we remove significant sugar from the type. - QualType desugarForDiagnostic(ASTContext &Context, QualType QT, + LLVM_EXTERNAL_VISIBILITY 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 --- a/clang/include/clang/AST/ASTDumper.h +++ b/clang/include/clang/AST/ASTDumper.h @@ -15,7 +15,7 @@ namespace clang { -class ASTDumper : public ASTNodeTraverser { +class LLVM_EXTERNAL_VISIBILITY ASTDumper : public ASTNodeTraverser { TextNodeDumper NodeDumper; diff --git a/clang/include/clang/AST/ASTDumperUtils.h b/clang/include/clang/AST/ASTDumperUtils.h --- a/clang/include/clang/AST/ASTDumperUtils.h +++ b/clang/include/clang/AST/ASTDumperUtils.h @@ -26,7 +26,7 @@ // Colors used for various parts of the AST dump // Do not use bold yellow for any text. It is hard to read on white screens. -struct TerminalColor { +struct LLVM_EXTERNAL_VISIBILITY TerminalColor { llvm::raw_ostream::Colors Color; bool Bold; }; @@ -83,7 +83,7 @@ // Indents ( `, -. | ) static const TerminalColor IndentColor = {llvm::raw_ostream::BLUE, false}; -class ColorScope { +class LLVM_EXTERNAL_VISIBILITY ColorScope { llvm::raw_ostream &OS; const bool ShowColors; diff --git a/clang/include/clang/AST/ASTImportError.h b/clang/include/clang/AST/ASTImportError.h --- a/clang/include/clang/AST/ASTImportError.h +++ b/clang/include/clang/AST/ASTImportError.h @@ -18,7 +18,7 @@ namespace clang { -class ASTImportError : public llvm::ErrorInfo { +class LLVM_EXTERNAL_VISIBILITY ASTImportError : public llvm::ErrorInfo { 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 --- a/clang/include/clang/AST/ASTImporter.h +++ b/clang/include/clang/AST/ASTImporter.h @@ -55,11 +55,11 @@ // 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 getCanonicalForwardRedeclChain(Decl* D); + LLVM_EXTERNAL_VISIBILITY llvm::SmallVector getCanonicalForwardRedeclChain(Decl* D); /// Imports selected nodes from one AST context into another context, /// merging AST nodes where appropriate. - class ASTImporter { + class LLVM_EXTERNAL_VISIBILITY ASTImporter { friend class ASTNodeImporter; public: using NonEquivalentDeclSet = llvm::DenseSet>; diff --git a/clang/include/clang/AST/ASTImporterLookupTable.h b/clang/include/clang/AST/ASTImporterLookupTable.h --- a/clang/include/clang/AST/ASTImporterLookupTable.h +++ b/clang/include/clang/AST/ASTImporterLookupTable.h @@ -43,7 +43,7 @@ // 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 LLVM_EXTERNAL_VISIBILITY 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/ASTImporterSharedState.h b/clang/include/clang/AST/ASTImporterSharedState.h --- a/clang/include/clang/AST/ASTImporterSharedState.h +++ b/clang/include/clang/AST/ASTImporterSharedState.h @@ -26,7 +26,7 @@ /// Importer specific state, which may be shared amongst several ASTImporter /// objects. -class ASTImporterSharedState { +class LLVM_EXTERNAL_VISIBILITY ASTImporterSharedState { /// Pointer to the import specific lookup table. std::unique_ptr LookupTable; diff --git a/clang/include/clang/AST/ASTMutationListener.h b/clang/include/clang/AST/ASTMutationListener.h --- a/clang/include/clang/AST/ASTMutationListener.h +++ b/clang/include/clang/AST/ASTMutationListener.h @@ -43,7 +43,7 @@ /// 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 LLVM_EXTERNAL_VISIBILITY ASTMutationListener { public: virtual ~ASTMutationListener(); diff --git a/clang/include/clang/AST/ASTNodeTraverser.h b/clang/include/clang/AST/ASTNodeTraverser.h --- a/clang/include/clang/AST/ASTNodeTraverser.h +++ b/clang/include/clang/AST/ASTNodeTraverser.h @@ -58,7 +58,7 @@ }; */ template -class ASTNodeTraverser +class LLVM_EXTERNAL_VISIBILITY ASTNodeTraverser : public ConstDeclVisitor, public ConstStmtVisitor, public comments::ConstCommentVisitor() to construct them. -class ASTNodeKind { +class LLVM_EXTERNAL_VISIBILITY ASTNodeKind { public: /// Empty identifier. It matches nothing. constexpr ASTNodeKind() : KindId(NKI_None) {} @@ -252,7 +252,7 @@ /// 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 LLVM_EXTERNAL_VISIBILITY DynTypedNode { public: /// Creates a \c DynTypedNode from \c Node. template @@ -512,74 +512,74 @@ }; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastPtrConverter {}; template <> -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< NestedNameSpecifier, void> : public PtrConverter {}; template <> -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< CXXCtorInitializer, void> : public PtrConverter {}; template <> -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< TemplateArgument, void> : public ValueConverter {}; template <> -struct DynTypedNode::BaseConverter +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter : public ValueConverter {}; template <> -struct DynTypedNode::BaseConverter +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter : public ValueConverter {}; template <> -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< TemplateName, void> : public ValueConverter {}; template <> -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< NestedNameSpecifierLoc, void> : public ValueConverter {}; template <> -struct DynTypedNode::BaseConverter : public ValueConverter {}; template -struct DynTypedNode::BaseConverter< +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter< T, std::enable_if_t::value>> : public DynCastValueConverter {}; template <> -struct DynTypedNode::BaseConverter +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter : public PtrConverter {}; template <> -struct DynTypedNode::BaseConverter +struct LLVM_EXTERNAL_VISIBILITY DynTypedNode::BaseConverter : public ValueConverter {}; // The only operation we allow on unsupported types is \c get. @@ -597,10 +597,10 @@ namespace llvm { template <> -struct DenseMapInfo : clang::ASTNodeKind::DenseMapInfo {}; +struct LLVM_EXTERNAL_VISIBILITY DenseMapInfo : clang::ASTNodeKind::DenseMapInfo {}; template <> -struct DenseMapInfo : clang::DynTypedNode::DenseMapInfo {}; +struct LLVM_EXTERNAL_VISIBILITY DenseMapInfo : clang::DynTypedNode::DenseMapInfo {}; } // end namespace llvm diff --git a/clang/include/clang/AST/ASTUnresolvedSet.h b/clang/include/clang/AST/ASTUnresolvedSet.h --- a/clang/include/clang/AST/ASTUnresolvedSet.h +++ b/clang/include/clang/AST/ASTUnresolvedSet.h @@ -26,7 +26,7 @@ class NamedDecl; /// An UnresolvedSet-like class which uses the ASTContext's allocator. -class ASTUnresolvedSet { +class LLVM_EXTERNAL_VISIBILITY ASTUnresolvedSet { friend class LazyASTUnresolvedSet; struct DeclsTy : ASTVector { @@ -95,7 +95,7 @@ /// An UnresolvedSet-like class that might not have been loaded from the /// external AST source yet. -class LazyASTUnresolvedSet { +class LLVM_EXTERNAL_VISIBILITY LazyASTUnresolvedSet { mutable ASTUnresolvedSet Impl; void getFromExternalSource(ASTContext &C) const; diff --git a/clang/include/clang/AST/ASTVector.h b/clang/include/clang/AST/ASTVector.h --- a/clang/include/clang/AST/ASTVector.h +++ b/clang/include/clang/AST/ASTVector.h @@ -33,7 +33,7 @@ class ASTContext; template -class ASTVector { +class LLVM_EXTERNAL_VISIBILITY ASTVector { private: T *Begin = nullptr; T *End = nullptr; diff --git a/clang/include/clang/AST/AbstractBasicReader.h b/clang/include/clang/AST/AbstractBasicReader.h --- a/clang/include/clang/AST/AbstractBasicReader.h +++ b/clang/include/clang/AST/AbstractBasicReader.h @@ -120,7 +120,7 @@ /// readStmtRef /// readDeclRef template -class DataStreamBasicReader : public BasicReaderBase { +class LLVM_EXTERNAL_VISIBILITY DataStreamBasicReader : public BasicReaderBase { protected: using BasicReaderBase::asImpl; DataStreamBasicReader(ASTContext &ctx) : BasicReaderBase(ctx) {} diff --git a/clang/include/clang/AST/AbstractBasicWriter.h b/clang/include/clang/AST/AbstractBasicWriter.h --- a/clang/include/clang/AST/AbstractBasicWriter.h +++ b/clang/include/clang/AST/AbstractBasicWriter.h @@ -117,7 +117,7 @@ /// writeStmtRef /// writeDeclRef template -class DataStreamBasicWriter : public BasicWriterBase { +class LLVM_EXTERNAL_VISIBILITY DataStreamBasicWriter : public BasicWriterBase { protected: using BasicWriterBase::asImpl; DataStreamBasicWriter(ASTContext &ctx) : BasicWriterBase(ctx) {} diff --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h --- a/clang/include/clang/AST/Attr.h +++ b/clang/include/clang/AST/Attr.h @@ -37,7 +37,7 @@ class OMPTraitInfo; /// Attr - This represents one attribute. -class Attr : public AttributeCommonInfo { +class LLVM_EXTERNAL_VISIBILITY Attr : public AttributeCommonInfo { private: unsigned AttrKind : 16; @@ -107,7 +107,7 @@ static StringRef getDocumentation(attr::Kind); }; -class TypeAttr : public Attr { +class LLVM_EXTERNAL_VISIBILITY TypeAttr : public Attr { protected: TypeAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed) @@ -120,7 +120,7 @@ } }; -class StmtAttr : public Attr { +class LLVM_EXTERNAL_VISIBILITY StmtAttr : public Attr { protected: StmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed) @@ -133,7 +133,7 @@ } }; -class InheritableAttr : public Attr { +class LLVM_EXTERNAL_VISIBILITY InheritableAttr : public Attr { protected: InheritableAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed, @@ -158,7 +158,7 @@ } }; -class DeclOrStmtAttr : public InheritableAttr { +class LLVM_EXTERNAL_VISIBILITY DeclOrStmtAttr : public InheritableAttr { protected: DeclOrStmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed, @@ -173,7 +173,7 @@ } }; -class InheritableParamAttr : public InheritableAttr { +class LLVM_EXTERNAL_VISIBILITY InheritableParamAttr : public InheritableAttr { protected: InheritableParamAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, @@ -189,7 +189,7 @@ } }; -class HLSLAnnotationAttr : public InheritableAttr { +class LLVM_EXTERNAL_VISIBILITY HLSLAnnotationAttr : public InheritableAttr { protected: HLSLAnnotationAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed, @@ -207,7 +207,7 @@ /// A parameter attribute which changes the argument-passing ABI rule /// for the parameter. -class ParameterABIAttr : public InheritableParamAttr { +class LLVM_EXTERNAL_VISIBILITY ParameterABIAttr : public InheritableParamAttr { protected: ParameterABIAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed, @@ -239,7 +239,7 @@ /// A single parameter index whose accessors require each use to make explicit /// the parameter index encoding needed. -class ParamIdx { +class LLVM_EXTERNAL_VISIBILITY ParamIdx { // Idx is exposed only via accessors that specify specific encodings. unsigned Idx : 30; unsigned HasThis : 1; diff --git a/clang/include/clang/AST/AttrIterator.h b/clang/include/clang/AST/AttrIterator.h --- a/clang/include/clang/AST/AttrIterator.h +++ b/clang/include/clang/AST/AttrIterator.h @@ -30,7 +30,7 @@ /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only /// providing attributes that are of a specific type. template -class specific_attr_iterator { +class LLVM_EXTERNAL_VISIBILITY specific_attr_iterator { using Iterator = typename Container::const_iterator; /// Current - The current, underlying iterator. diff --git a/clang/include/clang/AST/AttrVisitor.h b/clang/include/clang/AST/AttrVisitor.h --- a/clang/include/clang/AST/AttrVisitor.h +++ b/clang/include/clang/AST/AttrVisitor.h @@ -22,7 +22,7 @@ /// A simple visitor class that helps create attribute visitors. template