[PATCH] D120262: [OpenCL] Handle TypeExtensions in OpenCLBuiltinFileEmitter

Pedro Olsen Ferreira via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 09:23:07 PST 2022


arkangath added inline comments.


================
Comment at: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp:1183
+      SmallVector<StringRef, 2> ExtVec;
+      TypeExt.split(ExtVec, " ");
+      for (const auto Ext : ExtVec) {
----------------
svenvh wrote:
> arkangath wrote:
> > Just in case if relevant, your "KeepEmpty" will default to true here.
> > I don't know if it is possible or not (not enough context for me), but could the .td file have "Extension0  Extention1" (two spaces) that could lead to one empty StringRef here?
> That would lead to generation of `#if defined(Extension0) && defined()`, which would cause a compilation error.  I think that's not unreasonable behavior to keep, to enforce that extensions are separated by exactly one space in the .td file for the sake of consistency.
Ok, that's fine with me. I just wondered if it'd be easier to just set KeepEmpty=false on the split() call.


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

https://reviews.llvm.org/D120262



More information about the cfe-commits mailing list