Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2008-07-02 09:55:53 +0000
committerAndrew Ferguson2008-07-02 09:55:53 +0000
commitd4573870a7b700692ca97bb3689b64511c4ace79 (patch)
treea435a248b9a333a85023525f718ae43a4b5c15a8
parent29eafddce07deecd6fd61832ce3146173eefffd3 (diff)
downloadorg.eclipse.cdt-d4573870a7b700692ca97bb3689b64511c4ace79.tar.gz
org.eclipse.cdt-d4573870a7b700692ca97bb3689b64511c4ace79.tar.xz
org.eclipse.cdt-d4573870a7b700692ca97bb3689b64511c4ace79.zip
238852: suppress @param for f(void) parameter
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java38
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java40
2 files changed, 70 insertions, 8 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
index 7dea13b8e2c..b2f1ee6cde9 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java
@@ -441,7 +441,43 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
// * X
// */
// void foo(void) {}
- public void testAutoDocCommentContent21_238852() throws CoreException {
+ public void testAutoDocCommentContent21_238852_a() throws CoreException {
+ assertAutoEditBehaviour();
+ }
+
+ // /**X
+ // void foo(void* x) {}
+
+ // /**
+ // * X
+ // * @param x
+ // */
+ // void foo(void* x) {}
+ public void testAutoDocCommentContent21_238852_b() throws CoreException {
+ assertAutoEditBehaviour();
+ }
+
+ // /**X
+ // void foo(void (*fp)()) {}
+
+ // /**
+ // * X
+ // * @param fp
+ // */
+ // void foo(void (*fp)()) {}
+ public void testAutoDocCommentContent21_238852_c() throws CoreException {
+ assertAutoEditBehaviour();
+ }
+
+ // /**X
+ // void foo(void vs[]) {}
+
+ // /**
+ // * X
+ // * @param vs
+ // */
+ // void foo(void vs[]) {}
+ public void testAutoDocCommentContent21_238852_d() throws CoreException {
assertAutoEditBehaviour();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java
index bc671df5541..cb25d820924 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java
@@ -18,6 +18,7 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -33,7 +34,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
import org.eclipse.cdt.ui.text.doctools.DefaultMultilineCommentAutoEditStrategy;
@@ -87,16 +87,42 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut
protected StringBuilder documentFunctionParameters(IASTParameterDeclaration[] decls) {
StringBuilder result= new StringBuilder();
for(int i=0; i<decls.length; i++) {
- IASTDeclarator dtor= decls[i].getDeclarator();
- if(decls[i].getDeclSpecifier() instanceof IASTSimpleDeclSpecifier) {
- if(((IASTSimpleDeclSpecifier)decls[i].getDeclSpecifier()).getType() == IASTSimpleDeclSpecifier.t_void) {
- continue;
- }
+ if(!isVoidParameter(decls[i])) {
+ result.append(PARAM+getParameterName(decls[i])+"\n"); //$NON-NLS-1$
}
- result.append(PARAM+dtor.getName()+"\n"); //$NON-NLS-1$
}
return result;
}
+
+ /**
+ * @param decl
+ * @return the name of the parameter
+ */
+ protected String getParameterName(IASTParameterDeclaration decl) {
+ IASTDeclarator dtor= decl.getDeclarator();
+ for(int i=0; i<8 && dtor.getName().getRawSignature().length()==0 && dtor.getNestedDeclarator() != null; i++) {
+ dtor= dtor.getNestedDeclarator();
+ }
+ return dtor.getName().getRawSignature();
+ }
+
+ /**
+ * @param decl
+ * @return true if the specified parameter declaration is of void type
+ */
+ protected boolean isVoidParameter(IASTParameterDeclaration decl) {
+ if(decl.getDeclSpecifier() instanceof IASTSimpleDeclSpecifier) {
+ if(((IASTSimpleDeclSpecifier)decl.getDeclSpecifier()).getType() == IASTSimpleDeclSpecifier.t_void) {
+ IASTDeclarator dtor= decl.getDeclarator();
+ if(dtor.getPointerOperators().length == 0) {
+ if(!(dtor instanceof IASTFunctionDeclarator) && !(dtor instanceof IASTArrayDeclarator)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
/**
* @return the comment content to describe the return

Back to the top