aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZequan Wu <zequanwu@google.com>2020-11-18 15:26:21 -0800
committerZequan Wu <zequanwu@google.com>2020-11-22 16:05:53 -0800
commit15a3ae1ab1a64cc62041c32ba54914a9dd7b8361 (patch)
tree2bdad503bc071f9b6de8cce66e76a2f7ba60bdf7 /clang/lib/Frontend/InitPreprocessor.cpp
parent[ARM] Ensure MVE_TwoOpPattern is used inside Predicate's (diff)
downloadllvm-project-15a3ae1ab1a64cc62041c32ba54914a9dd7b8361.tar.gz
llvm-project-15a3ae1ab1a64cc62041c32ba54914a9dd7b8361.tar.bz2
llvm-project-15a3ae1ab1a64cc62041c32ba54914a9dd7b8361.zip
[Clang] Add __STDCPP_THREADS__ to standard predefine macros
According to https://eel.is/c++draft/cpp.predefined#2.6, `__STDCPP_THREADS__` is a predefined macro. Differential Revision: https://reviews.llvm.org/D91747
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 08907fe2469c..86d5e61b7112 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -403,6 +403,12 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__STDCPP_DEFAULT_NEW_ALIGNMENT__",
Twine(TI.getNewAlign() / TI.getCharWidth()) +
TI.getTypeConstantSuffix(TI.getSizeType()));
+
+ // -- __STDCPP_­THREADS__
+ // Defined, and has the value integer literal 1, if and only if a
+ // program can have more than one thread of execution.
+ if (LangOpts.getThreadModel() == LangOptions::ThreadModelKind::POSIX)
+ Builder.defineMacro("__STDCPP_THREADS__", "1");
}
// In C11 these are environment macros. In C++11 they are only defined