Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__
TargetInfo::getSuitableAlign() was introduced in r146762 and is defined
as alignof(std::max_align_t).
Introduce __ALIGNOF_MAX_ALIGN_T__ which exposes getSuitableAlign() so
that libc++ may take advantage of it.
llvm-svn: 201037
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 39c474b..7b3166d 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -600,6 +600,9 @@
DefineType("__CHAR16_TYPE__", TI.getChar16Type(), Builder);
DefineType("__CHAR32_TYPE__", TI.getChar32Type(), Builder);
+ Builder.defineMacro("__ALIGNOF_MAX_ALIGN_T__",
+ Twine(TI.getSuitableAlign() / TI.getCharWidth()));
+
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F");
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), "");
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L");