Skip to content
Open
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 @@ -54,6 +54,7 @@ from LocalVariable v, Function f
where
f = v.getFunction() and
not exists(v.getAnAccess()) and
not v.isCompilerGenerated() and
not v.isConst() and // workaround for folded constants
not exists(DeclStmt ds | ds.getADeclaration() = v and ds.isInMacroExpansion()) and // variable declared in a macro expansion
not declarationHasSideEffects(v) and
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The `cpp/unused-local-variable` query no longer reports compiler-generated variables, such as placeholders for empty function parameter packs.
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,18 @@ void test_initializer_side_effect()
{
int initialized = initialize(); // GOOD (initializer has a side effect)
}

// ---

void use(...);

template<typename... Args>
void f_args(const Args&... args) // GOOD: the compiler-generated parameter pack should be ignored
{
use(args...);
}

void test_call_f_args()
{
f_args();
}
Loading