diff --git a/build/org.eclipse.cdt.autotools-feature/feature.xml b/build/org.eclipse.cdt.autotools-feature/feature.xml
index 142c15f11cf..017514b9975 100644
--- a/build/org.eclipse.cdt.autotools-feature/feature.xml
+++ b/build/org.eclipse.cdt.autotools-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
diff --git a/build/org.eclipse.cdt.autotools-feature/p2.inf b/build/org.eclipse.cdt.autotools-feature/p2.inf
index 73fc9f2d12e..720696ace2a 100644
--- a/build/org.eclipse.cdt.autotools-feature/p2.inf
+++ b/build/org.eclipse.cdt.autotools-feature/p2.inf
@@ -4,5 +4,5 @@ provides.99.namespace=org.eclipse.equinox.p2.iu
provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group
provides.99.version=$version$
instructions.configure=\
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:0,name:CDT,enabled:false); \
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:1,name:CDT,enabled:false);
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:0,name:CDT,enabled:false); \
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:1,name:CDT,enabled:false);
diff --git a/build/org.eclipse.cdt.autotools.source-feature/feature.xml b/build/org.eclipse.cdt.autotools.source-feature/feature.xml
index 62f5daa388f..eb233097564 100644
--- a/build/org.eclipse.cdt.autotools.source-feature/feature.xml
+++ b/build/org.eclipse.cdt.autotools.source-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
entries = new ArrayList();
+ entries.add(new CIncludePathEntry("path0", 0));
+ entries.add(new CMacroEntry("MACRO0", "value0",0));
+ entries.add(new CIncludePathEntry("path1", 0));
+ entries.add(new CMacroEntry("MACRO1", "value1",0));
+ entries.add(new CIncludePathEntry("path2", 0));
+
+ entries.add(new CIncludeFileEntry("include-path-file", 0));
+
+ ILanguageSettingsProvider provider0 = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, entries);
+ List providers = new ArrayList();
+ providers.add(provider0);
+ cfgDescription.setLanguageSettingProviders(providers);
+
+ // retrieve entries by kind
+ List result = LanguageSettingsProvidersSerializer
+ .getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO);
+ assertEquals(new CIncludePathEntry("path0", 0), result.get(0));
+ assertEquals(new CMacroEntry("MACRO0", "value0",0), result.get(1));
+ assertEquals(new CIncludePathEntry("path1", 0), result.get(2));
+ assertEquals(new CMacroEntry("MACRO1", "value1",0), result.get(3));
+ assertEquals(new CIncludePathEntry("path2", 0), result.get(4));
+ assertEquals(5, result.size());
+ }
+
/**
* Test ability to serialize providers for a configuration.
*/
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 506f6a13c0f..af797d32842 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -732,7 +732,7 @@ public class AST2CPPTests extends AST2BaseTest {
// class A a;
// }
public void testNameHiding() throws Exception {
- String content= getAboveComment();
+ String content= getAboveComment();
IASTTranslationUnit tu = parse(content, ParserLanguage.CPP);
CPPNameCollector collector = new CPPNameCollector();
@@ -1039,13 +1039,13 @@ public class AST2CPPTests extends AST2BaseTest {
IFunction f = (IFunction) decl.getDeclarators()[0].getName().resolveBinding();
decl = (IASTSimpleDeclaration) tu.getDeclarations()[2];
- IVariable g = (IVariable) decl.getDeclarators()[0]
- .getNestedDeclarator().getName().resolveBinding();
+ IVariable g =
+ (IVariable) decl.getDeclarators()[0].getNestedDeclarator().getName().resolveBinding();
decl = (IASTSimpleDeclaration) tu.getDeclarations()[3];
- IVariable h = (IVariable) decl.getDeclarators()[0]
- .getNestedDeclarator().getNestedDeclarator().getName()
- .resolveBinding();
+ IVariable h =
+ (IVariable) decl.getDeclarators()[0].getNestedDeclarator().getNestedDeclarator()
+ .getName().resolveBinding();
IFunctionType t_f = f.getType();
IType t_f_return = t_f.getReturnType();
@@ -3538,7 +3538,7 @@ public class AST2CPPTests extends AST2BaseTest {
// B () : A() {}
// };
public void testBug89539() throws Exception {
- String content= getAboveComment();
+ String content= getAboveComment();
IASTTranslationUnit tu = parse(content, ParserLanguage.CPP);
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
@@ -4728,7 +4728,7 @@ public class AST2CPPTests extends AST2BaseTest {
// auto s2 = s1 += "";
// auto s3 = s2.append("foo");
// }
- public void testTypedefPreservation_380498_1() throws Exception {
+ public void testTypedefPreservation_380498_1() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s1 = ba.assertNonProblem("s1", ICPPVariable.class);
assertTrue(s1.getType() instanceof ITypedef);
@@ -4741,20 +4741,63 @@ public class AST2CPPTests extends AST2BaseTest {
assertEquals("string", ((ITypedef) s3.getType()).getName());
}
- // template
- // struct vector {
- // typedef T* const_iterator;
- // const_iterator begin() const;
- // };
- //
- // void test(const vector& v) {
+ // template
+ // struct vector {
+ // typedef T* const_iterator;
+ // const_iterator begin() const;
+ // };
+ //
+ // typedef int Element;
+ //
+ // void test(const vector& v) {
// auto it = v.begin();
// }
- public void testTypedefPreservation_380498_2() throws Exception {
+ public void testTypedefPreservation_380498_2() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class);
assertTrue(it.getType() instanceof ITypedef);
- assertEquals("vector::const_iterator", ASTTypeUtil.getType(it.getType(), false));
+ assertEquals("vector::const_iterator", ASTTypeUtil.getType(it.getType(), false));
+ }
+
+ // template class char_traits {};
+ // template > class basic_string {};
+ //
+ // template
+ // struct iterator_traits {
+ // typedef typename _Iterator::reference reference;
+ // };
+ //
+ // template
+ // struct iterator_traits<_Tp*> {
+ // typedef _Tp& reference;
+ // };
+ //
+ // template
+ // struct normal_iterator {
+ // typedef iterator_traits<_Iterator> traits_type;
+ // typedef typename traits_type::reference reference;
+ // reference operator*() const;
+ // };
+ //
+ // template struct vector {
+ // typedef T* pointer;
+ // typedef normal_iterator iterator;
+ // iterator begin();
+ // iterator end();
+ // };
+ //
+ // typedef basic_string string;
+ //
+ // void test() {
+ // vector v;
+ // for (auto s : v) {
+ // }
+ // }
+ public void testTypedefPreservation_380498_3() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class);
+ assertTrue(s.getType() instanceof ITypedef);
+ assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
}
// int f() {
@@ -5032,7 +5075,7 @@ public class AST2CPPTests extends AST2BaseTest {
// f1(__null);
// }
public void testBug240567() throws Exception {
- BindingAssertionHelper bh= getAssertionHelper();
+ BindingAssertionHelper bh= getAssertionHelper();
bh.assertNonProblem("f1(__null", 2, ICPPFunction.class);
}
@@ -5230,31 +5273,31 @@ public class AST2CPPTests extends AST2BaseTest {
assertEquals(body.getStatements().length, 3);
}
- public void testBug107150() throws Exception {
- StringBuffer buffer = new StringBuffer();
- buffer.append("#define FUNC_PROTOTYPE_PARAMS(list) list\r\n"); //$NON-NLS-1$
- buffer.append("int func1 FUNC_PROTOTYPE_PARAMS((int arg1)){\r\n"); //$NON-NLS-1$
- buffer.append("return 0;\r\n"); //$NON-NLS-1$
- buffer.append("}\r\n"); //$NON-NLS-1$
- buffer.append("int func2 FUNC_PROTOTYPE_PARAMS\r\n"); //$NON-NLS-1$
- buffer.append("((int arg1)){\r\n"); //$NON-NLS-1$
- buffer.append("return 0;\r\n"); //$NON-NLS-1$
- buffer.append("}\r\n"); //$NON-NLS-1$
- IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
- assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration);
+ public void testBug107150() throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("#define FUNC_PROTOTYPE_PARAMS(list) list\r\n"); //$NON-NLS-1$
+ buffer.append("int func1 FUNC_PROTOTYPE_PARAMS((int arg1)){\r\n"); //$NON-NLS-1$
+ buffer.append("return 0;\r\n"); //$NON-NLS-1$
+ buffer.append("}\r\n"); //$NON-NLS-1$
+ buffer.append("int func2 FUNC_PROTOTYPE_PARAMS\r\n"); //$NON-NLS-1$
+ buffer.append("((int arg1)){\r\n"); //$NON-NLS-1$
+ buffer.append("return 0;\r\n"); //$NON-NLS-1$
+ buffer.append("}\r\n"); //$NON-NLS-1$
+ IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
+ assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration);
- buffer = new StringBuffer();
- buffer.append("#define FUNC_PROTOTYPE_PARAMS(list) list\n"); //$NON-NLS-1$
- buffer.append("int func1 FUNC_PROTOTYPE_PARAMS((int arg1)){\n"); //$NON-NLS-1$
- buffer.append("return 0;\n"); //$NON-NLS-1$
- buffer.append("}\n"); //$NON-NLS-1$
- buffer.append("int func2 FUNC_PROTOTYPE_PARAMS\n"); //$NON-NLS-1$
- buffer.append("((int arg1)){\n"); //$NON-NLS-1$
- buffer.append("return 0;\n"); //$NON-NLS-1$
- buffer.append("}\n"); //$NON-NLS-1$
- tu = parse(buffer.toString(), ParserLanguage.CPP);
- assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration);
- }
+ buffer = new StringBuffer();
+ buffer.append("#define FUNC_PROTOTYPE_PARAMS(list) list\n"); //$NON-NLS-1$
+ buffer.append("int func1 FUNC_PROTOTYPE_PARAMS((int arg1)){\n"); //$NON-NLS-1$
+ buffer.append("return 0;\n"); //$NON-NLS-1$
+ buffer.append("}\n"); //$NON-NLS-1$
+ buffer.append("int func2 FUNC_PROTOTYPE_PARAMS\n"); //$NON-NLS-1$
+ buffer.append("((int arg1)){\n"); //$NON-NLS-1$
+ buffer.append("return 0;\n"); //$NON-NLS-1$
+ buffer.append("}\n"); //$NON-NLS-1$
+ tu = parse(buffer.toString(), ParserLanguage.CPP);
+ assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration);
+ }
// class __attribute__((visibility("default"))) FooClass
// {
@@ -5879,43 +5922,43 @@ public class AST2CPPTests extends AST2BaseTest {
checkNewExpression(fdef, 15, IASTIdExpression.class, "int [][]", null);
}
- // namespace ns {
- // void test() {}
- // +
- // }
- public void testTrailingSyntaxErrorInNamespace() throws Exception {
- final String comment= getAboveComment();
- IASTTranslationUnit tu= parse(comment, ParserLanguage.CPP, false, false);
- ICPPASTNamespaceDefinition ns= getDeclaration(tu, 0);
+ // namespace ns {
+ // void test() {}
+ // +
+ // }
+ public void testTrailingSyntaxErrorInNamespace() throws Exception {
+ final String comment= getAboveComment();
+ IASTTranslationUnit tu= parse(comment, ParserLanguage.CPP, false, false);
+ ICPPASTNamespaceDefinition ns= getDeclaration(tu, 0);
IASTDeclaration decl= getDeclaration(ns, 0);
IASTProblemDeclaration pdecl= getDeclaration(ns, 1);
assertEquals("+", pdecl.getRawSignature());
- }
+ }
- // extern "C" {
- // void test() {}
- // +
- // }
- public void testTrailingSyntaxErrorInLinkageSpec() throws Exception {
- final String comment= getAboveComment();
- IASTTranslationUnit tu= parse(comment, ParserLanguage.CPP, false, false);
- ICPPASTLinkageSpecification ls= getDeclaration(tu, 0);
+ // extern "C" {
+ // void test() {}
+ // +
+ // }
+ public void testTrailingSyntaxErrorInLinkageSpec() throws Exception {
+ final String comment= getAboveComment();
+ IASTTranslationUnit tu= parse(comment, ParserLanguage.CPP, false, false);
+ ICPPASTLinkageSpecification ls= getDeclaration(tu, 0);
IASTDeclaration decl= getDeclaration(ls, 0);
IASTProblemDeclaration pdecl= getDeclaration(ls, 1);
assertEquals("+", pdecl.getRawSignature());
- }
+ }
- // class C;
- // void func(void (C::*m)(int) const);
- public void test233889_a() throws Exception {
- BindingAssertionHelper bh= getAssertionHelper();
+ // class C;
+ // void func(void (C::*m)(int) const);
+ public void test233889_a() throws Exception {
+ BindingAssertionHelper bh= getAssertionHelper();
ICPPFunction func= bh.assertNonProblem("func(", 4, ICPPFunction.class);
assertEquals(1,func.getParameters().length);
IType type= func.getParameters()[0].getType();
ICPPPointerToMemberType ptm= assertInstance(type, ICPPPointerToMemberType.class);
ICPPFunctionType t= ((ICPPFunctionType)ptm.getType());
assertTrue(t.isConst());
- }
+ }
// struct C {
// int m1(int a);
@@ -5929,14 +5972,14 @@ public class AST2CPPTests extends AST2BaseTest {
// func(&C::m1);
// func(&C::m2);
// }
- public void testBug233889_b() throws Exception {
+ public void testBug233889_b() throws Exception {
BindingAssertionHelper bh= getAssertionHelper();
ICPPFunction fn1= bh.assertNonProblem("func(&C::m1", 4, ICPPFunction.class);
ICPPFunction fn2= bh.assertNonProblem("func(&C::m2", 4, ICPPFunction.class);
assertNotSame(fn1, fn2);
- }
+ }
- // class A;
+ // class A;
//
// void foo(A* a) {}
// void foo(const A* a) {}
@@ -6274,29 +6317,29 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(ors[0], m1);
}
- // struct A {
- // int a;
- // };
- //
- // void test(A* p) {
- // p.a; // should not resolve
- // }
- public void testPointerMemberAccess_245068() throws Exception {
- final String comment= getAboveComment();
- final boolean[] isCpps= {false, true};
- for (boolean isCpp : isCpps) {
- BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
- ba.assertProblem("a; // should not resolve", 1);
- }
- }
+ // struct A {
+ // int a;
+ // };
+ //
+ // void test(A* p) {
+ // p.a; // should not resolve
+ // }
+ public void testPointerMemberAccess_245068() throws Exception {
+ final String comment= getAboveComment();
+ final boolean[] isCpps= {false, true};
+ for (boolean isCpp : isCpps) {
+ BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
+ ba.assertProblem("a; // should not resolve", 1);
+ }
+ }
- // namespace ns {
- // template class CT {};
- // }
- // using ns::CT;
- public void testTemplateIdInUsingDecl_251199() throws Exception {
- parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
- }
+ // namespace ns {
+ // template class CT {};
+ // }
+ // using ns::CT;
+ public void testTemplateIdInUsingDecl_251199() throws Exception {
+ parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
+ }
// namespace ns {
// struct A {};
@@ -6309,7 +6352,7 @@ public class AST2CPPTests extends AST2BaseTest {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
bh.assertNonProblem("operator ns::A", 14);
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// void f();
@@ -6317,24 +6360,24 @@ public class AST2CPPTests extends AST2BaseTest {
// void test(int p) {
// f(p);
// }
- public void testFunctionExtraArgument() throws Exception {
+ public void testFunctionExtraArgument() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ba.assertProblem("f(p)", 1);
- }
+ }
- // void f(...);
+ // void f(...);
//
// void test(int* p) {
// f(p);
// }
- public void testVariadicFunction_2500582() throws Exception {
- final String comment= getAboveComment();
- final boolean[] isCpps= {false, true};
- for (boolean isCpp : isCpps) {
- BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
- ba.assertNonProblem("f(p)", 1, IFunction.class);
- }
- }
+ public void testVariadicFunction_2500582() throws Exception {
+ final String comment= getAboveComment();
+ final boolean[] isCpps= {false, true};
+ for (boolean isCpp : isCpps) {
+ BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
+ ba.assertNonProblem("f(p)", 1, IFunction.class);
+ }
+ }
// struct Incomplete;
//
@@ -6345,29 +6388,29 @@ public class AST2CPPTests extends AST2BaseTest {
// // Should resolve to f(Incomplete*) since 0 can be converted to Incomplete*
// f(0);
// }
- public void testVariadicFunction_2500583() throws Exception {
- final String comment= getAboveComment();
- final boolean[] isCpps= {false, true};
- for (boolean isCpp : isCpps) {
- BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
- IFunction decl= ba.assertNonProblem("f(Incomplete* p)", 1, IFunction.class);
- IFunction func= ba.assertNonProblem("f(0)", 1, IFunction.class);
- assertSame(decl, func);
- }
- }
+ public void testVariadicFunction_2500583() throws Exception {
+ final String comment= getAboveComment();
+ final boolean[] isCpps= {false, true};
+ for (boolean isCpp : isCpps) {
+ BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp);
+ IFunction decl= ba.assertNonProblem("f(Incomplete* p)", 1, IFunction.class);
+ IFunction func= ba.assertNonProblem("f(0)", 1, IFunction.class);
+ assertSame(decl, func);
+ }
+ }
- // class MyClass{
- // public:
- // int v;
- // int& operator () (int i){ return v; }
- // int& operator () (int i, int j){ return v; }
- // };
- //
- // int main(MyClass c, int i){
- // c(i,i)= 0;
- // c(i) = 0;
- // }
- public void testFunctionCallOnLHS_252695() throws Exception {
+ // class MyClass{
+ // public:
+ // int v;
+ // int& operator () (int i){ return v; }
+ // int& operator () (int i, int j){ return v; }
+ // };
+ //
+ // int main(MyClass c, int i){
+ // c(i,i)= 0;
+ // c(i) = 0;
+ // }
+ public void testFunctionCallOnLHS_252695() throws Exception {
final String code = getAboveComment();
IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP, true);
IASTFunctionDefinition fdef= getDeclaration(tu, 1);
@@ -6375,15 +6418,15 @@ public class AST2CPPTests extends AST2BaseTest {
assertInstance(exstmt.getExpression(), IASTBinaryExpression.class);
exstmt= getStatement(fdef, 1);
assertInstance(exstmt.getExpression(), IASTBinaryExpression.class);
- }
+ }
- // template class A;
- // class A {};
- // class A;
- // class B;
- // template class B;
- // template class B {};
- public void testInvalidClassRedeclaration_254961() throws Exception {
+ // template class A;
+ // class A {};
+ // class A;
+ // class B;
+ // template class B;
+ // template class B {};
+ public void testInvalidClassRedeclaration_254961() throws Exception {
final String code = getAboveComment();
IASTTranslationUnit tu= parse(code, ParserLanguage.CPP, true, false);
CPPNameCollector nc= new CPPNameCollector();
@@ -6393,15 +6436,15 @@ public class AST2CPPTests extends AST2BaseTest {
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDECLARATION, nc.getName(3).resolveBinding());
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDECLARATION, nc.getName(6).resolveBinding());
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDEFINITION, nc.getName(8).resolveBinding());
- }
+ }
- // template class A;
- // template class T> class A {};
- // template class T> class A;
- // template class T> class B {};
- // template class B;
- // template class B {};
- public void testInvalidClassRedeclaration_364226() throws Exception {
+ // template class A;
+ // template class T> class A {};
+ // template class T> class A;
+ // template class T> class B {};
+ // template class B;
+ // template class B {};
+ public void testInvalidClassRedeclaration_364226() throws Exception {
final String code = getAboveComment();
IASTTranslationUnit tu= parse(code, ParserLanguage.CPP, true, false);
CPPNameCollector nc= new CPPNameCollector();
@@ -6411,56 +6454,56 @@ public class AST2CPPTests extends AST2BaseTest {
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDECLARATION, nc.getName(7).resolveBinding());
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDECLARATION, nc.getName(12).resolveBinding());
assertProblemBinding(IProblemBinding.SEMANTIC_INVALID_REDEFINITION, nc.getName(14).resolveBinding());
- }
+ }
- // struct Foo {
- // void foo();
- // };
- // void Foo::foo(void) {
- // }
- public void testVoidParamInDefinition_257376() throws Exception {
- parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
- }
+ // struct Foo {
+ // void foo();
+ // };
+ // void Foo::foo(void) {
+ // }
+ public void testVoidParamInDefinition_257376() throws Exception {
+ parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
+ }
- // namespace ns {
- // struct C {
- // C(C* c){}
- // };
- // int a;
- // }
- // struct C {
- // C(ns::C*){}
- // };
- // void testbla() {
- // ns::C* cptr= 0;
- // C c= C(cptr);
- // }
- public void testNoKoenigForConstructors() throws Exception {
- parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
- }
+ // namespace ns {
+ // struct C {
+ // C(C* c){}
+ // };
+ // int a;
+ // }
+ // struct C {
+ // C(ns::C*){}
+ // };
+ // void testbla() {
+ // ns::C* cptr= 0;
+ // C c= C(cptr);
+ // }
+ public void testNoKoenigForConstructors() throws Exception {
+ parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
+ }
- // typedef void VOID;
- // void donothing();
- // void donothing(VOID){}
- // void donothing(VOID);
- // void test() {
- // donothing();
- // }
- public void testVoidViaTypedef_Bug258694() throws Exception {
- parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
- }
+ // typedef void VOID;
+ // void donothing();
+ // void donothing(VOID){}
+ // void donothing(VOID);
+ // void test() {
+ // donothing();
+ // }
+ public void testVoidViaTypedef_Bug258694() throws Exception {
+ parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
+ }
// struct A {
// B method(B p, int& a = y) { // B is not defined
// B b;
- // int x = y + 1;
- // return b;
+ // int x = y + 1;
+ // return b;
// }
// struct B {};
- // static int& x = y; // y is not defined
- // int y;
+ // static int& x = y; // y is not defined
+ // int y;
// };
- public void testScopeOfClassMember_259460() throws Exception {
+ public void testScopeOfClassMember_259460() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ba.assertNonProblem("B b", 1, ICPPClassType.class);
ba.assertProblem("B p", 1);
@@ -6468,23 +6511,23 @@ public class AST2CPPTests extends AST2BaseTest {
ba.assertNonProblem("y + 1;", 1, ICPPField.class);
ba.assertNonProblem("y) {", 1, ICPPField.class);
ba.assertProblem("y; // y is not defined", 1);
- }
+ }
// class A {
// int method(int a = GREEN) {
// return RED;
// }
- // static int x = GREEN; // GREEN is not defined
+ // static int x = GREEN; // GREEN is not defined
// enum Color {
// RED, GREEN
// };
// };
- public void testScopeOfClassMember_259648() throws Exception {
+ public void testScopeOfClassMember_259648() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ba.assertNonProblem("GREEN)", 5, IEnumerator.class);
ba.assertNonProblem("RED;", 3, IEnumerator.class);
ba.assertProblem("GREEN;", 5);
- }
+ }
// struct A {
// int& operator*();
@@ -6519,66 +6562,66 @@ public class AST2CPPTests extends AST2BaseTest {
parseAndCheckBindings(code);
}
- // struct A {
- // int a;
- // };
- //
- // struct B {
- // A operator-(B b);
- // A operator+(B& b);
- // A operator*(const B& b);
- // A operator/(B b) const;
- // A operator%(const B& b) const;
- // };
- //
- // void test(B p1, B p2) {
- // (p1 - p2).a; //1
- // (p1 + p2).a; //2
- // (p1 * p2).a; //3
- // (p1 / p2).a; //4
- // (p1 % p2).a; //5
- // }
- public void testOverloadedBinaryOperator_259927_1() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("a; //1", 1, ICPPField.class);
- ba.assertNonProblem("a; //2", 1, ICPPField.class);
- ba.assertNonProblem("a; //3", 1, ICPPField.class);
- ba.assertNonProblem("a; //4", 1, ICPPField.class);
- ba.assertNonProblem("a; //5", 1, ICPPField.class);
- }
+ // struct A {
+ // int a;
+ // };
+ //
+ // struct B {
+ // A operator-(B b);
+ // A operator+(B& b);
+ // A operator*(const B& b);
+ // A operator/(B b) const;
+ // A operator%(const B& b) const;
+ // };
+ //
+ // void test(B p1, B p2) {
+ // (p1 - p2).a; //1
+ // (p1 + p2).a; //2
+ // (p1 * p2).a; //3
+ // (p1 / p2).a; //4
+ // (p1 % p2).a; //5
+ // }
+ public void testOverloadedBinaryOperator_259927_1() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ba.assertNonProblem("a; //1", 1, ICPPField.class);
+ ba.assertNonProblem("a; //2", 1, ICPPField.class);
+ ba.assertNonProblem("a; //3", 1, ICPPField.class);
+ ba.assertNonProblem("a; //4", 1, ICPPField.class);
+ ba.assertNonProblem("a; //5", 1, ICPPField.class);
+ }
- // struct A {
- // int a;
- // };
- // struct B {};
- // enum E { zero };
- //
- // A operator-(B p1, int p2);
- // A operator+(int p1, const B& p2);
- // A operator*(E p1, int p2);
- // A operator/(int p1, const E& p2);
- // A operator%(const B& p1, const B& p2);
- //
- // void test(B b, E e, int i) {
- // (b - i).a; //1
- // (i + b).a; //2
- // (e * i).a; //3
- // (i / e).a; //4
- // (b % b).a; //5
- // (b + i).a; //6
- // }
- public void testOverloadedBinaryOperator_259927_2() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("a; //1", 1, ICPPField.class);
- ba.assertNonProblem("a; //2", 1, ICPPField.class);
- ba.assertNonProblem("a; //3", 1, ICPPField.class);
- ba.assertNonProblem("a; //4", 1, ICPPField.class);
- ba.assertNonProblem("a; //5", 1, ICPPField.class);
- ba.assertProblem("a; //6", 1);
- }
+ // struct A {
+ // int a;
+ // };
+ // struct B {};
+ // enum E { zero };
+ //
+ // A operator-(B p1, int p2);
+ // A operator+(int p1, const B& p2);
+ // A operator*(E p1, int p2);
+ // A operator/(int p1, const E& p2);
+ // A operator%(const B& p1, const B& p2);
+ //
+ // void test(B b, E e, int i) {
+ // (b - i).a; //1
+ // (i + b).a; //2
+ // (e * i).a; //3
+ // (i / e).a; //4
+ // (b % b).a; //5
+ // (b + i).a; //6
+ // }
+ public void testOverloadedBinaryOperator_259927_2() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ba.assertNonProblem("a; //1", 1, ICPPField.class);
+ ba.assertNonProblem("a; //2", 1, ICPPField.class);
+ ba.assertNonProblem("a; //3", 1, ICPPField.class);
+ ba.assertNonProblem("a; //4", 1, ICPPField.class);
+ ba.assertNonProblem("a; //5", 1, ICPPField.class);
+ ba.assertProblem("a; //6", 1);
+ }
- // struct A {
+ // struct A {
// int x;
// };
//
@@ -6591,29 +6634,29 @@ public class AST2CPPTests extends AST2BaseTest {
// (p1++).x; //1
// (++p1).x; //2
// }
- public void testOverloadedUnaryOperator_259927_3() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("x; //1", 1, ICPPField.class);
- ba.assertNonProblem("x; //2", 1, ICPPField.class);
- }
+ public void testOverloadedUnaryOperator_259927_3() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ba.assertNonProblem("x; //1", 1, ICPPField.class);
+ ba.assertNonProblem("x; //2", 1, ICPPField.class);
+ }
// struct A {
// int x;
// };
// struct B { };
- // A& operator++(B); // prefix
+ // A& operator++(B); // prefix
// A operator++(B, int); // postfix
//
// void test(B p1, B p2) {
// (p1++).x; //1
// (++p1).x; //2
// }
- public void testOverloadedUnaryOperator_259927_4() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("x; //1", 1, ICPPField.class);
- ba.assertNonProblem("x; //2", 1, ICPPField.class);
- }
+ public void testOverloadedUnaryOperator_259927_4() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ba.assertNonProblem("x; //1", 1, ICPPField.class);
+ ba.assertNonProblem("x; //2", 1, ICPPField.class);
+ }
// struct A {
@@ -6640,11 +6683,11 @@ public class AST2CPPTests extends AST2BaseTest {
// (!b).xx; // 5
// (~b).xx; // 6
// }
- public void testOverloadedUnaryOperator_259927_5() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- for(int i = 1; i <=6; i++)
- ba.assertNonProblem("xx; // "+i, 2, ICPPField.class);
- }
+ public void testOverloadedUnaryOperator_259927_5() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ for(int i = 1; i <=6; i++)
+ ba.assertNonProblem("xx; // "+i, 2, ICPPField.class);
+ }
// struct A {
// int xx;
@@ -6671,56 +6714,56 @@ public class AST2CPPTests extends AST2BaseTest {
// (!b).xx; // 5
// (~b).xx; // 6
//}
- public void testOverloadedUnaryOperator_259927_6() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- for(int i = 1; i <=6; i++)
- ba.assertNonProblem("xx; // "+i, 2, ICPPField.class);
- }
+ public void testOverloadedUnaryOperator_259927_6() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ for(int i = 1; i <=6; i++)
+ ba.assertNonProblem("xx; // "+i, 2, ICPPField.class);
+ }
- // int a,b,c,d ;
- // class X {
- // void m() {
- // T* a;
- // I* b;
- // S1* c;
- // S2* d;
- // }
- // typedef int T;
- // int I;
- // typedef int S1 (int(T)); // resolve this ambiguity first
- // typedef int S2 (int(t)); // resolve this ambiguity first
- // };
- public void testOrderOfAmbiguityResolution_259373() throws Exception {
- BindingAssertionHelper ba= getAssertionHelper();
- ICPPVariable a= ba.assertNonProblem("a;", 1);
- assertInstance(a.getType(), IPointerType.class);
- ICPPVariable b= ba.assertNonProblem("b;", 1);
- assertInstance(b.getType(), IBasicType.class);
- ICPPVariable c= ba.assertNonProblem("c;", 1);
- assertInstance(c.getType(), IPointerType.class);
- ITypedef s1= (ITypedef) ((IPointerType) c.getType()).getType();
- assertInstance(((IFunctionType) s1.getType()).getParameterTypes()[0], IPointerType.class);
- ICPPVariable d= ba.assertNonProblem("d;", 1);
- assertInstance(d.getType(), IPointerType.class);
- ITypedef s2= (ITypedef) ((IPointerType) d.getType()).getType();
- assertInstance(((IFunctionType) s2.getType()).getParameterTypes()[0], IBasicType.class);
- }
+ // int a,b,c,d ;
+ // class X {
+ // void m() {
+ // T* a;
+ // I* b;
+ // S1* c;
+ // S2* d;
+ // }
+ // typedef int T;
+ // int I;
+ // typedef int S1 (int(T)); // resolve this ambiguity first
+ // typedef int S2 (int(t)); // resolve this ambiguity first
+ // };
+ public void testOrderOfAmbiguityResolution_259373() throws Exception {
+ BindingAssertionHelper ba= getAssertionHelper();
+ ICPPVariable a= ba.assertNonProblem("a;", 1);
+ assertInstance(a.getType(), IPointerType.class);
+ ICPPVariable b= ba.assertNonProblem("b;", 1);
+ assertInstance(b.getType(), IBasicType.class);
+ ICPPVariable c= ba.assertNonProblem("c;", 1);
+ assertInstance(c.getType(), IPointerType.class);
+ ITypedef s1= (ITypedef) ((IPointerType) c.getType()).getType();
+ assertInstance(((IFunctionType) s1.getType()).getParameterTypes()[0], IPointerType.class);
+ ICPPVariable d= ba.assertNonProblem("d;", 1);
+ assertInstance(d.getType(), IPointerType.class);
+ ITypedef s2= (ITypedef) ((IPointerType) d.getType()).getType();
+ assertInstance(((IFunctionType) s2.getType()).getParameterTypes()[0], IBasicType.class);
+ }
- // namespace A {
- // class X {
- // friend void f(int);
- // class Y {
- // friend void g(int);
- // };
- // };
- // void test() {
- // f(1);
- // g(1);
- // }
- // }
- public void testFriendFunctionResolution_86368_1() throws Exception {
+ // namespace A {
+ // class X {
+ // friend void f(int);
+ // class Y {
+ // friend void g(int);
+ // };
+ // };
+ // void test() {
+ // f(1);
+ // g(1);
+ // }
+ // }
+ public void testFriendFunctionResolution_86368_1() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
@@ -6739,23 +6782,23 @@ public class AST2CPPTests extends AST2BaseTest {
g2= bh.assertNonProblem("g(1)", 1);
g1= bh.assertNonProblem("g(int)", 1);
assertSame(g1, g2);
- }
+ }
- // namespace A {
- // void f(int);
- // }
- // using A::f;
- // namespace A {
- // void f(char); // openReferences fails
- // }
- // void foo() {
- // f('i');
- // }
- // void bar() {
- // using A::f;
- // f('c');
- // }
- public void testFriendFunctionResolution_86368_2() throws Exception {
+ // namespace A {
+ // void f(int);
+ // }
+ // using A::f;
+ // namespace A {
+ // void f(char); // openReferences fails
+ // }
+ // void foo() {
+ // f('i');
+ // }
+ // void bar() {
+ // using A::f;
+ // f('c');
+ // }
+ public void testFriendFunctionResolution_86368_2() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
@@ -6774,96 +6817,96 @@ public class AST2CPPTests extends AST2BaseTest {
g2= bh.assertNonProblem("f('c')", 1);
g1= bh.assertNonProblem("f(char)", 1);
assertSame(g1, g2);
- }
+ }
- // class A {
- // public:
- // void foo() const volatile;
- // void foo() volatile;
- // void foo() const;
- // void foo();
- // void bar() const volatile;
- // void bar() volatile;
- // void bar() const;
- // void bar();
- // };
- // void A::foo() const volatile { bar();/*1*/ }
- // void A::foo() volatile { bar();/*2*/ }
- // void A::foo() const { bar();/*3*/ }
- // void A::foo() { bar();/*4*/ }
- // void test() {
- // A a;
- // const A ca;
- // volatile A va;
- // const volatile A cva;
- // cva.bar();/*5*/
- // va.bar();/*6*/
- // ca.bar();/*7*/
- // a.bar();/*8*/
- // }
- public void testMemberFunctionDisambiguationByCVness_238409() throws Exception {
+ // class A {
+ // public:
+ // void foo() const volatile;
+ // void foo() volatile;
+ // void foo() const;
+ // void foo();
+ // void bar() const volatile;
+ // void bar() volatile;
+ // void bar() const;
+ // void bar();
+ // };
+ // void A::foo() const volatile { bar();/*1*/ }
+ // void A::foo() volatile { bar();/*2*/ }
+ // void A::foo() const { bar();/*3*/ }
+ // void A::foo() { bar();/*4*/ }
+ // void test() {
+ // A a;
+ // const A ca;
+ // volatile A va;
+ // const volatile A cva;
+ // cva.bar();/*5*/
+ // va.bar();/*6*/
+ // ca.bar();/*7*/
+ // a.bar();/*8*/
+ // }
+ public void testMemberFunctionDisambiguationByCVness_238409() throws Exception {
final String code= getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
- ICPPMethod bar_cv= bh.assertNonProblem("bar();/*1*/", 3, ICPPMethod.class);
- ICPPMethod bar_v= bh.assertNonProblem("bar();/*2*/", 3, ICPPMethod.class);
- ICPPMethod bar_c= bh.assertNonProblem("bar();/*3*/", 3, ICPPMethod.class);
- ICPPMethod bar= bh.assertNonProblem("bar();/*4*/", 3, ICPPMethod.class);
- ICPPFunctionType bar_cv_ft= bar_cv.getType();
- ICPPFunctionType bar_v_ft= bar_v.getType();
- ICPPFunctionType bar_c_ft= bar_c.getType();
- ICPPFunctionType bar_ft= bar.getType();
+ ICPPMethod bar_cv= bh.assertNonProblem("bar();/*1*/", 3, ICPPMethod.class);
+ ICPPMethod bar_v= bh.assertNonProblem("bar();/*2*/", 3, ICPPMethod.class);
+ ICPPMethod bar_c= bh.assertNonProblem("bar();/*3*/", 3, ICPPMethod.class);
+ ICPPMethod bar= bh.assertNonProblem("bar();/*4*/", 3, ICPPMethod.class);
+ ICPPFunctionType bar_cv_ft= bar_cv.getType();
+ ICPPFunctionType bar_v_ft= bar_v.getType();
+ ICPPFunctionType bar_c_ft= bar_c.getType();
+ ICPPFunctionType bar_ft= bar.getType();
- assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
- assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
- assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
- assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
+ assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
+ assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
+ assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
+ assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
- bar_cv= bh.assertNonProblem("bar();/*5*/", 3, ICPPMethod.class);
- bar_v= bh.assertNonProblem("bar();/*6*/", 3, ICPPMethod.class);
- bar_c= bh.assertNonProblem("bar();/*7*/", 3, ICPPMethod.class);
- bar= bh.assertNonProblem("bar();/*8*/", 3, ICPPMethod.class);
- bar_cv_ft= bar_cv.getType();
- bar_v_ft= bar_v.getType();
- bar_c_ft= bar_c.getType();
- bar_ft= bar.getType();
+ bar_cv= bh.assertNonProblem("bar();/*5*/", 3, ICPPMethod.class);
+ bar_v= bh.assertNonProblem("bar();/*6*/", 3, ICPPMethod.class);
+ bar_c= bh.assertNonProblem("bar();/*7*/", 3, ICPPMethod.class);
+ bar= bh.assertNonProblem("bar();/*8*/", 3, ICPPMethod.class);
+ bar_cv_ft= bar_cv.getType();
+ bar_v_ft= bar_v.getType();
+ bar_c_ft= bar_c.getType();
+ bar_ft= bar.getType();
- assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
- assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
- assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
- assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
- }
+ assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
+ assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
+ assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
+ assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
+ }
- // void test1(float f);
- // void test1(void);
- // void blabla() {
- // test1(1);
- // }
- // enum E {e1};
- // class C {};
- // void test2(float f);
- // void test2(C c);
- // void blabla2() {
- // test2(e1);
- // }
- public void testOverloadResolution_262191() throws Exception {
+ // void test1(float f);
+ // void test1(void);
+ // void blabla() {
+ // test1(1);
+ // }
+ // enum E {e1};
+ // class C {};
+ // void test2(float f);
+ // void test2(C c);
+ // void blabla2() {
+ // test2(e1);
+ // }
+ public void testOverloadResolution_262191() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
- }
+ }
- // enum E {e1};
- // typedef int TInt;
- // void select(int);
- // void test() {
- // int a= TInt(1);
- // E e= E(0);
- // void* h;
- // select (int (h) + 1);
- // }
- public void testSimpleTypeConstructorExpressions() throws Exception {
+ // enum E {e1};
+ // typedef int TInt;
+ // void select(int);
+ // void test() {
+ // int a= TInt(1);
+ // E e= E(0);
+ // void* h;
+ // select (int (h) + 1);
+ // }
+ public void testSimpleTypeConstructorExpressions() throws Exception {
final String code= getAboveComment();
- parseAndCheckBindings(code);
- }
+ parseAndCheckBindings(code);
+ }
// struct A {};
// A a();
@@ -6918,7 +6961,7 @@ public class AST2CPPTests extends AST2BaseTest {
// for (;A* a = 0;) {a= 0;}
// for (;B* b;) {b= 0;}
// }
- public void testAmbiguityResolutionInCondition_263158() throws Exception {
+ public void testAmbiguityResolutionInCondition_263158() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper ba= new BindingAssertionHelper(code, true);
ba.assertNonProblem("A*", 1, ICPPClassType.class);
@@ -6926,7 +6969,7 @@ public class AST2CPPTests extends AST2BaseTest {
ba.assertNonProblem("B*", 1, ICPPVariable.class);
parseAndCheckBindings(code, ParserLanguage.CPP);
- }
+ }
// void f(int x);
//
@@ -7200,9 +7243,9 @@ public class AST2CPPTests extends AST2BaseTest {
// }
public void testOverloadResolutionForOperators_Bug266211() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("a; //1", 1, ICPPField.class);
- ba.assertNonProblem("a; //2", 1, ICPPField.class);
- ba.assertNonProblem("b; //3", 1, ICPPField.class);
+ ba.assertNonProblem("a; //1", 1, ICPPField.class);
+ ba.assertNonProblem("a; //2", 1, ICPPField.class);
+ ba.assertNonProblem("b; //3", 1, ICPPField.class);
}
@@ -7221,8 +7264,8 @@ public class AST2CPPTests extends AST2BaseTest {
// }
public void testOverloadResolutionForOperators_Bug268534() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("a; //1", 1, ICPPField.class);
- ba.assertNonProblem("a; //2", 1, ICPPField.class);
+ ba.assertNonProblem("a; //1", 1, ICPPField.class);
+ ba.assertNonProblem("a; //2", 1, ICPPField.class);
}
// class C {
@@ -7235,7 +7278,7 @@ public class AST2CPPTests extends AST2BaseTest {
// }
public void testInvalidUserDefinedConversion_Bug269729() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ba.assertProblem("test(c)", 4);
+ ba.assertProblem("test(c)", 4);
}
@@ -7269,16 +7312,16 @@ public class AST2CPPTests extends AST2BaseTest {
// A a;
public void testForwardDeclarationAfterUsing_271236() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ba.assertNonProblem("A a;", 1, ICPPClassType.class);
+ ba.assertNonProblem("A a;", 1, ICPPClassType.class);
}
// template class Moo;
// bool getFile(Moo & res);
public void testScopeOfClassFwdDecl_270831() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ICPPClassType t= ba.assertNonProblem("Foo", 3, ICPPClassType.class);
- IScope scope= t.getScope();
- assertEquals(EScopeKind.eGlobal, scope.getKind());
+ ICPPClassType t= ba.assertNonProblem("Foo", 3, ICPPClassType.class);
+ IScope scope= t.getScope();
+ assertEquals(EScopeKind.eGlobal, scope.getKind());
}
// class C {};
@@ -7300,13 +7343,13 @@ public class AST2CPPTests extends AST2BaseTest {
BindingAssertionHelper ba= new BindingAssertionHelper(code, true);
ICPPFunction t= ba.assertNonProblem("test(d1);", 4, ICPPFunction.class);
ICPPClassType ct= (ICPPClassType) t.getParameters()[0].getType();
- assertEquals("C", ct.getName());
+ assertEquals("C", ct.getName());
t= ba.assertNonProblem("test(d2);", 4, ICPPFunction.class);
ct= (ICPPClassType) t.getParameters()[0].getType();
- assertEquals("C", ct.getName());
+ assertEquals("C", ct.getName());
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// int foo(int x);
@@ -7328,7 +7371,7 @@ public class AST2CPPTests extends AST2BaseTest {
// class C {
// C(T); // ctor
// C(s); // instance s;
- // };
+ // };
public void testDeclarationAmbiguity_Bug269953() throws Exception {
final String code = getAboveComment();
IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP);
@@ -7444,21 +7487,21 @@ public class AST2CPPTests extends AST2BaseTest {
// }
public void testEnumToIntConversion_285368() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
- ICPPFunction f1 = ba.assertNonProblem("f(i1)", 1, ICPPFunction.class);
- IType t1 = f1.getType().getParameterTypes()[0];
- assertTrue(t1 instanceof ICPPBasicType);
- assertEquals(IBasicType.t_int, ((ICPPBasicType) t1).getType());
- assertEquals(0, ((ICPPBasicType) t1).getQualifierBits());
- ICPPFunction f2 = ba.assertNonProblem("f(u1)", 1, ICPPFunction.class);
- IType t2 = f2.getType().getParameterTypes()[0];
- assertTrue(t2 instanceof ICPPBasicType);
- assertEquals(IBasicType.t_int, ((ICPPBasicType) t2).getType());
- assertEquals(IBasicType.IS_UNSIGNED, ((ICPPBasicType) t2).getQualifierBits());
- ICPPFunction f3 = ba.assertNonProblem("f(l1)", 1, ICPPFunction.class);
- IType t3 = f3.getType().getParameterTypes()[0];
- assertTrue(t3 instanceof ICPPBasicType);
- assertEquals(IBasicType.t_int, ((ICPPBasicType) t3).getType());
- assertEquals(IBasicType.IS_LONG, ((ICPPBasicType) t3).getQualifierBits());
+ ICPPFunction f1 = ba.assertNonProblem("f(i1)", 1, ICPPFunction.class);
+ IType t1 = f1.getType().getParameterTypes()[0];
+ assertTrue(t1 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t1).getType());
+ assertEquals(0, ((ICPPBasicType) t1).getQualifierBits());
+ ICPPFunction f2 = ba.assertNonProblem("f(u1)", 1, ICPPFunction.class);
+ IType t2 = f2.getType().getParameterTypes()[0];
+ assertTrue(t2 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t2).getType());
+ assertEquals(IBasicType.IS_UNSIGNED, ((ICPPBasicType) t2).getQualifierBits());
+ ICPPFunction f3 = ba.assertNonProblem("f(l1)", 1, ICPPFunction.class);
+ IType t3 = f3.getType().getParameterTypes()[0];
+ assertTrue(t3 instanceof ICPPBasicType);
+ assertEquals(IBasicType.t_int, ((ICPPBasicType) t3).getType());
+ assertEquals(IBasicType.IS_LONG, ((ICPPBasicType) t3).getQualifierBits());
}
// typedef enum enum_name enum_name;
@@ -7734,26 +7777,26 @@ public class AST2CPPTests extends AST2BaseTest {
// template F methodTemplate;
// };
public void testFunctionDeclViaTypedef_86495() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
- BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
+ BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
- ICPPFunctionTemplate template= bh.assertNonProblem("functionTemplate", 16);
- assertNotNull(template.getType());
- assertEquals(1, template.getParameters().length);
+ ICPPFunctionTemplate template= bh.assertNonProblem("functionTemplate", 16);
+ assertNotNull(template.getType());
+ assertEquals(1, template.getParameters().length);
- ICPPMethod method= bh.assertNonProblem("method", 6);
- assertNotNull(method.getType());
- assertEquals(1, method.getParameters().length);
+ ICPPMethod method= bh.assertNonProblem("method", 6);
+ assertNotNull(method.getType());
+ assertEquals(1, method.getParameters().length);
- ICPPFunction friendFunction= bh.assertNonProblem("friendFunction", 14);
- assertNotNull(friendFunction.getType());
- assertEquals(1, friendFunction.getParameters().length);
+ ICPPFunction friendFunction= bh.assertNonProblem("friendFunction", 14);
+ assertNotNull(friendFunction.getType());
+ assertEquals(1, friendFunction.getParameters().length);
- ICPPMethod methodTemplate= bh.assertNonProblem("methodTemplate", 14);
- assertTrue(methodTemplate instanceof ICPPFunctionTemplate);
- assertNotNull(methodTemplate.getType());
- assertEquals(1, methodTemplate.getParameters().length);
+ ICPPMethod methodTemplate= bh.assertNonProblem("methodTemplate", 14);
+ assertTrue(methodTemplate instanceof ICPPFunctionTemplate);
+ assertNotNull(methodTemplate.getType());
+ assertEquals(1, methodTemplate.getParameters().length);
}
// void x(const char (&)[1]) {};
@@ -7770,8 +7813,8 @@ public class AST2CPPTests extends AST2BaseTest {
// f("");
// }
public void testCVQualifiersWithArrays_293982() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// template char (&func(T (&array)[N]))[N];
@@ -7785,8 +7828,8 @@ public class AST2CPPTests extends AST2BaseTest {
// f(b); func(b);
// }
public void testArrayTypeSizeFromInitializer_294144() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// struct A {
@@ -7796,8 +7839,8 @@ public class AST2CPPTests extends AST2BaseTest {
// template struct C {};
// };
public void testLookupInClassScopeForTemplateIDs_294904() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// template char (&func(T (&array)[N]))[N];
@@ -7810,8 +7853,8 @@ public class AST2CPPTests extends AST2BaseTest {
// func(A::array); // func is not resolved
// }
public void testCompleteArrayTypeWithIncompleteDeclaration_294144() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// void test() {
@@ -7819,8 +7862,8 @@ public class AST2CPPTests extends AST2BaseTest {
// return y < x ? -1 : y > x ? 1 : 0;
// }
public void testSyntax1_295064() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// typedef int TInt;
@@ -7829,8 +7872,8 @@ public class AST2CPPTests extends AST2BaseTest {
// };
// template inline CT::CT(TInt) {}
public void testSyntax2_295064() throws Exception {
- final String code = getAboveComment();
- parseAndCheckBindings(code, ParserLanguage.CPP);
+ final String code = getAboveComment();
+ parseAndCheckBindings(code, ParserLanguage.CPP);
}
// const unsigned int EIGHT= 8;
@@ -8268,7 +8311,7 @@ public class AST2CPPTests extends AST2BaseTest {
// struct X {
// X();
// X(X&);
- // };
+ // };
// void e(A);
// void f(A);
// void f(B);
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
index 37b10fbad55..978a6f18bd0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java
@@ -97,7 +97,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return name;
}
}
-
+
return null;
}
@@ -122,7 +122,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -136,11 +136,11 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
protected T getBindingFromASTName(String section, int len) {
if (len <= 0)
len += section.length();
-
+
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertFalse("Binding is a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -157,7 +157,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IASTName name= findName(section, len);
assertNotNull("Name not found for \"" + section + "\"", name);
assertEquals(section.substring(0, len), name.getRawSignature());
-
+
IBinding binding = name.resolveBinding();
assertNotNull("No binding for " + name.getRawSignature(), binding);
assertTrue("Binding is not a ProblemBinding for name \"" + name.getRawSignature() + "\"", IProblemBinding.class.isAssignableFrom(name.resolveBinding().getClass()));
@@ -267,13 +267,13 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
return null;
return nameList.get(idx);
}
-
+
public int size() {
return nameList.size();
}
}
- interface ITestStrategy {
+ protected interface ITestStrategy {
IIndex getIndex();
void setUp() throws Exception;
void tearDown() throws Exception;
@@ -300,7 +300,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() {
return cproject;
}
-
+
@Override
public StringBuilder[] getTestData() {
return testData;
@@ -365,7 +365,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -426,7 +426,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("references.c" + (cpp ? "pp" : "")), testData[1].toString());
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -452,7 +452,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -467,7 +467,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
* to put the contents of the section to. To request the AST of a file, put an asterisk after
* the file name.
*/
- class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
+ protected class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
private IIndex index;
private ICProject cproject;
private StringBuilder[] testData;
@@ -536,7 +536,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
}
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -564,7 +564,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public IIndex getIndex() {
return index;
}
-
+
@Override
public boolean isCompositeIndex() {
return false;
@@ -586,7 +586,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public ICProject getCProject() {
return cproject;
}
-
+
@Override
public void tearDown() throws Exception {
if (index != null) {
@@ -620,7 +620,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(cproject);
waitForIndexer(cproject);
-
+
if (DEBUG) {
System.out.println("Online: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
@@ -637,17 +637,17 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
CProjectHelper.createCProject("ReferencedContent" + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
String content = testData[0].toString();
IFile file = TestSourceReader.createFile(referenced.getProject(), new Path("header.h"), content);
-
+
IndexerPreferences.set(referenced.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
CCorePlugin.getIndexManager().reindex(referenced);
-
+
waitForIndexer(referenced);
-
+
if (DEBUG) {
System.out.println("Referenced: "+getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(referenced)).accept(new PDOMPrettyPrinter());
}
-
+
return referenced;
}
@@ -679,7 +679,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
public StringBuilder[] getTestData() {
return testData;
}
-
+
@Override
public boolean isCompositeIndex() {
return true;
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
index 6d23969e328..9c366e76317 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java
@@ -240,7 +240,7 @@ public class BaseTestCase extends TestCase {
* in the log should fail the test. If the logged number of non-OK status objects
* differs from the last value passed, the test is failed. If this method is not called
* at all, the expected number defaults to zero.
- * @param value
+ * @param count the expected number of logged error and warning messages
*/
public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) {
fExpectedLoggedNonOK= count;
@@ -306,7 +306,7 @@ public class BaseTestCase extends TestCase {
assertTrue(indexManager.isProjectRegistered(project));
assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()));
}
-
+
public static void waitUntilFileIsIndexed(IIndex index, IFile file) throws Exception {
TestSourceReader.waitUntilFileIsIndexed(index, file, INDEXER_TIMEOUT_SEC * 1000);
}
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java
new file mode 100644
index 00000000000..eb681dc47e3
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/OneSourceMultipleHeadersTestCase.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.testplugin.util;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.IPDOMManager;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.testplugin.CProjectHelper;
+import org.eclipse.cdt.internal.core.CCoreInternals;
+import org.eclipse.cdt.internal.core.pdom.PDOM;
+import org.eclipse.cdt.internal.pdom.tests.PDOMPrettyPrinter;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Base class for tests that use AST. The files in the test project are created from the comments
+ * preceding the test case. The test project will contain a single source file called source.cpp or
+ * source.c, depending on whether the project is for C++ or C, and zero or more header files called
+ * header1.h, header2.h, etc. The AST is created for the source file only and can be obtained
+ * by calling getAst().
+ */
+public class OneSourceMultipleHeadersTestCase extends BaseTestCase {
+ private static final boolean DEBUG = false;
+
+ private final TestSourceReader testSourceReader;
+ private final boolean cpp;
+ private IIndex index;
+ private ICProject cproject;
+ private StringBuilder[] testData;
+ private IASTTranslationUnit ast;
+
+ public OneSourceMultipleHeadersTestCase(TestSourceReader testSourceReader, boolean cpp) {
+ this(null, testSourceReader, cpp);
+ }
+
+ public OneSourceMultipleHeadersTestCase(String name, TestSourceReader testSourceReader,
+ boolean cpp) {
+ super(name);
+ this.testSourceReader = testSourceReader;
+ this.cpp = cpp;
+ }
+
+ protected ICProject getCProject() {
+ return cproject;
+ }
+
+ protected IIndex getIndex() {
+ return index;
+ }
+
+ protected StringBuilder[] getTestData() {
+ return testData;
+ }
+
+ protected IASTTranslationUnit getAst() {
+ return ast;
+ }
+
+ public String getAstSource() {
+ return testData[testData.length - 1].toString();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ cproject = cpp ?
+ CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
+ CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
+ testData = testSourceReader.getContentsForTest(getName());
+
+ if (testData.length > 0) {
+ for (int i = 0; i < testData.length - 1; i++) {
+ String filename = String.format("header%d.h", i + 1);
+ IFile file = TestSourceReader.createFile(cproject.getProject(), new Path(filename), testData[i].toString());
+ CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
+ }
+ }
+
+ IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("source.c" + (cpp ? "pp" : "")), getAstSource());
+ waitForIndexer(cproject);
+
+ if (DEBUG) {
+ System.out.println("Project PDOM: " + getName());
+ ((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
+ }
+
+ index= CCorePlugin.getIndexManager().getIndex(cproject);
+
+ index.acquireReadLock();
+ ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (index != null) {
+ index.releaseReadLock();
+ }
+ if (cproject != null) {
+ cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
index c27a7e263f6..7295d0ef6c7 100644
--- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
+++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/TestSourceReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,8 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian)
- *******************************************************************************/
+ * Sergey Prigogin (Google)
+ *******************************************************************************/
package org.eclipse.cdt.core.testplugin.util;
import java.io.BufferedReader;
@@ -57,23 +58,61 @@ import org.osgi.framework.Bundle;
* Utilities for reading test source code from plug-in .java sources
*/
public class TestSourceReader {
+ private final Bundle bundle;
+ private final String srcRoot;
+ private final Class clazz;
+ private final int numSections;
+
+ /**
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
+ * @param srcRoot the directory inside the bundle containing the packages
+ * @param clazz the name of the class containing the test
+ */
+ public TestSourceReader(Bundle bundle, String srcRoot, Class clazz) {
+ this(bundle, srcRoot, clazz, 0);
+ }
+
+ /**
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
+ * @param srcRoot the directory inside the bundle containing the packages
+ * @param clazz the name of the class containing the test
+ * @param numSections the number of comment sections preceding the named test to return.
+ * Pass zero to get all available sections.
+ */
+ public TestSourceReader(Bundle bundle, String srcRoot, Class clazz, int numSections) {
+ this.bundle = bundle;
+ this.srcRoot = srcRoot;
+ this.clazz = clazz;
+ this.numSections = numSections;
+ }
+
+ public StringBuilder[] getContentsForTest(final String testName) throws IOException {
+ return getContentsForTest(bundle, srcRoot, clazz, testName, numSections);
+ }
+
+ public String readTaggedComment(String tag) throws IOException {
+ return readTaggedComment(bundle, tag, clazz, tag);
+ }
+
/**
* Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code.
*
- * @param bundle the bundle containing the source, if null can try to load using classpath
- * (source folder has to be in the classpath for this to work)
+ * @param bundle the bundle containing the source, if {@code null} can try to load using
+ * classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
* @param testName the name of the test
- * @param sections the number of comment sections preceding the named test to return. Pass zero
- * to get all available sections.
+ * @param numSections the number of comment sections preceding the named test to return.
+ * Pass zero to get all available sections.
* @return an array of StringBuilder objects for each comment section found preceding the named
- * test in the source code.
+ * test in the source code.
* @throws IOException
*/
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
- final String testName, int sections) throws IOException {
+ final String testName, int numSections) throws IOException {
// Walk up the class inheritance chain until we find the test method.
try {
while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
@@ -91,7 +130,7 @@ public class TestSourceReader {
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
IPath filePath= new Path(srcRoot + '/' + classFile);
-
+
InputStream in;
Class superclass = clazz.getSuperclass();
try {
@@ -107,7 +146,7 @@ public class TestSourceReader {
clazz = superclass;
continue;
}
-
+
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
// Read the java file collecting comments until we encounter the test method.
@@ -120,7 +159,7 @@ public class TestSourceReader {
} else {
if (!line.startsWith("@") && content.length() > 0) {
contents.add(content);
- if (sections > 0 && contents.size() == sections + 1)
+ if (numSections > 0 && contents.size() == numSections + 1)
contents.remove(0);
content = new StringBuilder();
}
@@ -145,14 +184,14 @@ public class TestSourceReader {
clazz = superclass;
}
}
-
+
/**
* Searches for the offset of the first occurrence of a string in a workspace file.
* @param lookfor string to be searched for
* @param fullPath full path of the workspace file
* @return the offset or -1
- * @throws Exception
- * @throws UnsupportedEncodingException
+ * @throws Exception
+ * @throws UnsupportedEncodingException
* @since 4.0
*/
public static int indexOfInFile(String lookfor, Path fullPath) throws Exception {
@@ -183,7 +222,7 @@ public class TestSourceReader {
reader.close();
}
}
-
+
public static int getLineNumber(int offset, Path fullPath) throws Exception {
IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath);
Reader reader= new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset()));
@@ -203,12 +242,12 @@ public class TestSourceReader {
/**
* Reads a section in comments form the source of the given class. The section
- * is started with '// {tag}' and ends with the first line not started by '//'
+ * is started with '// {tag}' and ends with the first line not started by '//'
* @since 4.0
*/
public static String readTaggedComment(Bundle bundle, String srcRoot, Class clazz, final String tag) throws IOException {
IPath filePath= new Path(srcRoot + '/' + clazz.getName().replace('.', '/') + ".java");
-
+
InputStream in= FileLocator.openStream(bundle, filePath, false);
LineNumberReader reader= new LineNumberReader(new InputStreamReader(in));
boolean found= false;
@@ -244,15 +283,15 @@ public class TestSourceReader {
}
/**
- * Creates a file with content at the given path inside the given container.
+ * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced.
* @param container a container to create the file in
* @param filePath the path relative to the container to create the file at
* @param contents the content for the file
* @return a file object.
- * @throws CoreException
+ * @throws CoreException
* @since 4.0
- */
+ */
public static IFile createFile(final IContainer container, final IPath filePath,
final CharSequence contents) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
@@ -295,7 +334,7 @@ public class TestSourceReader {
}
/**
- * Creates a file with content at the given path inside the given container.
+ * Creates a file with content at the given path inside the given container.
* If the file exists its content is replaced.
* @param container a container to create the file in
* @param filePath the path relative to the container to create the file at
@@ -309,7 +348,7 @@ public class TestSourceReader {
/**
* Waits until the given file is indexed. Fails if this does not happen within the
- * given time.
+ * given time.
* @param file
* @param maxmillis
* @throws Exception
@@ -338,7 +377,7 @@ public class TestSourceReader {
} finally {
index.releaseReadLock();
}
-
+
Thread.sleep(50);
timeLeft= (int) (endTime - System.currentTimeMillis());
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsManager.java
index 0c8928d997f..e9cdcd93bca 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsManager.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsManager.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.core.resources.IFile;
@@ -39,6 +40,29 @@ import org.eclipse.core.runtime.IPath;
* @since 5.4
*/
public class LanguageSettingsManager {
+ /**
+ * Returns the list of setting entries of a certain kind (such as include paths)
+ * for the given configuration description, resource and language. This is a
+ * combined list for all providers taking into account settings of parent folder
+ * if settings for the given resource are not defined. For include paths both
+ * local (#include "...") and system (#include <...>) entries are returned.
+ *
+ * @param cfgDescription - configuration description.
+ * @param rc - resource such as file or folder.
+ * @param languageId - language id.
+ * @param kind - kind of language settings entries, such as
+ * {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag
+ * and it is possible to specify composite kind.
+ * Use {@link ICSettingEntry#ALL} to get all kinds.
+ *
+ * @return the list of setting entries.
+ *
+ * @since 5.5
+ */
+ public static List getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) {
+ return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, languageId, kind);
+ }
+
/**
* Returns the list of setting entries of the given provider
* for the given configuration description, resource and language.
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
index 313cc76e9e2..25797a7adbd 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java
@@ -13,10 +13,13 @@
package org.eclipse.cdt.core.model;
import java.net.URI;
+import java.util.List;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.resources.IPathEntryStore;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
@@ -1253,27 +1256,41 @@ public class CoreModel {
if(!mngr.isNewStyleCfg(indexCfg)){
return oldIsScannerInformationEmpty(resource);
}
- ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
- if(lSetting != null && lSetting instanceof CLanguageSettingCache){
- if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo())
- lSetting = null;
- }
- if(lSetting != null){
- ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
- if(entries.length != 0)
- return false;
+
+ if (indexCfg instanceof ILanguageSettingsProvidersKeeper) {
+ List languageIds = LanguageSettingsManager.getLanguages(resource, indexCfg);
+ for (String langId : languageIds) {
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(indexCfg, resource, langId,
+ ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO | ICSettingEntry.INCLUDE_FILE | ICSettingEntry.MACRO_FILE);
+ if (!(entries == null || entries.isEmpty())) {
+ return false;
+ }
+ }
+ return true;
- entries = lSetting.getSettingEntries(ICSettingEntry.MACRO);
- if(entries.length != 0)
- return false;
+ } else {
+ ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
+ if(lSetting != null && lSetting instanceof CLanguageSettingCache){
+ if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo())
+ lSetting = null;
+ }
+ if(lSetting != null){
+ ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
+ if(entries.length != 0)
+ return false;
- entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_FILE);
- if(entries.length != 0)
- return false;
-
- entries = lSetting.getSettingEntries(ICSettingEntry.MACRO_FILE);
- if(entries.length != 0)
- return false;
+ entries = lSetting.getSettingEntries(ICSettingEntry.MACRO);
+ if(entries.length != 0)
+ return false;
+
+ entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_FILE);
+ if(entries.length != 0)
+ return false;
+
+ entries = lSetting.getSettingEntries(ICSettingEntry.MACRO_FILE);
+ if(entries.length != 0)
+ return false;
+ }
}
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
index cc53679e3d1..71d725291bd 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICConfigurationDescription.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.core.settings.model;
import java.util.Map;
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
@@ -369,12 +370,16 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
boolean isPreferenceConfiguration();
/**
- * Convenience method to return a language setting for the file
- * with the specified project-relative path
+ * @deprecated Deprecated as of CDT 8.1. This method returns settings supplied by MBS only.
+ * For most cases, more generic Language Settings Providers mechanism should be used instead, see
+ * {@link LanguageSettingsManager#getSettingEntriesByKind(ICConfigurationDescription, org.eclipse.core.resources.IResource, String, int)}.
*
+ * Convenience method to return a language setting for the file with the specified project-relative path.
+ *
* @param path - file project relative path
* @return ICLanguageSetting or null if not found
*/
+ @Deprecated
ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus);
/**
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java
index 814856a9041..c2a1aade167 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsProvidersSerializer.java
@@ -1555,7 +1555,7 @@ public class LanguageSettingsProvidersSerializer {
for (ICLanguageSettingEntry entry : providerEntries) {
if (entry != null) {
String entryName = entry.getName();
- boolean isRightKind = checkBit(entry.getKind(), kind);
+ boolean isRightKind = checkBit(kind, entry.getKind());
// Only first entry is considered
// Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line
if (isRightKind && !alreadyAdded.contains(entryName)) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
index 7e7bf4c563c..9ee61237749 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
@@ -183,7 +183,8 @@ public class ASTTypeUtil {
if (val != null) {
buf.append(val.getSignature());
} else {
- appendType(arg.getTypeValue(), normalize, buf);
+ IType type = normalize ? arg.getTypeValue() : arg.getOriginalTypeValue();
+ appendType(type, normalize, buf);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateArgument.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateArgument.java
index 98f32777a92..54caf360824 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateArgument.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateArgument.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,7 +7,8 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ * Sergey Prigogin (Google)
+ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -15,53 +16,61 @@ import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
/**
- * Models the value of a template parameter or for the argument of a template-id.
+ * Models the value of a template parameter or for the argument of a template-id.
* Such a value can either be a type-value, or an integral value.
- *
+ *
* @since 5.1
* @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPTemplateArgument {
ICPPTemplateArgument[] EMPTY_ARGUMENTS = {};
/**
- * Returns whether this is an integral value, suitable for a template non-type parameter.
+ * Returns whether this is an integral value, suitable for a template non-type parameter.
*/
boolean isNonTypeValue();
/**
- * Returns whether this is a type value, suitable for either a template type or a
- * template template parameter.
+ * Returns whether this is a type value, suitable for either a template type or a
+ * template template parameter.
*/
boolean isTypeValue();
/**
- * If this is a type value (suitable for a template type and template template parameters),
- * the type used as a value is returned.
- * For non-type values, null is returned.
+ * If this is a type value (suitable for a template type and template template parameters),
+ * the type used as a value is returned.
+ * For non-type values, null is returned.
+ * The returned type has all typedefs resolved.
*/
IType getTypeValue();
-
+
/**
- * If this is a non-type value (suitable for a template non-type parameters),
- * the evaluation object is returned.
- * For type values, null is returned.
+ * Similar to {@link #getTypeValue()} but returns the original type value before typedef
+ * resolution.
+ * @since 5.5
+ */
+ IType getOriginalTypeValue();
+
+ /**
+ * If this is a non-type value (suitable for a template non-type parameters),
+ * the evaluation object is returned.
+ * For type values, null is returned.
* @noreference This method is not intended to be referenced by clients.
*/
ICPPEvaluation getNonTypeEvaluation();
-
+
/**
- * If this is a non-type value (suitable for a template non-type parameters),
- * the value is returned.
- * For type values, null is returned.
+ * If this is a non-type value (suitable for a template non-type parameters),
+ * the value is returned.
+ * For type values, null is returned.
*/
IValue getNonTypeValue();
/**
* If this is a non-type value (suitable for a template non-type parameter),
* the type of the value is returned.
- * For type values, null is returned.
+ * For type values, null is returned.
*/
IType getTypeOfNonTypeValue();
@@ -69,7 +78,7 @@ public interface ICPPTemplateArgument {
* Checks whether two arguments denote the same value.
*/
boolean isSameValue(ICPPTemplateArgument arg);
-
+
/**
* Returns whether this template argument is a pack expansion or not.
* @since 5.2
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
index 5198b0ac12c..8b465ba06c9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
@@ -20,18 +20,18 @@ import org.eclipse.core.runtime.CoreException;
* Buffer for marshalling and unmarshalling types.
*/
public interface ITypeMarshalBuffer {
- final static byte BASIC_TYPE= 1;
- final static byte POINTER_TYPE= 2;
- final static byte ARRAY_TYPE= 3;
- final static byte CVQUALIFIER_TYPE= 4;
- final static byte FUNCTION_TYPE= 5;
- final static byte REFERENCE_TYPE= 6;
- final static byte POINTER_TO_MEMBER_TYPE= 7;
- final static byte PACK_EXPANSION_TYPE= 8;
- final static byte PROBLEM_TYPE= 9;
- final static byte VALUE= 10;
- final static byte DEPENDENT_EXPRESSION_TYPE= 11;
- final static byte UNKNOWN_MEMBER= 12;
+ final static byte BASIC_TYPE= 1;
+ final static byte POINTER_TYPE= 2;
+ final static byte ARRAY_TYPE= 3;
+ final static byte CVQUALIFIER_TYPE= 4;
+ final static byte FUNCTION_TYPE= 5;
+ final static byte REFERENCE_TYPE= 6;
+ final static byte POINTER_TO_MEMBER_TYPE= 7;
+ final static byte PACK_EXPANSION_TYPE= 8;
+ final static byte PROBLEM_TYPE= 9;
+ final static byte VALUE= 10;
+ final static byte DEPENDENT_EXPRESSION_TYPE= 11;
+ final static byte UNKNOWN_MEMBER= 12;
final static byte UNKNOWN_MEMBER_CLASS_INSTANCE= 13;
final static byte DEFERRED_CLASS_INSTANCE= 14;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
index b81b6eb4eab..73129221962 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
@@ -8,7 +8,7 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
@@ -34,11 +34,11 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
evaluation.isTypeDependent() || evaluation.isValueDependent()) {
fEvaluation= evaluation;
} else {
- fEvaluation= new EvalFixed(evaluation.getTypeOrFunctionSet(point),
+ fEvaluation= new EvalFixed(evaluation.getTypeOrFunctionSet(point),
evaluation.getValueCategory(point), evaluation.getValue(point));
}
}
-
+
public CPPTemplateNonTypeArgument(IValue value, IType type) {
fEvaluation = new EvalFixed(type, PRVALUE, value);
}
@@ -48,6 +48,11 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
return false;
}
+ @Override
+ public IType getOriginalTypeValue() {
+ return null;
+ }
+
@Override
public boolean isNonTypeValue() {
return true;
@@ -67,12 +72,12 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
public IValue getNonTypeValue() {
return fEvaluation.getValue(null);
}
-
+
@Override
public IType getTypeOfNonTypeValue() {
return fEvaluation.getTypeOrFunctionSet(null);
}
-
+
@Override
public boolean isPackExpansion() {
return fEvaluation.getTypeOrFunctionSet(null) instanceof ICPPParameterPackType;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeArgument.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeArgument.java
index c8c7bc02aca..8f619a4e91b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeArgument.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeArgument.java
@@ -8,7 +8,7 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -22,12 +22,19 @@ import org.eclipse.core.runtime.Assert;
*/
public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
private final IType fType;
+ private final IType fOriginalType;
public CPPTemplateTypeArgument(IType type) {
- Assert.isNotNull(type);
- fType= type;
+ this(type, type);
}
-
+
+ public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {
+ Assert.isNotNull(simplifiedType);
+ Assert.isNotNull(originalType);
+ fType= simplifiedType;
+ fOriginalType= originalType;
+ }
+
@Override
public boolean isTypeValue() {
return true;
@@ -43,21 +50,26 @@ public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
return fType;
}
+ @Override
+ public IType getOriginalTypeValue() {
+ return fOriginalType;
+ }
+
@Override
public ICPPEvaluation getNonTypeEvaluation() {
return null;
}
-
+
@Override
public IValue getNonTypeValue() {
return null;
}
-
+
@Override
public IType getTypeOfNonTypeValue() {
return null;
}
-
+
@Override
public boolean isPackExpansion() {
return fType instanceof ICPPParameterPackType;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 59ad404d4ba..878ca093ec2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -174,8 +174,8 @@ public class CPPTemplates {
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
try {
- // Add default arguments, if necessary.
ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args);
+ // Add default arguments, if necessary.
arguments= addDefaultArguments(template, arguments, point);
if (arguments == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
@@ -208,7 +208,7 @@ public class CPPTemplates {
}
if (i < numArgs) {
ICPPTemplateArgument arg= arguments[i];
- ICPPTemplateArgument newArg = CPPTemplates.matchTemplateParameterAndArgument(param, arg, map, point);
+ ICPPTemplateArgument newArg = matchTemplateParameterAndArgument(param, arg, map, point);
if (newArg == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
if (newArg != arg) {
@@ -239,7 +239,7 @@ public class CPPTemplates {
return prim;
if (!isExplicitSpecialization) {
- IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDefinition, point);
+ IBinding result= selectSpecialization(template, arguments, isDefinition, point);
if (result != null)
return result;
}
@@ -314,7 +314,7 @@ public class CPPTemplates {
}
IBinding owner= template.getOwner();
- instance = CPPTemplates.createInstance(owner, template, map, arguments, point);
+ instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance);
return instance;
}
@@ -354,7 +354,7 @@ public class CPPTemplates {
}
IBinding owner= template.getOwner();
- instance = CPPTemplates.createInstance(owner, template, map, arguments, point);
+ instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance);
return instance;
}
@@ -423,7 +423,7 @@ public class CPPTemplates {
if (tpars[tparCount - 1].isParameterPack())
return arguments;
- if (havePackExpansion && tparCount+1 == argCount)
+ if (havePackExpansion && tparCount + 1 == argCount)
return arguments;
return null;
}
@@ -476,7 +476,7 @@ public class CPPTemplates {
if (ct instanceof ICPPClassTemplatePartialSpecialization) {
args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments();
} else {
- args = CPPTemplates.templateParametersAsArguments(ct.getTemplateParameters());
+ args = templateParametersAsArguments(ct.getTemplateParameters());
}
return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope());
}
@@ -741,7 +741,7 @@ public class CPPTemplates {
} else if (template instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) template;
ICPPClassSpecialization within = getSpecializationContext(owner);
- ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point);
+ ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (owner instanceof ICPPClassType && template instanceof ICPPMethod) {
if (template instanceof ICPPConstructor) {
@@ -766,7 +766,7 @@ public class CPPTemplates {
ICPPClassTemplate template= pspec.getPrimaryClassTemplate();
ICPPTemplateArgument[] args = pspec.getTemplateArguments();
template= (ICPPClassTemplate) owner.specializeMember(template, point);
- args= CPPTemplates.instantiateArguments(args, tpMap, -1, within, point);
+ args= instantiateArguments(args, tpMap, -1, within, point);
spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args);
} catch (DOMException e) {
}
@@ -782,13 +782,13 @@ public class CPPTemplates {
} else if (decl instanceof ICPPField) {
final ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPField field= (ICPPField) decl;
- IType type= CPPTemplates.instantiateType(field.getType(), tpMap, -1, within, point);
- IValue value= CPPTemplates.instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point);
+ IType type= instantiateType(field.getType(), tpMap, -1, within, point);
+ IValue value= instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point);
spec = new CPPFieldSpecialization(decl, owner, tpMap, type, value);
} else if (decl instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) decl;
ICPPClassSpecialization within = getSpecializationContext(owner);
- ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point);
+ ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (decl instanceof ICPPFunctionTemplate) {
@@ -808,7 +808,7 @@ public class CPPTemplates {
spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, type, exceptionSpecs);
}
} else if (decl instanceof ITypedef) {
- IType type= CPPTemplates.instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
+ IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
@@ -820,7 +820,7 @@ public class CPPTemplates {
for (IBinding delegate : delegates) {
try {
if (delegate instanceof ICPPUnknownBinding) {
- delegate= CPPTemplates.resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point);
+ delegate= resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point);
}
if (delegate instanceof CPPFunctionSet) {
for (IBinding b : ((CPPFunctionSet) delegate).getBindings()) {
@@ -948,7 +948,7 @@ public class CPPTemplates {
ICPPEvaluation eval = value.getEvaluation();
if (eval == null)
return PACK_SIZE_NOT_FOUND;
-
+
return ((CPPEvaluation) eval).determinePackSize(tpMap);
}
@@ -998,12 +998,12 @@ public class CPPTemplates {
System.arraycopy(result, 0, newResult, 0, j);
result= newResult;
for (int k= 0; k < packSize; k++) {
- result[j++]= CPPTemplates.instantiateType(origType, tpMap, k, within, point);
+ result[j++]= instantiateType(origType, tpMap, k, within, point);
}
continue;
}
} else {
- newType = CPPTemplates.instantiateType(origType, tpMap, packOffset, within, point);
+ newType = instantiateType(origType, tpMap, packOffset, within, point);
}
if (result != types) {
result[j++]= newType;
@@ -1043,14 +1043,14 @@ public class CPPTemplates {
ICPPTemplateArgument[] newResult= new ICPPTemplateArgument[args.length + resultShift + shift];
System.arraycopy(result, 0, newResult, 0, i + resultShift);
for (int j= 0; j < packSize; j++) {
- newResult[i + resultShift + j]= CPPTemplates.instantiateArgument(origArg, tpMap, j, within, point);
+ newResult[i + resultShift + j]= instantiateArgument(origArg, tpMap, j, within, point);
}
result= newResult;
resultShift += shift;
continue;
}
} else {
- newArg = CPPTemplates.instantiateArgument(origArg, tpMap, packOffset, within, point);
+ newArg = instantiateArgument(origArg, tpMap, packOffset, within, point);
}
if (result != args) {
result[i + resultShift]= newArg;
@@ -1243,7 +1243,7 @@ public class CPPTemplates {
}
}
- public static IType resolveTemplateTypeParameter(final ICPPTemplateParameter tpar,
+ public static IType resolveTemplateTypeParameter(final ICPPTemplateParameter tpar,
ICPPTemplateParameterMap tpMap, int packOffset, IASTNode point) {
ICPPTemplateArgument arg= null;
if (tpar.isParameterPack()) {
@@ -1262,7 +1262,7 @@ public class CPPTemplates {
}
if (arg != null) {
- IType t= arg.getTypeValue();
+ IType t= arg.getOriginalTypeValue();
if (t != null)
return t;
}
@@ -1480,7 +1480,7 @@ public class CPPTemplates {
while(true) {
ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters();
for (ICPPASTTemplateParameter par : pars) {
- IASTName name= CPPTemplates.getTemplateParameterName(par);
+ IASTName name= getTemplateParameterName(par);
if (name != null)
set.put(name.getLookupKey());
}
@@ -2190,7 +2190,7 @@ public class CPPTemplates {
if (map != null && pType != null) {
pType= instantiateType(pType, map, -1, null, point);
}
-
+
if (argType instanceof ICPPUnknownType) {
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), pType);
}
@@ -2258,7 +2258,7 @@ public class CPPTemplates {
/**
* Converts the template argument arg to match the parameter type
- * paramType or returns null, if this violates the rules
+ * paramType or returns null, if this violates the rules
* specified in 14.3.2 - 5.
* @throws DOMException
*/
@@ -2275,7 +2275,7 @@ public class CPPTemplates {
if (p.isSameType(a))
return arg;
}
-
+
if (a instanceof FunctionSetType) {
if (p instanceof IPointerType) {
p= ((IPointerType) p).getType();
@@ -2294,7 +2294,7 @@ public class CPPTemplates {
Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN, Context.ORDINARY, point);
if (cost == null || !cost.converts())
return null;
-
+
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), paramType);
}
@@ -2425,22 +2425,22 @@ public class CPPTemplates {
}
return unknown;
}
-
- private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap,
+
+ private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap,
int packOffset, ICPPClassSpecialization within, IASTNode point) throws DOMException {
final IType ot0= unknown.getOwnerType();
if (ot0 == null)
return unknown;
IBinding result = unknown;
- IType ot1 = CPPTemplates.instantiateType(ot0, tpMap, packOffset, within, point);
+ IType ot1 = instantiateType(ot0, tpMap, packOffset, within, point);
if (ot1 != null) {
ot1 = SemanticUtil.getUltimateType(ot1, false);
if (ot1 instanceof ICPPUnknownType) {
if (unknown instanceof ICPPUnknownMemberClassInstance) {
ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown;
ICPPTemplateArgument[] args0 = ucli.getArguments();
- ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments(args0, tpMap, packOffset, within, point);
+ ICPPTemplateArgument[] args1 = instantiateArguments(args0, tpMap, packOffset, within, point);
if (args0 != args1 || !ot1.isSameType(ot0)) {
args1= SemanticUtil.getSimplifiedArguments(args1);
result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1);
@@ -2457,7 +2457,7 @@ public class CPPTemplates {
if (s != null) {
result= CPPSemantics.resolveUnknownName(s, unknown, point);
if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) {
- ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments(
+ ICPPTemplateArgument[] args1 = instantiateArguments(
((ICPPUnknownMemberClassInstance) unknown).getArguments(), tpMap, packOffset, within, point);
if (result instanceof ICPPClassTemplate) {
result = instantiate((ICPPClassTemplate) result, args1, point);
@@ -2477,7 +2477,7 @@ public class CPPTemplates {
ICPPTemplateArgument[] arguments = dci.getTemplateArguments();
ICPPTemplateArgument[] newArgs;
try {
- newArgs = CPPTemplates.instantiateArguments(arguments, tpMap, packOffset, within, point);
+ newArgs = instantiateArguments(arguments, tpMap, packOffset, within, point);
} catch (DOMException e) {
return e.getProblem();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
index 9d1cf787526..d47fbbb1270 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
@@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
+import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
+import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
@@ -126,15 +128,6 @@ public class EvalID extends CPPEvaluation {
@Override
public IValue getValue(IASTNode point) {
// Name lookup is not needed here because it was already done in the "instantiate" method.
-// IBinding nameOwner = fNameOwner;
-// if (nameOwner == null && fFieldOwner != null)
-// nameOwner = (IBinding) fFieldOwner.getTypeOrFunctionSet(point);
-//
-// if (nameOwner instanceof ICPPClassType) {
-// ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, fTemplateArgs, point);
-// if (eval != null)
-// return eval.getValue(point);
-// }
return Value.create(this);
}
@@ -294,7 +287,7 @@ public class EvalID extends CPPEvaluation {
} else if (nameOwner instanceof IType) {
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
if (type instanceof IBinding)
- nameOwner = (IBinding) type;
+ nameOwner = (IBinding) getNestedType(type, TDEF);
}
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
index 9de29a630bb..6921ea4348d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
@@ -78,14 +78,14 @@ public class SemanticUtil {
// Resolve typedefs.
public static final int TDEF = 0x01;
// Resolve typedefs, but only if necessary for a nested type transformation.
- public static final int COND_TDEF = 0x02;
+ public static final int COND_TDEF = 0x02;
public static final int REF = 0x04;
public static final int CVTYPE = 0x08;
public static final int ALLCVQ = 0x10;
public static final int PTR = 0x20;
public static final int MPTR = 0x40;
public static final int ARRAY = 0x80;
-
+
static {
final int OPERATOR_SPC= OPERATOR_CHARS.length + 1;
for (OverloadableOperator op : OverloadableOperator.values()) {
@@ -93,7 +93,7 @@ public class SemanticUtil {
cas.put(CharArrayUtils.subarray(name, OPERATOR_SPC, name.length));
}
}
-
+
/**
* Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class. This does not include inherited methods. Conversion
@@ -116,7 +116,7 @@ public class SemanticUtil {
}
return methods;
}
-
+
/**
* Returns an array of ICPPMethod objects representing all conversion operators
* declared by the specified class and its ancestors. This includes inherited
@@ -132,7 +132,7 @@ public class SemanticUtil {
}
return methods;
}
-
+
/**
* @param root the class to start at
* @return the root and all its ancestor classes
@@ -147,7 +147,7 @@ public class SemanticUtil {
ObjectSet next= new ObjectSet(2);
for (int i = 0; i < current.size(); i++) {
- ICPPClassType clazz= current.keyAt(i);
+ ICPPClassType clazz= current.keyAt(i);
done.put(clazz);
for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) {
@@ -181,21 +181,21 @@ public class SemanticUtil {
}
return false;
}
-
+
public static CVQualifier getCVQualifier(IType t) {
if (t instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) t;
- return qt.isConst()
+ return qt.isConst()
? qt.isVolatile() ? CONST_VOLATILE : CONST
: qt.isVolatile() ? VOLATILE : NONE;
- }
+ }
if (t instanceof IPointerType) {
IPointerType pt= (IPointerType) t;
- return pt.isConst()
- ? pt.isVolatile()
+ return pt.isConst()
+ ? pt.isVolatile()
? pt.isRestrict() ? CONST_VOLATILE_RESTRICT : CONST_VOLATILE
: pt.isRestrict() ? CONST_RESTRICT : CONST
- : pt.isVolatile()
+ : pt.isVolatile()
? pt.isRestrict() ? VOLATILE_RESTRICT : VOLATILE
: pt.isRestrict() ? RESTRICT : NONE;
}
@@ -204,7 +204,7 @@ public class SemanticUtil {
}
return NONE;
}
-
+
/**
* Descends into type containers, stopping at pointer-to-member types if
* specified.
@@ -216,7 +216,7 @@ public class SemanticUtil {
final int options = TDEF | ALLCVQ | PTR | ARRAY | REF;
return getNestedType(type, stopAtPointerToMember ? options : (options | MPTR));
}
-
+
/**
* Descends into type containers, stopping at array, pointer or
* pointer-to-member types.
@@ -273,10 +273,10 @@ public class SemanticUtil {
beforeTypedefs = null;
} else if (tdef || cond_tdef) {
t= getNestedType(qttgt, options);
- if (t == qttgt)
+ if (t == qttgt)
return qt;
return addQualifiers(t, qt.isConst(), qt.isVolatile(), false);
- }
+ }
} else if (type instanceof IArrayType) {
final IArrayType atype= (IArrayType) type;
if ((options & ARRAY) != 0) {
@@ -298,7 +298,7 @@ public class SemanticUtil {
// A typedef within the reference type can influence whether the reference is lvalue or rvalue
IType nested= rt.getType();
IType newNested = getNestedType(nested, TDEF);
- if (nested == newNested)
+ if (nested == newNested)
return type;
return replaceNestedType((ITypeContainer) rt, newNested);
}
@@ -310,7 +310,7 @@ public class SemanticUtil {
}
return type;
}
-
+
type= t;
}
}
@@ -331,7 +331,7 @@ public class SemanticUtil {
return type;
}
return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs());
- }
+ }
if (type instanceof ITypedef) {
IType t= ((ITypedef) type).getType();
@@ -342,31 +342,31 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType();
- if (nestedType == null)
+ if (nestedType == null)
return type;
-
+
IType newType= getSimplifiedType(nestedType);
if (newType != nestedType) {
return replaceNestedType(tc, newType);
- }
+ }
return type;
}
return type;
}
-
+
static boolean isSimplified(IType type) {
if (type instanceof ICPPFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type;
if (!isSimplified(ft.getReturnType()))
return false;
-
+
IType[] ps = ft.getParameterTypes();
for (IType p : ps) {
if (!isSimplified(p))
return false;
}
return true;
- }
+ }
if (type instanceof ITypedef) {
return false;
}
@@ -379,7 +379,7 @@ public class SemanticUtil {
public static IType replaceNestedType(ITypeContainer type, IType newNestedType) {
if (newNestedType == null)
return type;
-
+
// Bug 249085 make sure not to add unnecessary qualifications
if (type instanceof IQualifierType) {
IQualifierType qt= (IQualifierType) type;
@@ -393,9 +393,9 @@ public class SemanticUtil {
/**
* Replaces the given type or its nested type with a typedef if that type is the same as
- * the type the typedef resolves to.
- *
- * @param type the type subject to substitution
+ * the type the typedef resolves to.
+ *
+ * @param type the type subject to substitution
* @param typedefType the type possibly containing the typedef as its nested type.
* @return the given type with the nested type replaced by the typedef, or {@code null} if
* the typedefType doesn't contain a typedef or the nested type doesn't match the typedef.
@@ -439,7 +439,7 @@ public class SemanticUtil {
public static IType mapToAST(IType type, IASTNode node) {
if (node == null)
return type;
-
+
if (type instanceof IFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) type;
final IType r = ft.getReturnType();
@@ -452,13 +452,13 @@ public class SemanticUtil {
if (type instanceof ITypeContainer) {
final ITypeContainer tc = (ITypeContainer) type;
final IType nestedType= tc.getType();
- if (nestedType == null)
+ if (nestedType == null)
return type;
-
+
IType newType= mapToAST(nestedType, node);
if (newType != nestedType) {
return replaceNestedType(tc, newType);
- }
+ }
return type;
} else if (type instanceof ICPPClassType && type instanceof IIndexBinding) {
IASTTranslationUnit tu = node.getTranslationUnit();
@@ -515,7 +515,7 @@ public class SemanticUtil {
final IType type= arg.getTypeValue();
final IType newType= getSimplifiedType(type);
if (newType != type) {
- return new CPPTemplateTypeArgument(newType);
+ return new CPPTemplateTypeArgument(newType, arg.getOriginalTypeValue());
}
}
return arg;
@@ -535,17 +535,17 @@ public class SemanticUtil {
return baseType;
} else if (baseType instanceof ICPPPointerToMemberType) {
ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType;
- if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
+ if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) {
- return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(),
+ return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
}
return baseType;
} else if (baseType instanceof IPointerType) {
IPointerType pt= (IPointerType) baseType;
- if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
+ if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())
|| (restrict && !pt.isRestrict())) {
- return new CPPPointerType(pt.getType(),
+ return new CPPPointerType(pt.getType(),
cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict());
}
return baseType;
@@ -562,7 +562,7 @@ public class SemanticUtil {
} else if (baseType == null) {
return null;
}
-
+
return new CPPQualifierType(baseType, cnst, vol);
}
return baseType;
@@ -590,7 +590,7 @@ public class SemanticUtil {
}
} else if (owner1 instanceof ICPPNamespace) {
if (owner2 instanceof ICPPNamespace) {
- if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
+ if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray()))
return false;
return isSameOwner(owner1.getOwner(), owner2.getOwner());
}
@@ -611,7 +611,7 @@ public class SemanticUtil {
public static boolean isEmptyParameterList(IType[] parameters) {
if (parameters.length == 0) {
return true;
- }
+ }
if (parameters.length == 1 && isVoidType(parameters[0])) {
return true;
}
@@ -629,28 +629,28 @@ public class SemanticUtil {
public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) {
return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet
*/
public static final String EDITOR_FOLDING_STATEMENTS = "editor_folding_statements"; //$NON-NLS-1$
-
+
/**
* A named preference that stores the value for functions folding for the default folding provider.
*
@@ -1025,7 +1026,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public final static String REMOVE_TRAILING_WHITESPACE = "removeTrailingWhitespace"; //$NON-NLS-1$
-
+
/**
* Preference key controlling how REMOVE_TRAILING_WHITESPACE option is applied.
* If REMOVE_TRAILING_WHITESPACE is enabled, this option limits the scope of
@@ -1162,14 +1163,14 @@ public class PreferenceConstants {
* @since 5.0
*/
public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$
-
+
/**
- * A named preference that holds the duration (in milli seconds) a content proposal may compute
+ * A named preference that holds the duration (in milli seconds) a content proposal may compute
* until it is assumed that the proposal computer has a problem and should be disabled.
*
* Value is of type long.
- *
- * @since 5.4
+ *
+ * @since 5.4
*/
public final static String CODEASSIST_PROPOSALS_TIMEOUT= "content_assist_proposals_timeout"; //$NON-NLS-1$
@@ -1179,7 +1180,7 @@ public class PreferenceConstants {
* Value is of type String. A RGB color value encoded as a string
* using class PreferenceConverter
*
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*
@@ -1193,7 +1194,7 @@ public class PreferenceConstants {
* Value is of type String. A RGB color value encoded as a string
* using class PreferenceConverter
*
- *
+ *
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
*
@@ -1438,7 +1439,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean.
*
- *
+ *
* @since 5.3
*/
public static final String EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES= "markOverloadedOperatorsOccurrences"; //$NON-NLS-1$
@@ -1462,7 +1463,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_RECONCILER = "scalability.reconciler"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether syntax coloring is disabled.
*
@@ -1492,7 +1493,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_ALERT = "scalability.detect"; //$NON-NLS-1$
-
+
/**
* The size of the file that will trigger scalability mode
*
@@ -1502,7 +1503,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_NUMBER_OF_LINES = "scalability.numberOfLines"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether syntax coloring is disabled.
*
@@ -1512,7 +1513,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_SEMANTIC_HIGHLIGHT = "scalability.semanticHighlight"; //$NON-NLS-1$
-
+
/**
* A named preference that controls whether the content assist auto activation is disabled in scalability mode.
*
@@ -1522,7 +1523,7 @@ public class PreferenceConstants {
* @since 5.0
*/
public static final String SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION = "scalability.contentAssistAutoActivation"; //$NON-NLS-1$
-
+
/**
* A named preference that controls how an include guard symbol is created.
*
@@ -1537,24 +1538,24 @@ public class PreferenceConstants {
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from
* the include file's name.
- *
+ *
* @since 5.1
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME = 0;
-
+
/**
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from a UUID.
- *
+ *
* @since 5.1
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_UUID = 1;
-
+
/**
* The value of CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME
* specifying that the include guard symbol is to be derived from
* the include file's path relative to the source folder.
- *
+ *
* @since 5.2
*/
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_PATH = 2;
@@ -1563,7 +1564,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a constant name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_CAPITALIZATION = "nameStyle.constant.capitalization"; //$NON-NLS-1$
@@ -1571,7 +1572,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_PREFIX = "nameStyle.constant.prefix"; //$NON-NLS-1$
@@ -1579,7 +1580,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_SUFFIX = "nameStyle.constant.suffix"; //$NON-NLS-1$
@@ -1588,7 +1589,7 @@ public class PreferenceConstants {
* of a constant name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CONSTANT_WORD_DELIMITER = "nameStyle.constant.wordDelimiter"; //$NON-NLS-1$
@@ -1597,7 +1598,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a variable name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_CAPITALIZATION = "nameStyle.variable.capitalization"; //$NON-NLS-1$
@@ -1605,7 +1606,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_PREFIX = "nameStyle.variable.prefix"; //$NON-NLS-1$
@@ -1613,7 +1614,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_SUFFIX = "nameStyle.variable.suffix"; //$NON-NLS-1$
@@ -1622,7 +1623,7 @@ public class PreferenceConstants {
* of a variable name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_VARIABLE_WORD_DELIMITER = "nameStyle.variable.wordDelimiter"; //$NON-NLS-1$
@@ -1631,7 +1632,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a field name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_CAPITALIZATION = "nameStyle.field.capitalization"; //$NON-NLS-1$
@@ -1639,7 +1640,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_PREFIX = "nameStyle.field.prefix"; //$NON-NLS-1$
@@ -1647,7 +1648,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_SUFFIX = "nameStyle.field.suffix"; //$NON-NLS-1$
@@ -1656,7 +1657,7 @@ public class PreferenceConstants {
* of a field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_FIELD_WORD_DELIMITER = "nameStyle.field.wordDelimiter"; //$NON-NLS-1$
@@ -1665,7 +1666,7 @@ public class PreferenceConstants {
* A named preference that controls how capitalization of a method name.
*
* Value is of type Integer.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_CAPITALIZATION = "nameStyle.method.capitalization"; //$NON-NLS-1$
@@ -1673,7 +1674,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_PREFIX = "nameStyle.method.prefix"; //$NON-NLS-1$
@@ -1681,7 +1682,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_SUFFIX = "nameStyle.method.suffix"; //$NON-NLS-1$
@@ -1690,7 +1691,7 @@ public class PreferenceConstants {
* of a method name.
*
* Value is of type String.
- *
+ *
* @since 5.4
*/
public static final String NAME_STYLE_METHOD_WORD_DELIMITER = "nameStyle.method.wordDelimiter"; //$NON-NLS-1$
@@ -1700,7 +1701,7 @@ public class PreferenceConstants {
* depends on capitalization of the method name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_CAPITALIZATION = "nameStyle.getter.capitalization"; //$NON-NLS-1$
@@ -1708,7 +1709,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_PREFIX = "nameStyle.getter.prefix"; //$NON-NLS-1$
@@ -1716,7 +1717,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the getter name for a boolean field.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_PREFIX_FOR_BOOLEAN = "nameStyle.getter.prefixForBoolean"; //$NON-NLS-1$
@@ -1724,7 +1725,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the getter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_SUFFIX = "nameStyle.getter.suffix"; //$NON-NLS-1$
@@ -1733,7 +1734,7 @@ public class PreferenceConstants {
* when composing the getter name from the field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_GETTER_WORD_DELIMITER = "nameStyle.getter.wordDelimiter"; //$NON-NLS-1$
@@ -1743,7 +1744,7 @@ public class PreferenceConstants {
* depends on capitalization of the field name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_CAPITALIZATION = "nameStyle.setter.capitalization"; //$NON-NLS-1$
@@ -1751,7 +1752,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the setter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_PREFIX = "nameStyle.setter.prefix"; //$NON-NLS-1$
@@ -1759,7 +1760,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the setter name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_SUFFIX = "nameStyle.setter.suffix"; //$NON-NLS-1$
@@ -1768,7 +1769,7 @@ public class PreferenceConstants {
* when composing the setter name from the field name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_SETTER_WORD_DELIMITER = "nameStyle.setter.wordDelimiter"; //$NON-NLS-1$
@@ -1778,7 +1779,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_CAPITALIZATION = "nameStyle.cpp.source.capitalization"; //$NON-NLS-1$
@@ -1786,7 +1787,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ source file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_PREFIX = "nameStyle.cpp.source.prefix"; //$NON-NLS-1$
@@ -1794,7 +1795,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ source file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_SUFFIX = "nameStyle.cpp.source.suffix"; //$NON-NLS-1$
@@ -1803,7 +1804,7 @@ public class PreferenceConstants {
* when composing the C++ source file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_SOURCE_WORD_DELIMITER = "nameStyle.cpp.source.wordDelimiter"; //$NON-NLS-1$
@@ -1813,7 +1814,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_CAPITALIZATION = "nameStyle.cpp.header.capitalization"; //$NON-NLS-1$
@@ -1821,7 +1822,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ header file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_PREFIX = "nameStyle.cpp.header.prefix"; //$NON-NLS-1$
@@ -1829,7 +1830,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ header file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_SUFFIX = "nameStyle.cpp.header.suffix"; //$NON-NLS-1$
@@ -1838,7 +1839,7 @@ public class PreferenceConstants {
* when composing the C++ header file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_HEADER_WORD_DELIMITER = "nameStyle.cpp.header.wordDelimiter"; //$NON-NLS-1$
@@ -1848,7 +1849,7 @@ public class PreferenceConstants {
* depends on capitalization of the class name.
*
* Value is of type Integer.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_CAPITALIZATION = "nameStyle.cpp.test.capitalization"; //$NON-NLS-1$
@@ -1856,7 +1857,7 @@ public class PreferenceConstants {
* A named preference that controls prefix of the C++ test file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_PREFIX = "nameStyle.cpp.test.prefix"; //$NON-NLS-1$
@@ -1864,7 +1865,7 @@ public class PreferenceConstants {
* A named preference that controls suffix of the C++ test file name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_SUFFIX = "nameStyle.cpp.test.suffix"; //$NON-NLS-1$
@@ -1873,7 +1874,7 @@ public class PreferenceConstants {
* when composing the C++ test file name from the class name.
*
* Value is of type String.
- *
+ *
* @since 5.3
*/
public static final String NAME_STYLE_CPP_TEST_WORD_DELIMITER = "nameStyle.cpp.test.wordDelimiter"; //$NON-NLS-1$
@@ -1882,7 +1883,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name without changing
* capitalization.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_ORIGINAL = 0;
@@ -1890,7 +1891,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by converting it to upper
* case.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_UPPER_CASE = 1;
@@ -1898,7 +1899,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by converting it to lower
* case.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CASE = 2;
@@ -1906,7 +1907,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by capitalizing first
* letter of every word.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_CAMEL_CASE = 3;
@@ -1914,7 +1915,7 @@ public class PreferenceConstants {
* The value of NAME_STYLE_*_CAPITALIZATION specifying that the name
* is to be derived from the class or the variable name by capitalizing first
* letter of every word except the first one.
- *
+ *
* @since 5.3
*/
public static final int NAME_STYLE_CAPITALIZATION_LOWER_CAMEL_CASE = 4;
@@ -1925,7 +1926,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean. The true value means that private members
* are before public ones. The default is to put public members before private ones.
- *
+ *
* @since 5.4
*/
public static final String CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = "class_member_ascending_visibility_order"; //$NON-NLS-1$
@@ -1936,7 +1937,7 @@ public class PreferenceConstants {
* Value is of type Boolean. The true value means that output
* parameters are before the input ones. The default is to put outputparameters after the input
* ones.
- *
+ *
* @since 5.4
*/
public static final String FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT = "function_output_parameters_before_input"; //$NON-NLS-1$
@@ -1947,7 +1948,7 @@ public class PreferenceConstants {
*
* Value is of type Boolean. The true value means that output
* parameters are passed by pointer. The default is to pass output parameters by reference.
- *
+ *
* @since 5.4
*/
public static final String FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER = "function_pass_output_parameters_by_pointer"; //$NON-NLS-1$
@@ -2057,7 +2058,7 @@ public class PreferenceConstants {
// Formatter profile
store.setDefault(PreferenceConstants.FORMATTER_PROFILE, FormatterProfileManager.DEFAULT_PROFILE);
-
+
// Content assist
store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$
store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$
@@ -2102,12 +2103,12 @@ public class PreferenceConstants {
// codegen
store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
-
+
// mark occurrences
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
store.setDefault(PreferenceConstants.EDITOR_MARK_OVERLOADED_OPERATOR_OCCURRENCES, false);
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
-
+
// Scalability
store.setDefault(PreferenceConstants.SCALABILITY_ALERT, true);
store.setDefault(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES, 5000);
@@ -2117,7 +2118,7 @@ public class PreferenceConstants {
store.setDefault(PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT, false);
store.setDefault(PreferenceConstants.SCALABILITY_PARSER_BASED_CONTENT_ASSIST, false);
store.setDefault(PreferenceConstants.SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION, false);
-
+
// Code Templates
store.setDefault(PreferenceConstants.CODE_TEMPLATES_INCLUDE_GUARD_SCHEME,
CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME);
@@ -2173,14 +2174,13 @@ public class PreferenceConstants {
/**
* Returns the node in the preference in the given context.
* @param key The preference key.
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the node matching the given context.
*/
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
IEclipsePreferences node = null;
-
+
if (project != null) {
node = new ProjectScope(project.getProject()).getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
@@ -2191,7 +2191,7 @@ public class PreferenceConstants {
if (node.get(key, null) != null) {
return node;
}
-
+
node = ConfigurationScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
@@ -2203,21 +2203,33 @@ public class PreferenceConstants {
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the current value for the string.
* @since 5.0
*/
public static String getPreference(String key, ICProject project) {
- return getPreferenceNode(key, project).get(key, null);
+ return getPreference(key, project, null);
+ }
+
+ /**
+ * Returns the string value for the given key in the given context.
+ * @param key The preference key
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
+ * @param defaultValue The default value if not specified in the preferences.
+ * @return Returns the current value of the preference.
+ * @since 5.5
+ */
+ public static String getPreference(String key, ICProject project, String defaultValue) {
+ return getPreferenceNode(key, project).get(key, defaultValue);
}
/**
* Returns the integer value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should
* be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string.
@@ -2230,9 +2242,8 @@ public class PreferenceConstants {
/**
* Returns the boolean value for the given key in the given context.
* @param key The preference key
- * @param project The current context or null if no context is available and
- * the workspace setting should be taken. Note that passing null should
- * be avoided.
+ * @param project The current context or {@code null} if no context is available and
+ * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string.
* @since 5.1
@@ -2243,14 +2254,12 @@ public class PreferenceConstants {
/**
* Returns the scopes for preference lookup.
- *
- * @param project a project or null
+ *
+ * @param project a project or {@code null}
* @return the scopes for preference lookup.
* @since 5.4
*/
public static IScopeContext[] getPreferenceScopes(IProject project) {
- return project != null ?
- new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
- new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
+ return CCorePreferenceConstants.getPreferenceScopes(project);
}
}
diff --git a/cross/org.eclipse.cdt.build.crossgcc-feature/feature.xml b/cross/org.eclipse.cdt.build.crossgcc-feature/feature.xml
index ec11f4d0e30..32495f897d7 100644
--- a/cross/org.eclipse.cdt.build.crossgcc-feature/feature.xml
+++ b/cross/org.eclipse.cdt.build.crossgcc-feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
-
-
-
-
diff --git a/cross/org.eclipse.cdt.launch.remote-feature/feature.xml b/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
index 293f57fb6f2..27981f690e9 100644
--- a/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
+++ b/cross/org.eclipse.cdt.launch.remote-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
GDB (DSF) launcher.
-
General Behavior
+
General Behavior
Terminate GDB when last process exits
@@ -101,6 +101,14 @@ specifically when using a GDB (DSF) launcher.
When checked, the Debug view will only show threads that are suspended.
When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously,
this option is only valuable in non-stop mode, where some threads can run while others are stopped.
+
+
+
Use aggressive breakpoint filtering
+
When checked, the button "Show Breakpoints Supported by Selected Target"
+ of the Breakpoints view will only show the breakpoints that affect the currently selected C/C++ debug context
+ (e.g., thread, process). Otherwise, "Show Breakpoints Supported by Selected Target" will show all breakpoints
+ that are for any C/C++ target.
+
Enable GDB traces
@@ -108,7 +116,17 @@ specifically when using a GDB (DSF) launcher.
will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB.
This information is often critical when the debugger is not behaving as you expect. Include this console output
when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at
- all times, as it does not cause any negative effect.
+ all times, as it does not cause any negative effect.
+
+ Once the number of characters specified by the limit field is reached, older trace lines will be discarded
+ gradually. This is to avoid these traces consuming too much memory, for very long debug sessions.
+
+
+
Display run-time type of variables
+
When checked, the CDT debugger will show the actual variable type (not the
+ declared one) in Variables and Expressions views. Not only does this allow to see what is the current run-time
+ type of a variable, but it allows to access fields that may not be in the base class.
+ Note that this feature will only work starting with GDB 7.5.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
index 0f2dbc62618..d07a96aeb57 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
@@ -11,6 +11,7 @@
* Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation
+ * Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@@ -645,6 +646,16 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// Need to set layout again.
group2.setLayout(groupLayout);
+ boolField= new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
+ MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter,
+ group2);
+
+ boolField.fillIntoGrid(group2, 3);
+ addField(boolField);
+ // Need to set layout again.
+ group2.setLayout(groupLayout);
+
final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES,
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
index fe43d6cf09c..b4a4cd1b627 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
@@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation
+ * Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@@ -37,6 +38,9 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_useInspectorHover_label;
/** @since 2.3 */
public static String GdbDebugPreferencePage_hideRunningThreads;
+ /** @since 2.4 */
+ public static String GdbDebugPreferencePage_useAggressiveBpFilter;
+
/** @since 2.2 */
public static String GdbDebugPreferencePage_prettyPrinting_label;
/** @since 2.2 */
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
index 85c62111b46..4c99203d7d6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
@@ -10,6 +10,7 @@
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
# IBM Corporation
+# Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
###############################################################################
GdbDebugPreferencePage_Add_button=Add
@@ -25,7 +26,7 @@ GdbDebugPreferencePage_Command_timeout=Command timeout (ms):
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View
-
+GdbDebugPreferencePage_useAggressiveBpFilter=Use aggressive breakpoint filtering
GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing
GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree
GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB)
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java
new file mode 100644
index 00000000000..44de92796ee
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMNode.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
+
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
+import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+/**
+ * BreakpointVMNode for GDB which supports aggressive breakpoint filtering.
+ * @since 2.4
+ */
+public class GdbBreakpointVMNode extends RawBreakpointVMNode {
+
+ public GdbBreakpointVMNode(BreakpointVMProvider provider) {
+ super(provider);
+ }
+
+ @Override
+ public int getDeltaFlags(Object event) {
+ if (event instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent)event).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
+ return IModelDelta.CONTENT;
+ }
+ }
+
+ return super.getDeltaFlags(event);
+ }
+
+ @Override
+ public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
+ if (event instanceof PropertyChangeEvent) {
+ String property = ((PropertyChangeEvent)event).getProperty();
+ if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
+ parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
+ rm.done();
+ return;
+ }
+ }
+
+ super.buildDelta(event, parent, nodeOffset, rm);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
index b6b20dc5618..68d8c7b660a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/breakpoints/GdbBreakpointVMProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Wind River Systems and others.
+ * Copyright (c) 2008, 2012 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,25 +7,43 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * Mikhail Khodjaiants (Mentor), Marc Khouzam (Ericsson)
+ * - Optionally use aggressive breakpoint filtering (Bug 360735)
+ * Marc Khouzam (Ericsson) - Add support to display proper breakpoints when dealing
+ * with a multi-selection in the debug view (Bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateCountingRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMData;
+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
-import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
+import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
+import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
+import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
@@ -38,8 +56,15 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
/**
* @since 3.0
@@ -50,38 +75,109 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
final private DsfServicesTracker fServicesTracker;
+ /** Indicator that we should use aggressive breakpoint filtering */
+ private boolean fUseAggressiveBpFilter = false;
+
+ /** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
+ private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(event.getProperty())) {
+ fUseAggressiveBpFilter = (Boolean)event.getNewValue();
+ // Set the property in the presentation context so it can be seen by the vmnode which
+ // will refresh the view
+ getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, fUseAggressiveBpFilter);
+ }
+ }
+ };
+
public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
super(adapter, presentationContext);
fSession = session;
fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
- }
+
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(fPropertyChangeListener);
+ fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
+ }
@Override
public void dispose() {
+ GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
fServicesTracker.dispose();
super.dispose();
}
@Override
- protected void calcFileteredBreakpoints(DataRequestMonitor rm) {
- if (Boolean.TRUE.equals(getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION))) {
- IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- List filteredBPs = new ArrayList(allBreakpoints.length);
- for (IBreakpoint bp : allBreakpoints) {
- if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(CDebugCorePlugin.PLUGIN_ID)) {
- filteredBPs.add(bp);
- }
- }
- rm.setData( filteredBPs.toArray(new IBreakpoint[filteredBPs.size()]) );
- rm.done();
- } else {
- super.calcFileteredBreakpoints(rm);
- }
+ protected void calcFileteredBreakpoints( final DataRequestMonitor rm ) {
+ if ( Boolean.TRUE.equals( getPresentationContext().getProperty( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION ) ) ) {
+ if ( fUseAggressiveBpFilter ) {
+ // Aggressive filtering of breakpoints. Only return bps that are installed on the target.
+ ISelection debugContext = getDebugContext();
+ if ( debugContext instanceof IStructuredSelection ) {
+ // Use a set to avoid duplicates
+ final Set bps = new HashSet();
+
+ int count = 0;
+ final ImmediateCountingRequestMonitor crm = new ImmediateCountingRequestMonitor( rm ) {
+ @Override
+ protected void handleSuccess() {
+ rm.done( bps.toArray( new IBreakpoint[bps.size()] ) );
+ }
+ };
+
+ for ( Object element : ( (IStructuredSelection)debugContext ).toList() ) {
+
+ IBreakpointsTargetDMContext bpContext = null;
+ IExecutionDMContext execContext = null;
+ if ( element instanceof IDMVMContext ) {
+ bpContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IBreakpointsTargetDMContext.class );
+ execContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IExecutionDMContext.class );
+
+ if ( bpContext != null && fSession.getId().equals( bpContext.getSessionId() ) ) {
+ count++;
+ getInstalledBreakpoints( bpContext, execContext, new DataRequestMonitor>( getExecutor(), crm ) {
+ @Override
+ protected void handleCompleted() {
+ if ( isSuccess() ) {
+ bps.addAll( getData() );
+ }
+ crm.done();
+ }
+ } );
+ }
+ }
+ }
+
+ crm.setDoneCount(count);
+ } else {
+ rm.done( new Status(
+ IStatus.ERROR,
+ GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_HANDLE,
+ "Invalid debug selection", //$NON-NLS-1$
+ null ) );
+ }
+ } else {
+ // Original behavior of bp filtering. Return all bp of type ICBreakpoint
+ IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
+ List filteredBPs = new ArrayList( allBreakpoints.length );
+ for (IBreakpoint bp : allBreakpoints) {
+ if ( bp instanceof ICBreakpoint && bp.getModelIdentifier().equals( CDebugCorePlugin.PLUGIN_ID ) ) {
+ filteredBPs.add( bp );
+ }
+ }
+ rm.done( filteredBPs.toArray( new IBreakpoint[filteredBPs.size()]) );
+ }
+ }
+ else {
+ super.calcFileteredBreakpoints( rm );
+ }
}
@Override
protected IVMNode createBreakpointVMNode() {
- return new RawBreakpointVMNode(this);
+ return new GdbBreakpointVMNode(this);
}
@Override
@@ -146,4 +242,160 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
rm.done();
}
}
+
+ private ISelection getDebugContext() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if ( window != null ) {
+ return DebugUITools.getDebugContextManager().getContextService( window ).getActiveContext();
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ private void getInstalledBreakpoints( final IBreakpointsTargetDMContext targetContext,
+ final IExecutionDMContext execContext,
+ final DataRequestMonitor> rm ) {
+
+ try {
+ fSession.getExecutor().execute( new DsfRunnable() {
+ @Override
+ public void run() {
+ final IBreakpointsExtension bpService = fServicesTracker.getService( IBreakpointsExtension.class );
+ if ( bpService == null ) {
+ rm.setStatus( new Status(
+ IStatus.ERROR,
+ GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Breakpoints service not available", //$NON-NLS-1$
+ null ) );
+ rm.done();
+ return;
+ }
+ bpService.getBreakpoints( targetContext, new DataRequestMonitor( fSession.getExecutor(), rm ) {
+
+ @Override
+ protected void handleSuccess() {
+ final MIBreakpointsManager bpManager = fServicesTracker.getService( MIBreakpointsManager.class );
+ if ( bpManager == null ) {
+ rm.setStatus( new Status(
+ IStatus.ERROR,
+ GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Breakpoint manager service not available", //$NON-NLS-1$
+ null ) );
+ rm.done();
+ return;
+ }
+
+ if ( getData().length > 0 ) {
+ final Set bps = new HashSet( getData().length );
+ final CountingRequestMonitor crm = new CountingRequestMonitor( ImmediateExecutor.getInstance(), rm ) {
+
+ @Override
+ protected void handleSuccess() {
+ rm.setData( bps );
+ rm.done();
+ }
+ };
+ crm.setDoneCount( getData().length );
+
+ for ( final IBreakpointDMContext bpCtx : getData() ) {
+ bpService.getBreakpointDMData(
+ bpCtx,
+ new DataRequestMonitor( ImmediateExecutor.getInstance(), crm ) {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
+ */
+ @Override
+ protected void handleSuccess() {
+ if ( getData() instanceof MIBreakpointDMData ) {
+ MIBreakpointDMData data = (MIBreakpointDMData)getData();
+ if ( !data.isPending() ) {
+ bpBelongsToContext( execContext, data, new ImmediateDataRequestMonitor(crm) {
+ @Override
+ protected void handleSuccess() {
+ if (getData()) {
+ IBreakpoint bp = bpManager.findPlatformBreakpoint( bpCtx );
+ if ( bp != null )
+ bps.add( bp );
+ }
+ crm.done();
+ }
+ });
+ return;
+ }
+ }
+ crm.done();
+ }
+ } );
+ }
+ }
+ else {
+ rm.setData( new HashSet() );
+ rm.done();
+ }
+ }
+ } );
+ }
+ } );
+ }
+ catch( RejectedExecutionException e ) {
+ rm.setStatus( new Status(
+ IStatus.ERROR,
+ GdbUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_STATE,
+ "Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e ) ); //$NON-NLS-1$ //$NON-NLS-2$);
+ rm.done();
+ }
+ }
+
+ private void bpBelongsToContext( IExecutionDMContext execContext, final MIBreakpointDMData data, final DataRequestMonitor rm ) {
+ if ( execContext == null ) {
+ // No execution context so accept all breakpoints
+ rm.done( true );
+ return;
+ }
+
+ // First check if a thread is selected as the context. In that case, we only want to show breakpoints that
+ // are applicable to that thread.
+ IMIExecutionDMContext threadContext = DMContexts.getAncestorOfType( execContext, IMIExecutionDMContext.class );
+ if ( threadContext != null ) {
+ // A thread is selected. Now make sure this breakpoint is assigned to this thread.
+ if ( data.getThreadId() != null && data.getThreadId().length() > 0 ) {
+ try {
+ int bpThreadId = Integer.parseInt( data.getThreadId() );
+ // A threadId of 0 means all threads of this process. We therefore will have to check
+ // if this breakpoint applies to the process that is selected. But if the threadId is not 0
+ // we simply make sure we have the right thread selected.
+ if ( bpThreadId != 0 ) {
+ rm.done( threadContext.getThreadId() == bpThreadId );
+ return;
+ }
+ }
+ catch( NumberFormatException e ) {
+ assert false;
+ GdbUIPlugin.getDefault().getLog().log( new Status(
+ IStatus.ERROR,
+ GdbUIPlugin.getUniqueIdentifier(),
+ "Invalid breakpoint thread id" ) ); //$NON-NLS-1$
+ rm.done( true );
+ return;
+ }
+ }
+ }
+
+ // If we get here it is that the breakpoint is not assigned to a single thread.
+ // We therefore make sure the breakpoint is applicable to the selected process.
+ final IMIContainerDMContext containerContext = DMContexts.getAncestorOfType( execContext, IMIContainerDMContext.class );
+ if ( containerContext != null ) {
+ if ( data.getGroupIds() != null ) {
+ List groupIds = Arrays.asList( data.getGroupIds() );
+ rm.done( groupIds.contains( containerContext.getGroupId() ) );
+ } else {
+ // This happens if we are debugging a single process, so all breakpoints apply.
+ rm.done( true );
+ }
+ } else {
+ // Accept breakpoint
+ rm.done( true );
+ }
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
index eb8ac629006..d4870fd785c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
@@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
+ * Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb;
@@ -131,5 +132,19 @@ public interface IGdbDebugPreferenceConstants {
* @since 4.1
*/
public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference whether to use the new behavior of the command
+ * "Show Breakpoints Supported by Selected Target" from the Breakpoints view.
+ * The original behavior is to only show breakpoints that apply to the current debug
+ * session; so all C/C++ breakpoints but not Java ones.
+ * The new behavior is to only show breakpoints that are actually installed in the current
+ * debug session.
+ *
+ * Default is true.
+ *
+ * @since 4.2
+ */
+ public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
index 054ea1edb48..07b0b858e76 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
@@ -11,6 +11,7 @@
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
+ * Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal;
@@ -43,5 +44,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, true);
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
index 088c3591b20..0f2a9314ce0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
@@ -8,7 +8,9 @@
* Contributors:
* Ericsson - Initial API and implementation
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
+ * Marc Khouzam (Ericsson) - Fetch groupIds when getting breakpoints (Bug 360735)
*******************************************************************************/
+
package org.eclipse.cdt.dsf.gdb.service;
import java.util.HashMap;
@@ -27,7 +29,10 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
+import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -89,6 +94,73 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
super.shutdown(requestMonitor);
}
+ /**
+ * {@inheritDoc}
+ *
+ * Starting with GDB 7.2, also provides information about which process each breakpoint applies to.
+ */
+ @Override
+ public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor drm)
+ {
+ // Validate the context
+ if (context == null) {
+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
+ drm.done();
+ return;
+ }
+
+ // Select the breakpoints context map
+ // If it doesn't exist then no breakpoint was ever inserted for this breakpoint space.
+ // In that case, return an empty list.
+ final Map breakpointContext = getBreakpointMap(context);
+ if (breakpointContext == null) {
+ drm.setData(new IBreakpointDMContext[0]);
+ drm.done();
+ return;
+ }
+
+ // Execute the command
+ fConnection.queueCommand(fConnection.getCommandFactory().createMIBreakList(context),
+ new DataRequestMonitor(getExecutor(), drm) {
+ @Override
+ protected void handleSuccess() {
+ final MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
+
+ // Also fetch the information about which breakpoint belongs to which
+ // process. We currently can only obtain this information from the CLI
+ // command. This information is needed for breakpoint filtering.
+ // Bug 360735
+ fConnection.queueCommand(fConnection.getCommandFactory().createCLIInfoBreak(context),
+ new ImmediateDataRequestMonitor(drm) {
+ @Override
+ protected void handleSuccess() {
+ Map groupIdMap = getData().getBreakpointToGroupMap();
+
+ // Refresh the breakpoints map and format the result
+ breakpointContext.clear();
+ IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
+ for (int i = 0; i < breakpoints.length; i++) {
+ MIBreakpointDMData breakpointData = new MIBreakpointDMData(breakpoints[i]);
+
+ // Now fill in the thread-group information into the breakpoint data
+ // It is ok to get null. For example, pending breakpoints are not
+ // associated to a thread-group; also, when debugging a single process,
+ // the thread-group list is empty.
+ int reference = breakpointData.getReference();
+ String[] groupIds = groupIdMap.get(reference);
+ breakpointData.setGroupIds(groupIds);
+
+ result[i] = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
+ breakpointContext.put(reference, breakpointData);
+ }
+ drm.setData(result);
+ drm.done();
+ }
+ });
+ }
+ });
+ }
+
private void setTracepointMode() {
ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
index e9e311cfc34..bff232cda88 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
@@ -269,6 +269,10 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.isEnabled();
}
+ ///////////////////////////////////////////////////////////////////////////
+ // MIBreakpointDMData
+ ///////////////////////////////////////////////////////////////////////////
+
/**
* @since 3.0
*/
@@ -283,10 +287,6 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getCommands();
}
- ///////////////////////////////////////////////////////////////////////////
- // MIBreakpointDMData
- ///////////////////////////////////////////////////////////////////////////
-
public int getNumber() {
return fBreakpoint.getNumber();
}
@@ -295,6 +295,16 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getThreadId();
}
+ /** @since 4.2 */
+ public String[] getGroupIds() {
+ return fBreakpoint.getGroupIds();
+ }
+
+ /** @since 4.2 */
+ public void setGroupIds(String[] groups) {
+ fBreakpoint.setGroupIds(groups);
+ }
+
public boolean isTemporary() {
return fBreakpoint.isTemporary();
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
index 010b5d70bcc..65b26f7d2c0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
@@ -1408,7 +1408,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/
public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) {
if (bpContext instanceof MIBreakpointDMContext) {
- return findPlatformBreakpoint(((MIBreakpointDMContext)bpContext).getReference());
+ IBreakpointsTargetDMContext targetCtx = DMContexts.getAncestorOfType(bpContext, IBreakpointsTargetDMContext.class);
+ if (targetCtx != null) {
+ Map bps = fTargetBPs.get(targetCtx);
+ if (bps != null)
+ return bps.get(bpContext);
+ }
}
return null;
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
index c10c43b7581..865f1b8c9fd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
@@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort;
+import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoBreak;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoProgram;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads;
@@ -167,6 +168,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowAttributes;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate;
import org.eclipse.cdt.dsf.mi.service.command.output.CLICatchInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoProgramInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo;
@@ -241,6 +243,16 @@ public class CommandFactory {
return new CLIExecAbort(ctx);
}
+ /** @since 4.2 */
+ public ICommand createCLIInfoBreak(IDMContext ctx) {
+ return new CLIInfoBreak(ctx);
+ }
+
+ /** @since 4.2 */
+ public ICommand createCLIInfoBreak(IDMContext ctx, int bpRef) {
+ return new CLIInfoBreak(ctx, bpRef);
+ }
+
public ICommand createCLIInfoProgram(IContainerDMContext ctx) {
return new CLIInfoProgram(ctx);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java
new file mode 100644
index 00000000000..cbeb9707b69
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIInfoBreak.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.mi.service.command.commands;
+
+import org.eclipse.cdt.dsf.datamodel.IDMContext;
+import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
+
+/**
+ * 'info break [BP_REFERENCE]
+ *
+ * will return information about the specified breakpoint. If no breakpoint is
+ * specified, it will return information about all breakpoints.
+ * We use it to find out to which inferior a breakpoint is applicable.
+ * This information is not available from -break-list or -break-info until GDB 7.6.
+ *
+ * @since 4.2
+ */
+public class CLIInfoBreak extends CLICommand {
+
+ private static final String INFO_BREAK = "info break"; //$NON-NLS-1$
+
+ public CLIInfoBreak(IDMContext ctx) {
+ super(ctx, INFO_BREAK);
+ };
+
+ public CLIInfoBreak(IDMContext ctx, int bpReference) {
+ super(ctx, INFO_BREAK + Integer.toString(bpReference));
+ }
+
+ @Override
+ public CLIInfoBreakInfo getResult(MIOutput MIresult) {
+ return new CLIInfoBreakInfo(MIresult);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java
new file mode 100644
index 00000000000..04936c1e85b
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/CLIInfoBreakInfo.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.mi.service.command.output;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 'info break [BP_REFERENCE] will return information about
+ * the specified breakpoint. We use it to find out to which
+ * inferiors a breakpoint is applicable.
+ *
+ * sample output:
+ *
+ * (gdb) info break
+ * Num Type Disp Enb Address What
+ * 1 breakpoint keep y
+ * 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 2
+ * 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 1
+ * 2 breakpoint keep y
+ * 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2
+ * 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 1
+ *
+ * If only one inferior is being debugged there is not mention of the inferior:
+ * (gdb) info break
+ * Num Type Disp Enb Address What
+ * 1 breakpoint keep y 0x08048533 in main() at loopfirst.cc:8
+ * 2 breakpoint keep y 0x08048553 in main() at loopfirst.cc:9
+ *
+ * Note that the below output is theoretically possible looking at GDB's code but
+ * I haven't figured out a way to trigger it. Still, we should be prepared for it:
+ * (gdb) info break
+ * Num Type Disp Enb Address What
+ * 1 breakpoint keep y
+ * 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 3, 2
+ * 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 2, 1
+ * 2 breakpoint keep y
+ * 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2, 1
+ * 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 3, 2, 1
+ *
+ * @since 4.2
+ */
+public class CLIInfoBreakInfo extends MIInfo {
+
+ private Map fBreakpointToGroupMap = new HashMap();
+
+ public CLIInfoBreakInfo(MIOutput out) {
+ super(out);
+ parse();
+ }
+
+ /**
+ * Returns the map of breakpoint to groupId array indicating to which thread-group
+ * each breakpoint applies. If there is only a single thread-group being debugged, an
+ * empty map will be returned.
+ */
+ public Map getBreakpointToGroupMap() {
+ return fBreakpointToGroupMap;
+ }
+
+ protected void parse() {
+ final String INFERIOR_PREFIX = " inf "; //$NON-NLS-1$
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ for (MIOOBRecord oob : out.getMIOOBRecords()) {
+ if (oob instanceof MIConsoleStreamOutput) {
+ String line = ((MIConsoleStreamOutput)oob).getString().trim();
+ int loc = line.indexOf(INFERIOR_PREFIX);
+ if (loc >= 0) {
+ // Get the breakpoint id by extracting the first element before a white space
+ // or before a period. We can set a limit of 2 since we only need the first element
+ String bpIdStr = line.split("[\\s\\.]", 2)[0]; //$NON-NLS-1$
+ int bpId = 0;
+ try {
+ bpId = Integer.parseInt(bpIdStr);
+ } catch (NumberFormatException e) {
+ assert false;
+ }
+
+ String[] groups = fBreakpointToGroupMap.get(bpId);
+ Set groupIdList = new HashSet();
+ if (groups != null) {
+ // Since we already know about this breakpoint id we must retain the list
+ // we have been building
+ groupIdList.addAll(Arrays.asList(groups));
+ }
+
+ // Get the comma-separated list of inferiors
+ // Split the list into individual ids
+ String inferiorIdStr = line.substring(loc + INFERIOR_PREFIX.length()).trim();
+ for (String id : inferiorIdStr.split(",")) { //$NON-NLS-1$
+ // Add the 'i' prefix as GDB does for MI commands
+ groupIdList.add("i" + id.trim()); //$NON-NLS-1$
+ }
+
+ fBreakpointToGroupMap.put(bpId, groupIdList.toArray(new String[groupIdList.size()]));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
index 310901feb1c..ad25af95923 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java
@@ -11,10 +11,14 @@
* Ericsson - Modified for the breakpoint service
* Ericsson - Added Tracepoint support (284286)
* Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint
+ * Marc Khouzam (Ericsson) - Add 'thread-group' field (bug 360735)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager;
@@ -105,6 +109,13 @@ public class MIBreakpoint {
*/
private boolean pending;
+ /**
+ * The list of groupIds to which this breakpoint applies.
+ * This field is only reported by MI starting with GDB 7.6.
+ * null will be returned if this field is not present.
+ */
+ private String[] groupIds;
+
public MIBreakpoint() {
}
@@ -134,6 +145,9 @@ public class MIBreakpoint {
isCatchpoint = other.isCatchpoint;
catchpointType = other.catchpointType;
pending = other.pending;
+ if (other.groupIds != null) {
+ groupIds = Arrays.copyOf(other.groupIds, other.groupIds.length);
+ }
}
public MIBreakpoint(MITuple tuple) {
@@ -409,6 +423,25 @@ public class MIBreakpoint {
return pending;
}
+ /**
+ * Returns the thread-groups to which this breakpoint applies.
+ * Returns null if the data is not known.
+ *
+ * @since 4.2
+ */
+ public String[] getGroupIds() {
+ return groupIds;
+ }
+
+ /**
+ * Sets the list of thread-groups to which this breakpoint applies.
+ *
+ * @since 4.2
+ */
+ public void setGroupIds(String[] groups) {
+ groupIds = groups;
+ }
+
// Parse the result string
void parse(MITuple tuple) {
MIResult[] results = tuple.getMIResults();
@@ -504,6 +537,10 @@ public class MIBreakpoint {
if (value instanceof MITuple) {
parseCommands((MITuple)value);
}
+ } else if (var.equals("thread-group")) { //$NON-NLS-1$
+ if (value instanceof MIList) {
+ parseGroups((MIList)value);
+ }
}
}
}
@@ -524,4 +561,17 @@ public class MIBreakpoint {
setCommands(cmds.toString());
}
+
+ private void parseGroups(MIList list) {
+ List groups = new ArrayList();
+
+ MIValue[] values = list.getMIValues();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] instanceof MIConst) {
+ groups.add(((MIConst)values[i]).getCString());
+ }
+ }
+
+ groupIds = groups.toArray(new String[groups.size()]);
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
index cf3c3e6ae97..48ffcdbf856 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ericsson - Adapted for DSF
+ * Dmitry Kozlov (Mentor) - Add tab symbols parsing (Bug 391115)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@@ -111,6 +112,8 @@ public class MIInstruction extends AbstractInstruction {
translated string since the only thing we are doing is
displaying it. */
str = ((MIConst) value).getString();
+ /* to avoid improper displaying of instructions we need to translate tabs */
+ str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
char chars[] = str.toCharArray();
int index = 0;
diff --git a/dsf-gdb/org.eclipse.cdt.gnu.dsf-feature/feature.xml b/dsf-gdb/org.eclipse.cdt.gnu.dsf-feature/feature.xml
index d44a3c5e5d6..d285847a470 100644
--- a/dsf-gdb/org.eclipse.cdt.gnu.dsf-feature/feature.xml
+++ b/dsf-gdb/org.eclipse.cdt.gnu.dsf-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml b/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
index 80882f96907..c49965e1796 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag-feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml b/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
index 57aacf5d9b4..07dd84a538e 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
+++ b/lrparser/org.eclipse.cdt.core.lrparser.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/releng/org.eclipse.cdt.platform-feature/feature.xml b/releng/org.eclipse.cdt.platform-feature/feature.xml
index 91b29d8fc44..06695f7fa0c 100644
--- a/releng/org.eclipse.cdt.platform-feature/feature.xml
+++ b/releng/org.eclipse.cdt.platform-feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/releng/org.eclipse.cdt.testing-feature/feature.xml b/releng/org.eclipse.cdt.testing-feature/feature.xml
index 881d23cc758..7d2161d47c3 100644
--- a/releng/org.eclipse.cdt.testing-feature/feature.xml
+++ b/releng/org.eclipse.cdt.testing-feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml b/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
index e43e6bf853c..cb845641752 100644
--- a/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
+++ b/upc/org.eclipse.cdt.core.parser.upc.sdk.feature/feature.xml
@@ -18,10 +18,6 @@
%license
-
-
-
-
diff --git a/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml b/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
index 1d31c82d452..98133b6c17a 100644
--- a/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
+++ b/upc/org.eclipse.cdt.core.parser.upc.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml b/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
index 59758a0c4e1..1e4100d3711 100644
--- a/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
+++ b/xlc/org.eclipse.cdt.xlc.source.feature/feature.xml
@@ -17,10 +17,6 @@
%license
-
-
-
-