llvm::getConstantStringInfo

Compute the contents of a null-terminated C string pointed to by V.

Synopsis

Declared in <llvm/Analysis/ValueTracking.h>

bool
getConstantStringInfo(
    Value const* V,
    StringRef& Str,
    bool TrimAtNul = true);

Description

If successful, it returns true and returns the string in Str. If unsuccessful, it returns false. This does not include the trailing null character by default. If TrimAtNul is set to false, then this returns any trailing null characters as well as any other characters that come after it.

Return Value

True if a constant string was successfully recovered.

Parameters

NameDescription
VPointer to a potential constant C string.
StrOutput string contents on success.
TrimAtNulWhether to stop at the first nul character.