#include "llvm/Bytecode/Archive.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compressor.h"
+#include "llvm/Support/ManagedStatic.h"
#include "llvm/System/Signals.h"
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <memory>
-
using namespace llvm;
// Option for compatibility with ASIX, not used but must allow it to be present.
for (std::set<sys::Path>::iterator I = content.begin(), E = content.end();
I != E; ++I) {
// Make sure it exists and is a directory
- sys::FileStatus Status;
- if (I->getFileStatus(Status)) {
- if (Status.isDir) {
- std::set<sys::Path> moreResults;
- if (recurseDirectories(*I, moreResults, ErrMsg))
- return true;
- result.insert(moreResults.begin(), moreResults.end());
- } else {
+ sys::PathWithStatus PwS(*I);
+ const sys::FileStatus *Status = PwS.getFileStatus(false, ErrMsg);
+ if (!Status)
+ return true;
+ if (Status->isDir) {
+ std::set<sys::Path> moreResults;
+ if (recurseDirectories(*I, moreResults, ErrMsg))
+ return true;
+ result.insert(moreResults.begin(), moreResults.end());
+ } else {
result.insert(*I);
- }
}
}
}
if (checkExistence) {
if (!aPath.exists())
throw std::string("File does not exist: ") + Members[i];
- sys::FileStatus si;
std::string Err;
- if (aPath.getFileStatus(si, &Err))
+ sys::PathWithStatus PwS(aPath);
+ const sys::FileStatus *si = PwS.getFileStatus(false, &Err);
+ if (!si)
throw Err;
- if (si.isDir) {
+ if (si->isDir) {
std::set<sys::Path> dirpaths;
if (recurseDirectories(aPath, dirpaths, ErrMsg))
return true;
}
if (found != remaining.end()) {
- sys::FileStatus si;
std::string Err;
- if (found->getFileStatus(si, &Err))
+ sys::PathWithStatus PwS(*found);
+ const sys::FileStatus *si = PwS.getFileStatus(false, &Err);
+ if (!si)
return true;
- if (si.isDir) {
+ if (si->isDir) {
if (OnlyUpdate) {
// Replace the item only if it is newer.
- if (si.modTime > I->getModTime())
+ if (si->modTime > I->getModTime())
if (I->replaceWith(*found, ErrMsg))
return true;
} else {
// main - main program for llvm-ar .. see comments in the code
int main(int argc, char **argv) {
+ llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
// Have the command line options parsed and handle things
// like --help and --version.