summaryrefslogtreecommitdiffstats
path: root/clang/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
commit57dd5cf441351531d26d7255a778430904c5288d (patch)
treecadc8e8db6663f87366c0c32030e1029f41cbd7d /clang/lib/CodeGen/CodeGenAction.cpp
parent683b7e087475ffb47312a48a75f5f0dc8e2ec560 (diff)
downloadbcm5719-llvm-57dd5cf441351531d26d7255a778430904c5288d.tar.gz
bcm5719-llvm-57dd5cf441351531d26d7255a778430904c5288d.zip
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> ...' llvm-svn: 209503
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 2d08c22c51d..5c0b6a9fd8e 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud