[flang-commits] [flang] [Flang] Fix -Wopen-mp-* and -Wopen-acc-* flag spellings (PR #188434)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Thu Mar 26 09:20:56 PDT 2026
================
@@ -148,6 +148,19 @@ class LanguageFeatureControl {
void AddAlternativeCliSpelling(UsageWarning w, std::string input) {
cliOptions_.insert({input, {w}});
}
+ void AddDeprecatedCliSpelling(
+ LanguageFeature f, std::string deprecated, std::string canonical) {
----------------
eugeneepshteyn wrote:
I noticed that that these (and similar functions) take straight `std::string` instead of `const std::string&` and thus potentially could incur extra object copy for no reason. Maybe it's better to rethink that? This is somewhat compensated by `std::move` below, but then it introduces strict ordering in the code that doesn't need to be there in my opinion. (With the current code, `cliOptions_.insert({deprecated...` must be executed before `deprecatedCliOptions_.insert({std::move(deprecated)...`, otherwise crash will likely follow.)
I think various `...Spelling(` functions should take `const std::string&` args and let safe copies happen "naturally" as they are needed, and don't use `std::move`.
https://github.com/llvm/llvm-project/pull/188434
More information about the flang-commits
mailing list