Skip to content

Commit d16fc30

Browse files
committed
[llvm] IDS auto codemod for TextAPI library
1 parent 339797d commit d16fc30

18 files changed

+167
-149
lines changed

llvm/include/llvm-c/Error.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_C_ERROR_H
1515
#define LLVM_C_ERROR_H
1616

17+
#include "llvm/Support/Compiler.h"
1718
#include "llvm-c/ExternC.h"
1819

1920
LLVM_C_EXTERN_C_BEGIN
@@ -41,46 +42,46 @@ typedef const void *LLVMErrorTypeId;
4142
* Returns the type id for the given error instance, which must be a failure
4243
* value (i.e. non-null).
4344
*/
44-
LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
45+
LLVM_ABI LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
4546

4647
/**
4748
* Dispose of the given error without handling it. This operation consumes the
4849
* error, and the given LLVMErrorRef value is not usable once this call returns.
4950
* Note: This method *only* needs to be called if the error is not being passed
5051
* to some other consuming operation, e.g. LLVMGetErrorMessage.
5152
*/
52-
void LLVMConsumeError(LLVMErrorRef Err);
53+
LLVM_ABI void LLVMConsumeError(LLVMErrorRef Err);
5354

5455
/**
5556
* Report a fatal error if Err is a failure value.
5657
*
5758
* This function can be used to wrap calls to fallible functions ONLY when it is
5859
* known that the Error will always be a success value.
5960
*/
60-
void LLVMCantFail(LLVMErrorRef Err);
61+
LLVM_ABI void LLVMCantFail(LLVMErrorRef Err);
6162

6263
/**
6364
* Returns the given string's error message. This operation consumes the error,
6465
* and the given LLVMErrorRef value is not usable once this call returns.
6566
* The caller is responsible for disposing of the string by calling
6667
* LLVMDisposeErrorMessage.
6768
*/
68-
char *LLVMGetErrorMessage(LLVMErrorRef Err);
69+
LLVM_ABI char *LLVMGetErrorMessage(LLVMErrorRef Err);
6970

7071
/**
7172
* Dispose of the given error message.
7273
*/
73-
void LLVMDisposeErrorMessage(char *ErrMsg);
74+
LLVM_ABI void LLVMDisposeErrorMessage(char *ErrMsg);
7475

7576
/**
7677
* Returns the type id for llvm StringError.
7778
*/
78-
LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
79+
LLVM_ABI LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
7980

8081
/**
8182
* Create a StringError.
8283
*/
83-
LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
84+
LLVM_ABI LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
8485

8586
/**
8687
* @}

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_TARGETPARSER_TRIPLE_H
1010
#define LLVM_TARGETPARSER_TRIPLE_H
1111

12+
#include "llvm/Support/Compiler.h"
1213
#include "llvm/ADT/Twine.h"
1314
#include "llvm/Support/VersionTuple.h"
1415

@@ -348,9 +349,9 @@ class Triple {
348349
/// triple fields unknown.
349350
Triple() = default;
350351

351-
explicit Triple(const Twine &Str);
352-
Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
353-
Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
352+
LLVM_ABI explicit Triple(const Twine &Str);
353+
LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
354+
LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
354355
const Twine &EnvironmentStr);
355356

356357
bool operator==(const Triple &Other) const {
@@ -381,7 +382,7 @@ class Triple {
381382
/// reasonably be done). In particular, it handles the common case in which
382383
/// otherwise valid components are in the wrong order. \p Form is used to
383384
/// specify the output canonical form.
384-
static std::string normalize(StringRef Str,
385+
LLVM_ABI static std::string normalize(StringRef Str,
385386
CanonicalForm Form = CanonicalForm::ANY);
386387

387388
/// Return the normalized form of this triple's string.
@@ -417,7 +418,7 @@ class Triple {
417418
/// triple, if present.
418419
///
419420
/// For example, "fooos1.2.3" would return (1, 2, 3).
420-
VersionTuple getEnvironmentVersion() const;
421+
LLVM_ABI VersionTuple getEnvironmentVersion() const;
421422

422423
/// Get the object format for this triple.
423424
ObjectFormatType getObjectFormat() const { return ObjectFormat; }
@@ -426,7 +427,7 @@ class Triple {
426427
/// present.
427428
///
428429
/// For example, "fooos1.2.3" would return (1, 2, 3).
429-
VersionTuple getOSVersion() const;
430+
LLVM_ABI VersionTuple getOSVersion() const;
430431

431432
/// Return just the major version number, this is specialized because it is a
432433
/// common query.
@@ -436,26 +437,26 @@ class Triple {
436437
/// "darwin" versions to the corresponding OS X versions. This may also be
437438
/// called with IOS triples but the OS X version number is just set to a
438439
/// constant 10.4.0 in that case. Returns true if successful.
439-
bool getMacOSXVersion(VersionTuple &Version) const;
440+
LLVM_ABI bool getMacOSXVersion(VersionTuple &Version) const;
440441

441442
/// Parse the version number as with getOSVersion. This should only be called
442443
/// with IOS or generic triples.
443-
VersionTuple getiOSVersion() const;
444+
LLVM_ABI VersionTuple getiOSVersion() const;
444445

445446
/// Parse the version number as with getOSVersion. This should only be called
446447
/// with WatchOS or generic triples.
447-
VersionTuple getWatchOSVersion() const;
448+
LLVM_ABI VersionTuple getWatchOSVersion() const;
448449

449450
/// Parse the version number as with getOSVersion.
450-
VersionTuple getDriverKitVersion() const;
451+
LLVM_ABI VersionTuple getDriverKitVersion() const;
451452

452453
/// Parse the Vulkan version number from the OSVersion and SPIR-V version
453454
/// (SubArch). This should only be called with Vulkan SPIR-V triples.
454-
VersionTuple getVulkanVersion() const;
455+
LLVM_ABI VersionTuple getVulkanVersion() const;
455456

456457
/// Parse the DXIL version number from the OSVersion and DXIL version
457458
/// (SubArch). This should only be called with DXIL triples.
458-
VersionTuple getDXILVersion() const;
459+
LLVM_ABI VersionTuple getDXILVersion() const;
459460

460461
/// @}
461462
/// @name Direct Component Access
@@ -469,42 +470,42 @@ class Triple {
469470
bool empty() const { return Data.empty(); }
470471

471472
/// Get the architecture (first) component of the triple.
472-
StringRef getArchName() const;
473+
LLVM_ABI StringRef getArchName() const;
473474

474475
/// Get the vendor (second) component of the triple.
475-
StringRef getVendorName() const;
476+
LLVM_ABI StringRef getVendorName() const;
476477

477478
/// Get the operating system (third) component of the triple.
478-
StringRef getOSName() const;
479+
LLVM_ABI StringRef getOSName() const;
479480

480481
/// Get the optional environment (fourth) component of the triple, or "" if
481482
/// empty.
482-
StringRef getEnvironmentName() const;
483+
LLVM_ABI StringRef getEnvironmentName() const;
483484

484485
/// Get the operating system and optional environment components as a single
485486
/// string (separated by a '-' if the environment component is present).
486-
StringRef getOSAndEnvironmentName() const;
487+
LLVM_ABI StringRef getOSAndEnvironmentName() const;
487488

488489
/// Get the version component of the environment component as a single
489490
/// string (the version after the environment).
490491
///
491492
/// For example, "fooos1.2.3" would return "1.2.3".
492-
StringRef getEnvironmentVersionString() const;
493+
LLVM_ABI StringRef getEnvironmentVersionString() const;
493494

494495
/// @}
495496
/// @name Convenience Predicates
496497
/// @{
497498

498499
/// Returns the pointer width of this architecture.
499-
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
500+
LLVM_ABI static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
500501

501502
/// Returns the pointer width of this architecture.
502503
unsigned getArchPointerBitWidth() const {
503504
return getArchPointerBitWidth(getArch());
504505
}
505506

506507
/// Returns the trampoline size in bytes for this configuration.
507-
unsigned getTrampolineSize() const;
508+
LLVM_ABI unsigned getTrampolineSize() const;
508509

509510
/// Test whether the architecture is 64-bit
510511
///
@@ -513,17 +514,17 @@ class Triple {
513514
/// 16-bit. The inner details of pointer width for particular architectures
514515
/// is not summed up in the triple, and so only a coarse grained predicate
515516
/// system is provided.
516-
bool isArch64Bit() const;
517+
LLVM_ABI bool isArch64Bit() const;
517518

518519
/// Test whether the architecture is 32-bit
519520
///
520521
/// Note that this tests for 32-bit pointer width, and nothing else.
521-
bool isArch32Bit() const;
522+
LLVM_ABI bool isArch32Bit() const;
522523

523524
/// Test whether the architecture is 16-bit
524525
///
525526
/// Note that this tests for 16-bit pointer width, and nothing else.
526-
bool isArch16Bit() const;
527+
LLVM_ABI bool isArch16Bit() const;
527528

528529
/// Helper function for doing comparisons against version numbers included in
529530
/// the target triple.
@@ -544,7 +545,7 @@ class Triple {
544545

545546
/// Comparison function for checking OS X version compatibility, which handles
546547
/// supporting skewed version numbering schemes used by the "darwin" triples.
547-
bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
548+
LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
548549
unsigned Micro = 0) const;
549550

550551
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
@@ -1143,38 +1144,38 @@ class Triple {
11431144
/// @{
11441145

11451146
/// Set the architecture (first) component of the triple to a known type.
1146-
void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
1147+
LLVM_ABI void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
11471148

11481149
/// Set the vendor (second) component of the triple to a known type.
1149-
void setVendor(VendorType Kind);
1150+
LLVM_ABI void setVendor(VendorType Kind);
11501151

11511152
/// Set the operating system (third) component of the triple to a known type.
1152-
void setOS(OSType Kind);
1153+
LLVM_ABI void setOS(OSType Kind);
11531154

11541155
/// Set the environment (fourth) component of the triple to a known type.
1155-
void setEnvironment(EnvironmentType Kind);
1156+
LLVM_ABI void setEnvironment(EnvironmentType Kind);
11561157

11571158
/// Set the object file format.
1158-
void setObjectFormat(ObjectFormatType Kind);
1159+
LLVM_ABI void setObjectFormat(ObjectFormatType Kind);
11591160

11601161
/// Set all components to the new triple \p Str.
1161-
void setTriple(const Twine &Str);
1162+
LLVM_ABI void setTriple(const Twine &Str);
11621163

11631164
/// Set the architecture (first) component of the triple by name.
1164-
void setArchName(StringRef Str);
1165+
LLVM_ABI void setArchName(StringRef Str);
11651166

11661167
/// Set the vendor (second) component of the triple by name.
1167-
void setVendorName(StringRef Str);
1168+
LLVM_ABI void setVendorName(StringRef Str);
11681169

11691170
/// Set the operating system (third) component of the triple by name.
1170-
void setOSName(StringRef Str);
1171+
LLVM_ABI void setOSName(StringRef Str);
11711172

11721173
/// Set the optional environment (fourth) component of the triple by name.
1173-
void setEnvironmentName(StringRef Str);
1174+
LLVM_ABI void setEnvironmentName(StringRef Str);
11741175

11751176
/// Set the operating system and optional environment components with a single
11761177
/// string.
1177-
void setOSAndEnvironmentName(StringRef Str);
1178+
LLVM_ABI void setOSAndEnvironmentName(StringRef Str);
11781179

11791180
/// @}
11801181
/// @name Helpers to build variants of a particular triple.
@@ -1186,92 +1187,92 @@ class Triple {
11861187
///
11871188
/// \returns A new triple with a 32-bit architecture or an unknown
11881189
/// architecture if no such variant can be found.
1189-
llvm::Triple get32BitArchVariant() const;
1190+
LLVM_ABI llvm::Triple get32BitArchVariant() const;
11901191

11911192
/// Form a triple with a 64-bit variant of the current architecture.
11921193
///
11931194
/// This can be used to move across "families" of architectures where useful.
11941195
///
11951196
/// \returns A new triple with a 64-bit architecture or an unknown
11961197
/// architecture if no such variant can be found.
1197-
llvm::Triple get64BitArchVariant() const;
1198+
LLVM_ABI llvm::Triple get64BitArchVariant() const;
11981199

11991200
/// Form a triple with a big endian variant of the current architecture.
12001201
///
12011202
/// This can be used to move across "families" of architectures where useful.
12021203
///
12031204
/// \returns A new triple with a big endian architecture or an unknown
12041205
/// architecture if no such variant can be found.
1205-
llvm::Triple getBigEndianArchVariant() const;
1206+
LLVM_ABI llvm::Triple getBigEndianArchVariant() const;
12061207

12071208
/// Form a triple with a little endian variant of the current architecture.
12081209
///
12091210
/// This can be used to move across "families" of architectures where useful.
12101211
///
12111212
/// \returns A new triple with a little endian architecture or an unknown
12121213
/// architecture if no such variant can be found.
1213-
llvm::Triple getLittleEndianArchVariant() const;
1214+
LLVM_ABI llvm::Triple getLittleEndianArchVariant() const;
12141215

12151216
/// Tests whether the target triple is little endian.
12161217
///
12171218
/// \returns true if the triple is little endian, false otherwise.
1218-
bool isLittleEndian() const;
1219+
LLVM_ABI bool isLittleEndian() const;
12191220

12201221
/// Test whether target triples are compatible.
1221-
bool isCompatibleWith(const Triple &Other) const;
1222+
LLVM_ABI bool isCompatibleWith(const Triple &Other) const;
12221223

12231224
/// Test whether the target triple is for a GPU.
12241225
bool isGPU() const { return isSPIRV() || isNVPTX() || isAMDGPU(); }
12251226

12261227
/// Merge target triples.
1227-
std::string merge(const Triple &Other) const;
1228+
LLVM_ABI std::string merge(const Triple &Other) const;
12281229

12291230
/// Some platforms have different minimum supported OS versions that
12301231
/// varies by the architecture specified in the triple. This function
12311232
/// returns the minimum supported OS version for this triple if one an exists,
12321233
/// or an invalid version tuple if this triple doesn't have one.
1233-
VersionTuple getMinimumSupportedOSVersion() const;
1234+
LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const;
12341235

12351236
/// @}
12361237
/// @name Static helpers for IDs.
12371238
/// @{
12381239

12391240
/// Get the canonical name for the \p Kind architecture.
1240-
static StringRef getArchTypeName(ArchType Kind);
1241+
LLVM_ABI static StringRef getArchTypeName(ArchType Kind);
12411242

12421243
/// Get the architecture name based on \p Kind and \p SubArch.
1243-
static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
1244+
LLVM_ABI static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
12441245

12451246
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
12461247
/// prefix used by the architecture specific builtins, and is suitable for
12471248
/// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
12481249
///
12491250
/// \return - The architecture prefix, or 0 if none is defined.
1250-
static StringRef getArchTypePrefix(ArchType Kind);
1251+
LLVM_ABI static StringRef getArchTypePrefix(ArchType Kind);
12511252

12521253
/// Get the canonical name for the \p Kind vendor.
1253-
static StringRef getVendorTypeName(VendorType Kind);
1254+
LLVM_ABI static StringRef getVendorTypeName(VendorType Kind);
12541255

12551256
/// Get the canonical name for the \p Kind operating system.
1256-
static StringRef getOSTypeName(OSType Kind);
1257+
LLVM_ABI static StringRef getOSTypeName(OSType Kind);
12571258

12581259
/// Get the canonical name for the \p Kind environment.
1259-
static StringRef getEnvironmentTypeName(EnvironmentType Kind);
1260+
LLVM_ABI static StringRef getEnvironmentTypeName(EnvironmentType Kind);
12601261

12611262
/// Get the name for the \p Object format.
1262-
static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
1263+
LLVM_ABI static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
12631264

12641265
/// @}
12651266
/// @name Static helpers for converting alternate architecture names.
12661267
/// @{
12671268

12681269
/// The canonical type for the given LLVM architecture name (e.g., "x86").
1269-
static ArchType getArchTypeForLLVMName(StringRef Str);
1270+
LLVM_ABI static ArchType getArchTypeForLLVMName(StringRef Str);
12701271

12711272
/// @}
12721273

12731274
/// Returns a canonicalized OS version number for the specified OS.
1274-
static VersionTuple getCanonicalVersionForOS(OSType OSKind,
1275+
LLVM_ABI static VersionTuple getCanonicalVersionForOS(OSType OSKind,
12751276
const VersionTuple &Version);
12761277
};
12771278

0 commit comments

Comments
 (0)