================
@@ -273,6 +273,21 @@ void CommandMangler::operator()(tooling::CompileCommand 
&Command,
       SawInput(Cmd[I]);
     Cmd.resize(DashDashIndex);
   }
+
+  llvm::SmallVector<const char *, 16> UnsupportedArgs;
+
+  for (auto *UnknownArg : ArgList.filtered(options::OPT_UNKNOWN)) {
+    unsigned Index = UnknownArg->getIndex();
+    const auto *Argument = UnknownArg->getValue();
+    UnsupportedArgs.push_back(Argument);
+    IndicesToDrop.push_back(Index);
+  }
+
+  if (!UnsupportedArgs.empty()) {
+    std::string UnsupportedArguments = llvm::join(UnsupportedArgs, ", ");
+    log("Warning: detected unsupported Flags {0}", UnsupportedArguments);
----------------
ArcsinX wrote:

- You can use `llvm::join(UnsupportedArgs, ", ")` return value directly.
- Put '{0}' into single quotes, this will make this message more readable, 
because we have spaces inside
- these options are `unknown`, but not `unsupported`
- maybe `option` word is more suitable here than `Flag`
- after you remove `std::string UnsupportedArguments = 
llvm::join(UnsupportedArgs, ", ");`, this `if` body became single-statement. 
For single-statement bodies we don't need `{}` (see 
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
 )

I.e. something like this
`log("Warning: detected unknown options: '{0}'",llvm::join(UnsupportedArgs, ", 
"));`


P.S. maybe we can skip unsupported options too? For the reference
https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Options/Options.h#L24


https://github.com/llvm/llvm-project/pull/200001
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to