aganea updated this revision to Diff 228971.
aganea edited the summary of this revision.
aganea added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Using `SmallVector` as requested.

The change in SmallVector.h is to support things such as `Opts.AddPluginActions 
= Args.getAllArgValues(OPT_add_plugin);` where `getAllArgValues()` returns a 
`std::vector`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69959/new/

https://reviews.llvm.org/D69959

Files:
  clang-tools-extra/clang-move/tool/ClangMove.cpp
  clang/include/clang/Frontend/FrontendOptions.h
  llvm/include/llvm/ADT/SmallVector.h

Index: llvm/include/llvm/ADT/SmallVector.h
===================================================================
--- llvm/include/llvm/ADT/SmallVector.h
+++ llvm/include/llvm/ADT/SmallVector.h
@@ -31,6 +31,7 @@
 #include <new>
 #include <type_traits>
 #include <utility>
+#include <vector>
 
 namespace llvm {
 
@@ -900,6 +901,11 @@
     this->assign(IL);
     return *this;
   }
+
+  const SmallVector &operator=(const std::vector<T> &Vec) {
+    this->assign(Vec.begin(), Vec.end());
+    return *this;
+  }
 };
 
 template <typename T, unsigned N>
Index: clang/include/clang/Frontend/FrontendOptions.h
===================================================================
--- clang/include/clang/Frontend/FrontendOptions.h
+++ clang/include/clang/Frontend/FrontendOptions.h
@@ -18,7 +18,6 @@
 #include <cassert>
 #include <memory>
 #include <string>
-#include <unordered_map>
 #include <vector>
 
 namespace llvm {
@@ -366,7 +365,7 @@
   std::string ARCMTMigrateReportOut;
 
   /// The input files and their types.
-  std::vector<FrontendInputFile> Inputs;
+  SmallVector<FrontendInputFile, 0> Inputs;
 
   /// When the input is a module map, the original module map file from which
   /// that map was inferred, if any (for umbrella modules).
@@ -391,33 +390,33 @@
   std::string ActionName;
 
   /// Args to pass to the plugins
-  std::unordered_map<std::string,std::vector<std::string>> PluginArgs;
+  llvm::StringMap<std::vector<std::string>> PluginArgs;
 
   /// The list of plugin actions to run in addition to the normal action.
-  std::vector<std::string> AddPluginActions;
+  SmallVector<std::string, 0> AddPluginActions;
 
   /// The list of plugins to load.
-  std::vector<std::string> Plugins;
+  SmallVector<std::string, 0> Plugins;
 
   /// The list of module file extensions.
-  std::vector<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
+  SmallVector<std::shared_ptr<ModuleFileExtension>, 0> ModuleFileExtensions;
 
   /// The list of module map files to load before processing the input.
-  std::vector<std::string> ModuleMapFiles;
+  SmallVector<std::string, 0> ModuleMapFiles;
 
   /// The list of additional prebuilt module files to load before
   /// processing the input.
-  std::vector<std::string> ModuleFiles;
+  SmallVector<std::string, 0> ModuleFiles;
 
   /// The list of files to embed into the compiled module file.
-  std::vector<std::string> ModulesEmbedFiles;
+  SmallVector<std::string, 0> ModulesEmbedFiles;
 
   /// The list of AST files to merge.
-  std::vector<std::string> ASTMergeFiles;
+  SmallVector<std::string, 0> ASTMergeFiles;
 
   /// A list of arguments to forward to LLVM's option processing; this
   /// should only be used for debugging and experimental features.
-  std::vector<std::string> LLVMArgs;
+  SmallVector<std::string, 0> LLVMArgs;
 
   /// File name of the file that will provide record layouts
   /// (in the format produced by -fdump-record-layouts).
Index: clang-tools-extra/clang-move/tool/ClangMove.cpp
===================================================================
--- clang-tools-extra/clang-move/tool/ClangMove.cpp
+++ clang-tools-extra/clang-move/tool/ClangMove.cpp
@@ -110,7 +110,7 @@
   Tool.appendArgumentsAdjuster(tooling::getInsertArgumentAdjuster(
       "-fparse-all-comments", tooling::ArgumentInsertPosition::BEGIN));
   move::MoveDefinitionSpec Spec;
-  Spec.Names = {Names.begin(), Names.end()};
+  Spec.Names = (std::vector<std::string> &)Names;
   Spec.OldHeader = OldHeader;
   Spec.NewHeader = NewHeader;
   Spec.OldCC = OldCC;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to