Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarco Stornelli2020-05-02 13:26:54 +0000
committerMarco Stornelli2020-05-04 17:26:16 +0000
commite730b264c5dee84dc0dbb172688c8e2c276a673f (patch)
tree02c282183076026d4d0a0993909daca3d1b2cca5 /core
parent0124c964b52d84c7eb30f7bd7ef259f80d28c2d5 (diff)
downloadorg.eclipse.cdt-e730b264c5dee84dc0dbb172688c8e2c276a673f.tar.gz
org.eclipse.cdt-e730b264c5dee84dc0dbb172688c8e2c276a673f.tar.xz
org.eclipse.cdt-e730b264c5dee84dc0dbb172688c8e2c276a673f.zip
Bug 562722 - Fix noexcept using implement method
Diffstat (limited to 'core')
-rwxr-xr-xcore/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java17
-rwxr-xr-xcore/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/overridemethods/OverrideMethodsRefactoringTest.java2
-rwxr-xr-xcore/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java8
3 files changed, 26 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
index 019ba9eff69..0bba6e7158a 100755
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java
@@ -919,4 +919,21 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase {
public void testNamespaceAlreadyInDefinition_Bug434677() throws Exception {
assertRefactoringSuccess();
}
+
+ //A.h
+ //
+ //struct A {
+ // /*$*/void waldo() noexcept;/*$$*/
+ //};
+
+ //A.cpp
+ //#include "A.h"
+ //====================
+ //#include "A.h"
+ //
+ //void A::waldo() noexcept {
+ //}
+ public void testNoexpect_Bug562722() throws Exception {
+ assertRefactoringSuccess();
+ }
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/overridemethods/OverrideMethodsRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/overridemethods/OverrideMethodsRefactoringTest.java
index 5fcde1e927b..dff120aa23e 100755
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/overridemethods/OverrideMethodsRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/overridemethods/OverrideMethodsRefactoringTest.java
@@ -498,7 +498,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
// virtual void baseFunc() const noexcept;
//};
//
- //inline void X::baseFunc() const {
+ //inline void X::baseFunc() const noexcept {
//}
public void testWithNoExcept() throws Exception {
selectedMethods = new String[] { "baseFunc()const" };
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java
index f6bdc336959..6392909f163 100755
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java
@@ -38,6 +38,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
@@ -357,6 +358,13 @@ public class ImplementMethodRefactoring extends CRefactoring {
.addExceptionSpecificationTypeId(typeId == null ? null : typeId.copy(CopyStyle.withLocations));
}
}
+ ICPPASTExpression noexceptExpression = functionDeclarator.getNoexceptExpression();
+ if (noexceptExpression != null) {
+ createdMethodDeclarator.setNoexceptExpression(
+ noexceptExpression == ICPPASTFunctionDeclarator.NOEXCEPT_DEFAULT ? noexceptExpression
+ : (ICPPASTExpression) noexceptExpression.copy(CopyStyle.withLocations));
+ }
+
IASTFunctionDefinition functionDefinition = nodeFactory.newFunctionDefinition(declSpecifier,
createdMethodDeclarator, nodeFactory.newCompoundStatement());
functionDefinition.setParent(unit);

Back to the top