aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorAnton Zabaznov <anton.zabaznov@intel.com>2021-04-22 19:53:59 +0300
committerAnton Zabaznov <anton.zabaznov@intel.com>2021-04-28 16:00:02 +0300
commitf0efc00751313779671746492ded4014b715df6a (patch)
tree15d7e89b222d92fb619019f55593a42715092da1 /clang/lib/Frontend/CompilerInstance.cpp
parent9a66d334522d6b69d7d1ea0dbc1b04ae0d43b959 (diff)
downloadllvm-f0efc00751313779671746492ded4014b715df6a.zip
llvm-f0efc00751313779671746492ded4014b715df6a.tar.gz
llvm-f0efc00751313779671746492ded4014b715df6a.tar.bz2
[OpenCL] Introduce new method for validating OpenCL target
Language options are not available when a target is being created, thus, a new method is introduced. Also, some refactoring is done, such as removing OpenCL feature macros setting from TargetInfo. Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D101087
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index b76baae..4a765b9 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -133,6 +133,11 @@ bool CompilerInstance::createTarget() {
// FIXME: can we disable FEnvAccess?
}
+ // We should do it here because target knows nothing about
+ // language options when it's being created.
+ if (getLangOpts().OpenCL)
+ getTarget().validateOpenCLTarget(getLangOpts(), getDiagnostics());
+
// Inform the target of the language options.
// FIXME: We shouldn't need to do this, the target should be immutable once
// created. This complexity should be lifted elsewhere.