Skip to content

Rule 20.12: Improve performance #241

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

Merged
merged 2 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import codingstandards.cpp.Macro

from FunctionLikeMacro m, MacroInvocation mi, int i, string expanded, string param
where
not isExcluded(m, Preprocessor2Package::macroParameterUsedAsHashOperandQuery()) and
not isExcluded(mi, Preprocessor2Package::macroParameterUsedAsHashOperandQuery()) and
mi = m.getAnInvocation() and
param = m.getParameter(i) and
(
Expand All @@ -31,9 +31,6 @@ where
// This check ensure there is an expansion that is used.
expanded = mi.getExpandedArgument(i) and
not expanded = "" and
exists(Macro furtherExpandedMacro |
mi.getUnexpandedArgument(i).matches(furtherExpandedMacro.getName() + "%")
)
not mi.getUnexpandedArgument(i) = mi.getExpandedArgument(i)
select m,
"Macro " + m.getName() + " contains use of parameter " + m.getParameter(i) +
" used in multiple contexts."
"Macro " + m.getName() + " contains use of parameter " + param + " used in multiple contexts."
1 change: 1 addition & 0 deletions change_notes/2023-03-07-20-12-perf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* `Rule 20.12` - the performance of this rule has been improved.