[llvm] Sketch of build and code changes for llvm shared library build using explicit visibility annotations (PR #96630)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 7 08:15:55 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 15bb02650e26875c48889053d6a9697444583721 ee6c363846a1553c2f81595f63eb2e70b5b4aa36 -- llvm/include/llvm-c/Target.h llvm/include/llvm-c/lto.h llvm/include/llvm/ADT/SmallVector.h llvm/include/llvm/ADT/ilist_node.h llvm/include/llvm/CodeGen/MachineFunction.h llvm/include/llvm/CodeGen/SelectionDAGNodes.h llvm/include/llvm/IR/Function.h llvm/include/llvm/IR/Module.h llvm/include/llvm/Passes/PassPlugin.h llvm/include/llvm/Support/Compiler.h llvm/include/llvm/Support/TargetSelect.h llvm/include/llvm/Transforms/InstCombine/InstCombiner.h llvm/include/llvm/Transforms/Scalar/GVN.h llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp llvm/lib/Support/BLAKE3/blake3.c llvm/lib/Support/SmallVector.cpp llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp llvm/lib/Target/X86/MCA/X86CustomBehaviour.cpp llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp llvm/lib/Target/X86/TargetInfo/X86TargetInfo.cpp llvm/lib/Target/X86/X86AsmPrinter.cpp llvm/lib/Target/X86/X86TargetMachine.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm-c/Target.h b/llvm/include/llvm-c/Target.h
index c68eb17189..876a2a2ba8 100644
--- a/llvm/include/llvm-c/Target.h
+++ b/llvm/include/llvm-c/Target.h
@@ -38,35 +38,35 @@ typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
/* Declare all of the target-initialization functions that are available. */
-#define LLVM_TARGET(TargetName) \
+#define LLVM_TARGET(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##TargetInfo(void);
#include "llvm/Config/Targets.def"
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
-#define LLVM_TARGET(TargetName) \
+#define LLVM_TARGET(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##Target(void);
#include "llvm/Config/Targets.def"
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
-#define LLVM_TARGET(TargetName) \
+#define LLVM_TARGET(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##TargetMC(void);
#include "llvm/Config/Targets.def"
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
/* Declare all of the available assembly printer initialization functions. */
-#define LLVM_ASM_PRINTER(TargetName) \
+#define LLVM_ASM_PRINTER(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##AsmPrinter(void);
#include "llvm/Config/AsmPrinters.def"
#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
/* Declare all of the available assembly parser initialization functions. */
-#define LLVM_ASM_PARSER(TargetName) \
+#define LLVM_ASM_PARSER(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##AsmParser(void);
#include "llvm/Config/AsmParsers.def"
#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
/* Declare all of the available disassembler initialization functions. */
-#define LLVM_DISASSEMBLER(TargetName) \
+#define LLVM_DISASSEMBLER(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##Disassembler(void);
#include "llvm/Config/Disassemblers.def"
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
@@ -205,7 +205,7 @@ LLVM_C_ABI void LLVMDisposeTargetData(LLVMTargetDataRef TD);
ownership of the target library info.
See the method llvm::PassManagerBase::add. */
LLVM_C_ABI void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI,
- LLVMPassManagerRef PM);
+ LLVMPassManagerRef PM);
/** Converts target data to a target layout string. The string must be disposed
with LLVMDisposeMessage.
@@ -237,52 +237,62 @@ LLVM_C_ABI LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef TD, unsigned AS);
/** Returns the integer type that is the same size as a pointer on a target.
See the method llvm::DataLayout::getIntPtrType. */
-LLVM_C_ABI LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD);
+LLVM_C_ABI LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C,
+ LLVMTargetDataRef TD);
/** Returns the integer type that is the same size as a pointer on a target.
This version allows the address space to be specified.
See the method llvm::DataLayout::getIntPtrType. */
-LLVM_C_ABI LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD,
- unsigned AS);
+LLVM_C_ABI LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C,
+ LLVMTargetDataRef TD,
+ unsigned AS);
/** Computes the size of a type in bytes for a target.
See the method llvm::DataLayout::getTypeSizeInBits. */
-LLVM_C_ABI unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the storage size of a type in bytes for a target.
See the method llvm::DataLayout::getTypeStoreSize. */
-LLVM_C_ABI unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the ABI size of a type in bytes for a target.
See the method llvm::DataLayout::getTypeAllocSize. */
-LLVM_C_ABI unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned long long LLVMABISizeOfType(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the ABI alignment of a type in bytes for a target.
See the method llvm::DataLayout::getTypeABISize. */
-LLVM_C_ABI unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the call frame alignment of a type in bytes for a target.
See the method llvm::DataLayout::getTypeABISize. */
-LLVM_C_ABI unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the preferred alignment of a type in bytes for a target.
See the method llvm::DataLayout::getTypeABISize. */
-LLVM_C_ABI unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty);
+LLVM_C_ABI unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD,
+ LLVMTypeRef Ty);
/** Computes the preferred alignment of a global variable in bytes for a target.
See the method llvm::DataLayout::getPreferredAlignment. */
LLVM_C_ABI unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef TD,
- LLVMValueRef GlobalVar);
+ LLVMValueRef GlobalVar);
/** Computes the structure element that contains the byte offset for a target.
See the method llvm::StructLayout::getElementContainingOffset. */
-LLVM_C_ABI unsigned LLVMElementAtOffset(LLVMTargetDataRef TD, LLVMTypeRef StructTy,
- unsigned long long Offset);
+LLVM_C_ABI unsigned LLVMElementAtOffset(LLVMTargetDataRef TD,
+ LLVMTypeRef StructTy,
+ unsigned long long Offset);
/** Computes the byte offset of the indexed struct element for a target.
See the method llvm::StructLayout::getElementContainingOffset. */
LLVM_C_ABI unsigned long long LLVMOffsetOfElement(LLVMTargetDataRef TD,
- LLVMTypeRef StructTy, unsigned Element);
+ LLVMTypeRef StructTy,
+ unsigned Element);
/**
* @}
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index ba286e8e97..04eadcefd2 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -16,8 +16,8 @@
#ifndef LLVM_C_LTO_H
#define LLVM_C_LTO_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
+#include "llvm/Support/Compiler.h"
#ifdef LLVM_BUILDING_LIBLTO
#define LLVM_LIBLTO_ABI LLVM_ABI_EXPORT
@@ -114,24 +114,21 @@ LLVM_C_EXTERN_C_BEGIN
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern const char*
-lto_get_version(void);
+LLVM_LIBLTO_ABI extern const char *lto_get_version(void);
/**
* Returns the last error string or NULL if last operation was successful.
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern const char*
-lto_get_error_message(void);
+LLVM_LIBLTO_ABI extern const char *lto_get_error_message(void);
/**
* Checks if a file is a loadable object file.
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_module_is_object_file(const char* path);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_module_is_object_file(const char *path);
/**
* Checks if a file is a loadable object compiled for requested target.
@@ -139,8 +136,8 @@ lto_module_is_object_file(const char* path);
* \since prior to LTO_API_VERSION=3
*/
LLVM_LIBLTO_ABI extern lto_bool_t
-lto_module_is_object_file_for_target(const char* path,
- const char* target_triple_prefix);
+lto_module_is_object_file_for_target(const char *path,
+ const char *target_triple_prefix);
/**
* Return true if \p Buffer contains a bitcode file with ObjC code (category
@@ -148,16 +145,16 @@ lto_module_is_object_file_for_target(const char* path,
*
* \since LTO_API_VERSION=20
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_module_has_objc_category(const void *mem, size_t length);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_module_has_objc_category(const void *mem,
+ size_t length);
/**
* Checks if a buffer is a loadable object file.
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_bool_t lto_module_is_object_file_in_memory(const void *mem,
- size_t length);
+LLVM_LIBLTO_ABI extern lto_bool_t
+lto_module_is_object_file_in_memory(const void *mem, size_t length);
/**
* Checks if a buffer is a loadable object compiled for requested target.
@@ -165,8 +162,8 @@ LLVM_LIBLTO_ABI extern lto_bool_t lto_module_is_object_file_in_memory(const void
* \since prior to LTO_API_VERSION=3
*/
LLVM_LIBLTO_ABI extern lto_bool_t
-lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
- const char* target_triple_prefix);
+lto_module_is_object_file_in_memory_for_target(
+ const void *mem, size_t length, const char *target_triple_prefix);
/**
* Loads an object file from disk.
@@ -174,8 +171,7 @@ lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_module_t
-lto_module_create(const char* path);
+LLVM_LIBLTO_ABI extern lto_module_t lto_module_create(const char *path);
/**
* Loads an object file from memory.
@@ -184,7 +180,7 @@ lto_module_create(const char* path);
* \since prior to LTO_API_VERSION=3
*/
LLVM_LIBLTO_ABI extern lto_module_t
-lto_module_create_from_memory(const void* mem, size_t length);
+lto_module_create_from_memory(const void *mem, size_t length);
/**
* Loads an object file from memory with an extra path argument.
@@ -193,7 +189,7 @@ lto_module_create_from_memory(const void* mem, size_t length);
* \since LTO_API_VERSION=9
*/
LLVM_LIBLTO_ABI extern lto_module_t
-lto_module_create_from_memory_with_path(const void* mem, size_t length,
+lto_module_create_from_memory_with_path(const void *mem, size_t length,
const char *path);
/**
@@ -250,15 +246,14 @@ lto_module_create_from_fd_at_offset(int fd, const char *path, size_t file_size,
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern void
-lto_module_dispose(lto_module_t mod);
+LLVM_LIBLTO_ABI extern void lto_module_dispose(lto_module_t mod);
/**
* Returns triple string which the object module was compiled under.
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern const char*
+LLVM_LIBLTO_ABI extern const char *
lto_module_get_target_triple(lto_module_t mod);
/**
@@ -266,8 +261,8 @@ lto_module_get_target_triple(lto_module_t mod);
*
* \since LTO_API_VERSION=4
*/
-LLVM_LIBLTO_ABI extern void
-lto_module_set_target_triple(lto_module_t mod, const char *triple);
+LLVM_LIBLTO_ABI extern void lto_module_set_target_triple(lto_module_t mod,
+ const char *triple);
/**
* Returns the number of symbols in the object module.
@@ -282,7 +277,7 @@ lto_module_get_num_symbols(lto_module_t mod);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern const char*
+LLVM_LIBLTO_ABI extern const char *
lto_module_get_symbol_name(lto_module_t mod, unsigned int index);
/**
@@ -301,8 +296,7 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
*
* \since LTO_API_VERSION=16
*/
-LLVM_LIBLTO_ABI extern const char*
-lto_module_get_linkeropts(lto_module_t mod);
+LLVM_LIBLTO_ABI extern const char *lto_module_get_linkeropts(lto_module_t mod);
/**
* If targeting mach-o on darwin, this function gets the CPU type and subtype
@@ -315,9 +309,9 @@ lto_module_get_linkeropts(lto_module_t mod);
*
* \since LTO_API_VERSION=27
*/
-LLVM_LIBLTO_ABI extern lto_bool_t lto_module_get_macho_cputype(lto_module_t mod,
- unsigned int *out_cputype,
- unsigned int *out_cpusubtype);
+LLVM_LIBLTO_ABI extern lto_bool_t
+lto_module_get_macho_cputype(lto_module_t mod, unsigned int *out_cputype,
+ unsigned int *out_cpusubtype);
/**
* This function can be used by the linker to check if a given module has
@@ -360,9 +354,9 @@ typedef void (*lto_diagnostic_handler_t)(
*
* \since LTO_API_VERSION=7
*/
-LLVM_LIBLTO_ABI extern void lto_codegen_set_diagnostic_handler(lto_code_gen_t,
- lto_diagnostic_handler_t,
- void *);
+LLVM_LIBLTO_ABI extern void
+lto_codegen_set_diagnostic_handler(lto_code_gen_t, lto_diagnostic_handler_t,
+ void *);
/**
* Instantiates a code generator.
@@ -373,8 +367,7 @@ LLVM_LIBLTO_ABI extern void lto_codegen_set_diagnostic_handler(lto_code_gen_t,
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_code_gen_t
-lto_codegen_create(void);
+LLVM_LIBLTO_ABI extern lto_code_gen_t lto_codegen_create(void);
/**
* Instantiate a code generator in its own context.
@@ -385,8 +378,7 @@ lto_codegen_create(void);
*
* \since LTO_API_VERSION=11
*/
-LLVM_LIBLTO_ABI extern lto_code_gen_t
-lto_codegen_create_in_local_context(void);
+LLVM_LIBLTO_ABI extern lto_code_gen_t lto_codegen_create_in_local_context(void);
/**
* Frees all code generator and all memory it internally allocated.
@@ -394,8 +386,7 @@ lto_codegen_create_in_local_context(void);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern void
-lto_codegen_dispose(lto_code_gen_t);
+LLVM_LIBLTO_ABI extern void lto_codegen_dispose(lto_code_gen_t);
/**
* Add an object module to the set of modules for which code will be generated.
@@ -407,8 +398,8 @@ lto_codegen_dispose(lto_code_gen_t);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_codegen_add_module(lto_code_gen_t cg,
+ lto_module_t mod);
/**
* Sets the object module for code generation. This will transfer the ownership
@@ -418,8 +409,8 @@ lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
*
* \since LTO_API_VERSION=13
*/
-LLVM_LIBLTO_ABI extern void
-lto_codegen_set_module(lto_code_gen_t cg, lto_module_t mod);
+LLVM_LIBLTO_ABI extern void lto_codegen_set_module(lto_code_gen_t cg,
+ lto_module_t mod);
/**
* Sets if debug info should be generated.
@@ -427,8 +418,8 @@ lto_codegen_set_module(lto_code_gen_t cg, lto_module_t mod);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_codegen_set_debug_model(lto_code_gen_t cg,
+ lto_debug_model);
/**
* Sets which PIC code model to generated.
@@ -436,16 +427,16 @@ lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_codegen_set_pic_model(lto_code_gen_t cg,
+ lto_codegen_model);
/**
* Sets the cpu to generate code for.
*
* \since LTO_API_VERSION=4
*/
-LLVM_LIBLTO_ABI extern void
-lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
+LLVM_LIBLTO_ABI extern void lto_codegen_set_cpu(lto_code_gen_t cg,
+ const char *cpu);
/**
* Sets the location of the assembler tool to run. If not set, libLTO
@@ -453,8 +444,8 @@ lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu);
*
* \since LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern void
-lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path);
+LLVM_LIBLTO_ABI extern void lto_codegen_set_assembler_path(lto_code_gen_t cg,
+ const char *path);
/**
* Sets extra arguments that libLTO should pass to the assembler.
@@ -462,8 +453,7 @@ lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path);
* \since LTO_API_VERSION=4
*/
LLVM_LIBLTO_ABI extern void
-lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
- int nargs);
+lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args, int nargs);
/**
* Adds to a list of all global symbols that must exist in the final generated
@@ -473,7 +463,7 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
* \since prior to LTO_API_VERSION=3
*/
LLVM_LIBLTO_ABI extern void
-lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol);
+lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char *symbol);
/**
* Writes a new object file at the specified path that contains the
@@ -483,7 +473,7 @@ lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol);
* \since LTO_API_VERSION=5
*/
LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
+lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path);
/**
* Generates code for all added modules into one native object file.
@@ -497,8 +487,8 @@ lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern const void*
-lto_codegen_compile(lto_code_gen_t cg, size_t* length);
+LLVM_LIBLTO_ABI extern const void *lto_codegen_compile(lto_code_gen_t cg,
+ size_t *length);
/**
* Generates code for all added modules into one native object file.
@@ -510,15 +500,14 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length);
* \since LTO_API_VERSION=5
*/
LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
+lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name);
/**
* Runs optimization for the merged module. Returns true on error.
*
* \since LTO_API_VERSION=12
*/
-LLVM_LIBLTO_ABI extern lto_bool_t
-lto_codegen_optimize(lto_code_gen_t cg);
+LLVM_LIBLTO_ABI extern lto_bool_t lto_codegen_optimize(lto_code_gen_t cg);
/**
* Generates code for the optimized merged module into one native object file.
@@ -532,16 +521,15 @@ lto_codegen_optimize(lto_code_gen_t cg);
*
* \since LTO_API_VERSION=12
*/
-LLVM_LIBLTO_ABI extern const void*
-lto_codegen_compile_optimized(lto_code_gen_t cg, size_t* length);
+LLVM_LIBLTO_ABI extern const void *
+lto_codegen_compile_optimized(lto_code_gen_t cg, size_t *length);
/**
* Returns the runtime API version.
*
* \since LTO_API_VERSION=12
*/
-LLVM_LIBLTO_ABI extern unsigned int
-lto_api_version(void);
+LLVM_LIBLTO_ABI extern unsigned int lto_api_version(void);
/**
* Parses options immediately, making them available as early as possible. For
@@ -555,7 +543,8 @@ lto_api_version(void);
*
* \since LTO_API_VERSION=28
*/
-LLVM_LIBLTO_ABI extern void lto_set_debug_options(const char *const *options, int number);
+LLVM_LIBLTO_ABI extern void lto_set_debug_options(const char *const *options,
+ int number);
/**
* Sets options to help debug codegen bugs. Since parsing shud only happen once,
@@ -568,8 +557,8 @@ LLVM_LIBLTO_ABI extern void lto_set_debug_options(const char *const *options, in
*
* \since prior to LTO_API_VERSION=3
*/
-LLVM_LIBLTO_ABI extern void
-lto_codegen_debug_options(lto_code_gen_t cg, const char *);
+LLVM_LIBLTO_ABI extern void lto_codegen_debug_options(lto_code_gen_t cg,
+ const char *);
/**
* Same as the previous function, but takes every option separately through an
@@ -578,7 +567,8 @@ lto_codegen_debug_options(lto_code_gen_t cg, const char *);
* \since prior to LTO_API_VERSION=26
*/
LLVM_LIBLTO_ABI extern void lto_codegen_debug_options_array(lto_code_gen_t cg,
- const char *const *, int number);
+ const char *const *,
+ int number);
/**
* Initializes LLVM disassemblers.
@@ -586,8 +576,7 @@ LLVM_LIBLTO_ABI extern void lto_codegen_debug_options_array(lto_code_gen_t cg,
*
* \since LTO_API_VERSION=5
*/
-LLVM_LIBLTO_ABI extern void
-lto_initialize_disassembler(void);
+LLVM_LIBLTO_ABI extern void lto_initialize_disassembler(void);
/**
* Sets if we should run internalize pass during optimization and code
@@ -622,9 +611,8 @@ typedef struct LLVMOpaqueLTOInput *lto_input_t;
*
* \since LTO_API_VERSION=24
*/
-LLVM_LIBLTO_ABI extern lto_input_t lto_input_create(const void *buffer,
- size_t buffer_size,
- const char *path);
+LLVM_LIBLTO_ABI extern lto_input_t
+lto_input_create(const void *buffer, size_t buffer_size, const char *path);
/**
* Frees all memory internally allocated by the LTO input file.
@@ -640,7 +628,8 @@ LLVM_LIBLTO_ABI extern void lto_input_dispose(lto_input_t input);
*
* \since LTO_API_VERSION=24
*/
-LLVM_LIBLTO_ABI extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);
+LLVM_LIBLTO_ABI extern unsigned
+lto_input_get_num_dependent_libraries(lto_input_t input);
/**
* Returns the ith dependent library specifier
@@ -649,9 +638,8 @@ LLVM_LIBLTO_ABI extern unsigned lto_input_get_num_dependent_libraries(lto_input_
*
* \since LTO_API_VERSION=24
*/
-LLVM_LIBLTO_ABI extern const char * lto_input_get_dependent_library(lto_input_t input,
- size_t index,
- size_t *size);
+LLVM_LIBLTO_ABI extern const char *
+lto_input_get_dependent_library(lto_input_t input, size_t index, size_t *size);
/**
* Returns the list of libcall symbols that can be generated by LTO
@@ -659,7 +647,8 @@ LLVM_LIBLTO_ABI extern const char * lto_input_get_dependent_library(lto_input_t
*
* \since prior to LTO_API_VERSION=25
*/
-LLVM_LIBLTO_ABI extern const char *const *lto_runtime_lib_symbols_list(size_t *size);
+LLVM_LIBLTO_ABI extern const char *const *
+lto_runtime_lib_symbols_list(size_t *size);
/**
* @} // endgoup LLVMCLTO
@@ -713,8 +702,9 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_dispose(thinlto_code_gen_t cg);
* \since LTO_API_VERSION=18
*/
LLVM_LIBLTO_ABI extern void thinlto_codegen_add_module(thinlto_code_gen_t cg,
- const char *identifier, const char *data,
- int length);
+ const char *identifier,
+ const char *data,
+ int length);
/**
* Optimize and codegen all the modules added to the codegenerator using
@@ -733,7 +723,8 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_process(thinlto_code_gen_t cg);
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern unsigned int thinlto_module_get_num_objects(thinlto_code_gen_t cg);
+LLVM_LIBLTO_ABI extern unsigned int
+thinlto_module_get_num_objects(thinlto_code_gen_t cg);
/**
* Returns a reference to the ith object file produced by the ThinLTO
@@ -744,8 +735,8 @@ LLVM_LIBLTO_ABI extern unsigned int thinlto_module_get_num_objects(thinlto_code_
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg,
- unsigned int index);
+LLVM_LIBLTO_ABI extern LTOObjectBuffer
+thinlto_module_get_object(thinlto_code_gen_t cg, unsigned int index);
/**
* Returns the number of object files produced by the ThinLTO CodeGenerator.
@@ -756,7 +747,8 @@ LLVM_LIBLTO_ABI extern LTOObjectBuffer thinlto_module_get_object(thinlto_code_ge
*
* \since LTO_API_VERSION=21
*/
-LLVM_LIBLTO_ABI unsigned int thinlto_module_get_num_object_files(thinlto_code_gen_t cg);
+LLVM_LIBLTO_ABI unsigned int
+thinlto_module_get_num_object_files(thinlto_code_gen_t cg);
/**
* Returns the path to the ith object file produced by the ThinLTO
@@ -767,8 +759,8 @@ LLVM_LIBLTO_ABI unsigned int thinlto_module_get_num_object_files(thinlto_code_ge
*
* \since LTO_API_VERSION=21
*/
-LLVM_LIBLTO_ABI const char *thinlto_module_get_object_file(thinlto_code_gen_t cg,
- unsigned int index);
+LLVM_LIBLTO_ABI const char *
+thinlto_module_get_object_file(thinlto_code_gen_t cg, unsigned int index);
/**
* Sets which PIC code model to generate.
@@ -776,8 +768,8 @@ LLVM_LIBLTO_ABI const char *thinlto_module_get_object_file(thinlto_code_gen_t cg
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,
- lto_codegen_model);
+LLVM_LIBLTO_ABI extern lto_bool_t
+thinlto_codegen_set_pic_model(thinlto_code_gen_t cg, lto_codegen_model);
/**
* Sets the path to a directory to use as a storage for temporary bitcode files.
@@ -786,8 +778,9 @@ LLVM_LIBLTO_ABI extern lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,
- const char *save_temps_dir);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,
+ const char *save_temps_dir);
/**
* Set the path to a directory where to save generated object files. This
@@ -797,15 +790,17 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t
*
* \since LTO_API_VERSION=21
*/
-LLVM_LIBLTO_ABI void thinlto_set_generated_objects_dir(thinlto_code_gen_t cg,
- const char *save_temps_dir);
+LLVM_LIBLTO_ABI void
+thinlto_set_generated_objects_dir(thinlto_code_gen_t cg,
+ const char *save_temps_dir);
/**
* Sets the cpu to generate code for.
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg, const char *cpu);
+LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg,
+ const char *cpu);
/**
* Disable CodeGen, only run the stages till codegen and stop. The output will
@@ -813,23 +808,25 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cpu(thinlto_code_gen_t cg, const
*
* \since LTO_API_VERSION=19
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_disable_codegen(thinlto_code_gen_t cg,
- lto_bool_t disable);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_disable_codegen(thinlto_code_gen_t cg, lto_bool_t disable);
/**
* Perform CodeGen only: disable all other stages.
*
* \since LTO_API_VERSION=19
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg,
- lto_bool_t codegen_only);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg,
+ lto_bool_t codegen_only);
/**
* Parse -mllvm style debug options.
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_debug_options(const char *const *options, int number);
+LLVM_LIBLTO_ABI extern void thinlto_debug_options(const char *const *options,
+ int number);
/**
* Test if a module has support for ThinLTO linking.
@@ -846,9 +843,9 @@ LLVM_LIBLTO_ABI extern lto_bool_t lto_module_is_thinlto(lto_module_t mod);
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,
- const char *name,
- int length);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,
+ const char *name, int length);
/**
* Adds a symbol to the list of global symbols that are cross-referenced between
@@ -858,9 +855,9 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_add_must_preserve_symbol(thinlto_cod
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
- const char *name,
- int length);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
+ const char *name, int length);
/**
* @} // endgoup LLVMCTLTO
@@ -889,8 +886,8 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_add_cross_referenced_symbol(thinlto_
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
- const char *cache_dir);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg, const char *cache_dir);
/**
* Sets the cache pruning interval (in seconds). A negative value disables the
@@ -899,8 +896,8 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg,
- int interval);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg, int interval);
/**
* Sets the maximum cache size that can be persistent across build, in terms of
@@ -915,7 +912,8 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_pruning_interval(thinlto_c
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_final_cache_size_relative_to_available_space(
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_final_cache_size_relative_to_available_space(
thinlto_code_gen_t cg, unsigned percentage);
/**
@@ -924,8 +922,9 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_final_cache_size_relative_to_ava
*
* \since LTO_API_VERSION=18
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,
- unsigned expiration);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,
+ unsigned expiration);
/**
* Sets the maximum size of the cache directory (in bytes). A value over the
@@ -935,8 +934,9 @@ LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_entry_expiration(thinlto_c
*
* \since LTO_API_VERSION=22
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,
- unsigned max_size_bytes);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,
+ unsigned max_size_bytes);
/**
* Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in
@@ -954,8 +954,9 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
*
* \since LTO_API_VERSION=22
*/
-LLVM_LIBLTO_ABI extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
- unsigned max_size_files);
+LLVM_LIBLTO_ABI extern void
+thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
+ unsigned max_size_files);
/**
* @} // endgroup LLVMCTLTO_CACHING
diff --git a/llvm/include/llvm/ADT/ilist_node.h b/llvm/include/llvm/ADT/ilist_node.h
index 3bd367954d..6d268d093a 100644
--- a/llvm/include/llvm/ADT/ilist_node.h
+++ b/llvm/include/llvm/ADT/ilist_node.h
@@ -299,7 +299,7 @@ public:
/// @name Adjacent Node Accessors
/// @{
/// Get the previous node, or \c nullptr for the list head.
- template<int = 0> NodeTy *getPrevNode() {
+ template <int = 0> NodeTy *getPrevNode() {
// Should be separated to a reused function, but then we couldn't use auto
// (and would need the type of the list).
const auto &List =
@@ -308,12 +308,12 @@ public:
}
/// Get the previous node, or \c nullptr for the list head.
- template<int = 0> const NodeTy *getPrevNode() const {
+ template <int = 0> const NodeTy *getPrevNode() const {
return const_cast<ilist_node_with_parent *>(this)->getPrevNode();
}
/// Get the next node, or \c nullptr for the list tail.
- template<int = 0> NodeTy *getNextNode() {
+ template <int = 0> NodeTy *getNextNode() {
// Should be separated to a reused function, but then we couldn't use auto
// (and would need the type of the list).
const auto &List =
@@ -322,7 +322,7 @@ public:
}
/// Get the next node, or \c nullptr for the list tail.
- template<int = 0> const NodeTy *getNextNode() const {
+ template <int = 0> const NodeTy *getNextNode() const {
return const_cast<ilist_node_with_parent *>(this)->getNextNode();
}
/// @}
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index 6aa9a10aab..4a4e99dd98 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -114,7 +114,8 @@
/// this attribute will be made public and visible outside of any shared library
/// they are linked in to.
-#if LLVM_HAS_CPP_ATTRIBUTE(gnu::visibility) && defined(__GNUC__) && !defined(__clang__)
+#if LLVM_HAS_CPP_ATTRIBUTE(gnu::visibility) && defined(__GNUC__) && \
+ !defined(__clang__)
#define LLVM_ATTRIBUTE_VISIBILITY_HIDDEN [[gnu::visibility("hidden")]]
#define LLVM_ATTRIBUTE_VISIBILITY_DEFAULT [[gnu::visibility("default")]]
#elif __has_attribute(visibility)
@@ -139,21 +140,21 @@
#endif
/// LLVM_ABI is the main export/visibility macro to mark something as explicitly
-/// exported when llvm is built as a shared library with everything else that is
+/// exported when llvm is built as a shared library with everything else that is
/// unannotated will have internal visibility.
-///
+///
/// LLVM_EXPORT_TEMPLATE is used on explicit template instantiations in source
-/// files that were declared extern in a header. This macro is only set as a
+/// files that were declared extern in a header. This macro is only set as a
/// compiler export attribute on windows, on other platforms it does nothing.
-///
-/// LLVM_TEMPLATE_ABI is for annotating extern template declarations in headers
-/// for both functions and classes. On windows its turned in to dllimport for
+///
+/// LLVM_TEMPLATE_ABI is for annotating extern template declarations in headers
+/// for both functions and classes. On windows its turned in to dllimport for
/// library consumers, for other platforms its a default visibility attribute.
-///
-/// LLVM_C_ABI is used to annotated functions and data that need to be exported
-/// for the libllvm-c API. This used both for the llvm-c headers and for the
-/// functions declared in the different Target's c++ source files that don't include
-/// the header forward declaring them.
+///
+/// LLVM_C_ABI is used to annotated functions and data that need to be exported
+/// for the libllvm-c API. This used both for the llvm-c headers and for the
+/// functions declared in the different Target's c++ source files that don't
+/// include the header forward declaring them.
#ifndef LLVM_ABI_GENERATING_ANNOTATIONS
// Marker to add to classes or functions in public headers that should not have
// export macros added to them by the clang tool
diff --git a/llvm/include/llvm/Support/TargetSelect.h b/llvm/include/llvm/Support/TargetSelect.h
index 255b37be5e..7435dca627 100644
--- a/llvm/include/llvm/Support/TargetSelect.h
+++ b/llvm/include/llvm/Support/TargetSelect.h
@@ -20,31 +20,37 @@
extern "C" {
// Declare all of the target-initialization functions that are available.
-#define LLVM_TARGET(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##TargetInfo();
+#define LLVM_TARGET(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##TargetInfo();
#include "llvm/Config/Targets.def"
-#define LLVM_TARGET(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##Target();
+#define LLVM_TARGET(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##Target();
#include "llvm/Config/Targets.def"
// Declare all of the target-MC-initialization functions that are available.
-#define LLVM_TARGET(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##TargetMC();
+#define LLVM_TARGET(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##TargetMC();
#include "llvm/Config/Targets.def"
// Declare all of the available assembly printer initialization functions.
-#define LLVM_ASM_PRINTER(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##AsmPrinter();
+#define LLVM_ASM_PRINTER(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##AsmPrinter();
#include "llvm/Config/AsmPrinters.def"
// Declare all of the available assembly parser initialization functions.
-#define LLVM_ASM_PARSER(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##AsmParser();
+#define LLVM_ASM_PARSER(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##AsmParser();
#include "llvm/Config/AsmParsers.def"
// Declare all of the available disassembler initialization functions.
-#define LLVM_DISASSEMBLER(TargetName) \
+#define LLVM_DISASSEMBLER(TargetName) \
LLVM_C_ABI void LLVMInitialize##TargetName##Disassembler();
#include "llvm/Config/Disassemblers.def"
// Declare all of the available TargetMCA initialization functions.
-#define LLVM_TARGETMCA(TargetName) LLVM_C_ABI void LLVMInitialize##TargetName##TargetMCA();
+#define LLVM_TARGETMCA(TargetName) \
+ LLVM_C_ABI void LLVMInitialize##TargetName##TargetMCA();
#include "llvm/Config/TargetMCAs.def"
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/96630
More information about the llvm-commits
mailing list