r258582 - Module Debugging: Canonicalize the file names used as PCH module names
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 22 15:30:57 PST 2016
Author: adrian
Date: Fri Jan 22 17:30:56 2016
New Revision: 258582
URL: http://llvm.org/viewvc/llvm-project?rev=258582&view=rev
Log:
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
Modified:
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/ExtDebugInfo.m
cfe/trunk/test/Modules/ModuleDebugInfo.m
Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=258582&r1=258581&r2=258582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Fri Jan 22 17:30:56 2016
@@ -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 {
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=258582&r1=258581&r2=258582&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Jan 22 17:30:56 2016
@@ -7581,8 +7581,9 @@ ASTReader::getSourceDescriptor(unsigned
// Chained PCH are not suported.
if (ModuleMgr.size() == 1) {
ModuleFile &MF = ModuleMgr.getPrimaryModule();
- return ASTReader::ASTSourceDescriptor(
- MF.OriginalSourceFileName, MF.OriginalDir, MF.FileName, MF.Signature);
+ StringRef ModuleName = llvm::sys::path::filename(MF.OriginalSourceFileName);
+ return ASTReader::ASTSourceDescriptor(ModuleName, MF.OriginalDir,
+ MF.FileName, MF.Signature);
}
return None;
}
Modified: cfe/trunk/test/Modules/ExtDebugInfo.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.m?rev=258582&r1=258581&r2=258582&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ExtDebugInfo.m (original)
+++ cfe/trunk/test/Modules/ExtDebugInfo.m Fri Jan 22 17:30:56 2016
@@ -34,7 +34,7 @@ int foo(ObjCClass *c) {
// CHECK-SAME: scope: ![[MOD:[0-9]+]],
// CHECK-SAME: flags: DIFlagFwdDecl)
// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
-// CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugObjC
+// CHECK: ![[MOD]] = !DIModule(scope: null, name: "DebugObjC
// CHECK: !DIGlobalVariable(name: "GlobalUnion",
// CHECK-SAME: type: ![[GLOBAL_UNION:[0-9]+]]
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.m?rev=258582&r1=258581&r2=258582&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ModuleDebugInfo.m (original)
+++ cfe/trunk/test/Modules/ModuleDebugInfo.m Fri Jan 22 17:30:56 2016
@@ -28,7 +28,7 @@
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
// CHECK-SAME: scope: ![[MODULE:[0-9]+]],
-// CHECK: ![[MODULE]] = !DIModule(scope: null, name:{{.*}}DebugObjC
+// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC
// CHECK: ![[TD_ENUM:.*]] = !DICompositeType(tag: DW_TAG_enumeration_type,
// CHECK-SAME-NOT: name:
More information about the cfe-commits
mailing list