[clang-tools-extra] r210840 - Prefix error_code with std.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 12 15:08:48 PDT 2014


Author: rafael
Date: Thu Jun 12 17:08:48 2014
New Revision: 210840

URL: http://llvm.org/viewvc/llvm-project?rev=210840&view=rev
Log:
Prefix error_code with std.

Modified:
    clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
    clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
    clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp
    clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp
    clang-tools-extra/trunk/modularize/Modularize.cpp
    clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp

Modified: clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp Thu Jun 12 17:08:48 2014
@@ -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 l
   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 l
     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 TURepl
   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.

Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp Thu Jun 12 17:08:48 2014
@@ -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) {

Modified: clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp Thu Jun 12 17:08:48 2014
@@ -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(Stri
 
 /// \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,
        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,
 
     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 {

Modified: clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/ReplacementHandling.cpp Thu Jun 12 17:08:48 2014
@@ -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::generateReplac
   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());

Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Thu Jun 12 17:08:48 2014
@@ -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(SmallVecto
 
   // 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(SmallVecto
     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;

Modified: clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp?rev=210840&r1=210839&r2=210840&view=diff
==============================================================================
--- clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp (original)
+++ clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp Thu Jun 12 17:08:48 2014
@@ -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::crea
 // 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::collectUmbrellaHe
   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::collectFileSystem
   }
 
   // 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;





More information about the cfe-commits mailing list