[PATCH] D85938: [OpenMP][OMPIRBuilder] Use the source (=directory + filename) for locations
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 14 07:06:53 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9240e48a588c: [OpenMP][OMPIRBuilder] Use the source (=directory + filename) for locations (authored by jdoerfert).
Changed prior to commit:
https://reviews.llvm.org/D85938?vs=285551&id=285647#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85938/new/
https://reviews.llvm.org/D85938
Files:
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
Index: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
===================================================================
--- llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -34,7 +34,8 @@
BB = BasicBlock::Create(Ctx, "", F);
DIBuilder DIB(*M);
- auto File = DIB.createFile("test.dbg", "/");
+ auto File = DIB.createFile("test.dbg", "/src", llvm::None,
+ Optional<StringRef>("/src/test.dbg"));
auto CU =
DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
@@ -301,7 +302,7 @@
dyn_cast<ConstantDataArray>(SrcStrGlob->getInitializer());
if (!SrcSrc)
return;
- EXPECT_EQ(SrcSrc->getAsCString(), ";test.dbg;foo;3;7;;");
+ EXPECT_EQ(SrcSrc->getAsCString(), ";/src/test.dbg;foo;3;7;;");
}
TEST_F(OpenMPIRBuilderTest, ParallelSimple) {
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===================================================================
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -263,8 +263,10 @@
DILocation *DIL = Loc.DL.get();
if (!DIL)
return getOrCreateDefaultSrcLocStr();
- StringRef FileName =
- !DIL->getFilename().empty() ? DIL->getFilename() : M.getName();
+ StringRef FileName = M.getName();
+ if (DIFile *DIF = DIL->getFile())
+ if (Optional<StringRef> Source = DIF->getSource())
+ FileName = *Source;
StringRef Function = DIL->getScope()->getSubprogram()->getName();
Function =
!Function.empty() ? Function : Loc.IP.getBlock()->getParent()->getName();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85938.285647.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200814/6d6473b2/attachment.bin>
More information about the llvm-commits
mailing list