diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-18 21:55:37 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-04-18 21:55:37 +0000 |
| commit | 34e485f92236672c2e97da092f7ad8378609c023 (patch) | |
| tree | fddd2ff52bb3e7336adb89b2fefbd53d766b45bf /clang/lib/Driver/ToolChains/Clang.cpp | |
| parent | 399249a2975af8d8217c76e0b633cce8e14a7dd3 (diff) | |
| download | bcm5719-llvm-34e485f92236672c2e97da092f7ad8378609c023.tar.gz bcm5719-llvm-34e485f92236672c2e97da092f7ad8378609c023.zip | |
[modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.
The driver needs to know whether it's building a module interface or
implementation unit because it affects which outputs it produces and how it
builds the command pipeline. But the frontend doesn't need to know and should
not care: all it needs to know is what action it is being asked to perform on
the input.
(This is in preparation for permitting -emit-obj to be used on a module
interface unit to produce object code without going via a "full" PCM file.)
llvm-svn: 300611
Diffstat (limited to 'clang/lib/Driver/ToolChains/Clang.cpp')
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 4259b629728..b6887b87584 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -649,8 +649,24 @@ static void addDashXForInput(const ArgList &Args, const InputInfo &Input, CmdArgs.push_back("-x"); if (Args.hasArg(options::OPT_rewrite_objc)) CmdArgs.push_back(types::getTypeName(types::TY_PP_ObjCXX)); - else - CmdArgs.push_back(types::getTypeName(Input.getType())); + else { + // Map the driver type to the frontend type. This is mostly an identity + // mapping, except that the distinction between module interface units + // and other source files does not exist at the frontend layer. + const char *ClangType; + switch (Input.getType()) { + case types::TY_CXXModule: + ClangType = "c++"; + break; + case types::TY_PP_CXXModule: + ClangType = "c++-cpp-output"; + break; + default: + ClangType = types::getTypeName(Input.getType()); + break; + } + CmdArgs.push_back(ClangType); + } } static void appendUserToPath(SmallVectorImpl<char> &Result) { |

