summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2015-02-06 01:25:07 +0000
committerTim Northover <tnorthover@apple.com>2015-02-06 01:25:07 +0000
commita6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89 (patch)
tree75edebfd255158517d23c6bafe62032c10c82768 /clang/lib/Frontend/InitPreprocessor.cpp
parent02bc357b6c8ddc660523a871ca6da63c9e1657ec (diff)
downloadbcm5719-llvm-a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89.tar.gz
bcm5719-llvm-a6a19f1e38769ed23fbb03bb0c2eacee6dbd7d89.zip
Preprocessor: support __BIGGEST_ALIGNMENT__ macro
For compatibility with GCC (and because it's generally helpful information otherwise inaccessible to the preprocessor). This appears to be canonically the alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though vector types will be given greater alignment). Patch mostly by Mats Petersson llvm-svn: 228367
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index f4241a94ae0..896277aa545 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -710,6 +710,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__POINTER_WIDTH__",
Twine((int)TI.getPointerWidth(0)));
+ // Define __BIGGEST_ALIGNMENT__ to be compatible with gcc.
+ Builder.defineMacro("__BIGGEST_ALIGNMENT__",
+ Twine(TI.getSuitableAlign() / TI.getCharWidth()) );
+
if (!LangOpts.CharIsSigned)
Builder.defineMacro("__CHAR_UNSIGNED__");
OpenPOWER on IntegriCloud