update llvm and clang tools to release/14.x
upstream commit 91632c8ac97fa3daffe4ff8f1391735b5d6805e6
This commit is contained in:
@@ -90,17 +90,18 @@ OPTIONS:
|
||||
--rsp-quoting - quoting style for response files
|
||||
=posix - posix
|
||||
=windows - windows
|
||||
--thin - create a thin archive
|
||||
--version - print the version and exit
|
||||
@<file> - read options from <file>
|
||||
|
||||
OPERATIONS:
|
||||
d - delete [files] from the archive
|
||||
m - move [files] in the archive
|
||||
p - print [files] found in the archive
|
||||
p - print contents of [files] found in the archive
|
||||
q - quick append [files] to the archive
|
||||
r - replace or insert [files] into the archive
|
||||
s - act as ranlib
|
||||
t - display contents of archive
|
||||
t - display list of files in archive
|
||||
x - extract [files] from the archive
|
||||
|
||||
MODIFIERS:
|
||||
@@ -118,7 +119,7 @@ MODIFIERS:
|
||||
[P] - use full names when matching (implied for thin archives)
|
||||
[s] - create an archive index (cf. ranlib)
|
||||
[S] - do not build a symbol table
|
||||
[T] - create a thin archive
|
||||
[T] - deprecated, use --thin instead
|
||||
[u] - update only [files] newer than archive contents
|
||||
[U] - use actual timestamps and uids/gids
|
||||
[v] - be verbose about actions taken
|
||||
@@ -136,14 +137,14 @@ static unsigned MRILineNumber;
|
||||
static bool ParsingMRIScript;
|
||||
|
||||
// Show the error plus the usage message, and exit.
|
||||
LLVM_ATTRIBUTE_NORETURN static void badUsage(Twine Error) {
|
||||
[[noreturn]] static void badUsage(Twine Error) {
|
||||
WithColor::error(errs(), ToolName) << Error << "\n";
|
||||
printHelpMessage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Show the error message and exit.
|
||||
LLVM_ATTRIBUTE_NORETURN static void fail(Twine Error) {
|
||||
[[noreturn]] static void fail(Twine Error) {
|
||||
if (ParsingMRIScript) {
|
||||
WithColor::error(errs(), ToolName)
|
||||
<< "script line " << MRILineNumber << ": " << Error << "\n";
|
||||
@@ -232,7 +233,7 @@ static std::string ArchiveName;
|
||||
static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
|
||||
static std::vector<std::unique_ptr<object::Archive>> Archives;
|
||||
|
||||
// This variable holds the list of member files to process, as given
|
||||
// This variable holds the list of member files to proecess, as given
|
||||
// on the command line.
|
||||
static std::vector<StringRef> Members;
|
||||
|
||||
@@ -390,8 +391,6 @@ static ArchiveOperation parseCommandLine() {
|
||||
break;
|
||||
case 'T':
|
||||
Thin = true;
|
||||
// Thin archives store path names, so P should be forced.
|
||||
CompareFullPath = true;
|
||||
break;
|
||||
case 'L':
|
||||
AddLibrary = true;
|
||||
@@ -407,6 +406,10 @@ static ArchiveOperation parseCommandLine() {
|
||||
}
|
||||
}
|
||||
|
||||
// Thin archives store path names, so P should be forced.
|
||||
if (Thin)
|
||||
CompareFullPath = true;
|
||||
|
||||
// At this point, the next thing on the command line must be
|
||||
// the archive name.
|
||||
getArchive();
|
||||
@@ -965,6 +968,8 @@ static void createSymbolTable(object::Archive *OldArchive) {
|
||||
if (OldArchive->hasSymbolTable())
|
||||
return;
|
||||
|
||||
if (OldArchive->isThin())
|
||||
Thin = true;
|
||||
performWriteOperation(CreateSymTab, OldArchive, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@@ -1003,12 +1008,17 @@ static int performOperation(ArchiveOperation Operation,
|
||||
fail("unable to open '" + ArchiveName + "': " + EC.message());
|
||||
|
||||
if (!EC) {
|
||||
Error Err = Error::success();
|
||||
object::Archive Archive(Buf.get()->getMemBufferRef(), Err);
|
||||
failIfError(std::move(Err), "unable to load '" + ArchiveName + "'");
|
||||
if (Archive.isThin())
|
||||
Expected<std::unique_ptr<object::Archive>> ArchiveOrError =
|
||||
object::Archive::create(Buf.get()->getMemBufferRef());
|
||||
if (!ArchiveOrError)
|
||||
failIfError(ArchiveOrError.takeError(),
|
||||
"unable to load '" + ArchiveName + "'");
|
||||
|
||||
std::unique_ptr<object::Archive> Archive = std::move(ArchiveOrError.get());
|
||||
if (Archive->isThin())
|
||||
CompareFullPath = true;
|
||||
performOperation(Operation, &Archive, std::move(Buf.get()), NewMembers);
|
||||
performOperation(Operation, Archive.get(), std::move(Buf.get()),
|
||||
NewMembers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1111,11 +1121,11 @@ static void runMRIScript() {
|
||||
}
|
||||
|
||||
static bool handleGenericOption(StringRef arg) {
|
||||
if (arg == "-help" || arg == "--help" || arg == "-h") {
|
||||
if (arg == "--help" || arg == "-h") {
|
||||
printHelpMessage();
|
||||
return true;
|
||||
}
|
||||
if (arg == "-version" || arg == "--version") {
|
||||
if (arg == "--version") {
|
||||
cl::PrintVersionMessage();
|
||||
return true;
|
||||
}
|
||||
@@ -1129,8 +1139,6 @@ static const char *matchFlagWithArg(StringRef Expected,
|
||||
|
||||
if (Arg.startswith("--"))
|
||||
Arg = Arg.substr(2);
|
||||
else if (Arg.startswith("-"))
|
||||
Arg = Arg.substr(1);
|
||||
|
||||
size_t len = Expected.size();
|
||||
if (Arg == Expected) {
|
||||
@@ -1199,6 +1207,11 @@ static int ar_main(int argc, char **argv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(*ArgIt, "--thin") == 0) {
|
||||
Thin = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
Match = matchFlagWithArg("format", ArgIt, Argv);
|
||||
if (Match) {
|
||||
FormatType = StringSwitch<Format>(Match)
|
||||
@@ -1261,16 +1274,8 @@ static int ranlib_main(int argc, char **argv) {
|
||||
return performOperation(CreateSymTab, nullptr);
|
||||
}
|
||||
|
||||
extern "C" int ZigLlvmAr_main(int argc, char **argv);
|
||||
int ZigLlvmAr_main(int argc, char **argv) {
|
||||
// ZIG PATCH: On Windows, InitLLVM calls GetCommandLineW(),
|
||||
// and overwrites the args. We don't want it to do that,
|
||||
// and we also don't need the signal handlers it installs
|
||||
// (we have our own already), so we just use llvm_shutdown_obj
|
||||
// instead.
|
||||
// InitLLVM X(argc, argv);
|
||||
llvm::llvm_shutdown_obj X;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
InitLLVM X(argc, argv);
|
||||
ToolName = argv[0];
|
||||
|
||||
llvm::InitializeAllTargetInfos();
|
||||
|
||||
Reference in New Issue
Block a user