Fix diag for read-only target features
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Fri, 16 Jun 2023 04:36:00 +0000 (00:36 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Fri, 16 Jun 2023 21:48:27 +0000 (17:48 -0400)
commitc8c583071591dbc6927955e608dcd44c0bac8b9c
tree14faf7ee36eedcbd80aba4ca1cbd1f7782d08ce8
parentf1bb534b0ab53fab501fa92c4ef0f5eaf75c6bd6
Fix diag for read-only target features

Currently the diag is emitted even when there is no
target feature specified on command line for OpenMP.
This is because the function to initialize feature map
is also used with cached feature string. The fix is to
only diag when the feature map is initialized with
feature strings from command line options.

Reviewed by: Joseph Huber, Matt Arsenault, Johannes Doerfert

Differential Revision: https://reviews.llvm.org/D153123
clang/lib/Basic/TargetInfo.cpp
clang/lib/Basic/Targets.cpp
clang/test/OpenMP/openmp-read-only-feature.c [new file with mode: 0644]