summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-04-04 22:56:05 +0000
committerSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-04-04 22:56:05 +0000
commit0e15a77d40d56489cc317e618658cbefbb4d6902 (patch)
tree4388b66b7226da268bccc1b274ebf89a6528f832 /clang/lib/Frontend/CompilerInvocation.cpp
parentbb8c665320504f35bf483f5503e5351c262444d3 (diff)
downloadbcm5719-llvm-0e15a77d40d56489cc317e618658cbefbb4d6902.tar.gz
bcm5719-llvm-0e15a77d40d56489cc317e618658cbefbb4d6902.zip
Set the default C standard to C99 when targeting the PS4.
Patch by Douglas Yung! Differential Revision: http://reviews.llvm.org/D18708 llvm-svn: 265359
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 5bb036ab26e..da0b3a83be8 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1355,6 +1355,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
}
void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
+ const llvm::Triple &T,
LangStandard::Kind LangStd) {
// Set some properties which depend solely on the input kind; it would be nice
// to move these to the language standard, and have the driver resolve the
@@ -1387,7 +1388,11 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
case IK_PreprocessedC:
case IK_ObjC:
case IK_PreprocessedObjC:
- LangStd = LangStandard::lang_gnu11;
+ // The PS4 uses C99 as the default C standard.
+ if (T.isPS4())
+ LangStd = LangStandard::lang_gnu99;
+ else
+ LangStd = LangStandard::lang_gnu11;
break;
case IK_CXX:
case IK_PreprocessedCXX:
@@ -1541,7 +1546,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
LangStd = OpenCLLangStd;
}
- CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
+ llvm::Triple T(TargetOpts.Triple);
+ CompilerInvocation::setLangDefaults(Opts, IK, T, LangStd);
// We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension
// keywords. This behavior is provided by GCC's poorly named '-fasm' flag,
@@ -1861,7 +1867,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
// Provide diagnostic when a given target is not expected to be an OpenMP
// device or host.
if (Opts.OpenMP && !Opts.OpenMPIsDevice) {
- llvm::Triple T(TargetOpts.Triple);
switch (T.getArch()) {
default:
break;
OpenPOWER on IntegriCloud