================
@@ -71,15 +72,20 @@ static std::optional<FixItHint> 
fixIfNotDangerous(SourceLocation Loc,
 
 // Build a string that can be emitted as FixIt with either a space in before
 // or after the qualifier, either ' const' or 'const '.
-static std::string buildQualifier(DeclSpec::TQ Qualifier,
+static std::string buildQualifier(Qualifiers::TQ Qualifier,
                                   bool WhitespaceBefore = false) {
   if (WhitespaceBefore)
-    return (llvm::Twine(' ') + DeclSpec::getSpecifierName(Qualifier)).str();
-  return (llvm::Twine(DeclSpec::getSpecifierName(Qualifier)) + " ").str();
+    return (llvm::Twine(' ') +
+            DeclSpec::getSpecifierName(static_cast<DeclSpec::TQ>(Qualifier)))
----------------
cor3ntin wrote:

In practice, this function only ever to print "const", afaik (and nothing else).

You could even reimplement it inline

```cpp
const char getSpecifierName(Qualifier T) {
  switch (T) {
     case Qualifiers::Qualifier:   return "const";
     default:
          assert("not supported");
  }
  return "";
}
```

But really if `Qualifiers::getAsString` passes the test, you should just use 
that.




https://github.com/llvm/llvm-project/pull/113295
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to