[PATCH] D53428: Adjust cl::opt uses for opt_storage refactored

Yevgeny Rouban via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 19 03:13:09 PDT 2018


yrouban created this revision.
yrouban added reviewers: chandlerc, rsmith, reames, skatkov.
Herald added a subscriber: cfe-commits.

This patch fixes compilation errors that result from refactoring of LLVM cl::opt structures introduced by https://reviews.llvm.org/D53426.
Basically for class-based cl::opt<MyClass> to access to the instance of MyClass one of the overloadable operators should be used.

For example if we have an option defined as cl::opt<std::string> MyStringOption;
Then the changes should look like the following:

Old: MyStringOption.c_str()
New: MyStringOption->c_str()

Old: cout << MyStringOption;
New: cout << *MyStringOption;


Repository:
  rC Clang

https://reviews.llvm.org/D53428

Files:
  lib/Tooling/Execution.cpp
  tools/arcmt-test/arcmt-test.cpp
  tools/clang-import-test/clang-import-test.cpp
  tools/clang-rename/ClangRename.cpp
  tools/diagtool/FindDiagnosticID.cpp
  unittests/Tooling/ExecutionTest.cpp


Index: unittests/Tooling/ExecutionTest.cpp
===================================================================
--- unittests/Tooling/ExecutionTest.cpp
+++ unittests/Tooling/ExecutionTest.cpp
@@ -158,7 +158,7 @@
   auto Executor = internal::createExecutorFromCommandLineArgsImpl(
       argc, &argv[0], TestCategory);
   ASSERT_TRUE((bool)Executor);
-  EXPECT_EQ(BeforeReset, "set");
+  EXPECT_EQ(*BeforeReset, "set");
   BeforeReset.removeArgument();
 }
 
Index: tools/diagtool/FindDiagnosticID.cpp
===================================================================
--- tools/diagtool/FindDiagnosticID.cpp
+++ tools/diagtool/FindDiagnosticID.cpp
@@ -66,7 +66,7 @@
       return 0;
     }
 
-    llvm::errs() << "error: invalid diagnostic '" << DiagnosticName << "'\n";
+    llvm::errs() << "error: invalid diagnostic '" << *DiagnosticName << "'\n";
     return 1;
   }
   OS << Diag->DiagID << "\n";
Index: tools/clang-rename/ClangRename.cpp
===================================================================
--- tools/clang-rename/ClangRename.cpp
+++ tools/clang-rename/ClangRename.cpp
@@ -104,9 +104,9 @@
   if (!Input.empty()) {
     // Populate QualifiedNames and NewNames from a YAML file.
     ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
-        llvm::MemoryBuffer::getFile(Input);
+        llvm::MemoryBuffer::getFile(*Input);
     if (!Buffer) {
-      errs() << "clang-rename: failed to read " << Input << ": "
+      errs() << "clang-rename: failed to read " << *Input << ": "
              << Buffer.getError().message() << "\n";
       return 1;
     }
Index: tools/clang-import-test/clang-import-test.cpp
===================================================================
--- tools/clang-import-test/clang-import-test.cpp
+++ tools/clang-import-test/clang-import-test.cpp
@@ -174,7 +174,7 @@
 
   {
     using namespace driver::types;
-    ID Id = lookupTypeForTypeSpecifier(Input.c_str());
+    ID Id = lookupTypeForTypeSpecifier(Input->c_str());
     assert(Id != TY_INVALID);
     if (isCXX(Id)) {
       Inv->getLangOpts()->CPlusPlus = true;
Index: tools/arcmt-test/arcmt-test.cpp
===================================================================
--- tools/arcmt-test/arcmt-test.cpp
+++ tools/arcmt-test/arcmt-test.cpp
@@ -243,7 +243,7 @@
   if (RemappingsFile.empty())
     inputBuf = MemoryBuffer::getSTDIN();
   else
-    inputBuf = MemoryBuffer::getFile(RemappingsFile);
+    inputBuf = MemoryBuffer::getFile(*RemappingsFile);
   if (!inputBuf) {
     errs() << "error: could not read remappings input\n";
     return true;
Index: lib/Tooling/Execution.cpp
===================================================================
--- lib/Tooling/Execution.cpp
+++ lib/Tooling/Execution.cpp
@@ -82,7 +82,7 @@
     return std::move(*Executor);
   }
   return llvm::make_error<llvm::StringError>(
-      llvm::Twine("Executor \"") + ExecutorName + "\" is not registered.",
+      llvm::Twine("Executor \"") + *ExecutorName + "\" is not registered.",
       llvm::inconvertibleErrorCode());
 }
 } // end namespace internal


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53428.170173.patch
Type: text/x-patch
Size: 3045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181019/c75e24f6/attachment.bin>


More information about the cfe-commits mailing list