diff options
| author | Adrian Prantl <aprantl@apple.com> | 2016-01-22 23:30:56 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2016-01-22 23:30:56 +0000 |
| commit | f5a6cecb8da7522684057bdf1029c01317029664 (patch) | |
| tree | 1a4be267fd1a397a8c13530acbb56eba3a9218fd /lib/CodeGen/ObjectFilePCHContainerOperations.cpp | |
| parent | 4eb7bf8669f7f77e63651483450fabb60ad797e7 (diff) | |
| download | clang-f5a6cecb8da7522684057bdf1029c01317029664.tar.gz | |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
| -rw-r--r-- | lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 406b433c95..e3030a8e81 100644 --- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/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 { |
