mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +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();
|
// B();
|
||||||
// void bf();
|
// void bf();
|
||||||
// };
|
// };
|
||||||
public void testFind_bug185408() throws Exception {
|
public void testFind_185408() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||||
NameCollector col = new NameCollector();
|
NameCollector col = new NameCollector();
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
|
@ -3519,7 +3519,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// int b;
|
// int b;
|
||||||
// void fb();
|
// void fb();
|
||||||
// };
|
// };
|
||||||
public void testGets() throws Exception {
|
public void testImplicitMethods() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
|
||||||
NameCollector col = new NameCollector();
|
NameCollector col = new NameCollector();
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
|
@ -7481,9 +7481,8 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// typedef C3 T3;
|
// typedef C3 T3;
|
||||||
// T3::C3(int) {
|
// T3::C3(int) {
|
||||||
// }
|
// }
|
||||||
public void testCTorWithTypedef_269953() throws Exception {
|
public void testCtorWithTypedef_269953() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> class Compare {
|
// template<class T> class Compare {
|
||||||
|
@ -7494,8 +7493,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// typedef Compare<int> MY_COMPARE;
|
// typedef Compare<int> MY_COMPARE;
|
||||||
// template<> MY_COMPARE::Compare() {}
|
// template<> MY_COMPARE::Compare() {}
|
||||||
public void testTemplateCTorWithTypedef_269953() throws Exception {
|
public void testTemplateCTorWithTypedef_269953() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// class IBase {
|
// class IBase {
|
||||||
|
@ -7524,8 +7522,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
public void testHiddenVirtualBase_282993() throws Exception {
|
public void testHiddenVirtualBase_282993() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// class C {
|
// class C {
|
||||||
|
@ -7556,8 +7553,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// m(a);
|
// m(a);
|
||||||
// }
|
// }
|
||||||
public void testInlineFriendFunction_284690() throws Exception {
|
public void testInlineFriendFunction_284690() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void f(int t);
|
// void f(int t);
|
||||||
|
@ -7603,7 +7599,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// MyStruct(MyEnum value) {}
|
// MyStruct(MyEnum value) {}
|
||||||
// };
|
// };
|
||||||
public void testEnumRedefinitionInStruct_385144() throws Exception {
|
public void testEnumRedefinitionInStruct_385144() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP);
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// class CL {
|
// class CL {
|
||||||
|
@ -7613,7 +7609,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
public void testLookupFromInlineFriend_284690() throws Exception {
|
public void testLookupFromInlineFriend_284690() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP);
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// class XInterface {};
|
// class XInterface {};
|
||||||
|
@ -7630,7 +7626,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// XInterface temp;
|
// XInterface temp;
|
||||||
// }
|
// }
|
||||||
public void testTypeLookupWithMultipleInheritance_286213() throws Exception {
|
public void testTypeLookupWithMultipleInheritance_286213() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP);
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// int v1;
|
// int v1;
|
||||||
|
@ -7745,8 +7741,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// foo(c);
|
// foo(c);
|
||||||
// }
|
// }
|
||||||
public void testUserDefinedConversion_222444a() throws Exception {
|
public void testUserDefinedConversion_222444a() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// class From {};
|
// class From {};
|
||||||
|
@ -7773,8 +7768,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// x3(f);
|
// x3(f);
|
||||||
// }
|
// }
|
||||||
public void testUserDefinedConversion_222444b() throws Exception {
|
public void testUserDefinedConversion_222444b() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// class A {};
|
// class A {};
|
||||||
|
@ -7861,8 +7855,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// // associated namespace.
|
// // associated namespace.
|
||||||
// }
|
// }
|
||||||
public void testAssociatedScopesForOverloadedOperators_293589() throws Exception {
|
public void testAssociatedScopesForOverloadedOperators_293589() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef int F(int);
|
// typedef int F(int);
|
||||||
|
@ -7909,8 +7902,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// f("");
|
// f("");
|
||||||
// }
|
// }
|
||||||
public void testCVQualifiersWithArrays_293982() throws Exception {
|
public void testCVQualifiersWithArrays_293982() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
||||||
|
@ -7924,8 +7916,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// f(b); func(b);
|
// f(b); func(b);
|
||||||
// }
|
// }
|
||||||
public void testArrayTypeSizeFromInitializer_294144() throws Exception {
|
public void testArrayTypeSizeFromInitializer_294144() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct A {
|
// struct A {
|
||||||
|
@ -7935,8 +7926,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// template<typename T> struct C {};
|
// template<typename T> struct C {};
|
||||||
// };
|
// };
|
||||||
public void testLookupInClassScopeForTemplateIDs_294904() throws Exception {
|
public void testLookupInClassScopeForTemplateIDs_294904() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
// template <typename T, int N> char (&func(T (&array)[N]))[N];
|
||||||
|
@ -7949,8 +7939,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// func(A::array);
|
// func(A::array);
|
||||||
// }
|
// }
|
||||||
public void testCompleteArrayTypeWithIncompleteDeclaration_294144() throws Exception {
|
public void testCompleteArrayTypeWithIncompleteDeclaration_294144() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
|
@ -7958,8 +7947,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// return y < x ? -1 : y > x ? 1 : 0;
|
// return y < x ? -1 : y > x ? 1 : 0;
|
||||||
// }
|
// }
|
||||||
public void testSyntax1_295064() throws Exception {
|
public void testSyntax1_295064() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef int TInt;
|
// typedef int TInt;
|
||||||
|
@ -7968,8 +7956,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// };
|
// };
|
||||||
// template <typename T> inline CT<T>::CT(TInt) {}
|
// template <typename T> inline CT<T>::CT(TInt) {}
|
||||||
public void testSyntax2_295064() throws Exception {
|
public void testSyntax2_295064() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// const unsigned int EIGHT= 8;
|
// const unsigned int EIGHT= 8;
|
||||||
|
@ -7986,8 +7973,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// static_assert(sizeof(VMPage) == 1, "bla");
|
// static_assert(sizeof(VMPage) == 1, "bla");
|
||||||
// }
|
// }
|
||||||
public void testStaticAssertions_294730() throws Exception {
|
public void testStaticAssertions_294730() throws Exception {
|
||||||
final String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct A {};
|
// struct A {};
|
||||||
|
@ -8261,7 +8247,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// __typeof(a->x) t7(); // type is const double
|
// __typeof(a->x) t7(); // type is const double
|
||||||
// __typeof((a->x)) t8(); // 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();
|
String code= getAboveComment();
|
||||||
parseAndCheckBindings(code, CPP);
|
parseAndCheckBindings(code, CPP);
|
||||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
|
||||||
|
@ -8284,6 +8270,35 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
assertEquals("const double", ASTTypeUtil.getType(f.getType().getReturnType()));
|
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;
|
// typedef int TInt;
|
||||||
// void test() {
|
// void test() {
|
||||||
// int a1= {}, a2{}; // Initializer for declarator
|
// int a1= {}, a2{}; // Initializer for declarator
|
||||||
|
@ -8313,8 +8328,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// S::S(int a) : f{a} {} // Member initializer
|
// S::S(int a) : f{a} {} // Member initializer
|
||||||
|
|
||||||
public void testInitSyntax_302412() throws Exception {
|
public void testInitSyntax_302412() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace std {
|
// namespace std {
|
||||||
|
@ -8352,8 +8366,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// fs({});
|
// fs({});
|
||||||
// }
|
// }
|
||||||
public void testListInitialization_302412a() throws Exception {
|
public void testListInitialization_302412a() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace std {
|
// namespace std {
|
||||||
|
@ -8724,8 +8737,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// i = p->f(p->xl); // OK
|
// i = p->f(p->xl); // OK
|
||||||
// }
|
// }
|
||||||
public void testScopedEnums_305975e() throws Exception {
|
public void testScopedEnums_305975e() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// enum class altitude { high=1, low=2 };
|
// 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
|
// // f(sizeof(S::m + 1)); // Error not detected by CDT: reference to non-static member in subexpression
|
||||||
// }
|
// }
|
||||||
public void testSizeofOfNonstaticMember_305979() throws Exception {
|
public void testSizeofOfNonstaticMember_305979() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void f(int);
|
// void f(int);
|
||||||
|
@ -8794,16 +8805,14 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// return 42;
|
// return 42;
|
||||||
// }
|
// }
|
||||||
public void testCastToVoid_309155() throws Exception {
|
public void testCastToVoid_309155() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
// void *libHandle (0);
|
// void *libHandle (0);
|
||||||
// }
|
// }
|
||||||
public void testCTorInitializerForVoidPtr_314113() throws Exception {
|
public void testCtorInitializerForVoidPtr_314113() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// struct D {};
|
// struct D {};
|
||||||
|
@ -8967,8 +8976,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// gb(a);
|
// gb(a);
|
||||||
// }
|
// }
|
||||||
public void testInlineNamespace_305980a() throws Exception {
|
public void testInlineNamespace_305980a() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace ns {
|
// namespace ns {
|
||||||
|
@ -8981,8 +8989,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// ns::a;
|
// ns::a;
|
||||||
// }
|
// }
|
||||||
public void testInlineNamespace_305980b() throws Exception {
|
public void testInlineNamespace_305980b() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace out {
|
// namespace out {
|
||||||
|
@ -9068,8 +9075,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
public void testLambdaExpression_316307b() throws Exception {
|
public void testLambdaExpression_316307b() throws Exception {
|
||||||
String code= getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// typedef int MyType;
|
// typedef int MyType;
|
||||||
|
@ -10268,21 +10274,6 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
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>
|
// template <bool>
|
||||||
// struct enable_if {
|
// struct enable_if {
|
||||||
// };
|
// };
|
||||||
|
@ -10461,24 +10452,10 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// __sync_val_compare_and_swap(&i, 1, 2);
|
// __sync_val_compare_and_swap(&i, 1, 2);
|
||||||
// __sync_synchronize();
|
// __sync_synchronize();
|
||||||
// }
|
// }
|
||||||
public void testGNUSyncBuiltins_bug389578() throws Exception {
|
public void testGNUSyncBuiltins_389578() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
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>
|
// template <typename T>
|
||||||
// struct underlying_type {
|
// struct underlying_type {
|
||||||
// typedef __underlying_type(T) 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_int>::type int_type;
|
||||||
// typedef underlying_type<e_ulong>::type ulong_type;
|
// typedef underlying_type<e_ulong>::type ulong_type;
|
||||||
// typedef underlying_type<e_long>::type loong_type;
|
// typedef underlying_type<e_long>::type loong_type;
|
||||||
public void testUnderlyingTypeBuiltin_bug411196() throws Exception {
|
public void testUnderlyingTypeBuiltin_411196() throws Exception {
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
|
|
||||||
assertSameType((ITypedef) helper.assertNonProblem("short1_type"), CPPVisitor.SHORT_TYPE);
|
assertSameType((ITypedef) helper.assertNonProblem("short1_type"), CPPVisitor.SHORT_TYPE);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
package org.eclipse.cdt.internal.pdom.tests;
|
package org.eclipse.cdt.internal.pdom.tests;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
@ -36,7 +35,7 @@ public class DBTest extends BaseTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
db = new Database(getTestDir().append(getName()+System.currentTimeMillis()+".dat").toFile(),
|
db = new Database(getTestDir().append(getName() + System.currentTimeMillis() + ".dat").toFile(),
|
||||||
new ChunkCache(), 0, false);
|
new ChunkCache(), 0, false);
|
||||||
db.setExclusiveLock();
|
db.setExclusiveLock();
|
||||||
}
|
}
|
||||||
|
@ -66,19 +65,19 @@ public class DBTest extends BaseTestCase {
|
||||||
assertEquals(0, db.getVersion());
|
assertEquals(0, db.getVersion());
|
||||||
|
|
||||||
final int realsize = 42;
|
final int realsize = 42;
|
||||||
final int deltas = (realsize+Database.BLOCK_HEADER_SIZE + Database.BLOCK_SIZE_DELTA - 1) / Database.BLOCK_SIZE_DELTA;
|
final int deltas = (realsize + Database.BLOCK_HEADER_SIZE + Database.BLOCK_SIZE_DELTA - 1) / Database.BLOCK_SIZE_DELTA;
|
||||||
final int blocksize = deltas * Database.BLOCK_SIZE_DELTA;
|
final int blocksize = deltas * Database.BLOCK_SIZE_DELTA;
|
||||||
final int freeDeltas= Database.CHUNK_SIZE/Database.BLOCK_SIZE_DELTA-deltas;
|
final int freeDeltas= Database.CHUNK_SIZE / Database.BLOCK_SIZE_DELTA - deltas;
|
||||||
|
|
||||||
long mem = db.malloc(realsize);
|
long mem = db.malloc(realsize);
|
||||||
assertEquals(-blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
|
assertEquals(-blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
|
||||||
db.free(mem);
|
db.free(mem);
|
||||||
assertEquals(blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
|
assertEquals(blocksize, db.getShort(mem - Database.BLOCK_HEADER_SIZE));
|
||||||
assertEquals(mem, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
|
assertEquals(mem, db.getRecPtr((deltas - Database.MIN_BLOCK_DELTAS +1 ) * Database.INT_SIZE));
|
||||||
assertEquals(mem + blocksize, db.getRecPtr((freeDeltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
|
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");
|
File tmp= File.createTempFile("readOnlyEmpty", ".db");
|
||||||
try {
|
try {
|
||||||
tmp.setReadOnly();
|
tmp.setReadOnly();
|
||||||
|
@ -95,7 +94,7 @@ public class DBTest extends BaseTestCase {
|
||||||
try {
|
try {
|
||||||
new Database(tmp, ChunkCache.getSharedInstance(), 0, true);
|
new Database(tmp, ChunkCache.getSharedInstance(), 0, true);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("A readonly file should be readable by a permanently readonly database "+e);
|
fail("A readonly file should be readable by a permanently readonly database " + e);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
tmp.delete(); // this may be pointless on some platforms
|
tmp.delete(); // this may be pointless on some platforms
|
||||||
|
@ -106,13 +105,13 @@ public class DBTest extends BaseTestCase {
|
||||||
final int realsize = 42;
|
final int realsize = 42;
|
||||||
final int deltas = (realsize + Database.BLOCK_HEADER_SIZE + Database.BLOCK_SIZE_DELTA - 1) / Database.BLOCK_SIZE_DELTA;
|
final int deltas = (realsize + Database.BLOCK_HEADER_SIZE + Database.BLOCK_SIZE_DELTA - 1) / Database.BLOCK_SIZE_DELTA;
|
||||||
final int blocksize = deltas * Database.BLOCK_SIZE_DELTA;
|
final int blocksize = deltas * Database.BLOCK_SIZE_DELTA;
|
||||||
final int freeDeltas= Database.MIN_BLOCK_DELTAS-deltas;
|
final int freeDeltas= Database.MIN_BLOCK_DELTAS - deltas;
|
||||||
|
|
||||||
long mem1 = db.malloc(realsize);
|
long mem1 = db.malloc(realsize);
|
||||||
long mem2 = db.malloc(realsize);
|
long mem2 = db.malloc(realsize);
|
||||||
db.free(mem1);
|
db.free(mem1);
|
||||||
db.free(mem2);
|
db.free(mem2);
|
||||||
assertEquals(mem2, db.getRecPtr((deltas-Database.MIN_BLOCK_DELTAS+1) * Database.INT_SIZE));
|
assertEquals(mem2, db.getRecPtr((deltas - Database.MIN_BLOCK_DELTAS + 1) * Database.INT_SIZE));
|
||||||
assertEquals(0, db.getRecPtr(mem2));
|
assertEquals(0, db.getRecPtr(mem2));
|
||||||
assertEquals(mem1, db.getRecPtr(mem2 + Database.INT_SIZE));
|
assertEquals(mem1, db.getRecPtr(mem2 + Database.INT_SIZE));
|
||||||
assertEquals(mem2, db.getRecPtr(mem1));
|
assertEquals(mem2, db.getRecPtr(mem1));
|
||||||
|
@ -249,33 +248,31 @@ public class DBTest extends BaseTestCase {
|
||||||
|
|
||||||
private void doTrials(int n, int min, int max, Random r, boolean caseSensitive) throws CoreException {
|
private void doTrials(int n, int min, int max, Random r, boolean caseSensitive) throws CoreException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
for(int i= 0; i < n; i++) {
|
for (int i= 0; i < n; i++) {
|
||||||
String a = randomString(min, max, r);
|
String a = randomString(min, max, r);
|
||||||
String b = randomString(min, max, r);
|
String b = randomString(min, max, r);
|
||||||
int expected = caseSensitive ? a.compareTo(b) : a.compareToIgnoreCase(b);
|
int expected = caseSensitive ? a.compareTo(b) : a.compareToIgnoreCase(b);
|
||||||
assertCMP(a, expected, b, caseSensitive);
|
assertCMP(a, expected, b, caseSensitive);
|
||||||
}
|
}
|
||||||
// System.out.print("Trials: "+n+" Max length: "+max+" ignoreCase: "+!caseSensitive);
|
// System.out.print("Trials: " + n + " Max length: " + max + " ignoreCase: " + !caseSensitive);
|
||||||
// System.out.println(" Time: "+(System.currentTimeMillis()-start));
|
// System.out.println(" Time: " + (System.currentTimeMillis() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String randomString(int min, int max, Random r) {
|
private String randomString(int min, int max, Random r) {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuilder result = new StringBuilder();
|
||||||
int len = min + r.nextInt(max-min);
|
int len = min + r.nextInt(max - min);
|
||||||
for(int i= 0; i < len; i++) {
|
for (int i= 0; i < len; i++) {
|
||||||
result.append(randomChar(r));
|
result.append(randomChar(r));
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private char randomChar(Random r) {
|
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));
|
return (char) (32 + r.nextInt(40));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertCMP(String a, int expected, String b, boolean caseSensitive)
|
private void assertCMP(String a, int expected, String b, boolean caseSensitive) throws CoreException {
|
||||||
throws CoreException
|
|
||||||
{
|
|
||||||
char[] acs = a.toCharArray();
|
char[] acs = a.toCharArray();
|
||||||
char[] bcs = b.toCharArray();
|
char[] bcs = b.toCharArray();
|
||||||
IString aiss = db.newString(a);
|
IString aiss = db.newString(a);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProbl
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parser Semantic Problems
|
* 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 final static int SEMANTIC_NAME_NOT_FOUND = BINDING_NOT_FOUND;
|
||||||
public static final int SEMANTIC_INVALID_OVERLOAD = BINDING_INVALID_OVERLOAD;
|
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_CANNOT_DEDUCE_AUTO_TYPE = 10003;
|
||||||
int TYPE_UNKNOWN_FOR_EXPRESSION = 10004;
|
int TYPE_UNKNOWN_FOR_EXPRESSION = 10004;
|
||||||
int TYPE_NOT_PERSISTED = 10005;
|
int TYPE_NOT_PERSISTED = 10005;
|
||||||
/**
|
/** @since 5.6 */
|
||||||
* @since 5.6
|
|
||||||
*/
|
|
||||||
int TYPE_ENUMERATION_EXPECTED = 10006;
|
int TYPE_ENUMERATION_EXPECTED = 10006;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class Value implements IValue {
|
||||||
* Creates a value representing the given number.
|
* Creates a value representing the given number.
|
||||||
*/
|
*/
|
||||||
public static IValue create(long value) {
|
public static IValue create(long value) {
|
||||||
if (value >=0 && value < TYPICAL.length)
|
if (value >= 0 && value < TYPICAL.length)
|
||||||
return TYPICAL[(int) value];
|
return TYPICAL[(int) value];
|
||||||
return new Value(toCharArray(value), null);
|
return new Value(toCharArray(value), null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* Unqualified name, also base class for operator and conversion name.
|
||||||
*/
|
*/
|
||||||
public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionContext {
|
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;
|
private char[] name;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
||||||
if (fDeclarations == null || fDeclarations.length == 0) {
|
if (fDeclarations == null || fDeclarations.length == 0) {
|
||||||
fDeclarations = new IASTName[] { name };
|
fDeclarations = new IASTName[] { name };
|
||||||
} else {
|
} else {
|
||||||
if (isDeclaredBefore((ASTNode)node, (ASTNode)fDeclarations[0])) {
|
if (isDeclaredBefore((ASTNode) node, (ASTNode) fDeclarations[0])) {
|
||||||
fDeclarations = ArrayUtil.prepend(IASTName.class, fDeclarations, name);
|
fDeclarations = ArrayUtil.prepend(IASTName.class, fDeclarations, name);
|
||||||
} else {
|
} else {
|
||||||
fDeclarations = ArrayUtil.append(IASTName.class, fDeclarations, name);
|
fDeclarations = ArrayUtil.append(IASTName.class, fDeclarations, name);
|
||||||
|
@ -227,7 +227,7 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
||||||
IASTNode parent = fDeclarations[i].getParent();
|
IASTNode parent = fDeclarations[i].getParent();
|
||||||
while (parent.getPropertyInParent() == IASTDeclarator.NESTED_DECLARATOR)
|
while (parent.getPropertyInParent() == IASTDeclarator.NESTED_DECLARATOR)
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
IASTInitializer init = ((IASTDeclarator)parent).getInitializer();
|
IASTInitializer init = ((IASTDeclarator) parent).getInitializer();
|
||||||
if (init != null)
|
if (init != null)
|
||||||
return init;
|
return init;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding resolveFinalBinding(CPPASTNameBase name) {
|
public IBinding resolveFinalBinding(CPPASTNameBase name) {
|
||||||
// check if the binding has been updated.
|
// Check if the binding has been updated.
|
||||||
IBinding current= name.getPreBinding();
|
IBinding current= name.getPreBinding();
|
||||||
if (current != this)
|
if (current != this)
|
||||||
return current;
|
return current;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
||||||
fDeclarations = new IASTName[] { name };
|
fDeclarations = new IASTName[] { name };
|
||||||
}
|
}
|
||||||
|
|
||||||
// built-in variables supply a null
|
// Built-in variables supply a null.
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
name.setBinding(this);
|
name.setBinding(this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,7 +97,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
||||||
} else if (fDeclarations == null) {
|
} else if (fDeclarations == null) {
|
||||||
fDeclarations = new IASTName[] { name };
|
fDeclarations = new IASTName[] { name };
|
||||||
} else {
|
} else {
|
||||||
// keep the lowest offset declaration at the first position
|
// Keep the lowest offset declaration at the first position.
|
||||||
if (fDeclarations.length > 0
|
if (fDeclarations.length > 0
|
||||||
&& ((ASTNode) node).getOffset() < ((ASTNode) fDeclarations[0]).getOffset()) {
|
&& ((ASTNode) node).getOffset() < ((ASTNode) fDeclarations[0]).getOffset()) {
|
||||||
fDeclarations = ArrayUtil.prepend(IASTName.class, fDeclarations, name);
|
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);
|
fDeclarations = ArrayUtil.append(IASTName.class, fDeclarations, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// array types may be incomplete
|
// Array types may be incomplete.
|
||||||
if (fType instanceof IArrayType) {
|
if (fType instanceof IArrayType) {
|
||||||
fType = null;
|
fType = null;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,15 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
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 {
|
public interface ICPPInternalBinding extends ICPPBinding {
|
||||||
|
|
||||||
IASTNode getDefinition();
|
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();
|
IASTNode[] getDeclarations();
|
||||||
|
|
||||||
void addDefinition(IASTNode node);
|
void addDefinition(IASTNode node);
|
||||||
void addDeclaration(IASTNode node);
|
void addDeclaration(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) {
|
private static IType getDeclType(ICPPASTSimpleDeclSpecifier spec) {
|
||||||
IASTExpression expr = spec.getDeclTypeExpression();
|
IASTExpression expr = spec.getDeclTypeExpression();
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class LongString implements IString {
|
||||||
|
|
||||||
// Write last record
|
// Write last record
|
||||||
int remaining= length - start;
|
int remaining= length - start;
|
||||||
long nextRecord = db.malloc(CHARSN + (useBytes ? remaining : remaining*2));
|
long nextRecord = db.malloc(CHARSN + (useBytes ? remaining : remaining * 2));
|
||||||
db.putRecPtr(lastNext, nextRecord);
|
db.putRecPtr(lastNext, nextRecord);
|
||||||
chunk= db.getChunk(nextRecord);
|
chunk= db.getChunk(nextRecord);
|
||||||
if (useBytes) {
|
if (useBytes) {
|
||||||
|
@ -125,7 +125,7 @@ public class LongString implements IString {
|
||||||
// Other records
|
// Other records
|
||||||
while (start < length) {
|
while (start < length) {
|
||||||
p = db.getRecPtr(p);
|
p = db.getRecPtr(p);
|
||||||
int partLen= Math.min(length-start, numCharsn);
|
int partLen= Math.min(length - start, numCharsn);
|
||||||
chunk= db.getChunk(p);
|
chunk= db.getChunk(p);
|
||||||
if (useBytes) {
|
if (useBytes) {
|
||||||
chunk.getCharsFromBytes(p + CHARSN, chars, start, partLen);
|
chunk.getCharsFromBytes(p + CHARSN, chars, start, partLen);
|
||||||
|
|
Loading…
Add table
Reference in a new issue