summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2014-05-23 07:34:08 +0000
committerRobert Lytton <robert@xmos.com>2014-05-23 07:34:08 +0000
commitb1d67d0ce55d8ff0574341ec394c435828bf6ea4 (patch)
tree9b2aea686e8fce38b683acf76f2b4cb95a3e9a84 /lib/CodeGen/CodeGenAction.cpp
parent41a49d921f07d786199780b1054a0ee839771168 (diff)
downloadclang-b1d67d0ce55d8ff0574341ec394c435828bf6ea4.tar.gz
clang-b1d67d0ce55d8ff0574341ec394c435828bf6ea4.tar.bz2
clang-b1d67d0ce55d8ff0574341ec394c435828bf6ea4.tar.xz
Fix '-main-file-name <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 <original file name> ...' Or 'clang -cc1 -main-file-name <original file name> ...' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--lib/CodeGen/CodeGenAction.cpp5
1 files changed, 4 insertions, 1 deletions
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;
}