-
-
Notifications
You must be signed in to change notification settings - Fork 672
Audit Log File #12710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit Log File #12710
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /** | ||
| * Generate text files for assistance in frontend development. | ||
| * | ||
| * Copyright: Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved | ||
| * Authors: Alexander Heistermann | ||
| * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) | ||
| * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/audit_log.d, _audit_log.d) | ||
| * Documentation: https://dlang.org/phobos/dmd_asttypename.html | ||
| * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/audit_log.d | ||
| */ | ||
|
|
||
| module dmd.audit_log; | ||
| import core.stdc.stdlib; | ||
| import core.stdc.stdio; | ||
| import dmd.root.rootobject; | ||
| import dmd.globals; | ||
| import dmd.ast_node; | ||
| import dmd.hdrgen; | ||
| import dmd.expression; | ||
| import dmd.dsymbol; | ||
| import dmd.statement; | ||
| import dmd.mtype; | ||
| import dmd.init; | ||
| import dmd.dtemplate; | ||
| import dmd.common.outbuffer; | ||
|
|
||
| private FILE*[string] file; | ||
|
|
||
| void Log(ASTNode node, string functioncall = __FUNCTION__, string modulecall = __MODULE__) | ||
| { | ||
| debug(__dmd_debug) | ||
| { | ||
| bool Exist() | ||
| { | ||
| auto paramCalls = global.params.calls; | ||
| for (size_t i = 0; i < paramCalls.length; i++) | ||
| { | ||
| if (paramCalls[i].toString() == functioncall | ||
| || paramCalls[i].toString() == modulecall) | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| if (!Exist()) | ||
| return; | ||
| auto tmpstring = "debug/" ~ modulecall ~ "/" ~ functioncall ~ ".txt\0"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debug is a common name, maybe we should use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, why the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Null terminated character as we are dealing with a c interface. |
||
| auto tmpfile = file.require(modulecall ~ " " ~ functioncall, fopen(tmpstring.ptr, "w+\0".ptr)); | ||
| OutBuffer buf; | ||
| HdrGenState hgs; | ||
| static if (is(typeof(node) == Type)) | ||
| toCBuffer(node, &buf, node.getTypeInfoIdent(), &hgs); | ||
| else | ||
| toCBuffer(node, &buf, &hgs); | ||
| fputs(buf.extractChars(), tmpfile); | ||
| } | ||
| } | ||
|
|
||
| void closeAll() | ||
| { | ||
| debug(__dmd_debug) | ||
| { | ||
| foreach (FILE* f; file) | ||
| { | ||
| fclose(f); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildkite fails because this variable is never used.