mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
20e43a2744
commit
724e1991ac
2 changed files with 8 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011, 2012 Anton Gorenkov and others
|
* Copyright (c) 2011, 2013 Anton Gorenkov and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -249,7 +249,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Checks that specified declaration is a class constructor
|
/** Checks that specified declaration is a class constructor
|
||||||
* (it is a class member and its name is equal to class name)
|
* (it is a class member and its name is equal to the class name)
|
||||||
*/
|
*/
|
||||||
private ICPPConstructor getConstructor(IASTDeclaration decl) {
|
private ICPPConstructor getConstructor(IASTDeclaration decl) {
|
||||||
if (decl instanceof ICPPASTFunctionDefinition) {
|
if (decl instanceof ICPPASTFunctionDefinition) {
|
||||||
|
@ -270,10 +270,11 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
if (memberName != null) {
|
if (memberName != null) {
|
||||||
IBinding memberBinding = memberName.resolveBinding();
|
IBinding memberBinding = memberName.resolveBinding();
|
||||||
ICPPClassType classType = null;
|
ICPPClassType classType = null;
|
||||||
if (memberBinding instanceof ICPPClassType)
|
if (memberBinding instanceof ICPPClassType) {
|
||||||
classType = (ICPPClassType) memberBinding;
|
classType = (ICPPClassType) memberBinding;
|
||||||
else if (memberBinding instanceof ICPPConstructor)
|
} else if (memberBinding instanceof ICPPConstructor) {
|
||||||
classType = ((ICPPConstructor) memberBinding).getClassOwner();
|
classType = ((ICPPConstructor) memberBinding).getClassOwner();
|
||||||
|
}
|
||||||
if (classType != null && classType.isSameType(constructor.getClassOwner()))
|
if (classType != null && classType.isSameType(constructor.getClassOwner()))
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011, 2012 Anton Gorenkov and others
|
* Copyright (c) 2011, 2013 Anton Gorenkov and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -606,7 +606,7 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
||||||
|
|
||||||
// struct A {
|
// struct A {
|
||||||
// A(int n) : waldo(n) {}
|
// A(int n) : waldo(n) {}
|
||||||
// A() : A(42) {} // warning: "Member 'waldo' was not initialized in this constructor"
|
// A() : A(42) {}
|
||||||
// int waldo;
|
// int waldo;
|
||||||
// };
|
// };
|
||||||
public void testBug402607_delegatingConstructor() throws Exception {
|
public void testBug402607_delegatingConstructor() throws Exception {
|
||||||
|
@ -617,7 +617,7 @@ public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
|
||||||
// struct A {
|
// struct A {
|
||||||
// typedef A B;
|
// typedef A B;
|
||||||
// A(int n) : waldo(n) {}
|
// A(int n) : waldo(n) {}
|
||||||
// A() : B(42) {} // warning: "Member 'waldo' was not initialized in this constructor"
|
// A() : B(42) {}
|
||||||
// int waldo;
|
// int waldo;
|
||||||
// };
|
// };
|
||||||
public void testBug402607_delegatingConstructorTypedef() throws Exception {
|
public void testBug402607_delegatingConstructorTypedef() throws Exception {
|
||||||
|
|
Loading…
Add table
Reference in a new issue