summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-06-25 23:51:17 -0400
committerNathan Ridge2018-07-07 20:17:13 -0400
commitfa50ca7bc0da3e51c4ad8774017d8d3c37a4e79c (patch)
treee71348a83098f82e04a2c039e19ed266d5d09c2a
parent9b2a2c206d9f5519f565968e2016e6ee521e9a9b (diff)
downloadorg.eclipse.cdt-fa50ca7bc0da3e51c4ad8774017d8d3c37a4e79c.zip
org.eclipse.cdt-fa50ca7bc0da3e51c4ad8774017d8d3c37a4e79c.tar.gz
org.eclipse.cdt-fa50ca7bc0da3e51c4ad8774017d8d3c37a4e79c.tar.xz
Bug 536268 - Find uses of overloaded operators when checking for unused symbols
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java1
-rw-r--r--codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/UnusedSymbolInFileScopeCheckerTest.java12
2 files changed, 13 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
index 700dda5..ebb2fca 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
@@ -233,6 +233,7 @@ public class UnusedSymbolInFileScopeChecker extends AbstractIndexAstChecker {
ast.accept(new ASTVisitor() {
{
shouldVisitNames = true;
+ shouldVisitImplicitNames = true;
shouldVisitDeclarations = true;
}
diff --git a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/UnusedSymbolInFileScopeCheckerTest.java b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/UnusedSymbolInFileScopeCheckerTest.java
index 8da64b7..39455f9 100644
--- a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/UnusedSymbolInFileScopeCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/core/internal/checkers/UnusedSymbolInFileScopeCheckerTest.java
@@ -346,4 +346,16 @@ public class UnusedSymbolInFileScopeCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
+
+ // class S {};
+ // S operator+(S, S);
+ //
+ // int main() {
+ // S a, b;
+ // a + b;
+ // }
+ public void testOverloadedOperator_536268() throws Exception {
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
}