[PATCH] D105501: [PowerPC] Power ISA features for Semachecking

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 10 09:20:55 PDT 2021


nemanjai added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:3275
 
-static bool SemaFeatureCheck(Sema &S, CallExpr *TheCall,
-                             StringRef FeatureToCheck, unsigned DiagID) {
+static bool SemaArchFeatureCheck(Sema &S, CallExpr *TheCall,
+                                 StringRef FeatureToCheck, int Arch) {
----------------
I don't think we need another function here. Simply passing a `StringRef` parameter to the other one that will have a default value of empty should suffice. Then if the parameter is non-empty, we push it into the diagnostic.
Something like:
```
if (!S.Context.getTargetInfo().hasFeature(FeatureToCheck)) {
  S.Diag(TheCall->getBeginLoc(), DiagID);
  if (!DiagArg.empty())
    Diag << DiagArg;
  Diag << TheCall->getSourceRange();
  return true;
}
```
(keep in mind that I don't know if I've adequately captured how `DiagnosticBuilder` works, but something along these lines should be possible). Then of course, the calls to this would be with `"7"` rather than `7`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105501/new/

https://reviews.llvm.org/D105501



More information about the cfe-commits mailing list