[PATCH] Driver: support detecting driver mode when clang has a version suffix without dash (PR21094)

David Blaikie dblaikie at gmail.com
Thu Oct 16 19:05:05 PDT 2014


Looks good

================
Comment at: tools/driver/driver.cpp:251
@@ +250,3 @@
+    while (!ProgNameRef.empty() &&
+           (isDigit(ProgNameRef.back()) || ProgNameRef.back() == '.'))
+      ProgNameRef = ProgNameRef.drop_back(1);
----------------
hans wrote:
> dblaikie wrote:
> > the extra parens around the isDigit call are a bit confusing/misleading (I saw the end ')' and thought it was maybe grouped with the empty() call above for some reason)
> The extra parenthesis are around the || expression.
> 
> Anyway, I've rewritten this with less parenthesis, and fitting on one line.
Oh, right - I just can't count. Sorry about that.

The new version isn't necessarily 'portable' to interesting digit characters in other languages? Maybe? Dunno if that's important.

If you're going to write it that way, I'll at least optionally suggest that you could use StringRef's find_last_not_of to do that search.

http://reviews.llvm.org/D5833






More information about the cfe-commits mailing list