[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

Zachary Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 11:44:32 PDT 2017

zturner added a comment.

Looks good with one more suggested fix.

Comment at: include/clang/Driver/Job.h:129
+  /// the given vector is to be copied in as opposed to moved. 
+  void setEnvironment(const std::vector<const char *> &NewEnvironment);
Since it's just a vector of pointers, I don't think this is a very valuable optimization, especially at the risk of complicating the API (I had to think again to recall how overload resolution works with rvalue references and const char*.  

Personally I would just have one function, `void setEnvironment(ArrayRef<const char*> NewEnvironment);`  (for example, this allows someone to pass in a `SmallVector` as well), and not worry about the optimization.  More flexibility in the API is preferable to optimizations unless this is a specific bottleneck, which seems unlikely.


More information about the cfe-commits mailing list