-
Notifications
You must be signed in to change notification settings - Fork 220
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
fix: #2171 #2314
base: master
Are you sure you want to change the base?
fix: #2171 #2314
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,39 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "(gdb) Attach", | ||
"type": "cppdbg", | ||
"request": "attach", | ||
"program": "enter program name, for example ${workspaceFolder}/a.exe", | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "/path/to/gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Set Disassembly Flavor to Intel", | ||
"text": "-gdb-set disassembly-flavor intel", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "(Windows) Launch", | ||
"type": "cppvsdbg", | ||
"request": "launch", | ||
"program": "enter program name, for example ${workspaceFolder}/a.exe", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${fileDirname}", | ||
"environment": [], | ||
"console": "externalTerminal" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,14 +35,16 @@ struct LintConfigParameterDescriptor { | |
std::string description; | ||
}; | ||
|
||
struct LintRuleDescriptor { | ||
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. Did you mean to delete this? |
||
LintRuleId name; // ID/name of the rule. | ||
absl::string_view topic; // section in style-guide | ||
std::string desc; // Detailed description. | ||
std::vector<LintConfigParameterDescriptor> param; | ||
}; | ||
|
||
} // namespace analysis | ||
} // namespace verilog | ||
|
||
#endif // VERIBLE_VERILOG_ANALYSIS_DESCRIPTIONS_H_ | ||
std::string format_long_description(const std::string& description) { | ||
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. Is this new function used anywhere? If so, you may declare it in a .h file, but define it in the corresponding .cc file. |
||
const size_t max_length = 80; | ||
std::string formatted_desc; | ||
size_t start = 0; | ||
|
||
while (start < description.size()) { | ||
size_t end = std::min(start + max_length, description.size()); | ||
formatted_desc += description.substr(start, end - start) + "\n "; | ||
start = end; | ||
} | ||
|
||
return formatted_desc; | ||
} |
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. Are you missing the change to the |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1035,3 +1035,29 @@ TEST(VerilogPreprocessTest, | |
|
||
} // namespace | ||
} // namespace verilog | ||
|
||
TEST(PreprocessorAnnotationTest, AnnotatesConditionals) { | ||
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. Nice test! |
||
const std::string input = R"( | ||
`ifdef FOO | ||
`ifdef BAR | ||
code | ||
`endif | ||
`else | ||
other_code | ||
`endif | ||
)"; | ||
|
||
const std::string expected_output = R"( | ||
`ifdef FOO // FOO | ||
`ifdef BAR // FOO && BAR | ||
code | ||
`endif // FOO && BAR | ||
`else // !FOO | ||
other_code | ||
`endif // FOO | ||
)"; | ||
|
||
VerilogPreprocess preprocess(/*config=*/{}); | ||
auto output = preprocess.AnnotatePreprocessorDirectives(input); | ||
EXPECT_EQ(output, expected_output); | ||
} |
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.
This file doesn't look like it should be added in this PR.
(I'm not familiar with VSCode and how this should work. Perhaps someone else can comment?)