mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
962e011886
commit
c4e47cdaa2
11 changed files with 97 additions and 125 deletions
|
@ -3486,7 +3486,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// B();
|
||||
// void bf();
|
||||
// };
|
||||
public void testFind_bug185408() throws Exception {
|
||||
public void testFind_185408() throws Exception {
|
||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||
NameCollector col = new NameCollector();
|
||||
tu.accept(col);
|
||||
|
@ -3519,7 +3519,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// int b;
|
||||
// void fb();
|
||||
// };
|
||||
public void testGets() throws Exception {
|
||||
public void testImplicitMethods() throws Exception {
|
||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||
NameCollector col = new NameCollector();
|
||||
tu.accept(col);
|
||||
|
@ -7481,9 +7481,8 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// typedef C3 T3;
|
||||
// T3::C3(int) {
|
||||
// }
|
||||
public void testCTorWithTypedef_269953() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
public void testCtorWithTypedef_269953() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template<class T> class Compare {
|
||||
|
@ -7494,8 +7493,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// typedef Compare<int> MY_COMPARE;
|
||||
// template<> MY_COMPARE::Compare() {}
|
||||
public void testTemplateCTorWithTypedef_269953() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class IBase {
|
||||
|
@ -7524,8 +7522,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// return 0;
|
||||
// }
|
||||
public void testHiddenVirtualBase_282993() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class C {
|
||||
|
@ -7556,8 +7553,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// m(a);
|
||||
// }
|
||||
public void testInlineFriendFunction_284690() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// void f(int t);
|
||||
|
@ -7603,7 +7599,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// MyStruct(MyEnum value) {}
|
||||
// };
|
||||
public void testEnumRedefinitionInStruct_385144() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class CL {
|
||||
|
@ -7613,7 +7609,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// }
|
||||
// };
|
||||
public void testLookupFromInlineFriend_284690() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class XInterface {};
|
||||
|
@ -7630,7 +7626,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// XInterface temp;
|
||||
// }
|
||||
public void testTypeLookupWithMultipleInheritance_286213() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// int v1;
|
||||
|
@ -7745,8 +7741,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// foo(c);
|
||||
// }
|
||||
public void testUserDefinedConversion_222444a() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class From {};
|
||||
|
@ -7773,8 +7768,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// x3(f);
|
||||
// }
|
||||
public void testUserDefinedConversion_222444b() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class A {};
|
||||
|
@ -7861,8 +7855,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// // associated namespace.
|
||||
// }
|
||||
public void testAssociatedScopesForOverloadedOperators_293589() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// typedef int F(int);
|
||||
|
@ -7909,8 +7902,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// f("");
|
||||
// }
|
||||
public void testCVQualifiersWithArrays_293982() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
||||
|
@ -7924,8 +7916,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// f(b); func(b);
|
||||
// }
|
||||
public void testArrayTypeSizeFromInitializer_294144() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct A {
|
||||
|
@ -7935,8 +7926,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// template<typename T> struct C {};
|
||||
// };
|
||||
public void testLookupInClassScopeForTemplateIDs_294904() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
||||
|
@ -7949,8 +7939,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// func(A::array);
|
||||
// }
|
||||
public void testCompleteArrayTypeWithIncompleteDeclaration_294144() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// void test() {
|
||||
|
@ -7958,8 +7947,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// return y < x ? -1 : y > x ? 1 : 0;
|
||||
// }
|
||||
public void testSyntax1_295064() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// typedef int TInt;
|
||||
|
@ -7968,8 +7956,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// };
|
||||
// template <typename T> inline CT<T>::CT(TInt) {}
|
||||
public void testSyntax2_295064() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// const unsigned int EIGHT= 8;
|
||||
|
@ -7986,8 +7973,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// static_assert(sizeof(VMPage) == 1, "bla");
|
||||
// }
|
||||
public void testStaticAssertions_294730() throws Exception {
|
||||
final String code= getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct A {};
|
||||
|
@ -8261,7 +8247,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// __typeof(a->x) t7(); // type is const double
|
||||
// __typeof((a->x)) t8(); // type is const double
|
||||
|
||||
public void testDeclType_294730() throws Exception {
|
||||
public void testDecltype_294730() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
||||
|
@ -8284,6 +8270,35 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
assertEquals("const double", ASTTypeUtil.getType(f.getType().getReturnType()));
|
||||
}
|
||||
|
||||
// class Waldo {
|
||||
// typedef int type;
|
||||
// static int value;
|
||||
// };
|
||||
//
|
||||
// int main() {
|
||||
// Waldo w;
|
||||
// decltype(w)::type i;
|
||||
// int x = decltype(w)::value;
|
||||
// }
|
||||
public void testDecltypeInNameQualifier_380751() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// T bar();
|
||||
// struct S {
|
||||
// void waldo();
|
||||
// };
|
||||
// int main() {
|
||||
// auto L = [](S s) { return s; };
|
||||
// typedef decltype(L) lambda_type;
|
||||
// decltype(bar<const lambda_type>()(S())) v;
|
||||
// v.waldo();
|
||||
// }
|
||||
public void testDecltypeWithConstantLambda_397494() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// typedef int TInt;
|
||||
// void test() {
|
||||
// int a1= {}, a2{}; // Initializer for declarator
|
||||
|
@ -8313,8 +8328,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// S::S(int a) : f{a} {} // Member initializer
|
||||
|
||||
public void testInitSyntax_302412() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// namespace std {
|
||||
|
@ -8352,8 +8366,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// fs({});
|
||||
// }
|
||||
public void testListInitialization_302412a() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// namespace std {
|
||||
|
@ -8724,8 +8737,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// i = p->f(p->xl); // OK
|
||||
// }
|
||||
public void testScopedEnums_305975e() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// enum class altitude { high=1, low=2 };
|
||||
|
@ -8766,8 +8778,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// // f(sizeof(S::m + 1)); // Error not detected by CDT: reference to non-static member in subexpression
|
||||
// }
|
||||
public void testSizeofOfNonstaticMember_305979() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// void f(int);
|
||||
|
@ -8794,16 +8805,14 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// return 42;
|
||||
// }
|
||||
public void testCastToVoid_309155() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// void test() {
|
||||
// void *libHandle (0);
|
||||
// }
|
||||
public void testCTorInitializerForVoidPtr_314113() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
public void testCtorInitializerForVoidPtr_314113() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct D {};
|
||||
|
@ -8967,8 +8976,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// gb(a);
|
||||
// }
|
||||
public void testInlineNamespace_305980a() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// namespace ns {
|
||||
|
@ -8981,8 +8989,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// ns::a;
|
||||
// }
|
||||
public void testInlineNamespace_305980b() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// namespace out {
|
||||
|
@ -9068,8 +9075,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// });
|
||||
// }
|
||||
public void testLambdaExpression_316307b() throws Exception {
|
||||
String code= getAboveComment();
|
||||
parseAndCheckBindings(code);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// typedef int MyType;
|
||||
|
@ -10268,21 +10274,6 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// T bar();
|
||||
// struct S {
|
||||
// void waldo();
|
||||
// };
|
||||
// int main() {
|
||||
// auto L = [](S s) { return s; };
|
||||
// typedef decltype(L) lambda_type;
|
||||
// decltype(bar<const lambda_type>()(S())) v;
|
||||
// v.waldo();
|
||||
// }
|
||||
public void testDecltypeWithConstantLambda_397494() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <bool>
|
||||
// struct enable_if {
|
||||
// };
|
||||
|
@ -10461,24 +10452,10 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// __sync_val_compare_and_swap(&i, 1, 2);
|
||||
// __sync_synchronize();
|
||||
// }
|
||||
public void testGNUSyncBuiltins_bug389578() throws Exception {
|
||||
public void testGNUSyncBuiltins_389578() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||
}
|
||||
|
||||
// class Waldo {
|
||||
// typedef int type;
|
||||
// static int value;
|
||||
// };
|
||||
//
|
||||
// int main() {
|
||||
// Waldo w;
|
||||
// decltype(w)::type i;
|
||||
// int x = decltype(w)::value;
|
||||
// }
|
||||
public void testDecltypeInNameQualifier_bug380751() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct underlying_type {
|
||||
// typedef __underlying_type(T) type;
|
||||
|
@ -10503,7 +10480,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// typedef underlying_type<e_int>::type int_type;
|
||||
// typedef underlying_type<e_ulong>::type ulong_type;
|
||||
// typedef underlying_type<e_long>::type loong_type;
|
||||
public void testUnderlyingTypeBuiltin_bug411196() throws Exception {
|
||||
public void testUnderlyingTypeBuiltin_411196() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
|
||||
assertSameType((ITypedef) helper.assertNonProblem("short1_type"), CPPVisitor.SHORT_TYPE);
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.pdom.tests;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
@ -78,7 +77,7 @@ public class DBTest extends BaseTestCase {
|
|||
assertEquals(mem + blocksize, db.getRecPtr((freeDeltas - Database.MIN_BLOCK_DELTAS + 1) * Database.INT_SIZE));
|
||||
}
|
||||
|
||||
public void testBug192437() throws IOException {
|
||||
public void testBug192437() throws Exception {
|
||||
File tmp= File.createTempFile("readOnlyEmpty", ".db");
|
||||
try {
|
||||
tmp.setReadOnly();
|
||||
|
@ -260,7 +259,7 @@ public class DBTest extends BaseTestCase {
|
|||
}
|
||||
|
||||
private String randomString(int min, int max, Random r) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
StringBuilder result = new StringBuilder();
|
||||
int len = min + r.nextInt(max - min);
|
||||
for (int i= 0; i < len; i++) {
|
||||
result.append(randomChar(r));
|
||||
|
@ -269,13 +268,11 @@ public class DBTest extends BaseTestCase {
|
|||
}
|
||||
|
||||
private char randomChar(Random r) {
|
||||
// we only match String.compareToIgnoreCase behaviour within this limited range
|
||||
// we only match String.compareToIgnoreCase behavior within this limited range
|
||||
return (char) (32 + r.nextInt(40));
|
||||
}
|
||||
|
||||
private void assertCMP(String a, int expected, String b, boolean caseSensitive)
|
||||
throws CoreException
|
||||
{
|
||||
private void assertCMP(String a, int expected, String b, boolean caseSensitive) throws CoreException {
|
||||
char[] acs = a.toCharArray();
|
||||
char[] bcs = b.toCharArray();
|
||||
IString aiss = db.newString(a);
|
||||
|
|
|
@ -44,7 +44,7 @@ public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProbl
|
|||
|
||||
/*
|
||||
* Parser Semantic Problems
|
||||
* All Semantic problems take a char[] as an argument
|
||||
* All semantic problems take a char[] as an argument.
|
||||
*/
|
||||
public final static int SEMANTIC_NAME_NOT_FOUND = BINDING_NOT_FOUND;
|
||||
public static final int SEMANTIC_INVALID_OVERLOAD = BINDING_INVALID_OVERLOAD;
|
||||
|
|
|
@ -41,9 +41,7 @@ public interface ISemanticProblem {
|
|||
int TYPE_CANNOT_DEDUCE_AUTO_TYPE = 10003;
|
||||
int TYPE_UNKNOWN_FOR_EXPRESSION = 10004;
|
||||
int TYPE_NOT_PERSISTED = 10005;
|
||||
/**
|
||||
* @since 5.6
|
||||
*/
|
||||
/** @since 5.6 */
|
||||
int TYPE_ENUMERATION_EXPECTED = 10006;
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
* Unqualified name, also base class for operator and conversion name.
|
||||
*/
|
||||
public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionContext {
|
||||
public static IASTName NOT_INITIALIZED= new CPPASTName(null);
|
||||
public static final IASTName NOT_INITIALIZED= new CPPASTName(null);
|
||||
|
||||
private char[] name;
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
|||
|
||||
@Override
|
||||
public IBinding resolveFinalBinding(CPPASTNameBase name) {
|
||||
// check if the binding has been updated.
|
||||
// Check if the binding has been updated.
|
||||
IBinding current= name.getPreBinding();
|
||||
if (current != this)
|
||||
return current;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
|||
fDeclarations = new IASTName[] { name };
|
||||
}
|
||||
|
||||
// built-in variables supply a null
|
||||
// Built-in variables supply a null.
|
||||
if (name != null) {
|
||||
name.setBinding(this);
|
||||
} else {
|
||||
|
@ -97,7 +97,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
|||
} else if (fDeclarations == null) {
|
||||
fDeclarations = new IASTName[] { name };
|
||||
} else {
|
||||
// keep the lowest offset declaration at the first position
|
||||
// Keep the lowest offset declaration at the first position.
|
||||
if (fDeclarations.length > 0
|
||||
&& ((ASTNode) node).getOffset() < ((ASTNode) fDeclarations[0]).getOffset()) {
|
||||
fDeclarations = ArrayUtil.prepend(IASTName.class, fDeclarations, name);
|
||||
|
@ -105,7 +105,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
|||
fDeclarations = ArrayUtil.append(IASTName.class, fDeclarations, name);
|
||||
}
|
||||
}
|
||||
// array types may be incomplete
|
||||
// Array types may be incomplete.
|
||||
if (fType instanceof IArrayType) {
|
||||
fType = null;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
|||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
//7.1.1-8 the mutable specifier can only be applied to names of class data members
|
||||
// 7.1.1-8 the mutable specifier can only be applied to names of class data members.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
|
||||
/**
|
||||
* Non api methods for cpp bindings.
|
||||
* Non API methods for cpp bindings.
|
||||
*/
|
||||
public interface ICPPInternalBinding extends ICPPBinding {
|
||||
|
||||
IASTNode getDefinition();
|
||||
|
||||
//implementors should keep the node with the lowest offset in declarations[0]
|
||||
/** Implementors must keep the node with the lowest offset in declarations[0] */
|
||||
IASTNode[] getDeclarations();
|
||||
|
||||
void addDefinition(IASTNode node);
|
||||
|
|
|
@ -2215,7 +2215,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
}
|
||||
|
||||
/**
|
||||
* Compute the type for decltype(expr) or typeof(expr)
|
||||
* Computes the type for decltype(expr) or typeof(expr).
|
||||
*/
|
||||
private static IType getDeclType(ICPPASTSimpleDeclSpecifier spec) {
|
||||
IASTExpression expr = spec.getDeclTypeExpression();
|
||||
|
|
Loading…
Add table
Reference in a new issue