[flang-commits] [flang] [flang][CLI] Have the CLI hint the flag to disable a warning (PR #144767)
Andre Kuhlenschmidt via flang-commits
flang-commits at lists.llvm.org
Tue Jun 24 10:28:45 PDT 2025
================
@@ -273,14 +273,37 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
return llvm::raw_ostream::SAVEDCOLOR;
}
+static std::string HintLanguageControlFlag(
+ const common::LanguageFeatureControl *hintFlagPtr,
+ std::optional<common::LanguageFeature> feature,
+ std::optional<common::UsageWarning> warning) {
+ if (hintFlagPtr) {
+ std::string_view flag{""};
+ if (warning) {
+ flag = hintFlagPtr->getDefaultCliSpelling(*warning);
+ } else if (feature) {
+ flag = hintFlagPtr->getDefaultCliSpelling(*feature);
+ }
+ if (!flag.empty()) {
+ std::string s{" [-Wno-" + std::string(flag) + "]"};
----------------
akuhlens wrote:
You don't actually have a std::string here. That is a char* literal on the left. I will double check, but I don't think it works without the conversion. It would probably work if I did `std::string:operator+(<lit>, <view>)` or something similar.
https://github.com/llvm/llvm-project/pull/144767
More information about the flang-commits
mailing list