mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
Adapt to Loc::filename now being a function
This commit is contained in:
parent
ae52da1bfa
commit
8fc096e4c6
6 changed files with 11 additions and 31 deletions
|
@ -233,7 +233,7 @@ bool functionIsInSanitizerBlacklist(FuncDeclaration *funcDecl) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto funcName = mangleExact(funcDecl);
|
auto funcName = mangleExact(funcDecl);
|
||||||
auto fileName = funcDecl->loc.filename;
|
auto fileName = funcDecl->loc.filename();
|
||||||
|
|
||||||
// TODO: LLVM supports sections (e.g. "[address]") in the blacklist file to
|
// TODO: LLVM supports sections (e.g. "[address]") in the blacklist file to
|
||||||
// only blacklist a function for a particular sanitizer. We could make use of
|
// only blacklist a function for a particular sanitizer. We could make use of
|
||||||
|
|
|
@ -118,10 +118,6 @@ void timeTraceProfilerBegin(const(char)* name_ptr, const(char)* detail_ptr, Loc
|
||||||
|
|
||||||
assert(timeTraceProfiler);
|
assert(timeTraceProfiler);
|
||||||
|
|
||||||
// `loc` contains a pointer to a string, so we need to duplicate that string too.
|
|
||||||
if (loc.filename)
|
|
||||||
loc.filename = strdup(loc.filename);
|
|
||||||
|
|
||||||
timeTraceProfiler.beginScope(xarraydup(name_ptr.toDString()),
|
timeTraceProfiler.beginScope(xarraydup(name_ptr.toDString()),
|
||||||
xarraydup(detail_ptr.toDString()), loc);
|
xarraydup(detail_ptr.toDString()), loc);
|
||||||
}
|
}
|
||||||
|
@ -333,9 +329,9 @@ struct TimeTraceProfiler
|
||||||
|
|
||||||
void writeLocation(Loc loc)
|
void writeLocation(Loc loc)
|
||||||
{
|
{
|
||||||
if (loc.filename)
|
if (loc.filename())
|
||||||
{
|
{
|
||||||
writeEscapeJSONString(buf, loc.filename.toDString());
|
writeEscapeJSONString(buf, loc.filename().toDString());
|
||||||
if (loc.linnum())
|
if (loc.linnum())
|
||||||
{
|
{
|
||||||
buf.writeByte(':');
|
buf.writeByte(':');
|
||||||
|
@ -387,10 +383,6 @@ struct TimeTraceScope
|
||||||
if (timeTraceProfilerEnabled())
|
if (timeTraceProfilerEnabled())
|
||||||
{
|
{
|
||||||
assert(timeTraceProfiler);
|
assert(timeTraceProfiler);
|
||||||
// `loc` contains a pointer to a string, so we need to duplicate that too.
|
|
||||||
import core.stdc.string : strdup;
|
|
||||||
if (loc.filename)
|
|
||||||
loc.filename = strdup(loc.filename);
|
|
||||||
timeTraceProfiler.beginScope(name.dup, "", loc);
|
timeTraceProfiler.beginScope(name.dup, "", loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,10 +391,6 @@ struct TimeTraceScope
|
||||||
if (timeTraceProfilerEnabled())
|
if (timeTraceProfilerEnabled())
|
||||||
{
|
{
|
||||||
assert(timeTraceProfiler);
|
assert(timeTraceProfiler);
|
||||||
// `loc` contains a pointer to a string, so we need to duplicate that too.
|
|
||||||
import core.stdc.string : strdup;
|
|
||||||
if (loc.filename)
|
|
||||||
loc.filename = strdup(loc.filename);
|
|
||||||
timeTraceProfiler.beginScope(name.dup, detail.dup, loc);
|
timeTraceProfiler.beginScope(name.dup, detail.dup, loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,10 +400,6 @@ struct TimeTraceScope
|
||||||
if (timeTraceProfilerEnabled())
|
if (timeTraceProfilerEnabled())
|
||||||
{
|
{
|
||||||
assert(timeTraceProfiler);
|
assert(timeTraceProfiler);
|
||||||
// `loc` contains a pointer to a string, so we need to duplicate that too.
|
|
||||||
import core.stdc.string : strdup;
|
|
||||||
if (loc.filename)
|
|
||||||
loc.filename = strdup(loc.filename);
|
|
||||||
timeTraceProfiler.beginScope(name.dup, detail(), loc);
|
timeTraceProfiler.beginScope(name.dup, detail(), loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,10 +430,6 @@ struct TimeTraceScopeDelayedDetail
|
||||||
if (timeTraceProfilerEnabled())
|
if (timeTraceProfilerEnabled())
|
||||||
{
|
{
|
||||||
assert(timeTraceProfiler);
|
assert(timeTraceProfiler);
|
||||||
// `loc` contains a pointer to a string, so we need to duplicate that too.
|
|
||||||
import core.stdc.string : strdup;
|
|
||||||
if (loc.filename)
|
|
||||||
loc.filename = strdup(loc.filename);
|
|
||||||
details_dlg = detail;
|
details_dlg = detail;
|
||||||
timeTraceProfiler.beginScope(name.dup, "", loc);
|
timeTraceProfiler.beginScope(name.dup, "", loc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ void emitCoverageLinecountInc(const Loc &loc) {
|
||||||
// Only emit coverage increment for locations in the source of the current
|
// Only emit coverage increment for locations in the source of the current
|
||||||
// module
|
// module
|
||||||
// (for example, 'inlined' methods from other source files should be skipped).
|
// (for example, 'inlined' methods from other source files should be skipped).
|
||||||
if (!global.params.cov || !loc.linnum() || !loc.filename || !m->d_cover_data ||
|
if (!global.params.cov || !loc.linnum() || !loc.filename() ||
|
||||||
strcmp(m->srcfile.toChars(), loc.filename) != 0) {
|
!m->d_cover_data || strcmp(m->srcfile.toChars(), loc.filename()) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,13 +240,13 @@ DIFile DIBuilder::CreateFile(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DIFile DIBuilder::CreateFile(const Loc &loc) {
|
DIFile DIBuilder::CreateFile(const Loc &loc) {
|
||||||
return CreateFile(loc.filename);
|
return CreateFile(loc.filename());
|
||||||
}
|
}
|
||||||
|
|
||||||
DIFile DIBuilder::CreateFile(Dsymbol *decl) {
|
DIFile DIBuilder::CreateFile(Dsymbol *decl) {
|
||||||
const char *filename = nullptr;
|
const char *filename = nullptr;
|
||||||
for (Dsymbol *sym = decl; sym && !filename; sym = sym->parent)
|
for (Dsymbol *sym = decl; sym && !filename; sym = sym->parent)
|
||||||
filename = sym->loc.filename;
|
filename = sym->loc.filename();
|
||||||
return CreateFile(filename);
|
return CreateFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -527,9 +527,9 @@ void onlyOneMainCheck(FuncDeclaration *fd) {
|
||||||
(isOSWindows && (fd->isWinMain() || fd->isDllMain()))) {
|
(isOSWindows && (fd->isWinMain() || fd->isDllMain()))) {
|
||||||
// global - across all modules compiled in this compiler invocation
|
// global - across all modules compiled in this compiler invocation
|
||||||
static Loc mainLoc;
|
static Loc mainLoc;
|
||||||
if (!mainLoc.filename) {
|
if (!mainLoc.filename()) {
|
||||||
mainLoc = fd->loc;
|
mainLoc = fd->loc;
|
||||||
assert(mainLoc.filename);
|
assert(mainLoc.filename());
|
||||||
} else {
|
} else {
|
||||||
const char *otherMainNames =
|
const char *otherMainNames =
|
||||||
isOSWindows ? ", `WinMain`, or `DllMain`" : "";
|
isOSWindows ? ", `WinMain`, or `DllMain`" : "";
|
||||||
|
|
|
@ -291,7 +291,7 @@ void DtoAssert(Module *M, const Loc &loc, DValue *msg) {
|
||||||
void DtoCAssert(Module *M, const Loc &loc, LLValue *msg) {
|
void DtoCAssert(Module *M, const Loc &loc, LLValue *msg) {
|
||||||
const auto &triple = *global.params.targetTriple;
|
const auto &triple = *global.params.targetTriple;
|
||||||
const auto file =
|
const auto file =
|
||||||
DtoConstCString(loc.filename ? loc.filename : M->srcfile.toChars());
|
DtoConstCString(loc.filename() ? loc.filename() : M->srcfile.toChars());
|
||||||
const auto line = DtoConstUint(loc.linnum());
|
const auto line = DtoConstUint(loc.linnum());
|
||||||
const auto fn = getCAssertFunction(loc, gIR->module);
|
const auto fn = getCAssertFunction(loc, gIR->module);
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ void DtoThrow(const Loc &loc, DValue *e) {
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
LLConstant *DtoModuleFileName(Module *M, const Loc &loc) {
|
LLConstant *DtoModuleFileName(Module *M, const Loc &loc) {
|
||||||
return DtoConstString(loc.filename ? loc.filename : M->srcfile.toChars());
|
return DtoConstString(loc.filename() ? loc.filename() : M->srcfile.toChars());
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue