[PATCH] D93698: [clang][cli] Port a CommaJoined option to the marshalling infrastructure

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 22 23:05:25 PST 2020


dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM, with one nit.



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:333-337
+    for (const std::string &Value : Values) {
+      if (&Value != &Values.front())
+        CommaJoinedValue.append(",");
+      CommaJoinedValue.append(Value);
+    }
----------------
The comparison to `.front` is a bit subtle. I think this might be more direct / easy to read using `drop_begin`:
```
CommaJoinedValue.append(Values.front());
for (const std::string &Value : llvm::drop_begin(Values, 1)) {
  CommaJoinedValue.append(",");
  CommaJoinedValue.append(Value);
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93698



More information about the cfe-commits mailing list