diff options
author | Nemanja Ivanovic <nemanja.i.ibm@gmail.com> | 2019-02-20 20:27:33 +0000 |
---|---|---|
committer | Nemanja Ivanovic <nemanja.i.ibm@gmail.com> | 2019-02-20 20:27:33 +0000 |
commit | 1e25464fc9b21129dbea14006f07e8611942fe99 (patch) | |
tree | 0255961f255bdc178448f93c8d7e52333cda9078 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 31823fba2e9245c7cfdd8cb210a5de05c6d60075 (diff) | |
download | bcm5719-llvm-1e25464fc9b21129dbea14006f07e8611942fe99.tar.gz bcm5719-llvm-1e25464fc9b21129dbea14006f07e8611942fe99.zip |
Make predefined FLT16 macros conditional on support for the type
We unconditionally predefine these macros. However, they may be used to
determine if the type is supported. In that case, there are unnecessary
failures to compile the code.
This is the proposed fix for https://bugs.llvm.org/show_bug.cgi?id=40559
Differential revision: https://reviews.llvm.org/D57577
llvm-svn: 354512
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 2c1a8eb2eac..e0e428ade29 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -830,7 +830,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI, DefineFmt("__UINTPTR", TI.getUIntPtrType(), TI, Builder); DefineTypeWidth("__UINTPTR_WIDTH__", TI.getUIntPtrType(), TI, Builder); - DefineFloatMacros(Builder, "FLT16", &TI.getHalfFormat(), "F16"); + if (TI.hasFloat16Type()) + DefineFloatMacros(Builder, "FLT16", &TI.getHalfFormat(), "F16"); DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F"); DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), ""); DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L"); |