Sorry for the delay. In ParsePragma.cpp:
void Parser::HandlePragmaOpenCLExtension() { assert(Tok.is(tok::annot_pragma_opencl_extension)); OpenCLExtData data = OpenCLExtData::getFromOpaqueValue(Tok.getAnnotationValue()); unsigned state = data.getInt(); IdentifierInfo *ename = data.getPointer(); SourceLocation NameLoc = Tok.getLocation(); ConsumeToken(); // The annotation token. OpenCLOptions &f = Actions.getOpenCLOptions(); auto CLVer = getLangOpts().OpenCLVersion; auto &Supp = getTargetInfo().getSupportedOpenCLOpts(); // OpenCL 1.1 9.1: "The all variant sets the behavior for all extensions, // overriding all previously issued extension directives, but only if the // behavior is set to disable." if (state == 0 && ename->isStr("all")) { #define OPENCLEXT(nm) \ if (Supp.is_##nm##_supported_extension(CLVer)) \ f.nm = 0; #include "clang/Basic/OpenCLExtensions.def" } #define OPENCLEXT(nm) else if (ename->isStr(#nm)) \ if (Supp.is_##nm##_supported_extension(CLVer)) \ f.nm = state; \ else if (Supp.is_##nm##_supported_core(CLVer)) \ PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << ename; \ else \ PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << ename; #include "clang/Basic/OpenCLExtensions.def" else { PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename; return; } } Whether an extension is supported is represented by getTargetInfo().getSupportedOpenCLOpts(), which does not change with pragma. Whether an extension is enabled is reprented by Actions.getOpenCLOptions(), which changes with pragma. test/SemaOpenCL/extensions.cl contains examples of unsupported extensions. Sam -----Original Message----- From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] Sent: Tuesday, May 31, 2016 6:07 PM To: Liu, Yaxun (Sam) <yaxun....@amd.com> Cc: Anastasia Stulova <anastasia.stul...@arm.com>; Clang Commits <cfe-commits@lists.llvm.org>; nd <n...@arm.com> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info. Hi Sam, > This commit does not change the initial state of the extensions. An extension > is supported is not the same as enabled. At the beginning all extensions are > disabled. I do not see this reflected in the code at all. Could you please: a. Point me to the location where this distinction is made. b. Convince me that I cannot enable an extension for a target if that target does not support the extension? Jeroen _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits