From b1d67d0ce55d8ff0574341ec394c435828bf6ea4 Mon Sep 17 00:00:00 2001 From: Robert Lytton Date: Fri, 23 May 2014 07:34:08 +0000 Subject: Fix '-main-file-name ' so that it is used for the ModuleID. Summary: Previously, you could not specify the original file name when passing a preprocessed file into the compiler Now you can use 'clang -Xclang -main-file-name -Xclang ...' Or 'clang -cc1 -main-file-name ...' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209503 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenAction.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenAction.cpp') diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index 2d08c22c51..5c0b6a9fd8 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/lib/CodeGen/CodeGenAction.cpp @@ -551,9 +551,12 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI, LinkModuleToUse = ModuleOrErr.get(); } + StringRef MainFileName = getCompilerInstance().getCodeGenOpts().MainFileName; + if (MainFileName.empty()) + MainFileName = InFile; BEConsumer = new BackendConsumer(BA, CI.getDiagnostics(), CI.getCodeGenOpts(), CI.getTargetOpts(), CI.getLangOpts(), - CI.getFrontendOpts().ShowTimers, InFile, + CI.getFrontendOpts().ShowTimers, MainFileName, LinkModuleToUse, OS.release(), *VMContext); return BEConsumer; } -- cgit v1.2.3