llvm::StringRef

Represent a constant reference to a string, i.e. a character array and a length, which need not be null terminated.

Synopsis

Declared in <llvm/ADT/StringRef.h>

class StringRef;

Description

This class does not own the string data, it is expected to be used in situations where the character data resides in some other buffer, whose lifetime extends past that of the StringRef. For this reason, it is not in general safe to store a StringRef.

Type Aliases

NameDescription
const_iterator Const iterator over characters in the string.
const_reverse_iterator Const reverse iterator over characters in the string.
iterator Iterator over characters in the string.
reverse_iterator Reverse iterator over characters in the string.
size_type Unsigned type used for sizes and indices.
value_type Character type of the referenced string.

Member Functions

NameDescription
StringRef [constructor]Constructors
operator= [deleted]Disallow accidental assignment from a temporary std::string.
back Get the last character in the string.
begin Return an iterator to the first character.
bytes Return a range over the string's bytes as unsigned chars.
bytes_begin Return an iterator to the first byte of the string.
bytes_end Return an iterator one past the last byte of the string.
compare Compare two strings; the result is negative, zero, or positive if this string is lexicographically less than, equal to, or greater than the RHS.
compare_insensitive Compare two strings, ignoring case.
compare_numeric Compare two strings, treating sequences of digits as numbers.
consumeInteger consumeInteger overloads
consume_back Returns true if this StringRef has the given suffix and removes that suffix.
consume_back_insensitive Returns true if this StringRef has the given suffix, ignoring case, and removes that suffix.
consume_front Returns true if this StringRef has the given prefix and removes that prefix.
consume_front_insensitive Returns true if this StringRef has the given prefix, ignoring case, and removes that prefix.
contains contains overloads
contains_insensitive contains_insensitive overloads
copy Allocate a copy in A and return a StringRef to it.
count count overloads
data Get a pointer to the start of the string (which may not be null terminated).
detectEOL Detect the line ending style of the string.
drop_back Return a StringRef equal to 'this' but with the last N elements dropped.
drop_front Return a StringRef equal to 'this' but with the first N elements dropped.
drop_until Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string.
drop_while Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string.
edit_distance Determine the edit distance between this string and another string.
edit_distance_insensitive Compute a case-insensitive edit distance to Other.
empty Check if the string is empty.
end Return an iterator past the last character.
ends_with ends_with overloads
ends_with_insensitive Check if this string ends with the given Suffix, ignoring case.
equals_insensitive Check for string equality, ignoring case.
find find overloads
find_first_not_of find_first_not_of overloads
find_first_of find_first_of overloads
find_if Search for the first character satisfying the predicate F
find_if_not Search for the first character not satisfying the predicate F
find_insensitive find_insensitive overloads
find_last_not_of find_last_not_of overloads
find_last_of find_last_of overloads
front Get the first character in the string.
getAsDouble Parse the current string as an IEEE double-precision floating point value.
getAsInteger getAsInteger overloads
lower Convert the given ASCII string to lowercase.
ltrim ltrim overloads
nonEmptyOr Returns this StringRef or a default value if this StringRef is empty.
operator[] Return the character at Index.
rbegin Return a reverse iterator to the last character.
rend Return a reverse iterator to the character before the first character.
rfind rfind overloads
rfind_if Search for the last character satisfying the predicate F
rfind_if_not Search for the last character not satisfying the predicate F
rfind_insensitive rfind_insensitive overloads
rsplit rsplit overloads
rtrim rtrim overloads
size Get the string size.
slice Return a reference to the substring from [Start, End).]
split split overloads
starts_with starts_with overloads
starts_with_insensitive Check if this string starts with the given Prefix, ignoring case.
str Get the contents as an std::string.
substr Return a reference to the substring from [Start, Start + N).]
take_back Return a StringRef equal to 'this' but with only the last N elements remaining. If N is greater than the length of the string, the entire string is returned.
take_front Return a StringRef equal to 'this' but with only the first N elements remaining. If N is greater than the length of the string, the entire string is returned.
take_until Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
take_while Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
trim trim overloads
upper Convert the given ASCII string to uppercase.
operator std::string_view Convert this StringRef to an std::string_view.

Static Data Members

NameDescription
npos Sentinel index value meaning "not found".

Non-Member Functions

NameDescription
ConvertUTF8toWideConverts a UTF-8 StringRef to a std::wstring.
DiffFilesWithToleranceCompare two files, allowing absolute and relative floating-point tolerance.
DisplayGraphDisplay a DOT graph file with the given Graphviz program.
EmitImportsFilesEmit into OutputFilename the files module ModulePath will import from.
MD5HashHelper to compute and return lower 64 bits of the given string's MD5 hash.
SplitStringSplit Source on Delimiters, appending fragments to OutFragments.
StrCmpOptionNameCompare two option name (or prefix) strings for sorting.
StripTemplateParametersStrips template parameters from a templated function name.
UpgradeDataLayoutStringUpgrade the datalayout string by adding a section for address space pointers.
arrayRefFromStringRefConstruct an array ref of bytes from a string ref.
caseFoldingDjbHashComputes the Bernstein hash after folding the input according to the Dwarf 5 standard case folding rules.
center_justifycenter_justify - add spaces before and after string so total output is Width characters. If Str is larger that Width, full string is written with no padding.
computeArchiveRelativePathCompute a relative path from the directory of From to To.
consumeSignedIntegerParse a signed integer from the front of Str using Radix into Result.
consumeUnsignedIntegerParse an unsigned integer from the front of Str using Radix into Result.
convertExceptionBehaviorToStrFor any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic exception behavior metadata.
convertRoundingModeToStrFor any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mode metadata.
convertStrToExceptionBehaviorReturns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrinsic exception behavior metadata.
convertStrToRoundingModeReturns a valid RoundingMode enumerator when given a string that is valid as input in constrained intrinsic rounding mode metadata.
convertToCamelFromSnakeCaseConvert a snake-case string to camel-case.
convertToSnakeFromCamelCaseConvert a camel-case string to snake-case.
convertUTF8ToUTF16StringConverts a UTF-8 string into a UTF-16 string with native endianness.
createCtxProfFromYAMLConvert a YAML contextual profile in Profile into bitstream form on Out.
createMIRParserFromFileThis function is the main interface to the MIR serialization format parser.
decodeBase64Decode a Base64 string into raw bytes.
denormalModeKindNameReturn the name used for the denormal handling mode used by the expected names from the denormal-fp-math attribute.
djbHashThe Bernstein hash function used by the DWARF accelerator tables.
doSystemDiffPerforms a system-based diff between Before and After.
emitSourceFileHeaderOutput an LLVM style file header to the specified raw_ostream.
exportDebugifyStatsWrite debugify statistics from Map to the file at Path.
findBooleanLoopTagsReturn the replacement tags for the enable tag Name, or nullptr.
fromHexConvert hexadecimal string Input to its binary representation. The return string is half the size of Input.
gatherImportedSummariesForModuleCompute summaries needed for ThinLTO backend compilation of a module.
getAllocTokenModeAsStringReturns the canonical string name for the given AllocTokenMode.
getAllocTokenModeFromStringReturns the AllocTokenMode from its canonical string name; if an invalid name was provided returns nullopt.
getAllocationFamilyIf a function is part of an allocation family (e.g. malloc/realloc/calloc/free), return the identifier for its family of functions.
getArm64ECDemangledFunctionNameReturns the ARM64EC demangled function name, unless the input is not mangled.
getArm64ECMangledFunctionNameReturns the ARM64EC mangled function name unless the input is already mangled.
getAsSignedIntegerParse a signed integer from Str using Radix into Result.
getAsUnsignedIntegerParse an unsigned integer from Str using Radix into Result.
getAssumptionsReturn the set of all assumptions for the function F.
getAssumptionsReturn the set of all assumptions for the call CB.
getAtomicScopeIRStringReturns the LLVM IR syncscope string that T uses to spell S.
getAutoSenseRadixDetect and strip a radix prefix from Str, returning the inferred radix.
getCPUDefaultTargetFeaturesReturns the default enabled features for CPU, or nullopt if unknown.
getCachedOrDownloadArtifactFetches any debuginfod artifact using the default local cache directory and server URLs.
getCachedOrDownloadArtifactFetches any debuginfod artifact from a cache or remote servers.
getCoverageMappingVarNameReturn the name of a coverage mapping variable for an instrumented module.
getCoverageUnusedNamesVarNameReturn the name of the variable listing PGO names referenced by coverage.
getDebuginfodCacheKeyReturns the cache key for a given debuginfod URL path.
getDefaultDebuginfodUrlsFinds default array of Debuginfod server URLs by checking DEBUGINFOD_URLS environment variable.
getEHPersonalityNameReturn the canonical name string for personality Pers.
getFloatFnGet the name of the overloaded floating point function corresponding to Ty.
getFuncNameWithoutPrefixStrip the filename prefix from a PGO function name.
getGCStrategyLookup the GCStrategy object associated with the given gc name.
getInstrProfBitmapBiasVarNameReturn the name of the runtime bitmap-bias global variable.
getInstrProfBitmapVarPrefixReturn the name prefix of profile bitmap variables.
getInstrProfCounterBiasVarNameReturn the name of the runtime counter-bias global variable.
getInstrProfCountersVarPrefixReturn the name prefix of profile counter variables.
getInstrProfDataVarPrefixReturn the name prefix of variables containing per-function control data.
getInstrProfInitFuncNameReturn the name of the compiler-generated profile runtime initializer.
getInstrProfInstrumentGPUFuncNameReturn the name of the GPU wave-cooperative counter increment helper.
getInstrProfNameSeparatorReturn the marker used to separate PGO names during serialization.
getInstrProfNameVarPrefixReturn the name prefix of variables containing instrumented function names.
getInstrProfNamesRegFuncNameReturn the name of the runtime interface that registers the PGO name strings.
getInstrProfNamesVarNameReturn the name of the variable holding the strings (possibly compressed) of all function's PGO names.
getInstrProfNamesVarPostfixVarNameReturn the name of the post-fix marker for the PGO names variable.
getInstrProfRegFuncNameReturn the name of the runtime interface that registers per-function control data for one instrumented function.
getInstrProfRegFuncsNameReturn the name of the function that registers per-function control data.
getInstrProfRuntimeHookVarNameReturn the name of the profile runtime hook variable.
getInstrProfRuntimeHookVarUseFuncNameReturn the name of the compiler generated function that references the runtime hook variable. The function is a weak global.
getInstrProfVNodesVarNameReturn the name of value profile node array variables:
getInstrProfVTableNamesVarNameReturn the name of the variable holding (possibly compressed) vtable names.
getInstrProfVTableVarPrefixReturn the name prefix of variables containing virtual table profile data.
getInstrProfValueProfFuncNameReturn the name profile runtime entry point to do value profiling for a given site.
getInstrProfValueProfMemOpFuncNameReturn the name profile runtime entry point to do memop size value profiling.
getInstrProfValuesVarPrefixReturn the name prefix of value profile variables.
getInstrProfVarPrefixReturn the prefix of the name of the variables to function as a filter.
getKCFITypeIDCompute KCFI type ID from mangled type name. The algorithm can be xxHash64 or FNV-1a.
getLazyIRFileModuleCreate a Module from a file, with lazy function-body loading for bitcode.
getLongDoubleFormatNameReturns the IR floating-point type name for a LongDoubleFormat.
getLoopVectorizeKindPrefixReturn a short prefix describing the loop's vectorizer origin.
getMachineTypeMap a /machine flag argument to a COFF machine type.
getModuleSummaryIndexForFileParse the module summary index out of an IR file.
getNameFromBundleAttrReturn the string name of the given operand-bundle attribute kind.
getObjCNamesIfSelectorParses an Objective-C selector name into its component parts.
getOrdinalSuffixReturns the English suffix for an ordinal integer (-st, -nd, -rd, -th).
getPGOFuncNameReturn a front-end PGO lookup name from raw name, linkage, and file name.
getPGOFuncNameMetadataNameReturn the metadata kind name used for legacy PGO function names.
getPGOFuncNameVarInitializerReturn the string initializer of PGO name variable NameVar.
getPGOFuncNameVarNameReturn the global variable name used to store a PGO function name.
getPGONameMetadataNameReturn the metadata kind name used for PGO global-object names.
getParsedIRPGONameParse a filename and function name from an IRPGO name string.
getPointerAuthStableSipHashCompute a stable non-zero 16-bit hash of the given string.
getPrefetchTargetSymbolNameReturn the symbol name for a prefetch target.
getStableSipHashCompute a stable 64-bit hash of the given string.
getTokenExtract one token from Source using the characters in Delimiters.
getTypeNameWe provide a function which tries to compute the (demangled) name of a type statically.
getUniqueInternalLinkagePostfixBuild a unique-internal-linkage post-fix hash for FName.
get_stable_nameStrip LLVM-introduced suffixes so the name is stable across builds.
get_threadpool_strategyBuild a strategy from a number of threads as a string provided in Num.
handleExecNameEncodedBEOptsHandle backend options that are encoded in the executable name.
handleExecNameEncodedOptimizerOptsHandle optimizer options which are encoded in the executable name. Same semantics as in 'handleExecNameEncodedBEOpts'.
hardware_concurrencyParse Num into a hardware_concurrency strategy.
hash_valueCompute a hash_code for a StringRef.
heavyweight_hardware_concurrencyParse Num into a heavyweight_hardware_concurrency strategy.
identify_magicIdentify the type of a binary file based on how magical it is.
isASCIIChecks whether all characters in S are ASCII.
isArm64ECMangledFunctionNameCheck if an ARM64EC function name is mangled.
isFunctionInPrintListReturns true if IR for FunctionName should be printed.
isPassInPrintListReturns true if -filter-passes is empty or contains PassName.
isReleaseModelValidCheck whether a release-mode ML advisor has a valid model to execute.
isReleaseModelValidCheck whether a release-mode ML advisor has a valid model to execute.
isSpecialPassReturn whether PassID names a special pass ending with a suffix in Specials.
left_justifyleft_justify - append spaces after string so total output is Width characters. If Str is larger that Width, full string is written with no padding.
machineToStrReturn a user-readable string for a COFF machine type.
mayBeOldLoopAttachmentTagCheck whether a string looks like an old loop attachment tag.
operator!=Return true if LHS and RHS differ in length or contents.
operator+Concatenate a StringRef and a C string with simplified codegen.
operator<Return true if LHS is lexicographically less than RHS.
operator<=Return true if LHS is lexicographically less than or equal to RHS.
operator==Return true if LHS and RHS have equal length and contents.
operator>Return true if LHS is lexicographically greater than RHS.
operator>=Return true if LHS is lexicographically greater than or equal to RHS.
parseAnalysisUtilityPassesAdd require<> or invalidate<> utility passes for an analysis.
parseAssemblyFileParse LLVM Assembly from a file.
parseAssemblyFileWithIndexParse LLVM Assembly and its module summary from a file.
parseAssemblyFileWithIndexNoUpgradeDebugInfoParse an assembly file with index without upgrading debug info.
parseAssemblyStringParse LLVM Assembly from a string.
parseCachePruningPolicyParse the given string as a cache pruning policy.
parseConstantValueParse a type and a constant value in the given string.
parseDIExpressionBodyAtBeginningParse a DIExpression body at the beginning of the given string.
parseDenormalFPAttributeReturns the denormal mode to use for inputs and outputs.
parseDenormalFPAttributeComponentParse the expected names from the denormal-fp-math attribute.
parseIRFileIf the given file holds a bitcode image, return a Module for it. Otherwise, attempt to parse it as LLVM Assembly and return a Module for it.
parseInfoSectionUnitHeaderParse the unit header at the start of a .debug_info(.dwo) section.
parseKCFIHashAlgorithmParse a KCFI hash algorithm name. Returns xxHash64 if the name is not recognized.
parseLongDoubleFormatParses an IR floating-point type name into a LongDoubleFormat, returning std::nullopt if it does not name a supported long double format.
parseSummaryIndexAssemblyFileParse a module summary index from an LLVM Assembly file.
parseSummaryIndexAssemblyStringParse a module summary index from an LLVM Assembly string.
parseTypeParse a type in the given string.
parseTypeAtBeginningParse a type at the beginning of the given string.
printEscapedStringPrint each character of the specified string, escaping it if it is not printable or if it is an escape char.
printHTMLEscapedPrint each character of the specified string, escaping HTML special characters.
printLowerCasePrint each character as lowercase if it is uppercase.
printPercentEncodedPrint String percent-encoded for a URL query component (RFC 3986).
processImportsFilesCall F passing each of the files module ModulePath will import from.
pruneCachePerform pruning using the supplied policy, returns true if pruning occurred, i.e. if Policy.Interval was expired.
readAndDecodeStringsDecode concatenated PGO name strings and invoke a callback for each name.
reportChangedIRReports a -print-changed dump for one pass over one IR unit.
reportFatalInternalErrorReport a fatal internal error with message reason.
reportFatalUsageErrorReport a fatal usage error with message reason.
report_fatal_errorReport a fatal error from a StringRef reason.
right_justifyright_justify - add spaces before string so total output is Width characters. If Str is larger that Width, full string is written with no padding.
shouldPrintAfterPassReturns true if IR should be printed after the pass named PassID.
shouldPrintBeforePassReturns true if IR should be printed before the pass named PassID.
spellReturns text representation of the given rounding mode.
splitIterate over partitions of a string split on character Separator.
splitIterate over partitions of a string split on Separator.
stable_hash_nameHash Name after normalizing it with get_stable_name().
stringifyKCFIHashAlgorithmConvert a KCFI hash algorithm enum to its string representation.
timeTraceAddInstantEventRecord an instant event with the given name and lazily computed detail.
timeTraceAsyncProfilerBeginManually begin an asynchronous time section with the given name and detail.
timeTraceProfilerBeginManually begin a time section with lazily computed metadata.
timeTraceProfilerBeginManually begin a time section with the given name and detail.
timeTraceProfilerBeginManually begin a time section with a lazily computed detail string.
timeTraceProfilerWriteWrite profiling data to a file.
toHexConvert string bytes to a hexadecimal string.
toStringRefConstruct a string ref from an array ref of unsigned chars.
toStringRefConstruct a string ref from an array ref of chars.
toStringRefConstruct a string ref from a boolean.
toStringRefArrayConstruct a vector of StringRefs from a null-terminated C-string array.
to_integerConvert string S to an integer of type N using radix Base.
tryGetFromHexConvert a hexadecimal string to binary bytes.
writeArchiveWrite an archive to the file named ArcName.
writeToOutputCreate an output stream for OutputFileName and pass it to Write.
xxh3_64bitsCompute the XXH3 64-bit hash of the bytes in data.
AArch64::getArchExtFeatureReturn the -target-feature enable/disable string for ArchExt.
AArch64::getArchForCpuReturn the default architecture for CPU name CPU.
AArch64::parseArchParse an architecture name as accepted by -march.
AArch64::parseArchExtensionParse a name as defined by the Extension class in tablegen.
AArch64::parseCpuGiven the name of a CPU or alias, return the corresponding CpuInfo.
AArch64::parseFMVExtensionParse a name as defined by the FMVInfo class in tablegen.
AArch64::resolveCPUAliasResolve a CPU alias to its canonical CPU name.
AArch64::targetFeatureToExtensionReturn the extension which has the given -target-feature name.
AArch64BuildAttributes::getFeatureAndBitsTagsIDReturn the feature-and-bits tag ID for the given tag name.
AArch64BuildAttributes::getFeatureAndBitsTagsStrReturn the tag name for the given feature-and-bits tag ID.
AArch64BuildAttributes::getOptionalIDReturn the subsection optionality ID for the given spelling.
AArch64BuildAttributes::getOptionalStrReturn the optionality spelling for the given subsection optionality ID.
AArch64BuildAttributes::getPauthABITagsIDReturn the PAuth ABI tag ID for the given tag name.
AArch64BuildAttributes::getPauthABITagsStrReturn the tag name for the given PAuth ABI tag ID.
AArch64BuildAttributes::getSubsectionOptionalUnknownErrorReturn the diagnostic text for an unrecognized subsection optionality.
AArch64BuildAttributes::getSubsectionTypeUnknownErrorReturn the diagnostic text for an unrecognized subsection type.
AArch64BuildAttributes::getTypeIDReturn the subsection type ID for the given spelling.
AArch64BuildAttributes::getTypeStrReturn the type spelling for the given subsection type ID.
AArch64BuildAttributes::getVendorIDReturn the vendor ID for the given subsection vendor name.
AArch64BuildAttributes::getVendorNameReturn the subsection vendor name for the given vendor ID.
AMDGPU::fillAMDGPUFeatureMapFills Features with default values for the given target GPU.
AMDGPU::getArchFamilyNameAMDGCNReturns the architecture family name for AMDGCN GPU kind AK.
AMDGPU::getArchNameAMDGCNReturns the canonical AMDGCN architecture name for GPU kind AK.
AMDGPU::getArchNameFromSubArchReturns the canonical GPU name for an AMDGPU subarch.
AMDGPU::getArchNameR600Returns the canonical R600 architecture name for GPU kind AK.
AMDGPU::getBaseArchNameAMDGCNThe canonical GPU name for a variant name.
AMDGPU::getCanonicalArchNameReturns the canonical architecture name for Arch under triple T.
AMDGPU::getIsaVersionReturns the ISA version for GPU name GPU.
AMDGPU::getSubArchNameReturns the triple subarch name for an AMDGPU subarch, e.g. AMDGPUSubArch900 -> "amdgpu9.00". Returns "amdgpu" for NoSubArch.
AMDGPU::isPseudoTargetReturn true if GPU name CPU is a pseudo target.
AMDGPU::parseArchAMDGCNParses an AMDGCN GPU name CPU into a GPUKind.
AMDGPU::parseArchR600Parses an R600 GPU name CPU into a GPUKind.
ARM::appendArchExtFeaturesAppend feature strings for architecture extension ArchExt.
ARM::computeDefaultTargetABIReturn the default ABI name string for triple TT.
ARM::getARMCPUForArchGet the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
ARM::getArchExtFeatureReturn the +feature or -feature string for extension name ArchExt.
ARM::getArchExtNameReturn the architecture-extension name for bitmask ArchExtKind.
ARM::getArchNameReturn the canonical architecture name for AK.
ARM::getArchSynonymConverts e.g. "armv8" -> "armv8-a"
ARM::getCPUAttrReturn the build-attribute CPU class string for AK.
ARM::getCanonicalArchNameReturn the canonical architecture substring from an architecture name.
ARM::getDefaultCPUReturn the default CPU name for architecture Arch.
ARM::getDefaultExtensionsReturn the default extension bitmask for CPU CPU under architecture AK.
ARM::getDefaultFPUReturn the default FPU for CPU CPU under architecture AK.
ARM::getFPUNameReturn the canonical FPU name for identifier FPUKind.
ARM::getFPUSynonymReturn the canonical FPU name for spelling FPU.
ARM::getSubArchReturn the sub-architecture feature name for AK without a leading "+".
ARM::parseArchParse architecture name Arch into an ArchKind.
ARM::parseArchEndianParse the endianness from an architecture name.
ARM::parseArchExtParse architecture-extension name ArchExt into its bitmask.
ARM::parseArchISAParse the ISA kind from an architecture name prefix.
ARM::parseArchProfileParse architecture name Arch into its ProfileKind.
ARM::parseArchVersionParse architecture name Arch into its major ISA version number.
ARM::parseBranchProtectionParse a branch-protection specification into PBP.
ARM::parseCPUArchParse CPU name CPU into its ArchKind.
ARM::parseFPUParse FPU name FPU into an FPUKind.
ARM::parseHWDivParse hardware-divide name HWDiv into its extension bitmask.
CSKY::getArchExtFeatureReturn the +feature or -feature string for extension name ArchExt.
CSKY::getArchExtNameReturn the architecture-extension name for bitmask ArchExtKind.
CSKY::getArchNameReturn the canonical architecture name for AK.
CSKY::getDefaultCPUReturn the default CPU name for architecture Arch.
CSKY::getDefaultExtensionsReturn the default extension bitmask for CPU name CPU.
CSKY::getFPUNameReturn the FPU name for identifier FPUKind.
CSKY::parseArchParse architecture name Arch into an ArchKind.
CSKY::parseArchExtParse architecture-extension name ArchExt into its bitmask.
CSKY::parseCPUArchParse CPU name CPU into its ArchKind.
ConverterEBCDIC::convertToEBCDICConverts a UTF-8 string to EBCDIC-1047.
ConverterEBCDIC::convertToUTF8Converts an EBCDIC-1047 string to UTF-8.
DOT::getColorStringGet a color string for this node number.
DWARFYAML::emitDebugSectionsParse YAMLString and emit all non-empty DWARF sections it describes.
DWARFYAML::getDWARFEmitterByNameReturn the emitter for the DWARF section named SecName.
ELF::convertArchNameToEMachineConvert an architecture name into ELF's e_machine value.
ELF::convertEMachineToArchNameConvert an ELF's e_machine value into an architecture name.
ELF::convertNameToOSABIConvert a lowercase string identifier into an OSABI value.
ELF::convertOSABIToNameConvert an OSABI value into a string that identifies the OS- or ABI-specific ELF extension.
ELFAttrs::attrTypeAsStringReturn the display name for attr from tagNameMap.
ELFAttrs::attrTypeFromStringReturn the attribute tag number for tag from tagNameMap.
ELFYAML::appendUniqueSuffixAppend a unique suffix derived from Msg to Name.
ELFYAML::dropUniqueSuffixDrop a unique suffix previously appended to an ELF symbol or section name.
FloatABI::getABITypeNameReturns the string spelling used by the "float-abi" IR module flag for a Soft or Hard ABIType. Default has no spelling.
FloatABI::parseABITypeParse the string spelling used by the "float-abi" IR module flag into an ABIType.
IndexedInstrProf::ComputeHashCompute the indexed-profile name hash for string K.
IntegerInclusiveIntervalUtils::parseIntervalsParse a interval specification string like "1-10,20-30,45" or "1-10:20-30:45". Intervals must be in increasing order and non-overlapping.
Intrinsic::getBaseNameReturn the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm.ssa.copy".
Intrinsic::getIntrinsicForClangBuiltinMap a Clang builtin name to an intrinsic ID.
Intrinsic::getIntrinsicForMSBuiltinMap a MS builtin name to an intrinsic ID.
Intrinsic::getNameReturn the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Intrinsic::getRequiredTargetFeaturesReturn the target feature expression required by an intrinsic.
Intrinsic::lookupIntrinsicIDLook up an intrinsic ID by its name string.
LoongArch::getArchFeaturesAppend +feature strings enabled by architecture name Arch.
LoongArch::getDefaultArchReturn the default LoongArch architecture name for the given bitness.
LoongArch::isValidArchNameReturn true if Arch is a recognized LoongArch architecture name.
LoongArch::isValidCPUNameReturn true if TuneCPU is a recognized LoongArch CPU name.
LoongArch::isValidFeatureNameReturn true if Feature is a recognized LoongArch feature name.
MCParserUtils::parseAssignmentExpressionParse a value expression and return whether it can be assigned to a symbol with the given name.
MachO::createRegexFromGlobCreate a regex rule from provided glob string.
MachO::getArchitectureFromNameConvert a name to an architecture slice.
MachO::getArchitectureNameConvert an architecture slice to a string.
MachO::getPlatformFromNameConvert a platform name to a platform type.
MachO::getPlatformNameConvert a platform type to its marketing name.
MachO::isPrivateLibraryDetermine if library is private by parsing file path. It does not touch the file system.
MachO::make_relativeTurn absolute symlink into relative.
MachO::parseSymbolGet symbol classification by parsing the name of a symbol.
NVPTX::getArchNameReturn the canonical processor name (e.g. "sm_90") for Kind, or "" if Kind is GK_NONE.
NVPTX::getVirtualArchReturn the virtual (compute_) arch name (e.g. "compute_90") for Kind, or "" if Kind is GK_NONE.
NVPTX::parseArchParse CPU (e.g. "sm_90") into a GPUKind, or GK_NONE if unrecognized.
PPC::getNormalizedPPCTargetCPUReturn the normalized PowerPC target CPU name for T.
PPC::getNormalizedPPCTuneCPUReturn the normalized PowerPC tune CPU name for T.
PPC::isValidCPUReturn true if CPU is a recognized PowerPC CPU name.
PPC::isValidFeatureNameReturn true if Name is a recognized PowerPC feature name.
PPC::normalizeCPUNameReturn a canonical PowerPC CPU name for aliases such as pwr10 and power10.
RISCV::getCPUConfigurableTuneFeaturesAppend the tune-feature directives configurable for CPU CPU.
RISCV::getCPUModelReturn the hardware model IDs for CPU CPU.
RISCV::getCPUNameFromCPUModelReturn the CPU name that matches hardware model Model.
RISCV::getFeaturesForCPUAppend the target-feature strings enabled by CPU CPU.
RISCV::getMArchFromMcpuReturn the default -march string for CPU CPU.
RISCV::hasFastScalarUnalignedAccessReturn true if CPU CPU treats scalar unaligned access as fast.
RISCV::hasFastVectorUnalignedAccessReturn true if CPU CPU treats vector unaligned access as fast.
RISCV::hasValidCPUModelReturn true if CPU CPU has a valid non-zero hardware model.
RISCV::parseCPUReturn true if CPU is a recognized RISC-V CPU for the given bitness.
RISCV::parseTuneCPUReturn true if CPU is a recognized RISC-V tune CPU for the given bitness.
RISCV::parseTuneFeatureStringParse the tune feature string with the respective processor. If ProcName is empty, directives are not filtered by processor.
RISCVCFI::getZicfilpLabelSchemeMap a CF branch-label scheme name to a ZicfilpLabelSchemeKind.
VFABI::getVFParamKindFromStringRetrieve the VFParamKind from a string token.
VFABI::tryDemangleForVFABIFunction to construct a VFInfo out of a mangled names in the following format:
Win64EH::getRegisterNameV3Return the register name for a 5-bit AMD64 integer register number. Covers 0-15 (RAX-R15) and 16-31 (R16-R31 for APX).
X86::getCPUDispatchManglingReturn the function-multiversion mangling character for CPU Name.
X86::getFeaturesForCPUFill in the features that CPU supports into Features.
X86::parseArchX86Parse CPU string into a CPUKind. Will only accept 64-bit capable CPUs if Only64Bit is true.
X86::parseTuneCPUParse CPU string as an -mtune CPU name into a CPUKind.
X86::updateImpliedFeaturesSet or clear entries in Features that are implied to be enabled/disabled by the provided Feature.
X86::validateCPUSpecificCPUDispatchReturn true if Name is a valid cpu_specific / cpu_dispatch CPU name.
XCOFF::getCpuIDMap a CPU name string to an XCOFF CFileCpuId value.
XCOFF::getMappingClassStringReturn the string name of a storage mapping class.
XCOFF::getNameForTracebackTableLanguageIdReturn the string name of a traceback-table language identifier.
XCOFF::getRelocationTypeStringReturn the string name of a relocation type.
XCOFF::getTCPUStringReturn the string name of a CFileCpuId value.
Xtensa::getBaseNameReturn the canonical CPU name for CPU, resolving aliases.
Xtensa::getCPUFeaturesAppend the +feature strings enabled by CPU name CPU to Features.
Xtensa::parseCPUKindParse CPU into an Xtensa CPUKind.
cas::createOnDiskActionCacheCreate an action cache on disk.
cas::createOnDiskUnifiedCASDatabasesCreate on-disk ObjectStore and ActionCache instances based on ondisk::UnifiedOnDiskCache, with built-in hashing.
cas::createPluginCASDatabasesCreate ObjectStore and ActionCache instances backed by a plugin that implements the C API in "llvm-c/CAS/PluginAPI_functions.h".
cas::validateOnDiskUnifiedCASDatabasesIfNeededValidate the data in Path, if needed to ensure correctness.
cl::TokenizeGNUCommandLineTokenize a GNU-style command line that may contain escapes and quotes.
cl::TokenizeWindowsCommandLineTokenizes a string of Windows command line arguments, which may contain quotes and escaped quotes.
cl::TokenizeWindowsCommandLineFullTokenize a full Windows command line, including the leading command name.
cl::TokenizeWindowsCommandLineNoCopyTokenize a Windows command line while avoiding copies when possible.
cl::getCompilerBuildConfigReturn enabled LLVM build-configuration tags such as +assertions.
cl::tokenizeConfigFileTokenizes content of configuration file.
codegen::MaybeSaveStatisticsConditionally save collected LLVM statistics based on --save-stats.
codeview::consumeDecode a numeric leaf value from a string buffer into Num.
codeview::consumeDecode an unsigned 32-bit integer from a string buffer.
codeview::fmt_guidAdapt a GUID string for use with formatv.
codeview::getBytesAsCStringReinterpret a byte array as a null-terminated C string.
codeview::getBytesAsCharactersReinterpret a byte array as an array of characters. Does not interpret as a C string, as StringRef has several helpers (split) that make that easy.
codeview::getSymbolNameExtract the name string embedded in a CodeView symbol record.
directive::FindNameFind the first spelling in a range that applies to a language version.
dwarf::AccessibilityStringReturns the name of the DW_ACCESS accessibility constant with the given value.
dwarf::AddressSpaceStringReturns the name of address space AS for target triple TT.
dwarf::ApplePropertyStringReturns the name of the Apple property attribute with the given value.
dwarf::ArrayOrderStringReturns the name of the array order constant with the given value.
dwarf::AtomTypeStringReturns the name of the accelerator-table atom type with the given value.
dwarf::AtomValueStringReturns the symbolic string representing Val when used as a value for atom Atom.
dwarf::AttributeEncodingStringReturns the name of the DW_ATE type-encoding constant with the given value.
dwarf::AttributeStringReturns the name of the DW_AT attribute with the given value.
dwarf::AttributeValueStringReturns the symbolic string representing Val when used as a value for attribute Attr.
dwarf::CallFrameStringReturns the name of the call-frame instruction for Encoding on Arch.
dwarf::CaseStringReturns the name of the DW_ID case-sensitivity constant with the given value.
dwarf::ChildrenStringReturns the name of the DW_CHILDREN constant with the given value.
dwarf::ConventionStringReturns the name of the DW_CC calling-convention constant with the given value.
dwarf::DecimalSignStringReturns the name of the DW_DS decimal sign constant with the given value.
dwarf::DefaultedMemberStringReturns the name of the DW_DEFAULTED constant with the given value.
dwarf::EndianityStringReturns the name of the DW_END endianity constant with the given value.
dwarf::EnumKindStringReturns the name of the Apple enum-kind constant with the given value.
dwarf::FormEncodingStringReturns the name of the DW_FORM form encoding with the given value.
dwarf::FormatStringReturns "DWARF32" or "DWARF64" depending on IsDWARF64.
dwarf::FormatStringReturns "DWARF32" or "DWARF64" for the given DWARF format enum.
dwarf::GDBIndexEntryKindStringReturns the name of the GDB index entry kind.
dwarf::GDBIndexEntryLinkageStringReturns the name of the GDB index entry linkage.
dwarf::GnuMacroStringReturns the name of the GNU .debug_macro entry type with the given value.
dwarf::IndexStringReturns the name of the DW_IDX index attribute with the given value.
dwarf::InlineCodeStringReturns the name of the DW_INL inline code constant with the given value.
dwarf::LNExtendedStringReturns the name of the extended line-number opcode with the given value.
dwarf::LNStandardStringReturns the name of the standard line-number opcode with the given value.
dwarf::LanguageDescriptionReturns a version-independent language name.
dwarf::LanguageDescriptionReturn a version-specific display name for a DWARF 6 language.
dwarf::LanguageDialectStringReturns the name of the language dialect constant with the given value.
dwarf::LanguageStringReturns the name of the DW_LANG source language with the given value.
dwarf::LocListEncodingStringReturns the name of the DW_LLE loclist entry encoding with the given value.
dwarf::MacinfoStringReturns the name of the DW_MACINFO record type with the given value.
dwarf::MacroStringReturns the name of the DW_MACRO entry type with the given value.
dwarf::OperationEncodingStringReturns the name of the DW_OP operation encoding with the given value.
dwarf::RLEStringReturns the name of the DWARF range-list entry encoding RLE.
dwarf::RangeListEncodingStringReturns the name of the DW_RLE range list entry encoding with the given value.
dwarf::SourceLanguageNameStringReturns the name of the DW_LNAME source language name.
dwarf::SubOperationEncodingStringReturns the name of the DW_OP sub-operation encoding with the given values.
dwarf::TagStringAll these functions map their argument's value back to the corresponding enumerator name or return an empty StringRef if the value isn't known.
dwarf::UnitTypeStringReturns the name of the DW_UT unit type with the given value.
dwarf::VirtualityStringReturns the name of the DW_VIRTUALITY constant with the given value.
dwarf::VisibilityStringReturns the name of the DW_VIS visibility constant with the given value.
dwarf::getAttributeEncodingMaps a DW_ATE type-encoding name string to its value, or 0 if unknown.
dwarf::getCallingConventionMaps a calling-convention name string to its encoding, or 0 if unknown.
dwarf::getEnumKindMaps an Apple enum kind name string to its encoding, or 0 if unknown.
dwarf::getLanguageMaps a DW_LANG name string to its encoding, or 0 if unknown.
dwarf::getLanguageDialectMaps a language dialect name string to its encoding, or 0 if unknown.
dwarf::getMacinfoMaps a DW_MACINFO name string to its encoding, or DW_MACINFO_invalid if unknown.
dwarf::getMacroMaps a DW_MACRO name string to its encoding, or 0 if unknown.
dwarf::getOperationEncodingMaps a DW_OP name string to its location-atom encoding, or 0 if unknown.
dwarf::getSourceLanguageNameMaps a DW_LNAME name string to its encoding, or 0 if unknown.
dwarf::getTagThese functions map their strings back to the corresponding enumeration value or return 0 if there is none, except for these exceptions:
dwarf::getVirtualityMaps a virtuality name string to its DW_VIRTUALITY encoding, or DW_VIRTUALITY_invalid if unknown.
dwarf::toStringRefTake an optional DWARFFormValue and try to extract a string value from it.
dwarf_linker::guessDeveloperDirMake a best effort to guess the Xcode.app/Contents/Developer path from an SDK path.
dwarf_linker::isInToolchainDirMake a best effort to determine whether Path is inside a toolchain.
dwarf_linker::parseDebugTableNameRecognise the table name and match it with the DebugSectionKind.
dxbc::isProgramPartReturn true if PartName is a program part name (DXIL or ILDB).
dxbc::parsePartTypeParse a four-character part name into a PartType.
dxil::getResourceClassNameReturns the name of a DXIL resource class.
dxil::getResourceNameFromBindingCallReturn the resource name from a handle-from-binding call.
gsym::getNameForGlobalInfoTypeReturn a human-readable name for a GlobalInfoType value.
hlsl::getSemanticKindMap a semantic name string to its corresponding PSV::SemanticKind.
ifs::parseTripleParse llvm triple string into a IFSTarget struct.
ifs::readIFSFromBufferAttempts to read an IFS interface file from a StringRef buffer.
ifs::writeBinaryStubAttempt to write a binary ELF stub.
impl::strip_quotesReturn Str as a StringRef, stripping surrounding quotes if present.
instrumentor::readConfigPathsFileRead the configuration paths from the file with path InputFile into Configs.
json::fixUTF8Replace invalid UTF-8 sequences in S with U+FFFD.
json::isUTF8Returns true if S is valid UTF-8, which is required for use as JSON.
json::parseParses the provided JSON source, or returns a ParseError.
json::parseParse JSON and convert the result to type T.
logicalview::emptyStringReturn an empty string reference.
logicalview::flattenedFilePathConvert Path into a flattened, filesystem-safe lowercase name.
logicalview::formatAttributesReturn a string with First and Others separated by spaces.
logicalview::formattedKindReturn Kind wrapped in curly braces for display.
logicalview::formattedNameReturn Name wrapped in single quotes for display.
logicalview::formattedNamesReturn the concatenation of Name1 and Name2 wrapped in single quotes.
logicalview::getAllLexicalComponentsSplit Name into lexical components separated by ::.
logicalview::getInnerComponentReturn the outermost and innermost lexical components of Name.
logicalview::transformPathNormalize Path to a unified, lowercase pathname.
logicalview::typeIntReturn the string spelling for the int type.
logicalview::typeNoneReturn the placeholder string used when no type is available.
logicalview::typeUnknownReturn the placeholder string used for an unknown type.
logicalview::typeVoidReturn the string spelling for the void type.
lto::getThinLTOOutputFileRewrite an output path by replacing a matching prefix.
lto::setupStatsFileSetups the output file for saving statistics.
mc::getABINameReturn the value of the -target-abi command-line option.
mc::getAsSecureLogFileReturn the value of the -as-secure-log-file command-line option.
memprof::getGUIDReturn the memprof GUID for FunctionName after LTO suffix canonicalization.
memprof::getMemprofOptionsSymbolDarwinLinkageNameReturn the Darwin linkage name of the memprof default-options string.
memprof::getMemprofOptionsSymbolNameReturn the IR-level name of the memprof default-options string symbol.
nvvm::getEvictPolicyNameReturn the PTX name for an L2 eviction policy.
nvvm::getTMATensorReductionOpNameReturn the PTX name for a TMA tensor reduction operation.
objcopy::getObjectFormatNameReturns the format name of B if it is an ObjectFile, or "" otherwise.
objcopy::printCopyMessagePrints information about the input and output files involved in a copy operation to stdout.
object::createBinaryCreate a Binary by reading the file at Path, autodetecting its type.
object::extractOffloadBundleByURIExtracts an Offload Bundle Entry given by URI.
object::getELFRelocationTypeNameReturn the relocation type name for Machine and Type.
object::getELFSectionTypeNameReturn the section type name for Machine and Type.
object::getElfArchTypeReturn the ELF class and data encoding from an object buffer's ident.
object::getImageKindConvert a string Name to an image kind.
object::getImageKindNameConvert an image kind to its string representation.
object::getOffloadKindConvert a string Name to an offload kind.
object::getOffloadKindNameConvert an offload kind to its string representation.
object::getRISCVVendorRelocationTypeNameReturn the RISC-V vendor relocation type name for Type and Vendor.
object::hashGnuCompute the GNU hash of a dynamic symbol name.
object::hashSysVCompute the SysV ELF hash of a dynamic symbol name.
object::parseBuildIDParses a build ID from a hex string.
object::writeImportLibraryWrites a COFF import library containing entries described by the Exports array.
offloading::getOffloadEntrySectionReturns the section name for offloading entries based on the target triple.
omp::deconstructOpenMPKernelNameDeconstruct an OpenMP kernel name into the parent function name and the line number.
omp::getOpenMPContextTraitPropertyFullNameReturn a textual representation of the trait property Kind with selector and set name included.
omp::getOpenMPContextTraitPropertyNameReturn a textual representation of the trait property Kind.
omp::getOpenMPContextTraitSelectorKindParse Str and return the trait set it matches or TraitSelector::invalid.
omp::getOpenMPContextTraitSelectorNameReturn a textual representation of the trait selector Kind.
omp::getOpenMPContextTraitSetKindParse Str and return the trait set it matches or TraitSet::invalid.
omp::getOpenMPContextTraitSetNameReturn a textual representation of the trait set Kind.
omp::getReservedLocatorNamesReturn the reserved OpenMP locator names (lowercase).
omp::prettifyFunctionNameCreate a nicer version of a function name for humans to look at.
orc::isCOFFInitializerSectionReturns true if Name is a COFF initializer section.
orc::isELFFinalizerSectionReturns true if SecName is an ELF finalizer section.
orc::isELFInitializerSectionReturns true if SecName is an ELF initializer section.
orc::isMachOInitializerSectionReturns true if the given segment and section form a MachO initializer section.
orc::isMachOInitializerSectionReturns true if QualifiedName is a MachO initializer section.
orc::loadLinkableFileCreate a MemoryBuffer covering the "linkable" part of the given path.
orc::loadMachOLinkableFileLoad a relocatable object compatible with TT from Path.
orc::recordAddrRecords the address of the symbol with the given name.
pdb::hashStringV1Compute the PDB V1 string hash used by name tables and TPI/IPI.
pdb::hashStringV2Compute the PDB V2 string hash used by the name hash table.
remarks::magicToFormatParse and validate a magic number to a remark format.
remarks::parseFormatParse and validate a string for the remark format.
remarks::parseHotnessThresholdOptionParse a remarks hotness threshold option value.
remarks::typeToStrReturn the string spelling of remark type Ty.
sys::DontRemoveFileOnSignalThis function removes a file from the list of files to be removed on signal delivery.
sys::ExecuteAndWaitExecute a program and wait for it to finish.
sys::ExecuteNoWaitSimilar to ExecuteAndWait, but returns immediately.
sys::PrintStackTraceOnErrorSignalWhen an error signal (such as SIGABRT or SIGSEGV) is delivered to the process, print a stack trace and then exit. Print a stack trace if a fatal signal occurs.
sys::RemoveFileOnSignalThis function registers signal handlers to ensure that if a signal gets delivered that the named file is removed. Remove a file if a fatal signal occurs.
sys::commandLineFitsWithinSystemLimitsReturn true if the given arguments fit within system-specific argument length limits.
sys::commandLineFitsWithinSystemLimitsReturn true if the given arguments fit within system-specific argument length limits.
sys::findProgramByNameFind the first executable file Name in Paths.
sys::getHostCPUNamegetHostCPUName - Get the LLVM name for the host CPU.
sys::writeFileWithEncodingSaves the UTF8-encoded contents string into the file FileName using a specific encoding.
wasm::relocTypetoStringReturn the name of a Wasm relocation type value.
wasm::sectionTypeToStringReturn the name of a Wasm section type value.
wasm::toStringReturn the name of a Wasm symbol type enumerator.
xray::loadInstrumentationMapLoads the instrumentation map from |Filename|. This auto-deduces the type of the instrumentation map.
xray::loadProfileThis function will attempt to load an XRay Profiling Mode profile from the provided Filename.
xray::loadTraceFileThis function will attempt to load XRay trace records from the provided |Filename|.
yaml::dumpTokensDump all the tokens in this stream to OS.
yaml::escapeEscape Input for use inside a double-quoted YAML scalar.
yaml::isBoolReturn true if S is a YAML boolean scalar token.
yaml::isNullReturn true if S is a YAML null scalar token.
yaml::isNumericReturn true if S looks like a YAML numeric scalar.
yaml::needsQuotesDetermine the quoting style required for scalar S.
yaml::parseBoolParse S as a bool according to https://yaml.org/type/bool.html.
yaml::scanTokensScans all tokens in input without outputting anything. This is used for benchmarking the tokenizer.
AMDGPU::HSAMD::fromStringConverts String to HSAMetadata.
MachO::DylibReader::accumulateSourceLocFromDSYMGet the source location for each symbol from dylib.
coverage::accessors::getCoverageMappingOutOfLineRead coverage mapping out-of-line, from MappingBuf.
dxbc::SourceInfo::getSectionNameReturn the name of Type, or an empty StringRef if it is invalid.
offloading::amdgpu::isImageCompatibleWithEnvCheck if an image is compatible with current system's environment. The system environment is given as a 'target-id' which has the form:
offloading::sycl::forEachSymbolInvoke Callback with a StringRef for each symbol in Symbols, the raw serialized symbol-table blob.
sys::locale::columnWidthReturns the display column width of the UTF-8 string s.
sys::path::beginGet begin iterator over path.
sys::path::convert_to_slashReplaces backslashes with slashes if Windows.
sys::path::endGet end iterator over path.
sys::path::extensionGet extension.
sys::path::filenameGet filename.
sys::path::get_separatorReturn the preferred separator for this platform.
sys::path::parent_pathGet parent path.
sys::path::rbeginGet reverse begin iterator over path.
sys::path::relative_pathGet relative path.
sys::path::remove_leading_dotslashRemove redundant leading "./" pieces and consecutive separators.
sys::path::rendGet reverse end iterator over path.
sys::path::root_directoryGet root directory.
sys::path::root_nameGet root name.
sys::path::root_pathGet root path.
sys::path::stemGet stem.
sys::unicode::columnWidthUTF8Returns the terminal column width of UTF-8 string Text.
sys::unicode::nameToCodepointLooseMatchingMaps a Unicode character name or alias to its code point with loose match.
sys::unicode::nameToCodepointStrictMaps a Unicode character name or alias to its code point with exact match.
sys::unicode::nearestMatchesForCodepointNameFinds Unicode character names nearest to Pattern by edit distance.

Derived Classes

NameDescription
StringLiteral A compile-time StringRef wrapper over a string literal.