[clang] 8c3fa31 - [OpenCL][TableGen] Fix type extension guard emission

Sven van Haastregt via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 20 02:07:49 PDT 2022


Author: Sven van Haastregt
Date: 2022-06-20T10:07:34+01:00
New Revision: 8c3fa31701c4b874138c52266e7ab96818092f47

URL: https://github.com/llvm/llvm-project/commit/8c3fa31701c4b874138c52266e7ab96818092f47
DIFF: https://github.com/llvm/llvm-project/commit/8c3fa31701c4b874138c52266e7ab96818092f47.diff

LOG: [OpenCL][TableGen] Fix type extension guard emission

For certain cases (such as for the double subtype of AGenType), the
OpenCLBuiltinFileEmitterBase would not emit the extension #if-guard.
Fix that by looking at the extension of the actual type instead of the
argument type (which could be a GenType that does not carry any
extension information).

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index dca9970444a73..cddbd7b17c5f6 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -1082,7 +1082,7 @@ void OpenCLBuiltinFileEmitterBase::expandTypesInSignature(
         // If the type requires an extension, add a TypeExtMap entry mapping
         // the full type name to the extension.
         StringRef Ext =
-            Arg->getValueAsDef("Extension")->getValueAsString("ExtName");
+            Type->getValueAsDef("Extension")->getValueAsString("ExtName");
         if (!Ext.empty() && TypeExtMap.find(FullType) == TypeExtMap.end()) {
           TypeExtMap.insert({FullType, Ext});
         }


        


More information about the cfe-commits mailing list