summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-04-27 19:53:03 +0000
committerSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-04-27 19:53:03 +0000
commitbf010806724cf614d2954cb1406cfd08b2112746 (patch)
treeae3c49e934ddfbbb003d495eeb7d3b3de5d2a171 /clang/lib/Frontend/CompilerInvocation.cpp
parent0e0bcc4bdbdd64bf4e7bc2d474bf3bfb1ec27556 (diff)
downloadbcm5719-llvm-bf010806724cf614d2954cb1406cfd08b2112746.tar.gz
bcm5719-llvm-bf010806724cf614d2954cb1406cfd08b2112746.zip
Set the default C standard to C99 when targeting the PS4.
Patch by Douglas Yung! Differential Revision: http://reviews.llvm.org/D19003 llvm-svn: 267772
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 67d116cee15..0c4d5c71d5c 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1344,6 +1344,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
@@ -1376,7 +1377,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:
@@ -1529,7 +1534,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,
@@ -1851,7 +1857,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