aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-03-18 17:55:18 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2014-03-18 17:55:18 +0000
commitfcdc45ff2df34f38bde572ed3d5d2481edd03deb (patch)
tree71eeda2f28aec4150d29fbf8e845feba10c10412 /clang/lib/Frontend/CompilerInvocation.cpp
parenta9dafe679319112d26c1d2edb1bb26952c2983db (diff)
downloadllvm-fcdc45ff2df34f38bde572ed3d5d2481edd03deb.zip
llvm-fcdc45ff2df34f38bde572ed3d5d2481edd03deb.tar.gz
llvm-fcdc45ff2df34f38bde572ed3d5d2481edd03deb.tar.bz2
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 3 insertions, 0 deletions
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;