33 #define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11) OPT_##ID,
34 #include "Options.inc"
38 #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
39 #include "Options.inc"
43 #define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X6, X7, X8, X9, X10) \
45 X1, X2, X9, X10, OPT_##ID, llvm::opt::Option::KIND##Class, X8, X7, \
46 OPT_##GROUP, OPT_##ALIAS, X6 \
48 #include "Options.inc"
54 LibOptTable() : OptTable(infoTable,
true) {}
62 return Arg->getValue();
70 std::vector<StringRef>
Ret;
75 for (
auto *Arg : Args->
filtered(OPT_libpath))
76 Ret.push_back(Arg->getValue());
83 while (!Env.
empty()) {
85 std::tie(Path, Env) = Env.
split(
';');
93 for (
auto Dir : Paths) {
110 unsigned MissingIndex;
111 unsigned MissingCount;
113 Table.ParseArgs(ArgsArr.
slice(1), MissingIndex, MissingCount);
118 << (MissingCount == 1 ?
" argument.\n" :
" arguments.\n");
121 for (
auto *Arg : Args.
filtered(OPT_UNKNOWN))
122 llvm::errs() <<
"ignoring unknown argument: " << Arg->getSpelling() <<
"\n";
129 std::vector<StringRef> SearchPaths =
getSearchPaths(&Args, Saver);
131 std::vector<llvm::NewArchiveMember> Members;
132 for (
auto *Arg : Args.
filtered(OPT_INPUT)) {
135 llvm::errs() << Arg->getValue() <<
": no such file or directory\n";
142 llvm::errs() << Arg->getValue() <<
": " << EIB.message() <<
"\n";
152 <<
": not a COFF object, bitcode or resource file\n";
155 Members.emplace_back(std::move(*MOrErr));
158 std::pair<StringRef, std::error_code> Result =
161 true, Args.
hasArg(OPT_llvmlibthin));
164 if (Result.first.empty())
165 Result.first = ArgsArr[0];
166 llvm::errs() << Result.first <<
": " << Result.second.message() <<
"\n";
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void replace_extension(SmallVectorImpl< char > &path, const Twine &extension)
Replace the file extension of path with extension.
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)
Tagged union holding either a T or a Error.
bool hasArg(OptSpecifier Id) const
int libDriverMain(ArrayRef< const char * > ARgs)
Windows compiled resource file (.rc)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
arg_iterator filtered_end() const
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.
static std::string getOutputPath(llvm::opt::InputArgList *Args, const llvm::NewArchiveMember &FirstMember)
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.
iterator_range< arg_iterator > filtered(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
static const char *const Magic
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
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 ...
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
Entry for a single option instance in the option data table.
Arg * getLastArg(OptSpecifier Id) const
static Expected< NewArchiveMember > getFile(StringRef FileName, bool Deterministic)
arg_iterator filtered_begin(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
StringRef - Represent a constant reference to a string, i.e.
bool exists(file_status status)
Does file exist?
std::unique_ptr< MemoryBuffer > Buf
static Optional< std::string > GetEnv(StringRef name)