[darwin] parse the SDK settings from SDKSettings.json if it exists and
authorAlex Lorenz <arphaman@gmail.com>
Mon, 17 Dec 2018 19:19:15 +0000 (19:19 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Mon, 17 Dec 2018 19:19:15 +0000 (19:19 +0000)
commit0a264f3928019b1db5205b96fcca8261b223eec1
tree52772b336aa9a24cc6fff529115e39ceae1dd4a2
parentc32d47c6a83dec619c1dd911cb8b544952a5a2df
[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
16 files changed:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Basic/TargetOptions.h
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Driver/DarwinSDKInfo.h [new file with mode: 0644]
clang/lib/CodeGen/ModuleBuilder.cpp
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/DarwinSDKInfo.cpp [new file with mode: 0644]
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/darwin-sdk-version.c [new file with mode: 0644]
clang/test/Driver/Inputs/MacOSX10.14.sdk/SDKSettings.json [new file with mode: 0644]
clang/test/Driver/darwin-sdk-version.c [new file with mode: 0644]
clang/test/Frontend/ast-main.c
clang/test/Frontend/ast-main.cpp