From 0c290ae7eabb8cb32e1eb28f55cceb9e6350d596 Mon Sep 17 00:00:00 2001 From: Elliott Baron Date: Tue, 25 Aug 2009 21:01:56 -0400 Subject: Initial commit: New file. * .gitignore: New file. * org.eclipse.cdt.codan.checkers.ui/.classpath: New file. * org.eclipse.cdt.codan.checkers.ui/.project: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Template: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.checkers.ui/build.properties: New file. * org.eclipse.cdt.codan.checkers.ui/plugin.xml: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java: New file. * org.eclipse.cdt.codan.checkers/.classpath: New file. * org.eclipse.cdt.codan.checkers/.project: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/CVS/Template: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.checkers/build.properties: New file. * org.eclipse.cdt.codan.checkers/plugin.xml: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java: New file. * org.eclipse.cdt.codan.core/.classpath: New file. * org.eclipse.cdt.codan.core/.project: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/CVS/Root: New file. * org.eclipse.cdt.codan.core/CVS/Template: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.core/build.properties: New file. * org.eclipse.cdt.codan.core/plugin.xml: New file. * org.eclipse.cdt.codan.core/schema/CVS/Entries: New file. * org.eclipse.cdt.codan.core/schema/CVS/Repository: New file. * org.eclipse.cdt.codan.core/schema/CVS/Root: New file. * org.eclipse.cdt.codan.core/schema/checkers.exsd: New file. * org.eclipse.cdt.codan.core/src/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java: New file. * org.eclipse.cdt.codan.ui/.classpath: New file. * org.eclipse.cdt.codan.ui/.project: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/CVS/Template: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.ui/build.properties: New file. * org.eclipse.cdt.codan.ui/plugin.xml: New file. * org.eclipse.cdt.codan.ui/src/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java: New file. --- org.eclipse.cdt.codan.checkers/.classpath | 7 + org.eclipse.cdt.codan.checkers/.project | 28 ++++ .../.settings/CVS/Entries | 1 + .../.settings/CVS/Repository | 1 + org.eclipse.cdt.codan.checkers/.settings/CVS/Root | 1 + .../.settings/org.eclipse.jdt.core.prefs | 12 ++ org.eclipse.cdt.codan.checkers/CVS/Entries | 7 + org.eclipse.cdt.codan.checkers/CVS/Repository | 1 + org.eclipse.cdt.codan.checkers/CVS/Root | 1 + org.eclipse.cdt.codan.checkers/CVS/Template | 0 .../META-INF/CVS/Entries | 1 + .../META-INF/CVS/Repository | 1 + org.eclipse.cdt.codan.checkers/META-INF/CVS/Root | 1 + .../META-INF/MANIFEST.MF | 12 ++ org.eclipse.cdt.codan.checkers/build.properties | 5 + org.eclipse.cdt.codan.checkers/plugin.xml | 55 +++++++ org.eclipse.cdt.codan.checkers/src/CVS/Entries | 1 + org.eclipse.cdt.codan.checkers/src/CVS/Repository | 1 + org.eclipse.cdt.codan.checkers/src/CVS/Root | 1 + org.eclipse.cdt.codan.checkers/src/org/CVS/Entries | 1 + .../src/org/CVS/Repository | 1 + org.eclipse.cdt.codan.checkers/src/org/CVS/Root | 1 + .../src/org/eclipse/CVS/Entries | 1 + .../src/org/eclipse/CVS/Repository | 1 + .../src/org/eclipse/CVS/Root | 1 + .../src/org/eclipse/cdt/CVS/Entries | 1 + .../src/org/eclipse/cdt/CVS/Repository | 1 + .../src/org/eclipse/cdt/CVS/Root | 1 + .../src/org/eclipse/cdt/codan/CVS/Entries | 1 + .../src/org/eclipse/cdt/codan/CVS/Repository | 1 + .../src/org/eclipse/cdt/codan/CVS/Root | 1 + .../org/eclipse/cdt/codan/checkers/Activator.java | 74 +++++++++ .../src/org/eclipse/cdt/codan/checkers/CVS/Entries | 2 + .../org/eclipse/cdt/codan/checkers/CVS/Repository | 1 + .../src/org/eclipse/cdt/codan/checkers/CVS/Root | 1 + .../codan/checkers/CloseOpenedFilesChecker.java | 103 ++++++++++++ .../sample/AssignmentInConditionChecker.java | 59 +++++++ .../eclipse/cdt/codan/checkers/sample/CVS/Entries | 3 + .../cdt/codan/checkers/sample/CVS/Repository | 1 + .../org/eclipse/cdt/codan/checkers/sample/CVS/Root | 1 + .../checkers/sample/NonVirtualDestructor.java | 181 +++++++++++++++++++++ .../sample/StatementHasNoEffectChecker.java | 110 +++++++++++++ 42 files changed, 685 insertions(+) create mode 100644 org.eclipse.cdt.codan.checkers/.classpath create mode 100644 org.eclipse.cdt.codan.checkers/.project create mode 100644 org.eclipse.cdt.codan.checkers/.settings/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/.settings/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/.settings/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.eclipse.cdt.codan.checkers/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/CVS/Template create mode 100644 org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/META-INF/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF create mode 100644 org.eclipse.cdt.codan.checkers/build.properties create mode 100644 org.eclipse.cdt.codan.checkers/plugin.xml create mode 100644 org.eclipse.cdt.codan.checkers/src/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java create mode 100644 org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java (limited to 'org.eclipse.cdt.codan.checkers') diff --git a/org.eclipse.cdt.codan.checkers/.classpath b/org.eclipse.cdt.codan.checkers/.classpath new file mode 100644 index 0000000..1fa3e68 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.eclipse.cdt.codan.checkers/.project b/org.eclipse.cdt.codan.checkers/.project new file mode 100644 index 0000000..6b76138 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.project @@ -0,0 +1,28 @@ + + + org.eclipse.cdt.codan.checkers + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.eclipse.cdt.codan.checkers/.settings/CVS/Entries b/org.eclipse.cdt.codan.checkers/.settings/CVS/Entries new file mode 100644 index 0000000..c7206e9 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Entries @@ -0,0 +1 @@ +/org.eclipse.jdt.core.prefs/1.2/Tue Jun 2 21:11:37 2009// diff --git a/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository b/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository new file mode 100644 index 0000000..d2cb1b1 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/.settings diff --git a/org.eclipse.cdt.codan.checkers/.settings/CVS/Root b/org.eclipse.cdt.codan.checkers/.settings/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..bd2d10b --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Tue Jun 02 17:10:46 EDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.eclipse.cdt.codan.checkers/CVS/Entries b/org.eclipse.cdt.codan.checkers/CVS/Entries new file mode 100644 index 0000000..79d42fe --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/CVS/Entries @@ -0,0 +1,7 @@ +/.classpath/1.2/Fri Apr 17 20:50:15 2009// +/.project/1.1/Thu Apr 9 12:48:43 2009// +D/.settings//// +D/META-INF//// +/build.properties/1.1/Thu Apr 9 12:48:44 2009// +/plugin.xml/1.5/Sat May 9 01:16:26 2009// +D/src//// diff --git a/org.eclipse.cdt.codan.checkers/CVS/Repository b/org.eclipse.cdt.codan.checkers/CVS/Repository new file mode 100644 index 0000000..856ae55 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers diff --git a/org.eclipse.cdt.codan.checkers/CVS/Root b/org.eclipse.cdt.codan.checkers/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/CVS/Template b/org.eclipse.cdt.codan.checkers/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries new file mode 100644 index 0000000..011c155 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries @@ -0,0 +1 @@ +/MANIFEST.MF/1.4/Sat Apr 18 02:11:45 2009// diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository new file mode 100644 index 0000000..f2114bc --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/META-INF diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF new file mode 100644 index 0000000..50e70f6 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Checkers +Bundle-SymbolicName: org.eclipse.cdt.codan.checkers;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.eclipse.cdt.codan.checkers.Activator +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.5.0", + org.eclipse.cdt.core;bundle-version="5.1.0", + org.eclipse.cdt.codan.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/org.eclipse.cdt.codan.checkers/build.properties b/org.eclipse.cdt.codan.checkers/build.properties new file mode 100644 index 0000000..e9863e2 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/org.eclipse.cdt.codan.checkers/plugin.xml b/org.eclipse.cdt.codan.checkers/plugin.xml new file mode 100644 index 0000000..7ba8f3e --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/plugin.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/CVS/Entries new file mode 100644 index 0000000..381094d --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/CVS/Entries @@ -0,0 +1 @@ +D/org//// diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/CVS/Repository new file mode 100644 index 0000000..5218fe8 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Root b/org.eclipse.cdt.codan.checkers/src/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries new file mode 100644 index 0000000..0f148f8 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries @@ -0,0 +1 @@ +D/eclipse//// diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository new file mode 100644 index 0000000..5dd4d70 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries new file mode 100644 index 0000000..e524915 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries @@ -0,0 +1 @@ +D/cdt//// diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository new file mode 100644 index 0000000..e5eb786 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries new file mode 100644 index 0000000..8d969ba --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries @@ -0,0 +1 @@ +D/codan//// diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository new file mode 100644 index 0000000..1a2ee41 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries new file mode 100644 index 0000000..513604d --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries @@ -0,0 +1 @@ +D/checkers//// diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository new file mode 100644 index 0000000..edbf463 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java new file mode 100644 index 0000000..2915e7d --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java @@ -0,0 +1,74 @@ +package org.eclipse.cdt.codan.checkers; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.cdt.codan.checkers"; + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * @param e + */ + public static void log(Throwable e) { + getDefault().getLog().log(getStatus(e)); + } + + public static void log(String message) { + getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, message)); + } + + /** + * @param e + * @return + */ + public static IStatus getStatus(Throwable e) { + return new Status(Status.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e); + } +} diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries new file mode 100644 index 0000000..0f9ebcd --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries @@ -0,0 +1,2 @@ +/Activator.java/1.3/Sat May 9 01:36:37 2009// +D/sample//// diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository new file mode 100644 index 0000000..c37351c --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java new file mode 100644 index 0000000..354223f --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2009 Elliott Baron + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Elliott Baron - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.checkers; + +import java.text.MessageFormat; + +import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker; +import org.eclipse.cdt.core.dom.ast.ASTVisitor; +import org.eclipse.cdt.core.dom.ast.IASTDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTExpression; +import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; +import org.eclipse.cdt.core.dom.ast.IASTIdExpression; +import org.eclipse.cdt.core.dom.ast.IASTInitializer; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IBinding; + +public class CloseOpenedFilesChecker extends AbstractIndexAstChecker { + private static final String ERR_ID = Activator.PLUGIN_ID + ".CloseOpenedFilesProblem"; + + public void processAst(IASTTranslationUnit ast) { + // traverse the AST using the visitor pattern + CloseOpenedFilesVisitor visitor = new CloseOpenedFilesVisitor(); + ast.accept(visitor); + + IASTName closeFD = visitor.getCloseFD(); + if (closeFD != null) { + IASTName openFD = visitor.getOpenFD(); + if (openFD == null || !matchingFileDescriptors(closeFD.getBinding(), openFD.getBinding())) { + String message = MessageFormat.format("File descriptor \"{0}\" has not been opened", closeFD.toString()); + reportProblem(ERR_ID, closeFD, message); + } + } + } + + private boolean matchingFileDescriptors(IBinding closeFD, IBinding openFD) { + // FIXME elaborate + return closeFD.equals(openFD); + } + + class CloseOpenedFilesVisitor extends ASTVisitor { + + public static final String OPEN = "open"; + public static final String CLOSE = "close"; + + private IASTName openFD; + private IASTName closeFD; + + public CloseOpenedFilesVisitor() { + shouldVisitExpressions = true; + } + + @Override + public int visit(IASTExpression expression) { + if (expression instanceof IASTFunctionCallExpression) { + IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression; + IASTExpression funcName = callExpression.getFunctionNameExpression(); + if (funcName instanceof IASTIdExpression) { + IASTName name = ((IASTIdExpression) funcName).getName(); + String simpleName = String.valueOf(name.getSimpleID()); + if (simpleName.equals(OPEN)) { + IASTNode parent = callExpression.getParent(); + if (parent instanceof IASTInitializer) { + parent = parent.getParent(); + if (parent instanceof IASTDeclarator) { + openFD = ((IASTDeclarator) parent).getName(); + } + } + } + else if (simpleName.equals(CLOSE)) { + IASTExpression paramExpression = callExpression.getParameterExpression(); + if (paramExpression instanceof IASTIdExpression) { + closeFD = ((IASTIdExpression) paramExpression).getName(); + } + } + } + + return PROCESS_SKIP; + } + else { + return PROCESS_CONTINUE; + } + } + + public IASTName getOpenFD() { + return openFD; + } + + public IASTName getCloseFD() { + return closeFD; + } + } + +} diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java new file mode 100644 index 0000000..5ce5661 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.checkers.sample; + +import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker; +import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; +import org.eclipse.cdt.core.dom.ast.ASTVisitor; +import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; +import org.eclipse.cdt.core.dom.ast.IASTExpression; +import org.eclipse.cdt.core.dom.ast.IASTForStatement; +import org.eclipse.cdt.core.dom.ast.IASTIfStatement; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; + +public class AssignmentInConditionChecker extends AbstractIndexAstChecker { + private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.AssignmentInConditionProblem"; + + public void processAst(IASTTranslationUnit ast) { + // traverse the ast using the visitor pattern. + ast.accept(new CheckCodeVisitor()); + } + + class CheckCodeVisitor extends ASTVisitor { + CheckCodeVisitor() { + shouldVisitExpressions = true; + } + + public int visit(IASTExpression expression) { + if (isAssignmentExpression(expression) + && isUsedAsCondition(expression)) { + reportProblem(ER_ID, expression, "Possible assignment in condition"); + } + return PROCESS_CONTINUE; + } + + private boolean isAssignmentExpression(IASTExpression e) { + if (e instanceof IASTBinaryExpression) { + IASTBinaryExpression binExpr = (IASTBinaryExpression) e; + return binExpr.getOperator() == IASTBinaryExpression.op_assign; + } + return false; + } + + private boolean isUsedAsCondition(IASTExpression expression) { + ASTNodeProperty prop = expression.getPropertyInParent(); + if (prop == IASTForStatement.CONDITION + || prop == IASTIfStatement.CONDITION) + return true; + return false; + } + } +} diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries new file mode 100644 index 0000000..7071b8d --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries @@ -0,0 +1,3 @@ +/AssignmentInConditionChecker.java/1.4/Fri Jul 31 20:39:13 2009// +/NonVirtualDestructor.java/1.4/Fri Jul 31 20:39:13 2009// +/StatementHasNoEffectChecker.java/1.5/Fri Jul 31 20:39:13 2009// diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository new file mode 100644 index 0000000..28a5431 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java new file mode 100644 index 0000000..45f7e72 --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java @@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.checkers.sample; + +import java.text.MessageFormat; + +import org.eclipse.cdt.codan.checkers.Activator; +import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker; +import org.eclipse.cdt.core.dom.ast.ASTVisitor; +import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; +import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding; + +/** + * Checker to find that class has virtual method and non virtual destructor + * + * @author Alena + * + */ +public class NonVirtualDestructor extends AbstractIndexAstChecker { + private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.NonVirtualDestructorProblem"; + + public void processAst(IASTTranslationUnit ast) { + // traverse the ast using the visitor pattern. + ast.accept(new OnEachClass()); + } + + class OnEachClass extends ASTVisitor { + private IASTName className; + private IBinding virMethodName; + private IBinding destName; + + OnEachClass() { + // shouldVisitDeclarations = true; + shouldVisitDeclSpecifiers = true; + } + + public int visit(IASTDeclSpecifier decl) { + if (isClassDecl(decl)) { + try { + boolean err = hasErrorCondition(decl); + if (err) { + String mess; + String clazz = className.toString(); + String method = virMethodName.getName(); + IASTNode ast = decl; + if (destName != null) { + if (destName instanceof ICPPInternalBinding) { + ICPPInternalBinding bin = (ICPPInternalBinding) destName; + ast = bin.getDeclarations()[0]; + } + mess = MessageFormat + .format( + "Class ''{0}'' has virtual method ''{1}'' but non-virtual destructor ''{2}''", + clazz, method, destName.getName()); + reportProblem(ER_ID, ast, mess); + } + } + } catch (DOMException e) { + // ignore, no error + } catch (Exception e) { + Activator.log(e); + } + return PROCESS_SKIP; + } + return PROCESS_CONTINUE; + } + + /** + * @param decl + * @throws DOMException + */ + private boolean hasErrorCondition(IASTDeclSpecifier decl) + throws DOMException { + ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) decl; + className = spec.getName(); + IBinding binding = className.getBinding(); + if (binding == null) { + binding = className.resolveBinding(); + } + if (binding instanceof ICPPClassType) { + ICPPClassType type = (ICPPClassType) binding; + virMethodName = null; + destName = null; + // check for the following conditions: + // class has own virtual method and own non-virtual destructor + // class has own virtual method and base non-virtual destructor + // class has base virtual method and own non-virtual destructor + ICPPMethod[] declaredMethods = type.getDeclaredMethods(); + boolean hasOwnVirtualMethod = false; + boolean hasOwnNonVirDestructor = false; + boolean hasDestructor = false; + boolean hasVirtualMethod = false; + for (int i = 0; i < declaredMethods.length; i++) { + ICPPMethod icppMethod = declaredMethods[i]; + if (icppMethod.isVirtual() && !icppMethod.isDestructor()) { + hasOwnVirtualMethod = true; + virMethodName = icppMethod; + } + if (icppMethod.isDestructor()) { + hasDestructor = true; + if (!icppMethod.isVirtual()) { + hasOwnNonVirDestructor = true; + destName = icppMethod; + } + } + } + boolean hasVirDestructor = false; + // class has own virtual method and own non-virtual destructor + if (hasOwnVirtualMethod && hasOwnNonVirDestructor) { + return true; + } + // class does not have virtual methods but has virtual + // destructor + // - not an error + if (hasOwnVirtualMethod == false && hasDestructor == true + && hasOwnNonVirDestructor == false) { + return false; + } + ICPPMethod[] allDeclaredMethods = type.getAllDeclaredMethods(); + for (int i = 0; i < allDeclaredMethods.length; i++) { + ICPPMethod icppMethod = allDeclaredMethods[i]; + if (icppMethod.isVirtual() && !icppMethod.isDestructor()) { + hasVirtualMethod = true; + if (virMethodName == null) + virMethodName = icppMethod; + } + if (icppMethod.isDestructor()) { + hasDestructor = true; + if (icppMethod.isVirtual()) { + hasVirDestructor = true; + } else { + if (destName == null) + destName = icppMethod; + } + } + } + if (hasOwnVirtualMethod) { + // class has own virtual method and base non-virtual + // destructor + if (hasDestructor == true && hasVirDestructor == false) { + return true; + } + } else if (hasVirtualMethod) { + // class has base virtual method and own non-virtual + // destructor + if (hasOwnNonVirDestructor == true) { + return true; + } + } + } + return false; + } + + /** + * @param decl + * @return + */ + private boolean isClassDecl(IASTDeclSpecifier decl) { + if (decl instanceof ICPPASTCompositeTypeSpecifier) { + return true; + } + return false; + } + } +} diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java new file mode 100644 index 0000000..c08f58a --- /dev/null +++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.checkers.sample; + +import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker; +import org.eclipse.cdt.core.dom.ast.ASTVisitor; +import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; +import org.eclipse.cdt.core.dom.ast.IASTExpression; +import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; +import org.eclipse.cdt.core.dom.ast.IASTIdExpression; +import org.eclipse.cdt.core.dom.ast.IASTStatement; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; +import org.eclipse.cdt.core.dom.ast.IBasicType; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression; + +/** + * Checker that detects statements without effect such as + * + * a+b; + * + * or + * + * +b; + * + * + */ +public class StatementHasNoEffectChecker extends AbstractIndexAstChecker { + private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.StatementHasNoEffectProblem"; + + public void processAst(IASTTranslationUnit ast) { + // traverse the ast using the visitor pattern. + ast.accept(new CheckStmpVisitor()); + } + + class CheckStmpVisitor extends ASTVisitor { + CheckStmpVisitor() { + shouldVisitStatements = true; + } + + public int visit(IASTStatement stmt) { + if (stmt instanceof IASTExpressionStatement) { + if (hasNoEffect(((IASTExpressionStatement) stmt) + .getExpression())) { + reportProblem(ER_ID, stmt, "Statement has no effect"); + } + return PROCESS_SKIP; + } + return PROCESS_CONTINUE; + } + + /** + * We consider has not effect binary statements without assignment and + * unary statement which is not dec and inc. If operator is overloaded + * we not going to bother. + * + * @param e + * @return + */ + private boolean hasNoEffect(IASTExpression e) { + if (e instanceof IASTBinaryExpression) { + IASTBinaryExpression binExpr = (IASTBinaryExpression) e; + if (binExpr.getOperator() == IASTBinaryExpression.op_assign) + return false; + if (binExpr instanceof CPPASTBinaryExpression) { + // unfortunately ICPPASTBinaryExpression does not have + // getOverload public method + CPPASTBinaryExpression cppBin = (CPPASTBinaryExpression) binExpr; + ICPPFunction overload = cppBin.getOverload(); + if (overload != null) + return false; + IType expressionType = binExpr.getOperand1() + .getExpressionType(); + if (!(expressionType instanceof IBasicType)) { + return false; // must be overloaded but parser could not + // find it + } + } + return true; + } + if (e instanceof IASTUnaryExpression) { + IASTUnaryExpression unaryExpr = (IASTUnaryExpression) e; + int operator = unaryExpr.getOperator(); + switch (operator) { + case IASTUnaryExpression.op_postFixDecr: + case IASTUnaryExpression.op_prefixDecr: + case IASTUnaryExpression.op_postFixIncr: + case IASTUnaryExpression.op_prefixIncr: + return false; + } + return true; + } + if (e instanceof IASTIdExpression) { + // simply a; + return true; + } + return false; + } + } +} -- cgit