From fcdc45ff2df34f38bde572ed3d5d2481edd03deb Mon Sep 17 00:00:00 2001 From: Yunzhong Gao Date: Tue, 18 Mar 2014 17:55:18 +0000 Subject: Creating a printing policy for "half": Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for other languages, error messages and metadata (and hence debug info) should refer to the half-precision floating point as "__fp16" instead of "half" when compiling for non-OpenCL languages. This patch creates a new printing policy for half in a similar manner to what is done for bool and wchar_t. Differential Revision: http://llvm-reviews.chandlerc.com/D2952 llvm-svn: 204164 --- clang/lib/Frontend/CompilerInvocation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 7cc0b1b..79d8151 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1116,6 +1116,9 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, // OpenCL and C++ both have bool, true, false keywords. Opts.Bool = Opts.OpenCL || Opts.CPlusPlus; + // OpenCL has half keyword + Opts.Half = Opts.OpenCL; + // C++ has wchar_t keyword. Opts.WChar = Opts.CPlusPlus; -- cgit v1.1