mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
232988: apply fix
This commit is contained in:
parent
3eb91c4fa0
commit
a9dcca01fd
2 changed files with 111 additions and 4 deletions
|
@ -413,6 +413,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
|
|||
// public:
|
||||
// /**
|
||||
// * X
|
||||
// * @param x
|
||||
// */
|
||||
// virtual void foo(D x);
|
||||
// };
|
||||
|
@ -420,6 +421,110 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit
|
|||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// class A {};
|
||||
// /**X
|
||||
// A baz;
|
||||
|
||||
// class A {};
|
||||
// /**
|
||||
// * X
|
||||
// */
|
||||
// A baz;
|
||||
public void testAutoDocCommentContent20() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
/** Declarations **/
|
||||
|
||||
// /**X
|
||||
// int foo_bar();
|
||||
|
||||
// /**
|
||||
// * X
|
||||
// * @return
|
||||
// */
|
||||
// int foo_bar();
|
||||
public void testAutoDocCommentContent3_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// /** X
|
||||
// int foo_bar();
|
||||
|
||||
// /**
|
||||
// * X
|
||||
// * @return
|
||||
// */
|
||||
// int foo_bar();
|
||||
public void testAutoDocCommentContent4_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// /**X
|
||||
// *
|
||||
// */
|
||||
// int foo_bar();
|
||||
|
||||
// /**
|
||||
// * X
|
||||
// *
|
||||
// */
|
||||
// int foo_bar();
|
||||
public void testAutoDocCommentContent5_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// /**X
|
||||
// void foo_bar(int x);
|
||||
|
||||
// /**
|
||||
// * X
|
||||
// * @param x
|
||||
// */
|
||||
// void foo_bar(int x);
|
||||
public void testAutoDocCommentContent6_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// class A {}; class B {};
|
||||
// /**X
|
||||
// C* bar_baz(A a, B b, int c);
|
||||
|
||||
// class A {}; class B {};
|
||||
// /**
|
||||
// * X
|
||||
// * @param a
|
||||
// * @param b
|
||||
// * @param c
|
||||
// * @return
|
||||
// */
|
||||
// C* bar_baz(A a, B b, int c);
|
||||
public void testAutoDocCommentContent7_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
// #define STATIC static
|
||||
//
|
||||
// class D {
|
||||
// public:
|
||||
// /**X
|
||||
// STATIC void D::foo(int x);
|
||||
// };
|
||||
|
||||
// #define STATIC static
|
||||
//
|
||||
// class D {
|
||||
// public:
|
||||
// /**
|
||||
// * X
|
||||
// * @param x
|
||||
// */
|
||||
// STATIC void D::foo(int x);
|
||||
// };
|
||||
public void testAutoDocCommentContent17_Dec() throws CoreException {
|
||||
assertAutoEditBehaviour();
|
||||
}
|
||||
|
||||
protected void assertAutoEditBehaviour() throws CoreException {
|
||||
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
||||
final IDocument doc = new Document();
|
||||
|
|
|
@ -48,6 +48,7 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut
|
|||
private static final String RETURN = "@return\n"; //$NON-NLS-1$
|
||||
|
||||
protected boolean documentPureVirtuals= true;
|
||||
protected boolean documentDeclarations= true;
|
||||
|
||||
public DoxygenMultilineAutoEditStrategy() {
|
||||
}
|
||||
|
@ -136,11 +137,12 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut
|
|||
|
||||
if(sdec.getDeclSpecifier() instanceof IASTCompositeTypeSpecifier) {
|
||||
return result;
|
||||
} else if(documentPureVirtuals && sdec.getDeclSpecifier() instanceof ICPPASTDeclSpecifier) {
|
||||
} else if(sdec.getDeclSpecifier() instanceof ICPPASTDeclSpecifier) {
|
||||
IASTDeclarator[] dcs= sdec.getDeclarators();
|
||||
if(dcs.length == 1) {
|
||||
ICPPASTFunctionDeclarator fdecl= (ICPPASTFunctionDeclarator) sdec.getDeclarators()[0];
|
||||
if(fdecl.isPureVirtual()) {
|
||||
if(dcs.length == 1 && dcs[0] instanceof ICPPASTFunctionDeclarator) {
|
||||
ICPPASTFunctionDeclarator fdecl= (ICPPASTFunctionDeclarator) dcs[0];
|
||||
boolean shouldDocument= documentDeclarations || (documentPureVirtuals && fdecl.isPureVirtual());
|
||||
if(shouldDocument) {
|
||||
return documentFunction(fdecl, sdec.getDeclSpecifier());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue