llvm::identify_magic

identify_magic overloads

Synopses

Declared in <llvm/BinaryFormat/Magic.h>

Identify the type of a binary file based on how magical it is.

file_magic
identify_magic(StringRef magic);
» more...

Get and identify path's type based on its content.

std::error_code
identify_magic(
    Twine const& path,
    file_magic& result);
» more...

Return Value

  • The identified file_magic kind for the given bytes.
  • errc::success if result has been successfully set, otherwise a platform-specific error_code.

Parameters

NameDescription
magicLeading bytes of the file used for magic identification.
pathInput path.
resultSet to the type of file, or file_magic::unknown.