aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-01-22 23:30:56 +0000
committerAdrian Prantl <aprantl@apple.com>2016-01-22 23:30:56 +0000
commit3a2d4947a69ff4731d2adb9862552fc8a003d295 (patch)
tree595c8728ff691c26a0628692f617168cd600af3c /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parent841e5a03982111d06bbd7555dde162b839e9ec18 (diff)
downloadllvm-3a2d4947a69ff4731d2adb9862552fc8a003d295.zip
llvm-3a2d4947a69ff4731d2adb9862552fc8a003d295.tar.gz
llvm-3a2d4947a69ff4731d2adb9862552fc8a003d295.tar.bz2
Module Debugging: Canonicalize the file names used as PCH module names
by stripping the path. Follow-up to r258555. This is safe because only one PCH per CU is currently supported for module debugging. rdar://problem/24301262 llvm-svn: 258582
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r--clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index 406b433..e3030a8 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -19,8 +19,8 @@
#include "clang/CodeGen/BackendUtil.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/HeaderSearch.h"
+#include "clang/Lex/Preprocessor.h"
#include "clang/Serialization/ASTWriter.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitstreamReader.h"
@@ -31,6 +31,7 @@
#include "llvm/IR/Module.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Path.h"
#include "llvm/Support/TargetRegistry.h"
#include <memory>
@@ -164,9 +165,12 @@ public:
M->setDataLayout(Ctx->getTargetInfo().getDataLayoutString());
Builder.reset(new CodeGen::CodeGenModule(
*Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags));
- Builder->getModuleDebugInfo()->setModuleMap(MMap);
- Builder->getModuleDebugInfo()->setPCHDescriptor(
- {MainFileName, "", OutputFileName, ~1ULL});
+
+ // Prepare CGDebugInfo to emit debug info for a clang module.
+ auto *DI = Builder->getModuleDebugInfo();
+ StringRef ModuleName = llvm::sys::path::filename(MainFileName);
+ DI->setPCHDescriptor({ModuleName, "", OutputFileName, ~1ULL});
+ DI->setModuleMap(MMap);
}
bool HandleTopLevelDecl(DeclGroupRef D) override {