aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMing-Yi Lai <ming-yi.lai@mediatek.com>2025-02-19 10:12:54 +0800
committerGitHub <noreply@github.com>2025-02-19 10:12:54 +0800
commitf6d74af4d9cabb9a940656887c82aaba3ad1f922 (patch)
treeba3d04832a61ad308d9ae722e6328672b14fa63b /clang/lib/Frontend/CompilerInvocation.cpp
parentb100c5074bb761f1a2ca39c4e274aa2f7e724439 (diff)
downloadllvm-f6d74af4d9cabb9a940656887c82aaba3ad1f922.zip
llvm-f6d74af4d9cabb9a940656887c82aaba3ad1f922.tar.gz
llvm-f6d74af4d9cabb9a940656887c82aaba3ad1f922.tar.bz2
[clang][X86] Only define __CET__ macro for X86 targets (#127616)
The `-fcf-protection` flag is now also used to enable CFI features for the RISC-V target, so it's not suitable to define `__CET__` solely based on the flag anymore. This patch moves the definition of the `__CET__` macro into X86 target hook, so only X86 targets with the `-fcf-protection` flag would enable the `__CET__` macro. See https://github.com/llvm/llvm-project/pull/109784 and https://github.com/llvm/llvm-project/pull/112477 for the adoption of `-fcf-protection` flag for RISC-V targets.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp11
1 files changed, 0 insertions, 11 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b9a5c05..4eb743a 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4776,17 +4776,6 @@ static bool ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
}
}
- // Add the __CET__ macro if a CFProtection option is set.
- if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
- StringRef Name = A->getValue();
- if (Name == "branch")
- Opts.addMacroDef("__CET__=1");
- else if (Name == "return")
- Opts.addMacroDef("__CET__=2");
- else if (Name == "full")
- Opts.addMacroDef("__CET__=3");
- }
-
// Add macros from the command line.
for (const auto *A : Args.filtered(OPT_D, OPT_U)) {
if (A->getOption().matches(OPT_D))