[PATCH] D101087: [OpenCL] Introduce new method for validating OpenCL target

Anton Zabaznov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 08:47:42 PDT 2021


azabaznov added inline comments.


================
Comment at: clang/include/clang/Basic/OpenCLOptions.h:179
+  static bool isOpenCLOptionCoreIn(const LangOptions &LO, Args &&... args) {
+    return OpenCLOptionInfo(std::forward<Args>(args)...).isCoreIn(LO);
+  }
----------------
Anastasia wrote:
> Do you think we could avoid constructing the temporary objects somehow?
> 
> I.e. could we just check the condition `CLVer >= Avail` that is used in the non-static member function directly?
> 
> We could then use these helpers in the non-static members perhaps to avoid duplication.
In future I would like to have a file scope variable to to something like:

```
extern llvm::StringMap<OpenCLOptionInfo> OpenCLOptionsKV = {
#include "OpenCLExtensions.inc"
};
```

where `OpenCLExtensions.inc` will be generated from TableGen file. This file-scope variable will be initialized once and contain all the information about OpenCL options. As for now I think using variadics and creating a temporary variable is much more simple than obtaining a full list of arguments and choosing the proper one to call `CLVer >= Avail` and even for checking core :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101087



More information about the cfe-commits mailing list