diff options
author | Elliott Baron <ebaron@fedoraproject.org> | 2009-08-25 21:01:56 -0400 |
---|---|---|
committer | Elliott Baron <ebaron@fedoraproject.org> | 2009-08-25 21:01:56 -0400 |
commit | 0c290ae7eabb8cb32e1eb28f55cceb9e6350d596 (patch) | |
tree | ca8dda9f30ed2be55b5f06cbf59c3d29e82a8832 /org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java | |
download | codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.gz codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.xz codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.zip |
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.
Diffstat (limited to 'org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java')
-rw-r--r-- | org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java | 181 |
1 files changed, 181 insertions, 0 deletions
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; + } + } +} |