34 #define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11, _12) OPT_##ID,
35 #include "Options.inc"
39 #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
40 #include "Options.inc"
44 #define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X6, X7, X8, X9, X10, X11) \
45 {X1, X2, X9, X10, OPT_##ID, llvm::opt::Option::KIND##Class, \
46 X8, X7, OPT_##GROUP, OPT_##ALIAS, X6, X11},
47 #include "Options.inc"
53 LibOptTable() : OptTable(infoTable,
true) {}
61 return Arg->getValue();
69 std::vector<StringRef>
Ret;
74 for (
auto *Arg : Args->
filtered(OPT_libpath))
75 Ret.push_back(Arg->getValue());
82 while (!Env.
empty()) {
84 std::tie(Path, Env) = Env.
split(
';');
92 for (
auto Dir : Paths) {
109 unsigned MissingIndex;
110 unsigned MissingCount;
112 Table.ParseArgs(ArgsArr.
slice(1), MissingIndex, MissingCount);
117 << (MissingCount == 1 ?
" argument.\n" :
" arguments.\n");
120 for (
auto *Arg : Args.
filtered(OPT_UNKNOWN))
121 llvm::errs() <<
"ignoring unknown argument: " << Arg->getSpelling() <<
"\n";
128 std::vector<StringRef> SearchPaths =
getSearchPaths(&Args, Saver);
130 std::vector<llvm::NewArchiveMember> Members;
131 for (
auto *Arg : Args.
filtered(OPT_INPUT)) {
134 llvm::errs() << Arg->getValue() <<
": no such file or directory\n";
141 llvm::errs() << Arg->getValue() <<
": " << EIB.message() <<
"\n";
150 <<
": not a COFF object, bitcode or resource file\n";
153 Members.emplace_back(std::move(*MOrErr));
156 std::pair<StringRef, std::error_code> Result =
159 true, Args.
hasArg(OPT_llvmlibthin));
162 if (Result.first.empty())
163 Result.first = ArgsArr[0];
164 llvm::errs() << Result.first <<
": " << Result.second.message() <<
"\n";
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Windows compiled resource file (.res)
Error takeError()
Take ownership of the stored error.
Base class for error info classes.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
std::pair< StringRef, std::error_code > writeArchive(StringRef ArcName, std::vector< NewArchiveMember > &NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin, std::unique_ptr< MemoryBuffer > OldArchiveBuf=nullptr)
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Tagged union holding either a T or a Error.
int libDriverMain(ArrayRef< const char * > ARgs)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Allocate memory in an ever growing pool, as if by bump-pointer.
static Optional< std::string > findInputFile(StringRef File, ArrayRef< StringRef > Paths)
Provide access to the Option info table.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static std::string getOutputPath(llvm::opt::InputArgList *Args, const llvm::NewArchiveMember &FirstMember)
iterator_range< filtered_iterator< sizeof...(OptSpecifiers)> > filtered(OptSpecifiers...Ids) const
void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a Windows command line which may contain quotes and escaped quotes.
void handleAllErrors(Error E, HandlerTs &&...Handlers)
Behaves the same as handleErrors, except that it requires that all errors be handled by the given han...
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
static const char *const Magic
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void replace_extension(SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)
Replace the file extension of path with extension.
bool hasArgNoClaim(OptSpecifiers...Ids) const
hasArg - Does the arg list contain any option matching Id.
Arg * getLastArg(OptSpecifiers...Ids) const
Return the last argument matching Id, or null.
bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv, bool MarkEOLs=false, bool RelativeNames=false)
Expand response files on a command line recursively using the given StringSaver and tokenization stra...
static std::vector< StringRef > getSearchPaths(llvm::opt::InputArgList *Args, StringSaver &Saver)
StringRef save(const char *S)
StringRef str() const
Explicit conversion to StringRef.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Defines the llvm::Arg class for parsed arguments.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
Saves strings in the inheritor's stable storage and returns a StringRef with a stable character point...
Provides a library for accessing information about this process and other processes on the operating ...
Entry for a single option instance in the option data table.
static Expected< NewArchiveMember > getFile(StringRef FileName, bool Deterministic)
StringRef - Represent a constant reference to a string, i.e.
bool hasArg(OptSpecifiers...Ids) const
bool exists(file_status status)
Does file exist?
std::unique_ptr< MemoryBuffer > Buf
static Optional< std::string > GetEnv(StringRef name)
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...