aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-12 22:08:48 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-12 22:08:48 +0000
commit19ae52efbcdb05cd71d42d2bbc7b2a8b78dd7953 (patch)
treec1546827122a0ab83b5b7123ea89951dde13d792
parentd42da8f3ebe8db57bec35c5774e2c99e080953d5 (diff)
Prefix error_code with std.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@210840 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp7
-rw-r--r--clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp3
-rw-r--r--clang-modernize/Core/IncludeExcludeInfo.cpp43
-rw-r--r--clang-modernize/Core/ReplacementHandling.cpp3
-rw-r--r--modularize/Modularize.cpp16
-rw-r--r--module-map-checker/ModuleMapChecker.cpp21
6 files changed, 45 insertions, 48 deletions
diff --git a/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
index f11d4c6a..7064bfe7 100644
--- a/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ b/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -29,7 +29,6 @@
using namespace llvm;
using namespace clang;
-using std::error_code;
static void eatDiagnostics(const SMDiagnostic &, void *) {}
@@ -45,7 +44,7 @@ collectReplacementsFromDirectory(const llvm::StringRef Directory,
using namespace llvm::sys::fs;
using namespace llvm::sys::path;
- error_code ErrorCode;
+ std::error_code ErrorCode;
for (recursive_directory_iterator I(Directory, ErrorCode), E;
I != E && !ErrorCode; I.increment(ErrorCode)) {
@@ -61,7 +60,7 @@ collectReplacementsFromDirectory(const llvm::StringRef Directory,
TURFiles.push_back(I->path());
std::unique_ptr<MemoryBuffer> Out;
- error_code BufferError = MemoryBuffer::getFile(I->path(), Out);
+ std::error_code BufferError = MemoryBuffer::getFile(I->path(), Out);
if (BufferError) {
errs() << "Error reading " << I->path() << ": " << BufferError.message()
<< "\n";
@@ -264,7 +263,7 @@ bool deleteReplacementFiles(const TUReplacementFiles &Files,
bool Success = true;
for (TUReplacementFiles::const_iterator I = Files.begin(), E = Files.end();
I != E; ++I) {
- error_code Error = llvm::sys::fs::remove(*I);
+ std::error_code Error = llvm::sys::fs::remove(*I);
if (Error) {
Success = false;
// FIXME: Use Diagnostics for outputting errors.
diff --git a/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 2e5271bb..d0af35e2 100644
--- a/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -27,7 +27,6 @@
using namespace llvm;
using namespace clang;
using namespace clang::replace;
-using std::error_code;
static cl::opt<std::string> Directory(cl::Positional, cl::Required,
cl::desc("<Search Root Directory>"));
@@ -223,7 +222,7 @@ int main(int argc, char **argv) {
TUReplacements TUs;
TUReplacementFiles TURFiles;
- error_code ErrorCode =
+ std::error_code ErrorCode =
collectReplacementsFromDirectory(Directory, TUs, TURFiles, Diagnostics);
if (ErrorCode) {
diff --git a/clang-modernize/Core/IncludeExcludeInfo.cpp b/clang-modernize/Core/IncludeExcludeInfo.cpp
index 2e4f1c21..b5cf5bbe 100644
--- a/clang-modernize/Core/IncludeExcludeInfo.cpp
+++ b/clang-modernize/Core/IncludeExcludeInfo.cpp
@@ -21,7 +21,6 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-using std::error_code;
/// A string type to represent paths.
typedef SmallString<64> PathString;
@@ -83,8 +82,8 @@ std::string removeRelativeOperators(StringRef Path) {
/// \brief Helper function to tokenize a string of paths and populate
/// the vector.
-error_code parseCLInput(StringRef Line, std::vector<std::string> &List,
- StringRef Separator) {
+std::error_code parseCLInput(StringRef Line, std::vector<std::string> &List,
+ StringRef Separator) {
SmallVector<StringRef, 32> Tokens;
Line.split(Tokens, Separator, /*MaxSplit=*/ -1, /*KeepEmpty=*/ false);
for (SmallVectorImpl<StringRef>::iterator I = Tokens.begin(),
@@ -92,7 +91,7 @@ error_code parseCLInput(StringRef Line, std::vector<std::string> &List,
I != E; ++I) {
// Convert each path to its absolute path.
PathString Path = I->rtrim();
- if (error_code Err = sys::fs::make_absolute(Path))
+ if (std::error_code Err = sys::fs::make_absolute(Path))
return Err;
// Remove relative operators from the path.
std::string AbsPath = removeRelativeOperators(Path);
@@ -104,44 +103,46 @@ error_code parseCLInput(StringRef Line, std::vector<std::string> &List,
llvm::errs() << "Parse: " <<List.back() << "\n";
}
- return error_code();
+ return std::error_code();
}
} // end anonymous namespace
-error_code IncludeExcludeInfo::readListFromString(StringRef IncludeString,
- StringRef ExcludeString) {
- if (error_code Err = parseCLInput(IncludeString, IncludeList,
- /*Separator=*/ ","))
+std::error_code
+IncludeExcludeInfo::readListFromString(StringRef IncludeString,
+ StringRef ExcludeString) {
+ if (std::error_code Err = parseCLInput(IncludeString, IncludeList,
+ /*Separator=*/","))
return Err;
- if (error_code Err = parseCLInput(ExcludeString, ExcludeList,
- /*Separator=*/ ","))
+ if (std::error_code Err = parseCLInput(ExcludeString, ExcludeList,
+ /*Separator=*/","))
return Err;
- return error_code();
+ return std::error_code();
}
-error_code IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile,
- StringRef ExcludeListFile) {
+std::error_code
+IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile,
+ StringRef ExcludeListFile) {
if (!IncludeListFile.empty()) {
std::unique_ptr<MemoryBuffer> FileBuf;
- if (error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) {
+ if (std::error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) {
errs() << "Unable to read from include file.\n";
return Err;
}
- if (error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList,
- /*Separator=*/ "\n"))
+ if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList,
+ /*Separator=*/"\n"))
return Err;
}
if (!ExcludeListFile.empty()) {
std::unique_ptr<MemoryBuffer> FileBuf;
- if (error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) {
+ if (std::error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) {
errs() << "Unable to read from exclude file.\n";
return Err;
}
- if (error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList,
- /*Separator=*/ "\n"))
+ if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList,
+ /*Separator=*/"\n"))
return Err;
}
- return error_code();
+ return std::error_code();
}
bool IncludeExcludeInfo::isFileIncluded(StringRef FilePath) const {
diff --git a/clang-modernize/Core/ReplacementHandling.cpp b/clang-modernize/Core/ReplacementHandling.cpp
index 6af01b81..0251a9e3 100644
--- a/clang-modernize/Core/ReplacementHandling.cpp
+++ b/clang-modernize/Core/ReplacementHandling.cpp
@@ -23,7 +23,6 @@
using namespace llvm;
using namespace llvm::sys;
using namespace clang::tooling;
-using std::error_code;
bool ReplacementHandling::findClangApplyReplacements(const char *Argv0) {
CARPath = FindProgramByName("clang-apply-replacements");
@@ -145,7 +144,7 @@ bool ReplacementHandling::generateReplacementsFileName(
Error.clear();
SmallString<128> Prefix = DestinationDir;
path::append(Prefix, path::filename(MainSourceFile));
- if (error_code EC =
+ if (std::error_code EC =
fs::createUniqueFile(Prefix + "_%%_%%_%%_%%_%%_%%.yaml", Result)) {
const std::string &Msg = EC.message();
Error.append(Msg.begin(), Msg.end());
diff --git a/modularize/Modularize.cpp b/modularize/Modularize.cpp
index 4662a7f7..e4841cca 100644
--- a/modularize/Modularize.cpp
+++ b/modularize/Modularize.cpp
@@ -175,7 +175,6 @@ using namespace clang::tooling;
using namespace llvm;
using namespace llvm::opt;
using namespace Modularize;
-using std::error_code;
// Option to specify a file name for a list of header files to check.
cl::opt<std::string>
@@ -216,9 +215,10 @@ std::string CommandLine;
// Read the header list file and collect the header file names and
// optional dependencies.
-error_code getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
- DependencyMap &Dependencies,
- StringRef ListFileName, StringRef HeaderPrefix) {
+std::error_code
+getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
+ DependencyMap &Dependencies, StringRef ListFileName,
+ StringRef HeaderPrefix) {
// By default, use the path component of the list file name.
SmallString<256> HeaderDirectory(ListFileName);
sys::path::remove_filename(HeaderDirectory);
@@ -231,7 +231,7 @@ error_code getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
// Read the header list file into a buffer.
std::unique_ptr<MemoryBuffer> listBuffer;
- if (error_code ec = MemoryBuffer::getFile(ListFileName, listBuffer)) {
+ if (std::error_code ec = MemoryBuffer::getFile(ListFileName, listBuffer)) {
return ec;
}
@@ -284,7 +284,7 @@ error_code getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
Dependencies[HeaderFileName.str()] = Dependents;
}
- return error_code();
+ return std::error_code();
}
// Helper function for finding the input file in an arguments list.
@@ -706,8 +706,8 @@ int main(int Argc, const char **Argv) {
// Get header file names and dependencies.
SmallVector<std::string, 32> Headers;
DependencyMap Dependencies;
- if (error_code EC = getHeaderFileNames(Headers, Dependencies, ListFileName,
- HeaderPrefix)) {
+ if (std::error_code EC = getHeaderFileNames(Headers, Dependencies,
+ ListFileName, HeaderPrefix)) {
errs() << Argv[0] << ": error: Unable to get header list '" << ListFileName
<< "': " << EC.message() << '\n';
return 1;
diff --git a/module-map-checker/ModuleMapChecker.cpp b/module-map-checker/ModuleMapChecker.cpp
index 87360f8a..23d75dc5 100644
--- a/module-map-checker/ModuleMapChecker.cpp
+++ b/module-map-checker/ModuleMapChecker.cpp
@@ -97,7 +97,6 @@ using namespace clang::tooling;
using namespace llvm;
using namespace llvm::opt;
using namespace llvm::sys;
-using std::error_code;
// Option for include paths.
static cl::list<std::string>
@@ -133,11 +132,11 @@ int main(int Argc, const char **Argv) {
// Do the checks. The return value is the program return code,
// 0 for okay, 1 for module map warnings produced, 2 for any other error.
- error_code ReturnCode = Checker->doChecks();
+ std::error_code ReturnCode = Checker->doChecks();
- if (ReturnCode == error_code(1, std::generic_category()))
+ if (ReturnCode == std::error_code(1, std::generic_category()))
return 1; // Module map warnings were issued.
- else if (ReturnCode == error_code(2, std::generic_category()))
+ else if (ReturnCode == std::error_code(2, std::generic_category()))
return 2; // Some other error occurred.
else
return 0; // No errors or warnings.
@@ -244,26 +243,26 @@ ModuleMapChecker *ModuleMapChecker::createModuleMapChecker(
// Returns error_code of 0 if there were no errors or warnings, 1 if there
// were warnings, 2 if any other problem, such as if a bad
// module map path argument was specified.
-error_code ModuleMapChecker::doChecks() {
- error_code returnValue;
+std::error_code ModuleMapChecker::doChecks() {
+ std::error_code returnValue;
// Load the module map.
if (!loadModuleMap())
- return error_code(2, std::generic_category());
+ return std::error_code(2, std::generic_category());
// Collect the headers referenced in the modules.
collectModuleHeaders();
// Collect the file system headers.
if (!collectFileSystemHeaders())
- return error_code(2, std::generic_category());
+ return std::error_code(2, std::generic_category());
// Do the checks. These save the problematic file names.
findUnaccountedForHeaders();
// Check for warnings.
if (UnaccountedForHeaders.size())
- returnValue = error_code(1, std::generic_category());
+ returnValue = std::error_code(1, std::generic_category());
// Dump module map if requested.
if (DumpModuleMap) {
@@ -364,7 +363,7 @@ bool ModuleMapChecker::collectUmbrellaHeaders(StringRef UmbrellaDirName) {
if (Directory.size() == 0)
Directory = ".";
// Walk the directory.
- error_code EC;
+ std::error_code EC;
fs::file_status Status;
for (fs::directory_iterator I(Directory.str(), EC), E; I != E;
I.increment(EC)) {
@@ -481,7 +480,7 @@ bool ModuleMapChecker::collectFileSystemHeaders(StringRef IncludePath) {
}
// Recursively walk the directory tree.
- error_code EC;
+ std::error_code EC;
fs::file_status Status;
int Count = 0;
for (fs::recursive_directory_iterator I(Directory.str(), EC), E; I != E;