[clang-tools-extra] r210776 - Replace llvm::error_code with std::error_code.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 12 06:32:11 PDT 2014


Author: rafael
Date: Thu Jun 12 08:32:11 2014
New Revision: 210776

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

Modified:
    clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
    clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
    clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.h
    clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
    clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
    clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
    clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.h
    clang-tools-extra/trunk/unittests/clang-modernize/IncludeDirectivesTest.cpp
    clang-tools-extra/trunk/unittests/clang-modernize/IncludeExcludeTest.cpp
    clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
    clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyOptionsTest.cpp
    clang-tools-extra/trunk/unittests/include/common/Utility.h

Modified: clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h Thu Jun 12 08:32:11 2014
@@ -65,7 +65,7 @@ FileToReplacementsMap;
 ///
 /// \returns An error_code indicating success or failure in navigating the
 /// directory structure.
-llvm::error_code
+std::error_code
 collectReplacementsFromDirectory(const llvm::StringRef Directory,
                                  TUReplacements &TUs,
                                  TUReplacementFiles &TURFiles,

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=210776&r1=210775&r2=210776&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 08:32:11 2014
@@ -36,7 +36,7 @@ static void eatDiagnostics(const SMDiagn
 namespace clang {
 namespace replace {
 
-llvm::error_code
+std::error_code
 collectReplacementsFromDirectory(const llvm::StringRef Directory,
                                  TUReplacements &TUs,
                                  TUReplacementFiles & TURFiles,

Modified: clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.h?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.h (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.h Thu Jun 12 08:32:11 2014
@@ -29,16 +29,16 @@ public:
   ///
   /// Returns error_code::success() on successful parse of the strings or
   /// an error_code indicating the encountered error.
-  llvm::error_code readListFromString(llvm::StringRef IncludeString,
-                                      llvm::StringRef ExcludeString);
+  std::error_code readListFromString(llvm::StringRef IncludeString,
+                                     llvm::StringRef ExcludeString);
 
   /// \brief Read and parse the lists of paths from \a IncludeListFile
   /// and \a ExcludeListFile. Each file should contain one path per line.
   ///
   /// Returns error_code::success() on successful read and parse of both files
   /// or an error_code indicating the encountered error.
-  llvm::error_code readListFromFile(llvm::StringRef IncludeListFile,
-                                    llvm::StringRef ExcludeListFile);
+  std::error_code readListFromFile(llvm::StringRef IncludeListFile,
+                                   llvm::StringRef ExcludeListFile);
 
   /// \brief Determine if the given path is in the list of include paths but
   /// not in the list of exclude paths.

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.cpp Thu Jun 12 08:32:11 2014
@@ -62,15 +62,15 @@ namespace clang {
 namespace tidy {
 
 /// \brief Parses -line-filter option and stores it to the \c Options.
-llvm::error_code parseLineFilter(const std::string &LineFilter,
-                                 clang::tidy::ClangTidyGlobalOptions &Options) {
+std::error_code parseLineFilter(const std::string &LineFilter,
+                                clang::tidy::ClangTidyGlobalOptions &Options) {
   llvm::yaml::Input Input(LineFilter);
   Input >> Options.LineFilter;
   return Input.error();
 }
 
-llvm::error_code parseConfiguration(const std::string &Config,
-                                    clang::tidy::ClangTidyOptions &Options) {
+std::error_code parseConfiguration(const std::string &Config,
+                                   clang::tidy::ClangTidyOptions &Options) {
   llvm::yaml::Input Input(Config);
   Input >> Options;
   return Input.error();

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Thu Jun 12 08:32:11 2014
@@ -89,12 +89,12 @@ private:
 };
 
 /// \brief Parses LineFilter from JSON and stores it to the \p Options.
-llvm::error_code parseLineFilter(const std::string &LineFilter,
-                                 clang::tidy::ClangTidyGlobalOptions &Options);
+std::error_code parseLineFilter(const std::string &LineFilter,
+                                clang::tidy::ClangTidyGlobalOptions &Options);
 
 /// \brief Parses configuration from JSON and stores it to the \p Options.
-llvm::error_code parseConfiguration(const std::string &Config,
-                                    clang::tidy::ClangTidyOptions &Options);
+std::error_code parseConfiguration(const std::string &Config,
+                                   clang::tidy::ClangTidyOptions &Options);
 
 } // end namespace tidy
 } // end namespace clang

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Thu Jun 12 08:32:11 2014
@@ -109,7 +109,7 @@ int main(int argc, const char **argv) {
   CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory);
 
   clang::tidy::ClangTidyGlobalOptions GlobalOptions;
-  if (llvm::error_code Err =
+  if (std::error_code Err =
           clang::tidy::parseLineFilter(LineFilter, GlobalOptions)) {
     llvm::errs() << "Invalid LineFilter: " << Err.message() << "\n\nUsage:\n";
     llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true);

Modified: clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.h?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.h (original)
+++ clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.h Thu Jun 12 08:32:11 2014
@@ -137,7 +137,7 @@ public:
   /// \returns 0 if there were no errors or warnings, 1 if there
   ///   were warnings, 2 if any other problem, such as a bad
   ///   module map path argument was specified.
-  llvm::error_code doChecks();
+  std::error_code doChecks();
 
   // The following functions are called by doChecks.
 

Modified: clang-tools-extra/trunk/unittests/clang-modernize/IncludeDirectivesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-modernize/IncludeDirectivesTest.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-modernize/IncludeDirectivesTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-modernize/IncludeDirectivesTest.cpp Thu Jun 12 08:32:11 2014
@@ -66,7 +66,7 @@ public:
   /// refer to the headers by using '\<FileName\>'.
   std::string makeHeaderFileName(StringRef FileName) const {
     SmallString<128> Path;
-    llvm::error_code EC = llvm::sys::fs::current_path(Path);
+    std::error_code EC = llvm::sys::fs::current_path(Path);
     assert(!EC);
     (void)EC;
 

Modified: clang-tools-extra/trunk/unittests/clang-modernize/IncludeExcludeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-modernize/IncludeExcludeTest.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-modernize/IncludeExcludeTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-modernize/IncludeExcludeTest.cpp Thu Jun 12 08:32:11 2014
@@ -16,11 +16,11 @@
 
 TEST(IncludeExcludeTest, ParseString) {
   IncludeExcludeInfo IEManager;
-  llvm::error_code Err = IEManager.readListFromString(
+  std::error_code Err = IEManager.readListFromString(
       /*include=*/ "a,b/b2,c/c2,d/../d2/../d3",
       /*exclude=*/ "a/af.cpp,a/a2,b/b2/b2f.cpp,c/c2");
 
-  ASSERT_EQ(Err, llvm::error_code());
+  ASSERT_EQ(Err, std::error_code());
 
   // If the file does not appear on the include list then it is not safe to
   // transform. Files are not safe to transform by default.
@@ -61,11 +61,11 @@ TEST(IncludeExcludeTest, ParseString) {
 
 TEST(IncludeExcludeTest, ParseStringCases) {
   IncludeExcludeInfo IEManager;
-  llvm::error_code Err = IEManager.readListFromString(
+  std::error_code Err = IEManager.readListFromString(
       /*include=*/  "a/.,b/b2/,c/c2/c3/../../c4/,d/d2/./d3/,/e/e2/.",
       /*exclude=*/ "");
 
-  ASSERT_EQ(Err, llvm::error_code());
+  ASSERT_EQ(Err, std::error_code());
 
   EXPECT_TRUE(IEManager.isFileIncluded("a/f.cpp"));
   EXPECT_TRUE(IEManager.isFileIncluded("b/b2/f.cpp"));
@@ -123,10 +123,10 @@ TEST(IncludeExcludeFileTest, UNIXFile) {
   ASSERT_NO_FATAL_FAILURE(UnixFiles.CreateFiles(/* UnixMode= */true));
 
   IncludeExcludeInfo IEManager;
-  llvm::error_code Err = IEManager.readListFromFile(
+  std::error_code Err = IEManager.readListFromFile(
       UnixFiles.IncludeDataPath.c_str(), UnixFiles.ExcludeDataPath.c_str());
 
-  ASSERT_EQ(Err, llvm::error_code());
+  ASSERT_EQ(Err, std::error_code());
 
   EXPECT_FALSE(IEManager.isFileIncluded("f.cpp"));
   EXPECT_TRUE(IEManager.isFileIncluded("a/f.cpp"));
@@ -138,10 +138,10 @@ TEST(IncludeExcludeFileTest, DOSFile) {
   ASSERT_NO_FATAL_FAILURE(DOSFiles.CreateFiles(/* UnixMode= */false));
 
   IncludeExcludeInfo IEManager;
-  llvm::error_code Err = IEManager.readListFromFile(
+  std::error_code Err = IEManager.readListFromFile(
       DOSFiles.IncludeDataPath.c_str(), DOSFiles.ExcludeDataPath.c_str());
 
-  ASSERT_EQ(Err, llvm::error_code());
+  ASSERT_EQ(Err, std::error_code());
 
   EXPECT_FALSE(IEManager.isFileIncluded("f.cpp"));
   EXPECT_TRUE(IEManager.isFileIncluded("a/f.cpp"));

Modified: clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp Thu Jun 12 08:32:11 2014
@@ -124,7 +124,7 @@ TEST(Transform, Timings) {
   // file anyway. What is important is that we have an absolute path with which
   // to use with mapVirtualFile().
   SmallString<128> CurrentDir;
-  llvm::error_code EC = llvm::sys::fs::current_path(CurrentDir);
+  std::error_code EC = llvm::sys::fs::current_path(CurrentDir);
   assert(!EC);
   (void)EC;
 
@@ -237,7 +237,7 @@ TEST(Transform, isFileModifiable) {
   // file anyway. What is important is that we have an absolute path with which
   // to use with mapVirtualFile().
   SmallString<128> CurrentDir;
-  llvm::error_code EC = llvm::sys::fs::current_path(CurrentDir);
+  std::error_code EC = llvm::sys::fs::current_path(CurrentDir);
   assert(!EC);
   (void)EC;
 

Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyOptionsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyOptionsTest.cpp?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyOptionsTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyOptionsTest.cpp Thu Jun 12 08:32:11 2014
@@ -31,7 +31,7 @@ TEST(ParseLineFilter, InvalidFilter) {
 
 TEST(ParseLineFilter, ValidFilter) {
   ClangTidyGlobalOptions Options;
-  llvm::error_code Error = parseLineFilter(
+  std::error_code Error = parseLineFilter(
       "[{\"name\":\"file1.cpp\",\"lines\":[[3,15],[20,30],[42,42]]},"
       "{\"name\":\"file2.h\"},"
       "{\"name\":\"file3.cc\",\"lines\":[[100,1000]]}]",
@@ -56,10 +56,10 @@ TEST(ParseLineFilter, ValidFilter) {
 
 TEST(ParseConfiguration, ValidConfiguration) {
   ClangTidyOptions Options;
-  llvm::error_code Error = parseConfiguration("Checks: \"-*,misc-*\"\n"
-                                              "HeaderFilterRegex: \".*\"\n"
-                                              "AnalyzeTemporaryDtors: true\n",
-                                              Options);
+  std::error_code Error = parseConfiguration("Checks: \"-*,misc-*\"\n"
+                                             "HeaderFilterRegex: \".*\"\n"
+                                             "AnalyzeTemporaryDtors: true\n",
+                                             Options);
   EXPECT_FALSE(Error);
   EXPECT_EQ("-*,misc-*", Options.Checks);
   EXPECT_EQ(".*", Options.HeaderFilterRegex);

Modified: clang-tools-extra/trunk/unittests/include/common/Utility.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include/common/Utility.h?rev=210776&r1=210775&r2=210776&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/include/common/Utility.h (original)
+++ clang-tools-extra/trunk/unittests/include/common/Utility.h Thu Jun 12 08:32:11 2014
@@ -12,7 +12,7 @@
 
 // FIXME: copied from unittests/Support/Path.cpp
 #define ASSERT_NO_ERROR(x)                                                     \
-  if (llvm::error_code ASSERT_NO_ERROR_ec = x) {                               \
+  if (std::error_code ASSERT_NO_ERROR_ec = x) {                                \
     llvm::SmallString<128> MessageStorage;                                     \
     llvm::raw_svector_ostream Message(MessageStorage);                         \
     Message << #x ": did not return errc::success.\n"                          \





More information about the cfe-commits mailing list