[PATCH] D82579: [NFC] Extract unifyTargetFeatures
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 25 11:54:27 PDT 2020
yaxunl marked 4 inline comments as done.
yaxunl added inline comments.
================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:93
+ StringRef Name = Features[I];
+ assert(Name[0] == '-' || Name[0] == '+');
+ LastOpt[Name.drop_front(1)] = I;
----------------
tra wrote:
> I don't think assert should be used for something that may be specified to the user on command line.
>
The entries in this array is not directly from command line.
It is either put in by clang code, or translated from -mxxx or -mno-xxx options whereas the translated entry should always have + or - prefix. So if things go wrong, it is due to developers.
================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:97
+
+ for (unsigned I = 0, N = Features.size(); I < N; ++I) {
+ // If this feature was overridden, ignore it.
----------------
tra wrote:
> Would it be simpler to just iterate over features backwards and skip the features we've already seen?
>
That may save a little when there are repeating entries but you need to reverse the obtained vector to maintain the order. Since most cases there are just a few unique features, reversing may ends up slower.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82579/new/
https://reviews.llvm.org/D82579
More information about the cfe-commits
mailing list