Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang tooling generated visibility macros for Clang #109702

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion clang/include/clang/APINotes/APINotesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/APINotes/APINotesReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/APINotes/APINotesWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions clang/include/clang/APINotes/APINotesYAMLCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);
Expand Down
21 changes: 11 additions & 10 deletions clang/include/clang/APINotes/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
17 changes: 9 additions & 8 deletions clang/include/clang/ARCMigrate/ARCMT.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -75,25 +76,25 @@ 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);

/// Get the set of file remappings from a list of files with remapping
/// 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;
Expand All @@ -107,7 +108,7 @@ class MigrationProcess {
DiagnosticConsumer *diagClient,
StringRef outputDir = StringRef());

class RewriteListener {
class CLANG_ABI RewriteListener {
public:
virtual ~RewriteListener();

Expand Down
11 changes: 6 additions & 5 deletions clang/include/clang/ARCMigrate/ARCMTActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,37 @@

#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;

public:
CheckAction(std::unique_ptr<FrontendAction> WrappedAction);
};

class ModifyAction : public WrapperFrontendAction {
class CLANG_ABI ModifyAction : public WrapperFrontendAction {
protected:
bool BeginInvocation(CompilerInstance &CI) override;

public:
ModifyAction(std::unique_ptr<FrontendAction> WrappedAction);
};

class MigrateSourceAction : public ASTFrontendAction {
class CLANG_ABI MigrateSourceAction : public ASTFrontendAction {
FileRemapper Remapper;
protected:
bool BeginInvocation(CompilerInstance &CI) override;
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) override;
};

class MigrateAction : public WrapperFrontendAction {
class CLANG_ABI MigrateAction : public WrapperFrontendAction {
std::string MigrateDir;
std::string PlistOut;
bool EmitPremigrationARCErrors;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/ARCMigrate/FileRemapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/APNumericStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.
Expand Down
Loading
Loading