[clang-tools-extra] r212406 - Update for llvm api change.

Rafael Espindola rafael.espindola at gmail.com
Sun Jul 6 10:43:19 PDT 2014


Author: rafael
Date: Sun Jul  6 12:43:19 2014
New Revision: 212406

URL: http://llvm.org/viewvc/llvm-project?rev=212406&view=rev
Log:
Update for llvm api change.

Modified:
    clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
    clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp
    clang-tools-extra/trunk/modularize/Modularize.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=212406&r1=212405&r2=212406&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 Sun Jul  6 12:43:19 2014
@@ -59,15 +59,15 @@ collectReplacementsFromDirectory(const l
 
     TURFiles.push_back(I->path());
 
-    std::unique_ptr<MemoryBuffer> Out;
-    std::error_code BufferError = MemoryBuffer::getFile(I->path(), Out);
-    if (BufferError) {
+    ErrorOr<std::unique_ptr<MemoryBuffer>> Out =
+        MemoryBuffer::getFile(I->path());
+    if (std::error_code BufferError = Out.getError()) {
       errs() << "Error reading " << I->path() << ": " << BufferError.message()
              << "\n";
       continue;
     }
 
-    yaml::Input YIn(Out->getBuffer(), nullptr, &eatDiagnostics);
+    yaml::Input YIn(Out.get()->getBuffer(), nullptr, &eatDiagnostics);
     tooling::TranslationUnitReplacements TU;
     YIn >> TU;
     if (YIn.error()) {

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=212406&r1=212405&r2=212406&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeExcludeInfo.cpp Sun Jul  6 12:43:19 2014
@@ -123,23 +123,27 @@ std::error_code
 IncludeExcludeInfo::readListFromFile(StringRef IncludeListFile,
                                      StringRef ExcludeListFile) {
   if (!IncludeListFile.empty()) {
-    std::unique_ptr<MemoryBuffer> FileBuf;
-    if (std::error_code Err = MemoryBuffer::getFile(IncludeListFile, FileBuf)) {
+    ErrorOr<std::unique_ptr<MemoryBuffer>> FileBuf =
+        MemoryBuffer::getFile(IncludeListFile);
+    if (std::error_code Err = FileBuf.getError()) {
       errs() << "Unable to read from include file.\n";
       return Err;
     }
-    if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), IncludeList,
-                                           /*Separator=*/"\n"))
+    if (std::error_code Err =
+            parseCLInput(FileBuf.get()->getBuffer(), IncludeList,
+                         /*Separator=*/"\n"))
       return Err;
   }
   if (!ExcludeListFile.empty()) {
-    std::unique_ptr<MemoryBuffer> FileBuf;
-    if (std::error_code Err = MemoryBuffer::getFile(ExcludeListFile, FileBuf)) {
+    ErrorOr<std::unique_ptr<MemoryBuffer>> FileBuf =
+        MemoryBuffer::getFile(ExcludeListFile);
+    if (std::error_code Err = FileBuf.getError()) {
       errs() << "Unable to read from exclude file.\n";
       return Err;
     }
-    if (std::error_code Err = parseCLInput(FileBuf->getBuffer(), ExcludeList,
-                                           /*Separator=*/"\n"))
+    if (std::error_code Err =
+            parseCLInput(FileBuf.get()->getBuffer(), ExcludeList,
+                         /*Separator=*/"\n"))
       return Err;
   }
   return std::error_code();

Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=212406&r1=212405&r2=212406&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Sun Jul  6 12:43:19 2014
@@ -230,14 +230,14 @@ getHeaderFileNames(SmallVectorImpl<std::
     HeaderDirectory = HeaderPrefix;
 
   // Read the header list file into a buffer.
-  std::unique_ptr<MemoryBuffer> listBuffer;
-  if (std::error_code ec = MemoryBuffer::getFile(ListFileName, listBuffer)) {
-    return ec;
-  }
+  ErrorOr<std::unique_ptr<MemoryBuffer>> listBuffer =
+      MemoryBuffer::getFile(ListFileName);
+  if (std::error_code EC = listBuffer.getError())
+    return EC;
 
   // Parse the header list into strings.
   SmallVector<StringRef, 32> Strings;
-  listBuffer->getBuffer().split(Strings, "\n", -1, false);
+  listBuffer.get()->getBuffer().split(Strings, "\n", -1, false);
 
   // Collect the header file names from the string list.
   for (SmallVectorImpl<StringRef>::iterator I = Strings.begin(),





More information about the cfe-commits mailing list