-
Notifications
You must be signed in to change notification settings - Fork 0
align comments with code in decompiler #7
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
base: master
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -87,6 +87,13 @@ void PrintLanguage::setLineCommentIndent(int4 val) | |
line_commentindent = val; | ||
} | ||
|
||
/// \param val is whether to align comments with code or use a fixed indentation | ||
void PrintLanguage::setLineCommentIndentAlign(bool val) | ||
|
||
{ | ||
line_commentindentalign = val; | ||
} | ||
|
||
/// By default, comments are indicated in the high-level language by preceding | ||
/// them with a specific sequence of delimiter characters, and optionally | ||
/// by ending the comment with another set of delimiter characters. | ||
|
@@ -573,6 +580,7 @@ void PrintLanguage::resetDefaultsInternal(void) | |
mods = 0; | ||
head_comment_type = Comment::header | Comment::warningheader; | ||
line_commentindent = 20; | ||
line_commentindentalign = false; | ||
namespc_strategy = MINIMAL_NAMESPACES; | ||
instr_comment_type = Comment::user2 | Comment::warning; | ||
} | ||
|
@@ -587,9 +595,14 @@ void PrintLanguage::emitLineComment(int4 indent,const Comment *comm) | |
const string &text( comm->getText() ); | ||
const AddrSpace *spc = comm->getAddr().getSpace(); | ||
uintb off = comm->getAddr().getOffset(); | ||
if (indent <0) | ||
indent = line_commentindent; // User specified default indent | ||
emit->tagLine(indent); | ||
if (line_commentindentalign) { | ||
emit->tagLine(); | ||
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. Security Issue: When comment alignment is enabled, there's no validation of indent values in the |
||
} | ||
else { | ||
if (indent <0) | ||
indent = line_commentindent; // User specified default indent | ||
emit->tagLine(indent); | ||
} | ||
int4 id = emit->startComment(); | ||
// The comment delimeters should not be printed as | ||
// comment tags, so that they won't get filled | ||
|
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.
Missing Default Reset
The resetDefaultsInternal() method initializes line_commentindentalign but the variable isn't declared in the class. This creates a mismatch between initialization and declaration, potentially causing undefined behavior.
Standards