[PATCH] D94474: [WIP][clang][cli] Test manual header search argument generation with round-trip

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 10:29:04 PST 2021


dexonsmith added inline comments.


================
Comment at: clang/include/clang/Frontend/CompilerInvocation.h:199-203
   void generateCC1CommandLine(llvm::SmallVectorImpl<const char *> &Args,
                               StringAllocator SA) const;
+  void generateCC1CommandLine(llvm::SmallVectorImpl<const char *> &Args,
+                              StringAllocator SA,
+                              ArrayRef<llvm::opt::OptSpecifier> Included) const;
----------------
You can avoid the duplication at least for the WIP with:
```
void generateCC1CommandLine(llvm::SmallVectorImpl<const char *> &Args,
                              StringAllocator SA,
                              ArrayRef<llvm::opt::OptSpecifier> Included = None) const;
```
and then in the body:
```
auto IsIncluded = Included.empty()
    ? [](OptSpecifier) { return true; }
    : [&Included](OptSpecifier Opt) { return Included.count(Opt); };

// ...
if (... && IsIncluded(Opt)) {
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94474



More information about the cfe-commits mailing list