summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2018-12-17 19:19:15 +0000
committerAlex Lorenz <arphaman@gmail.com>2018-12-17 19:19:15 +0000
commit0a264f3928019b1db5205b96fcca8261b223eec1 (patch)
tree52772b336aa9a24cc6fff529115e39ceae1dd4a2 /clang/lib/CodeGen/ModuleBuilder.cpp
parentc32d47c6a83dec619c1dd911cb8b544952a5a2df (diff)
downloadbcm5719-llvm-0a264f3928019b1db5205b96fcca8261b223eec1.tar.gz
bcm5719-llvm-0a264f3928019b1db5205b96fcca8261b223eec1.zip
[darwin] parse the SDK settings from SDKSettings.json if it exists and
pass in the -target-sdk-version to the compiler and backend This commit adds support for reading the SDKSettings.json file in the Darwin driver. This file is used by the driver to determine the SDK's version, and it uses that information to pass it down to the compiler using the new -target-sdk-version= option. This option is then used to set the appropriate SDK Version module metadata introduced in r349119. Note: I had to adjust the two ast tests as the SDKROOT environment variable on macOS caused SDK version to be picked up for the compilation of source file but not the AST. rdar://45774000 Differential Revision: https://reviews.llvm.org/D55673 llvm-svn: 349380
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r--clang/lib/CodeGen/ModuleBuilder.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index 1264893ec13..c0a37698e76 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -132,6 +132,9 @@ namespace {
M->setTargetTriple(Ctx->getTargetInfo().getTriple().getTriple());
M->setDataLayout(Ctx->getTargetInfo().getDataLayout());
+ const auto &SDKVersion = Ctx->getTargetInfo().getSDKVersion();
+ if (!SDKVersion.empty())
+ M->setSDKVersion(SDKVersion);
Builder.reset(new CodeGen::CodeGenModule(Context, HeaderSearchOpts,
PreprocessorOpts, CodeGenOpts,
*M, Diags, CoverageInfo));
OpenPOWER on IntegriCloud