r210688 - Use std::error_code instead of llvm::error_code.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 11 17:01:13 PDT 2014


Fixed it r210722. Thanks.

On 11 June 2014 18:49, Zachary Turner <zturner at google.com> wrote:
> I think this change breaks Tests\Format\style-on-command-line.cpp.  The new
> error message is all lower case, so it ec.message() returns "invalid
> argument" but the test checks for "Invalid argument" (uppercase i).  I'm not
> 100% sure if this error message is the same on all platforms, so rather than
> change the case to fix the test on Windows and assume it works everywhere
> else, I will just mention it here so you're aware.
>
>
> On Wed, Jun 11, 2014 at 12:05 PM, Rafael Espindola
> <rafael.espindola at gmail.com> wrote:
>>
>> Author: rafael
>> Date: Wed Jun 11 14:05:55 2014
>> New Revision: 210688
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=210688&view=rev
>> Log:
>> Use std::error_code instead of llvm::error_code.
>>
>> This is an update for a llvm api change.
>>
>> Modified:
>>     cfe/trunk/lib/Basic/VirtualFileSystem.cpp
>>     cfe/trunk/lib/Format/Format.cpp
>>     cfe/trunk/lib/Frontend/CompilerInstance.cpp
>>     cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
>>     cfe/trunk/unittests/Format/FormatTest.cpp
>>
>> Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=210688&r1=210687&r2=210688&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
>> +++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Wed Jun 11 14:05:55 2014
>> @@ -198,10 +198,10 @@ ErrorOr<Status> OverlayFileSystem::statu
>>    // FIXME: handle symlinks that cross file systems
>>    for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {
>>      ErrorOr<Status> Status = (*I)->status(Path);
>> -    if (Status || Status.getError() != errc::no_such_file_or_directory)
>> +    if (Status || Status.getError() !=
>> std::errc::no_such_file_or_directory)
>>        return Status;
>>    }
>> -  return make_error_code(errc::no_such_file_or_directory);
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>>  }
>>
>>  error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path,
>> @@ -209,10 +209,10 @@ error_code OverlayFileSystem::openFileFo
>>    // FIXME: handle symlinks that cross file systems
>>    for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {
>>      error_code EC = (*I)->openFileForRead(Path, Result);
>> -    if (!EC || EC != errc::no_such_file_or_directory)
>> +    if (!EC || EC != std::errc::no_such_file_or_directory)
>>        return EC;
>>    }
>> -  return make_error_code(errc::no_such_file_or_directory);
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>>  }
>>
>>
>> //===-----------------------------------------------------------------------===/
>> @@ -744,17 +744,17 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
>>      return EC;
>>
>>    if (Path.empty())
>> -    return make_error_code(errc::invalid_argument);
>> +    return make_error_code(std::errc::invalid_argument);
>>
>>    sys::path::const_iterator Start = sys::path::begin(Path);
>>    sys::path::const_iterator End = sys::path::end(Path);
>>    for (std::vector<Entry *>::iterator I = Roots.begin(), E = Roots.end();
>>         I != E; ++I) {
>>      ErrorOr<Entry *> Result = lookupPath(Start, End, *I);
>> -    if (Result || Result.getError() != errc::no_such_file_or_directory)
>> +    if (Result || Result.getError() !=
>> std::errc::no_such_file_or_directory)
>>        return Result;
>>    }
>> -  return make_error_code(errc::no_such_file_or_directory);
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>>  }
>>
>>  ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start,
>> @@ -767,7 +767,7 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
>>    if (CaseSensitive ? !Start->equals(From->getName())
>>                      : !Start->equals_lower(From->getName()))
>>      // failure to match
>> -    return make_error_code(errc::no_such_file_or_directory);
>> +    return make_error_code(std::errc::no_such_file_or_directory);
>>
>>    ++Start;
>>
>> @@ -778,16 +778,16 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath
>>
>>    DirectoryEntry *DE = dyn_cast<DirectoryEntry>(From);
>>    if (!DE)
>> -    return make_error_code(errc::not_a_directory);
>> +    return make_error_code(std::errc::not_a_directory);
>>
>>    for (DirectoryEntry::iterator I = DE->contents_begin(),
>>                                  E = DE->contents_end();
>>         I != E; ++I) {
>>      ErrorOr<Entry *> Result = lookupPath(Start, End, *I);
>> -    if (Result || Result.getError() != errc::no_such_file_or_directory)
>> +    if (Result || Result.getError() !=
>> std::errc::no_such_file_or_directory)
>>        return Result;
>>    }
>> -  return make_error_code(errc::no_such_file_or_directory);
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>>  }
>>
>>  ErrorOr<Status> VFSFromYAML::status(const Twine &Path) {
>> @@ -820,7 +820,7 @@ error_code VFSFromYAML::openFileForRead(
>>
>>    FileEntry *F = dyn_cast<FileEntry>(*E);
>>    if (!F) // FIXME: errc::not_a_file?
>> -    return make_error_code(errc::invalid_argument);
>> +    return make_error_code(std::errc::invalid_argument);
>>
>>    if (error_code EC =
>> ExternalFS->openFileForRead(F->getExternalContentsPath(),
>>                                                    Result))
>>
>> Modified: cfe/trunk/lib/Format/Format.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210688&r1=210687&r2=210688&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Format/Format.cpp (original)
>> +++ cfe/trunk/lib/Format/Format.cpp Wed Jun 11 14:05:55 2014
>> @@ -447,7 +447,7 @@ llvm::error_code parseConfiguration(Stri
>>    FormatStyle::LanguageKind Language = Style->Language;
>>    assert(Language != FormatStyle::LK_None);
>>    if (Text.trim().empty())
>> -    return llvm::make_error_code(llvm::errc::invalid_argument);
>> +    return llvm::make_error_code(std::errc::invalid_argument);
>>
>>    std::vector<FormatStyle> Styles;
>>    llvm::yaml::Input Input(Text);
>> @@ -463,14 +463,14 @@ llvm::error_code parseConfiguration(Stri
>>    for (unsigned i = 0; i < Styles.size(); ++i) {
>>      // Ensures that only the first configuration can skip the Language
>> option.
>>      if (Styles[i].Language == FormatStyle::LK_None && i != 0)
>> -      return llvm::make_error_code(llvm::errc::invalid_argument);
>> +      return llvm::make_error_code(std::errc::invalid_argument);
>>      // Ensure that each language is configured at most once.
>>      for (unsigned j = 0; j < i; ++j) {
>>        if (Styles[i].Language == Styles[j].Language) {
>>          DEBUG(llvm::dbgs()
>>                << "Duplicate languages in the config file on positions "
>> << j
>>                << " and " << i << "\n");
>> -        return llvm::make_error_code(llvm::errc::invalid_argument);
>> +        return llvm::make_error_code(std::errc::invalid_argument);
>>        }
>>      }
>>    }
>> @@ -485,7 +485,7 @@ llvm::error_code parseConfiguration(Stri
>>        return llvm::error_code();
>>      }
>>    }
>> -  return llvm::make_error_code(llvm::errc::not_supported);
>> +  return llvm::make_error_code(std::errc::not_supported);
>>  }
>>
>>  std::string configurationAsText(const FormatStyle &Style) {
>> @@ -2049,7 +2049,7 @@ FormatStyle getStyle(StringRef StyleName
>>          break;
>>        }
>>        if (llvm::error_code ec = parseConfiguration(Text->getBuffer(),
>> &Style)) {
>> -        if (ec == llvm::errc::not_supported) {
>> +        if (ec == std::errc::not_supported) {
>>            if (!UnsuitableConfigFiles.empty())
>>              UnsuitableConfigFiles.append(", ");
>>            UnsuitableConfigFiles.append(ConfigFile);
>>
>> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210688&r1=210687&r2=210688&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
>> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Wed Jun 11 14:05:55 2014
>> @@ -572,7 +572,7 @@ CompilerInstance::createOutputFile(Strin
>>          llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);
>>
>>      if (CreateMissingDirectories &&
>> -        EC == llvm::errc::no_such_file_or_directory) {
>> +        EC == std::errc::no_such_file_or_directory) {
>>        StringRef Parent = llvm::sys::path::parent_path(OutputPath);
>>        EC = llvm::sys::fs::create_directories(Parent);
>>        if (!EC) {
>>
>> Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210688&r1=210687&r2=210688&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
>> +++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Wed Jun 11
>> 14:05:55 2014
>> @@ -35,7 +35,7 @@ public:
>>      std::map<std::string, vfs::Status>::iterator I =
>>          FilesAndDirs.find(Path.str());
>>      if (I == FilesAndDirs.end())
>> -      return make_error_code(errc::no_such_file_or_directory);
>> +      return make_error_code(std::errc::no_such_file_or_directory);
>>      return I->second;
>>    }
>>    error_code openFileForRead(const Twine &Path,
>> @@ -306,7 +306,8 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
>>    EXPECT_TRUE(S->equivalent(*O->status("//root/"))); // non-volatile
>> UniqueID
>>
>>    // broken mapping
>> -  EXPECT_EQ(errc::no_such_file_or_directory,
>> O->status("//root/file2").getError());
>> +  EXPECT_EQ(std::errc::no_such_file_or_directory,
>> +            O->status("//root/file2").getError());
>>    EXPECT_EQ(0, NumDiagnostics);
>>  }
>>
>> @@ -370,11 +371,11 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) {
>>    O->pushOverlay(FS);
>>
>>    ErrorOr<vfs::Status> SS = O->status("//root/xx");
>> -  EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());
>> +  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
>>    SS = O->status("//root/xX");
>> -  EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());
>> +  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
>>    SS = O->status("//root/Xx");
>> -  EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());
>> +  EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
>>    EXPECT_EQ(0, NumDiagnostics);
>>  }
>>
>>
>> Modified: cfe/trunk/unittests/Format/FormatTest.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=210688&r1=210687&r2=210688&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
>> +++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jun 11 14:05:55 2014
>> @@ -8181,7 +8181,7 @@ TEST_F(FormatTest, ParsesConfigurationWi
>>    CHECK_PARSE("Language: Cpp\n"
>>                "IndentWidth: 12",
>>                IndentWidth, 12u);
>> -  EXPECT_EQ(llvm::errc::not_supported,
>> +  EXPECT_EQ(std::errc::not_supported,
>>              parseConfiguration("Language: JavaScript\n"
>>                                 "IndentWidth: 34",
>>                                 &Style));
>> @@ -8194,9 +8194,9 @@ TEST_F(FormatTest, ParsesConfigurationWi
>>                "IndentWidth: 12",
>>                IndentWidth, 12u);
>>    CHECK_PARSE("IndentWidth: 23", IndentWidth, 23u);
>> -  EXPECT_EQ(llvm::errc::not_supported, parseConfiguration("Language:
>> Cpp\n"
>> -                                                          "IndentWidth:
>> 34",
>> -                                                          &Style));
>> +  EXPECT_EQ(std::errc::not_supported, parseConfiguration("Language:
>> Cpp\n"
>> +                                                         "IndentWidth:
>> 34",
>> +                                                         &Style));
>>    EXPECT_EQ(23u, Style.IndentWidth);
>>    CHECK_PARSE("IndentWidth: 56", IndentWidth, 56u);
>>    EXPECT_EQ(FormatStyle::LK_JavaScript, Style.Language);
>> @@ -8254,7 +8254,7 @@ TEST_F(FormatTest, ParsesConfigurationWi
>>    EXPECT_EQ(789u, Style.TabWidth);
>>
>>
>> -  EXPECT_EQ(llvm::errc::invalid_argument,
>> +  EXPECT_EQ(std::errc::invalid_argument,
>>              parseConfiguration("---\n"
>>                                 "Language: JavaScript\n"
>>                                 "IndentWidth: 56\n"
>> @@ -8262,7 +8262,7 @@ TEST_F(FormatTest, ParsesConfigurationWi
>>                                 "IndentWidth: 78\n"
>>                                 "...\n",
>>                                 &Style));
>> -  EXPECT_EQ(llvm::errc::invalid_argument,
>> +  EXPECT_EQ(std::errc::invalid_argument,
>>              parseConfiguration("---\n"
>>                                 "Language: JavaScript\n"
>>                                 "IndentWidth: 56\n"
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list