using namespace clang::driver;
using namespace clang::driver::options;
using namespace clang::tooling;
-using namespace llvm;
-using namespace llvm::opt;
-using namespace llvm::sys;
+namespace cl = llvm::cl;
+namespace sys = llvm::sys;
// Option for include paths.
static cl::list<std::string>
DumpModuleMap(DumpModuleMap), CommandLine(CommandLine),
LangOpts(new LangOptions()), DiagIDs(new DiagnosticIDs()),
DiagnosticOpts(new DiagnosticOptions()),
- DC(errs(), DiagnosticOpts.get()),
+ DC(llvm::errs(), DiagnosticOpts.get()),
Diagnostics(
new DiagnosticsEngine(DiagIDs, DiagnosticOpts.get(), &DC, false)),
TargetOpts(new ModuleMapTargetOptions()),
// Dump module map if requested.
if (DumpModuleMap) {
- errs() << "\nDump of module map:\n\n";
+ llvm::errs() << "\nDump of module map:\n\n";
ModMap->dump();
}
// return error if not found.
if (!ModuleMapEntry) {
- errs() << "error: File \"" << ModuleMapPath << "\" not found.\n";
+ llvm::errs() << "error: File \"" << ModuleMapPath << "\" not found.\n";
return false;
}
Directory = ".";
// Walk the directory.
std::error_code EC;
- fs::file_status Status;
- for (fs::directory_iterator I(Directory.str(), EC), E; I != E;
+ sys::fs::file_status Status;
+ for (sys::fs::directory_iterator I(Directory.str(), EC), E; I != E;
I.increment(EC)) {
if (EC)
return false;
std::string File(I->path());
I->status(Status);
- fs::file_type Type = Status.type();
+ sys::fs::file_type Type = Status.type();
// If the file is a directory, ignore the name.
- if (Type == fs::file_type::directory_file)
+ if (Type == sys::fs::file_type::directory_file)
continue;
// If the file does not have a common header extension, ignore it.
if (!isHeader(File))
Directory = ".";
if (IncludePath.startswith("/") || IncludePath.startswith("\\") ||
((IncludePath.size() >= 2) && (IncludePath[1] == ':'))) {
- errs() << "error: Include path \"" << IncludePath
- << "\" is not relative to the module map file.\n";
+ llvm::errs() << "error: Include path \"" << IncludePath
+ << "\" is not relative to the module map file.\n";
return false;
}
// Recursively walk the directory tree.
std::error_code EC;
- fs::file_status Status;
+ sys::fs::file_status Status;
int Count = 0;
- for (fs::recursive_directory_iterator I(Directory.str(), EC), E; I != E;
+ for (sys::fs::recursive_directory_iterator I(Directory.str(), EC), E; I != E;
I.increment(EC)) {
if (EC)
return false;
std::string file(I->path());
I->status(Status);
- fs::file_type type = Status.type();
+ sys::fs::file_type type = Status.type();
// If the file is a directory, ignore the name (but still recurses).
- if (type == fs::file_type::directory_file)
+ if (type == sys::fs::file_type::directory_file)
continue;
// If the file does not have a common header extension, ignore it.
if (!isHeader(file))
Count++;
}
if (Count == 0) {
- errs() << "warning: No headers found in include path: \"" << IncludePath
- << "\"\n";
+ llvm::errs() << "warning: No headers found in include path: \""
+ << IncludePath << "\"\n";
}
return true;
}
// Look for header in module map.
if (ModuleMapHeadersSet.insert(*I)) {
UnaccountedForHeaders.push_back(*I);
- errs() << "warning: " << ModuleMapPath
- << " does not account for file: " << *I << "\n";
+ llvm::errs() << "warning: " << ModuleMapPath
+ << " does not account for file: " << *I << "\n";
}
}
}
#include "llvm/Support/Path.h"
#include "gtest/gtest.h"
-using namespace llvm;
-using namespace llvm::sys;
using namespace clang;
namespace {
FileMgr.getVirtualFile(HeaderPath, 0, 0);
// Add header's parent path to search path.
- StringRef SearchPath = path::parent_path(HeaderPath);
+ StringRef SearchPath = llvm::sys::path::parent_path(HeaderPath);
const DirectoryEntry *DE = FileMgr.getDirectory(SearchPath);
DirectoryLookup DL(DE, SrcMgr::C_User, false);
HeaderInfo.AddSearchPath(DL, IsSystemHeader);
// the InclusionDirective callback.
CharSourceRange InclusionDirectiveFilenameRange(const char* SourceText,
const char* HeaderPath, bool SystemHeader) {
- std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(SourceText);
+ std::unique_ptr<llvm::MemoryBuffer> Buf =
+ llvm::MemoryBuffer::getMemBuffer(SourceText);
SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf)));
VoidModuleLoader ModLoader;
LangOptions OpenCLLangOpts;
OpenCLLangOpts.OpenCL = 1;
- std::unique_ptr<MemoryBuffer> SourceBuf =
- MemoryBuffer::getMemBuffer(SourceText, "test.cl");
+ std::unique_ptr<llvm::MemoryBuffer> SourceBuf =
+ llvm::MemoryBuffer::getMemBuffer(SourceText, "test.cl");
SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(SourceBuf)));
VoidModuleLoader ModLoader;