<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 12:05 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Jun 11 14:05:55 2014<br>
New Revision: 210688<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210688&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=210688&view=rev</a><br>
Log:<br>
Use std::error_code instead of llvm::error_code.<br>
<br>
This is an update for a llvm api change.<br>
<br>
Modified:<br>
cfe/trunk/lib/Basic/VirtualFileSystem.cpp<br>
cfe/trunk/lib/Format/Format.cpp<br>
cfe/trunk/lib/Frontend/CompilerInstance.cpp<br>
cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp<br>
cfe/trunk/unittests/Format/FormatTest.cpp<br>
<br>
Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=210688&r1=210687&r2=210688&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=210688&r1=210687&r2=210688&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)<br>
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Wed Jun 11 14:05:55 2014<br>
@@ -198,10 +198,10 @@ ErrorOr<Status> OverlayFileSystem::statu<br>
// FIXME: handle symlinks that cross file systems<br>
for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {<br>
ErrorOr<Status> Status = (*I)->status(Path);<br>
- if (Status || Status.getError() != errc::no_such_file_or_directory)<br>
+ if (Status || Status.getError() != std::errc::no_such_file_or_directory)<br>
return Status;<br>
}<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
}<br>
<br>
error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path,<br>
@@ -209,10 +209,10 @@ error_code OverlayFileSystem::openFileFo<br>
// FIXME: handle symlinks that cross file systems<br>
for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) {<br>
error_code EC = (*I)->openFileForRead(Path, Result);<br>
- if (!EC || EC != errc::no_such_file_or_directory)<br>
+ if (!EC || EC != std::errc::no_such_file_or_directory)<br>
return EC;<br>
}<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
}<br>
<br>
//===-----------------------------------------------------------------------===/<br>
@@ -744,17 +744,17 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath<br>
return EC;<br>
<br>
if (Path.empty())<br>
- return make_error_code(errc::invalid_argument);<br>
+ return make_error_code(std::errc::invalid_argument);<br>
<br>
sys::path::const_iterator Start = sys::path::begin(Path);<br>
sys::path::const_iterator End = sys::path::end(Path);<br>
for (std::vector<Entry *>::iterator I = Roots.begin(), E = Roots.end();<br>
I != E; ++I) {<br>
ErrorOr<Entry *> Result = lookupPath(Start, End, *I);<br>
- if (Result || Result.getError() != errc::no_such_file_or_directory)<br>
+ if (Result || Result.getError() != std::errc::no_such_file_or_directory)<br>
return Result;<br>
}<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
}<br>
<br>
ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start,<br>
@@ -767,7 +767,7 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath<br>
if (CaseSensitive ? !Start->equals(From->getName())<br>
: !Start->equals_lower(From->getName()))<br>
// failure to match<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
<br>
++Start;<br>
<br>
@@ -778,16 +778,16 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath<br>
<br>
DirectoryEntry *DE = dyn_cast<DirectoryEntry>(From);<br>
if (!DE)<br>
- return make_error_code(errc::not_a_directory);<br>
+ return make_error_code(std::errc::not_a_directory);<br>
<br>
for (DirectoryEntry::iterator I = DE->contents_begin(),<br>
E = DE->contents_end();<br>
I != E; ++I) {<br>
ErrorOr<Entry *> Result = lookupPath(Start, End, *I);<br>
- if (Result || Result.getError() != errc::no_such_file_or_directory)<br>
+ if (Result || Result.getError() != std::errc::no_such_file_or_directory)<br>
return Result;<br>
}<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
}<br>
<br>
ErrorOr<Status> VFSFromYAML::status(const Twine &Path) {<br>
@@ -820,7 +820,7 @@ error_code VFSFromYAML::openFileForRead(<br>
<br>
FileEntry *F = dyn_cast<FileEntry>(*E);<br>
if (!F) // FIXME: errc::not_a_file?<br>
- return make_error_code(errc::invalid_argument);<br>
+ return make_error_code(std::errc::invalid_argument);<br>
<br>
if (error_code EC = ExternalFS->openFileForRead(F->getExternalContentsPath(),<br>
Result))<br>
<br>
Modified: cfe/trunk/lib/Format/Format.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210688&r1=210687&r2=210688&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210688&r1=210687&r2=210688&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Format/Format.cpp (original)<br>
+++ cfe/trunk/lib/Format/Format.cpp Wed Jun 11 14:05:55 2014<br>
@@ -447,7 +447,7 @@ llvm::error_code parseConfiguration(Stri<br>
FormatStyle::LanguageKind Language = Style->Language;<br>
assert(Language != FormatStyle::LK_None);<br>
if (Text.trim().empty())<br>
- return llvm::make_error_code(llvm::errc::invalid_argument);<br>
+ return llvm::make_error_code(std::errc::invalid_argument);<br>
<br>
std::vector<FormatStyle> Styles;<br>
llvm::yaml::Input Input(Text);<br>
@@ -463,14 +463,14 @@ llvm::error_code parseConfiguration(Stri<br>
for (unsigned i = 0; i < Styles.size(); ++i) {<br>
// Ensures that only the first configuration can skip the Language option.<br>
if (Styles[i].Language == FormatStyle::LK_None && i != 0)<br>
- return llvm::make_error_code(llvm::errc::invalid_argument);<br>
+ return llvm::make_error_code(std::errc::invalid_argument);<br>
// Ensure that each language is configured at most once.<br>
for (unsigned j = 0; j < i; ++j) {<br>
if (Styles[i].Language == Styles[j].Language) {<br>
DEBUG(llvm::dbgs()<br>
<< "Duplicate languages in the config file on positions " << j<br>
<< " and " << i << "\n");<br>
- return llvm::make_error_code(llvm::errc::invalid_argument);<br>
+ return llvm::make_error_code(std::errc::invalid_argument);<br>
}<br>
}<br>
}<br>
@@ -485,7 +485,7 @@ llvm::error_code parseConfiguration(Stri<br>
return llvm::error_code();<br>
}<br>
}<br>
- return llvm::make_error_code(llvm::errc::not_supported);<br>
+ return llvm::make_error_code(std::errc::not_supported);<br>
}<br>
<br>
std::string configurationAsText(const FormatStyle &Style) {<br>
@@ -2049,7 +2049,7 @@ FormatStyle getStyle(StringRef StyleName<br>
break;<br>
}<br>
if (llvm::error_code ec = parseConfiguration(Text->getBuffer(), &Style)) {<br>
- if (ec == llvm::errc::not_supported) {<br>
+ if (ec == std::errc::not_supported) {<br>
if (!UnsuitableConfigFiles.empty())<br>
UnsuitableConfigFiles.append(", ");<br>
UnsuitableConfigFiles.append(ConfigFile);<br>
<br>
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210688&r1=210687&r2=210688&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210688&r1=210687&r2=210688&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Wed Jun 11 14:05:55 2014<br>
@@ -572,7 +572,7 @@ CompilerInstance::createOutputFile(Strin<br>
llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath);<br>
<br>
if (CreateMissingDirectories &&<br>
- EC == llvm::errc::no_such_file_or_directory) {<br>
+ EC == std::errc::no_such_file_or_directory) {<br>
StringRef Parent = llvm::sys::path::parent_path(OutputPath);<br>
EC = llvm::sys::fs::create_directories(Parent);<br>
if (!EC) {<br>
<br>
Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210688&r1=210687&r2=210688&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210688&r1=210687&r2=210688&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)<br>
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Wed Jun 11 14:05:55 2014<br>
@@ -35,7 +35,7 @@ public:<br>
std::map<std::string, vfs::Status>::iterator I =<br>
FilesAndDirs.find(Path.str());<br>
if (I == FilesAndDirs.end())<br>
- return make_error_code(errc::no_such_file_or_directory);<br>
+ return make_error_code(std::errc::no_such_file_or_directory);<br>
return I->second;<br>
}<br>
error_code openFileForRead(const Twine &Path,<br>
@@ -306,7 +306,8 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {<br>
EXPECT_TRUE(S->equivalent(*O->status("//root/"))); // non-volatile UniqueID<br>
<br>
// broken mapping<br>
- EXPECT_EQ(errc::no_such_file_or_directory, O->status("//root/file2").getError());<br>
+ EXPECT_EQ(std::errc::no_such_file_or_directory,<br>
+ O->status("//root/file2").getError());<br>
EXPECT_EQ(0, NumDiagnostics);<br>
}<br>
<br>
@@ -370,11 +371,11 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) {<br>
O->pushOverlay(FS);<br>
<br>
ErrorOr<vfs::Status> SS = O->status("//root/xx");<br>
- EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());<br>
+ EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());<br>
SS = O->status("//root/xX");<br>
- EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());<br>
+ EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());<br>
SS = O->status("//root/Xx");<br>
- EXPECT_EQ(errc::no_such_file_or_directory, SS.getError());<br>
+ EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());<br>
EXPECT_EQ(0, NumDiagnostics);<br>
}<br>
<br>
<br>
Modified: cfe/trunk/unittests/Format/FormatTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=210688&r1=210687&r2=210688&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=210688&r1=210687&r2=210688&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jun 11 14:05:55 2014<br>
@@ -8181,7 +8181,7 @@ TEST_F(FormatTest, ParsesConfigurationWi<br>
CHECK_PARSE("Language: Cpp\n"<br>
"IndentWidth: 12",<br>
IndentWidth, 12u);<br>
- EXPECT_EQ(llvm::errc::not_supported,<br>
+ EXPECT_EQ(std::errc::not_supported,<br>
parseConfiguration("Language: JavaScript\n"<br>
"IndentWidth: 34",<br>
&Style));<br>
@@ -8194,9 +8194,9 @@ TEST_F(FormatTest, ParsesConfigurationWi<br>
"IndentWidth: 12",<br>
IndentWidth, 12u);<br>
CHECK_PARSE("IndentWidth: 23", IndentWidth, 23u);<br>
- EXPECT_EQ(llvm::errc::not_supported, parseConfiguration("Language: Cpp\n"<br>
- "IndentWidth: 34",<br>
- &Style));<br>
+ EXPECT_EQ(std::errc::not_supported, parseConfiguration("Language: Cpp\n"<br>
+ "IndentWidth: 34",<br>
+ &Style));<br>
EXPECT_EQ(23u, Style.IndentWidth);<br>
CHECK_PARSE("IndentWidth: 56", IndentWidth, 56u);<br>
EXPECT_EQ(FormatStyle::LK_JavaScript, Style.Language);<br>
@@ -8254,7 +8254,7 @@ TEST_F(FormatTest, ParsesConfigurationWi<br>
EXPECT_EQ(789u, Style.TabWidth);<br>
<br>
<br>
- EXPECT_EQ(llvm::errc::invalid_argument,<br>
+ EXPECT_EQ(std::errc::invalid_argument,<br>
parseConfiguration("---\n"<br>
"Language: JavaScript\n"<br>
"IndentWidth: 56\n"<br>
@@ -8262,7 +8262,7 @@ TEST_F(FormatTest, ParsesConfigurationWi<br>
"IndentWidth: 78\n"<br>
"...\n",<br>
&Style));<br>
- EXPECT_EQ(llvm::errc::invalid_argument,<br>
+ EXPECT_EQ(std::errc::invalid_argument,<br>
parseConfiguration("---\n"<br>
"Language: JavaScript\n"<br>
"IndentWidth: 56\n"<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>