View | Details | Raw Unified | Return to bug 160884 | Differences between
and this patch

Collapse All | Expand All

(-)parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java (-1 / +6 lines)
Lines 18-23 Link Here
18
import org.eclipse.cdt.core.dom.ast.IFunctionType;
18
import org.eclipse.cdt.core.dom.ast.IFunctionType;
19
import org.eclipse.cdt.core.dom.ast.IParameter;
19
import org.eclipse.cdt.core.dom.ast.IParameter;
20
import org.eclipse.cdt.core.dom.ast.IScope;
20
import org.eclipse.cdt.core.dom.ast.IScope;
21
import org.eclipse.cdt.internal.core.Util;
21
import org.eclipse.cdt.internal.core.pdom.PDOM;
22
import org.eclipse.cdt.internal.core.pdom.PDOM;
22
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
23
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
23
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
24
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
Lines 42-48 Link Here
42
43
43
	public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
44
	public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
44
		super(pdom, parent, name);
45
		super(pdom, parent, name);
45
		pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(name.resolveBinding()));
46
		try {
47
			pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(name.resolveBinding()));
48
		} catch (DOMException e) {
49
			throw new CoreException(Util.createStatus(e));
50
		}
46
	}
51
	}
47
52
48
	public PDOMCFunction(PDOM pdom, int record) {
53
	public PDOMCFunction(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java (-4 / +10 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.cdt.internal.core.pdom.dom.c;
13
package org.eclipse.cdt.internal.core.pdom.dom.c;
13
14
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.IASTName;
17
import org.eclipse.cdt.core.dom.ast.IASTName;
17
import org.eclipse.cdt.core.dom.ast.IType;
18
import org.eclipse.cdt.core.dom.ast.IType;
18
import org.eclipse.cdt.core.dom.ast.ITypedef;
19
import org.eclipse.cdt.core.dom.ast.ITypedef;
20
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.pdom.PDOM;
21
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
22
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
23
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
Lines 35-44 Link Here
35
			throws CoreException {
37
			throws CoreException {
36
		super(pdom, parent, name);
38
		super(pdom, parent, name);
37
		
39
		
38
		IType type = typedef.getType();
40
		try {
39
		PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
41
			IType type = typedef.getType();
40
		if (typeNode != null)
42
			PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
41
			pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
43
			if (typeNode != null)
44
				pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
45
		} catch (DOMException e) {
46
			throw new CoreException(Util.createStatus(e));
47
		}
42
	}
48
	}
43
49
44
	public PDOMCTypedef(PDOM pdom, int record) {
50
	public PDOMCTypedef(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java (-5 / +12 lines)
Lines 8-19 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
package org.eclipse.cdt.internal.core.pdom.dom.c;
14
package org.eclipse.cdt.internal.core.pdom.dom.c;
14
15
15
import org.eclipse.cdt.core.dom.IPDOMNode;
16
import org.eclipse.cdt.core.dom.IPDOMNode;
16
import org.eclipse.cdt.core.dom.IPDOMVisitor;
17
import org.eclipse.cdt.core.dom.IPDOMVisitor;
18
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
19
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
18
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
20
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
19
import org.eclipse.cdt.core.dom.ast.IASTName;
21
import org.eclipse.cdt.core.dom.ast.IASTName;
Lines 32-37 Link Here
32
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
34
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
33
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
35
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
34
import org.eclipse.cdt.core.model.ILanguage;
36
import org.eclipse.cdt.core.model.ILanguage;
37
import org.eclipse.cdt.internal.core.Util;
35
import org.eclipse.cdt.internal.core.pdom.PDOM;
38
import org.eclipse.cdt.internal.core.pdom.PDOM;
36
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
39
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
37
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
40
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
Lines 109-119 Link Here
109
			else if (binding instanceof IEnumeration)
112
			else if (binding instanceof IEnumeration)
110
				pdomBinding = new PDOMCEnumeration(pdom, parent, name);
113
				pdomBinding = new PDOMCEnumeration(pdom, parent, name);
111
			else if (binding instanceof IEnumerator) {
114
			else if (binding instanceof IEnumerator) {
112
				IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
115
				try {
113
				PDOMBinding pdomEnumeration = adaptBinding(enumeration);
116
					IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
114
				if (pdomEnumeration instanceof PDOMCEnumeration)
117
					PDOMBinding pdomEnumeration = adaptBinding(enumeration);
115
				pdomBinding = new PDOMCEnumerator(pdom, parent, name,
118
					if (pdomEnumeration instanceof PDOMCEnumeration)
116
						(PDOMCEnumeration)pdomEnumeration);
119
					pdomBinding = new PDOMCEnumerator(pdom, parent, name,
120
							(PDOMCEnumeration)pdomEnumeration);
121
				} catch (DOMException e) {
122
					throw new CoreException(Util.createStatus(e));
123
				}
117
			} else if (binding instanceof ITypedef)
124
			} else if (binding instanceof ITypedef)
118
				pdomBinding = new PDOMCTypedef(pdom, parent, name, (ITypedef)binding);
125
				pdomBinding = new PDOMCTypedef(pdom, parent, name, (ITypedef)binding);
119
		}
126
		}
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java (-3 / +6 lines)
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.IASTName;
16
import org.eclipse.cdt.core.dom.ast.IASTName;
17
import org.eclipse.cdt.core.dom.ast.IType;
17
import org.eclipse.cdt.core.dom.ast.IType;
18
import org.eclipse.cdt.core.dom.ast.IVariable;
18
import org.eclipse.cdt.core.dom.ast.IVariable;
19
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
22
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
Lines 41-50 Link Here
41
	public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
42
	public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
42
		super(pdom, parent, name);
43
		super(pdom, parent, name);
43
		IVariable binding = (IVariable)name.getBinding();
44
		IVariable binding = (IVariable)name.getBinding();
44
		if (binding != null) {
45
45
			IType type = binding.getType();
46
		try {
47
			pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(binding));
48
		} catch (DOMException e) {
49
			throw new CoreException(Util.createStatus(e));
46
		}
50
		}
47
		pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(binding));
48
	}
51
	}
49
52
50
	public PDOMCVariable(PDOM pdom, int record) {
53
	public PDOMCVariable(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java (-1 / +6 lines)
Lines 20-25 Link Here
20
import org.eclipse.cdt.core.dom.ast.IASTNode;
20
import org.eclipse.cdt.core.dom.ast.IASTNode;
21
import org.eclipse.cdt.core.dom.ast.IType;
21
import org.eclipse.cdt.core.dom.ast.IType;
22
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
22
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
23
import org.eclipse.cdt.internal.core.Util;
23
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
24
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
24
import org.eclipse.cdt.internal.core.pdom.PDOM;
25
import org.eclipse.cdt.internal.core.pdom.PDOM;
25
import org.eclipse.cdt.internal.core.pdom.db.Database;
26
import org.eclipse.cdt.internal.core.pdom.db.Database;
Lines 64-70 Link Here
64
			if (typeNode != null)
65
			if (typeNode != null)
65
				db.putInt(record + TYPE_OFFSET, typeNode.getRecord());
66
				db.putInt(record + TYPE_OFFSET, typeNode.getRecord());
66
		}
67
		}
67
		db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(name.resolveBinding()));
68
		try {
69
			db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(name.resolveBinding()));
70
		} catch (DOMException e) {
71
			throw new CoreException(Util.createStatus(e));
72
		}
68
	}
73
	}
69
74
70
	public PDOMCPPVariable(PDOM pdom, int record) {
75
	public PDOMCPPVariable(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java (-1 / +6 lines)
Lines 27-32 Link Here
27
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
27
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
28
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
28
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
29
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
29
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
30
import org.eclipse.cdt.internal.core.Util;
30
import org.eclipse.cdt.internal.core.pdom.PDOM;
31
import org.eclipse.cdt.internal.core.pdom.PDOM;
31
import org.eclipse.cdt.internal.core.pdom.db.Database;
32
import org.eclipse.cdt.internal.core.pdom.db.Database;
32
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
33
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
Lines 83-89 Link Here
83
			}
84
			}
84
		}
85
		}
85
		IBinding binding = name.resolveBinding();
86
		IBinding binding = name.resolveBinding();
86
		db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
87
		try {
88
			db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
89
		} catch (DOMException e) {
90
			throw new CoreException(Util.createStatus(e));
91
		}
87
	}
92
	}
88
93
89
	public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
94
	public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java (-4 / +9 lines)
Lines 28-33 Link Here
28
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
28
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
29
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
29
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
30
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
30
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
31
import org.eclipse.cdt.internal.core.Util;
31
import org.eclipse.cdt.internal.core.pdom.PDOM;
32
import org.eclipse.cdt.internal.core.pdom.PDOM;
32
import org.eclipse.cdt.internal.core.pdom.db.Database;
33
import org.eclipse.cdt.internal.core.pdom.db.Database;
33
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
34
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
Lines 94-103 Link Here
94
			}
95
			}
95
			annotation |= PDOMCAnnotation.encodeCVQualifiers(funcDecl) << CV_OFFSET;
96
			annotation |= PDOMCAnnotation.encodeCVQualifiers(funcDecl) << CV_OFFSET;
96
		}
97
		}
97
		IBinding binding = name.resolveBinding();
98
		try {
98
		annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(binding);
99
			IBinding binding = name.resolveBinding();
99
		db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(binding));
100
			annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(binding);
100
		db.putByte(record + ANNOTATION1, annotation);
101
			db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(binding));
102
			db.putByte(record + ANNOTATION1, annotation);
103
		} catch (DOMException e) {
104
			throw new CoreException(Util.createStatus(e));
105
		}
101
	}
106
	}
102
107
103
	public PDOMCPPMethod(PDOM pdom, int record) {
108
	public PDOMCPPMethod(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java (-8 / +16 lines)
Lines 23-29 Link Here
23
import org.eclipse.cdt.core.dom.IPDOMVisitor;
23
import org.eclipse.cdt.core.dom.IPDOMVisitor;
24
import org.eclipse.cdt.core.dom.ast.DOMException;
24
import org.eclipse.cdt.core.dom.ast.DOMException;
25
import org.eclipse.cdt.core.dom.ast.IASTName;
25
import org.eclipse.cdt.core.dom.ast.IASTName;
26
import org.eclipse.cdt.core.dom.ast.IASTNode;
27
import org.eclipse.cdt.core.dom.ast.IBinding;
26
import org.eclipse.cdt.core.dom.ast.IBinding;
28
import org.eclipse.cdt.core.dom.ast.IField;
27
import org.eclipse.cdt.core.dom.ast.IField;
29
import org.eclipse.cdt.core.dom.ast.IScope;
28
import org.eclipse.cdt.core.dom.ast.IScope;
Lines 35-40 Link Here
35
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
34
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
36
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
35
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
37
import org.eclipse.cdt.core.parser.util.ArrayUtil;
36
import org.eclipse.cdt.core.parser.util.ArrayUtil;
37
import org.eclipse.cdt.internal.core.Util;
38
import org.eclipse.cdt.internal.core.pdom.PDOM;
38
import org.eclipse.cdt.internal.core.pdom.PDOM;
39
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
39
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
40
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
40
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
Lines 63-72 Link Here
63
		super(pdom, parent, name);
63
		super(pdom, parent, name);
64
64
65
		IBinding binding = name.resolveBinding();
65
		IBinding binding = name.resolveBinding();
66
		int key = 0;
66
		try {
67
		if (binding instanceof ICPPClassType) // not sure why it wouldn't
67
			int key = 0;
68
			key = ((ICPPClassType) binding).getKey();
68
			if (binding instanceof ICPPClassType) // not sure why it wouldn't
69
		pdom.getDB().putByte(record + KEY, (byte) key);
69
				key = ((ICPPClassType) binding).getKey();
70
			pdom.getDB().putByte(record + KEY, (byte) key);
71
		} catch (DOMException e) {
72
			throw new CoreException(Util.createStatus(e));
73
		}
70
		// linked list is initialized by storage being zero'd by malloc
74
		// linked list is initialized by storage being zero'd by malloc
71
	}
75
	}
72
	
76
	
Lines 189-197 Link Here
189
		
193
		
190
		// Visit my base classes
194
		// Visit my base classes
191
		for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) {
195
		for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) {
192
			IBinding baseClass = base.getBaseClass();
196
			try {
193
			if (baseClass != null && baseClass instanceof PDOMCPPClassType)
197
				IBinding baseClass = base.getBaseClass();
194
				((PDOMCPPClassType)baseClass).visitAllDeclaredMethods(visited, methods);
198
				if (baseClass != null && baseClass instanceof PDOMCPPClassType)
199
					((PDOMCPPClassType)baseClass).visitAllDeclaredMethods(visited, methods);
200
			} catch (DOMException e) {
201
				throw new CoreException(Util.createStatus(e));
202
			}
195
		}
203
		}
196
	}
204
	}
197
	
205
	
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java (-2 / +7 lines)
Lines 19-24 Link Here
19
import org.eclipse.cdt.core.dom.ast.IType;
19
import org.eclipse.cdt.core.dom.ast.IType;
20
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
20
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
21
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
21
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
22
import org.eclipse.cdt.internal.core.Util;
22
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
23
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
23
import org.eclipse.cdt.internal.core.pdom.PDOM;
24
import org.eclipse.cdt.internal.core.pdom.PDOM;
24
import org.eclipse.cdt.internal.core.pdom.db.Database;
25
import org.eclipse.cdt.internal.core.pdom.db.Database;
Lines 47-54 Link Here
47
			throws CoreException {
48
			throws CoreException {
48
		super(pdom, parent, name);
49
		super(pdom, parent, name);
49
		IBinding binding = name.resolveBinding();
50
		IBinding binding = name.resolveBinding();
50
		Database db = pdom.getDB();
51
		try {
51
		db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
52
			Database db = pdom.getDB();
53
			db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
54
		} catch (DOMException e) {
55
			throw new CoreException(Util.createStatus(e));
56
		}
52
	}		
57
	}		
53
58
54
	public PDOMCPPField(PDOM pdom, int bindingRecord) {
59
	public PDOMCPPField(PDOM pdom, int bindingRecord) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBasicType.java (-13 / +18 lines)
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.IASTExpression;
16
import org.eclipse.cdt.core.dom.ast.IASTExpression;
17
import org.eclipse.cdt.core.dom.ast.IType;
17
import org.eclipse.cdt.core.dom.ast.IType;
18
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
18
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
19
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.db.Database;
21
import org.eclipse.cdt.internal.core.pdom.db.Database;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
22
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
Lines 46-64 Link Here
46
		
47
		
47
		Database db = pdom.getDB();
48
		Database db = pdom.getDB();
48
		
49
		
49
		db.putChar(record + TYPE_ID, (char)type.getType());
50
		try {
50
		
51
			db.putChar(record + TYPE_ID, (char)type.getType());
51
		char flags = 0;
52
			
52
		if (type.isLong())
53
			char flags = 0;
53
			flags |= IS_LONG;
54
			if (type.isLong())
54
		if (type.isShort())
55
				flags |= IS_LONG;
55
			flags |= IS_SHORT;
56
			if (type.isShort())
56
		if (type.isSigned())
57
				flags |= IS_SHORT;
57
			flags |= IS_SIGNED;
58
			if (type.isSigned())
58
		if (type.isUnsigned())
59
				flags |= IS_SIGNED;
59
			flags |= IS_UNSIGNED;
60
			if (type.isUnsigned())
60
		
61
				flags |= IS_UNSIGNED;
61
		db.putChar(record + FLAGS, flags);
62
			
63
			db.putChar(record + FLAGS, flags);
64
		} catch (DOMException e) {
65
			throw new CoreException(Util.createStatus(e));
66
		}
62
	}
67
	}
63
	
68
	
64
	protected int getRecordSize() {
69
	protected int getRecordSize() {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java (-4 / +9 lines)
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.IASTName;
16
import org.eclipse.cdt.core.dom.ast.IASTName;
17
import org.eclipse.cdt.core.dom.ast.IType;
17
import org.eclipse.cdt.core.dom.ast.IType;
18
import org.eclipse.cdt.core.dom.ast.ITypedef;
18
import org.eclipse.cdt.core.dom.ast.ITypedef;
19
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.PDOM;
20
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
21
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
22
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
Lines 34-43 Link Here
34
	public PDOMCPPTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
35
	public PDOMCPPTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
35
			throws CoreException {
36
			throws CoreException {
36
		super(pdom, parent, name);
37
		super(pdom, parent, name);
37
		IType type = typedef.getType();
38
		try {
38
		PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
39
			IType type = typedef.getType();
39
		if (typeNode != null)
40
			PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
40
			pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
41
			if (typeNode != null)
42
				pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
43
		} catch (DOMException e) {
44
			throw new CoreException(Util.createStatus(e));
45
		}
41
	}
46
	}
42
47
43
	public PDOMCPPTypedef(PDOM pdom, int record) {
48
	public PDOMCPPTypedef(PDOM pdom, int record) {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java (-4 / +9 lines)
Lines 20-25 Link Here
20
import org.eclipse.cdt.core.dom.ast.IScope;
20
import org.eclipse.cdt.core.dom.ast.IScope;
21
import org.eclipse.cdt.core.dom.ast.IType;
21
import org.eclipse.cdt.core.dom.ast.IType;
22
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
22
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
23
import org.eclipse.cdt.internal.core.Util;
23
import org.eclipse.cdt.internal.core.pdom.PDOM;
24
import org.eclipse.cdt.internal.core.pdom.PDOM;
24
import org.eclipse.cdt.internal.core.pdom.db.Database;
25
import org.eclipse.cdt.internal.core.pdom.db.Database;
25
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
26
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
Lines 63-72 Link Here
63
64
64
		db.putInt(record + NEXT_PARAM, 0);
65
		db.putInt(record + NEXT_PARAM, 0);
65
		
66
		
66
		IType type = param.getType();
67
		try {
67
		if (type != null) {
68
			IType type = param.getType();
68
			PDOMNode typeNode = getLinkageImpl().addType(this, type);
69
			if (type != null) {
69
			db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
70
				PDOMNode typeNode = getLinkageImpl().addType(this, type);
71
				db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
72
			}
73
		} catch (DOMException e) {
74
			throw new CoreException(Util.createStatus(e));
70
		}
75
		}
71
	}
76
	}
72
77
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java (-34 / +44 lines)
Lines 14-19 Link Here
14
14
15
import org.eclipse.cdt.core.dom.IPDOMNode;
15
import org.eclipse.cdt.core.dom.IPDOMNode;
16
import org.eclipse.cdt.core.dom.IPDOMVisitor;
16
import org.eclipse.cdt.core.dom.IPDOMVisitor;
17
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
18
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
18
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
19
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
19
import org.eclipse.cdt.core.dom.ast.IASTName;
20
import org.eclipse.cdt.core.dom.ast.IASTName;
Lines 42-47 Link Here
42
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
43
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
43
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
44
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
44
import org.eclipse.cdt.core.model.ILanguage;
45
import org.eclipse.cdt.core.model.ILanguage;
46
import org.eclipse.cdt.internal.core.Util;
45
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
47
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
46
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
48
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
47
import org.eclipse.cdt.internal.core.pdom.PDOM;
49
import org.eclipse.cdt.internal.core.pdom.PDOM;
Lines 115-156 Link Here
115
			return null;
117
			return null;
116
		
118
		
117
		PDOMBinding pdomBinding = adaptBinding(binding);
119
		PDOMBinding pdomBinding = adaptBinding(binding);
118
		if (pdomBinding == null) {
120
		try {
119
			PDOMNode parent = getAdaptedParent(binding);
121
			if (pdomBinding == null) {
120
			if (parent != null) {
122
				PDOMNode parent = getAdaptedParent(binding);
121
				if (binding instanceof ICPPField && parent instanceof PDOMCPPClassType)
123
				if (parent != null) {
122
					pdomBinding = new PDOMCPPField(pdom, (PDOMCPPClassType)parent, name);
124
					if (binding instanceof ICPPField && parent instanceof PDOMCPPClassType)
123
				else if (binding instanceof ICPPVariable) {
125
						pdomBinding = new PDOMCPPField(pdom, (PDOMCPPClassType)parent, name);
124
					if (!(binding.getScope() instanceof CPPBlockScope))
126
					else if (binding instanceof ICPPVariable) {
125
						pdomBinding = new PDOMCPPVariable(pdom, parent, name);
127
						if (!(binding.getScope() instanceof CPPBlockScope))
126
				} else if (binding instanceof ICPPMethod && parent instanceof PDOMCPPClassType) {
128
							pdomBinding = new PDOMCPPVariable(pdom, parent, name);
127
					pdomBinding = new PDOMCPPMethod(pdom, parent, name);
129
					} else if (binding instanceof ICPPMethod && parent instanceof PDOMCPPClassType) {
128
				} else if (binding instanceof CPPImplicitMethod && parent instanceof PDOMCPPClassType) {
129
					if(!name.isReference()) {
130
						//because we got the implicit method off of an IASTName that is not a reference,
131
						//it is no longer completly implicit and it should be treated as a normal method.
132
						pdomBinding = new PDOMCPPMethod(pdom, parent, name);
130
						pdomBinding = new PDOMCPPMethod(pdom, parent, name);
131
					} else if (binding instanceof CPPImplicitMethod && parent instanceof PDOMCPPClassType) {
132
						if(!name.isReference()) {
133
							//because we got the implicit method off of an IASTName that is not a reference,
134
							//it is no longer completly implicit and it should be treated as a normal method.
135
							pdomBinding = new PDOMCPPMethod(pdom, parent, name);
136
						}
137
					} else if (binding instanceof ICPPFunction) {
138
						pdomBinding = new PDOMCPPFunction(pdom, parent, name);
139
					} else if (binding instanceof ICPPClassType) {
140
						pdomBinding = new PDOMCPPClassType(pdom, parent, name);
141
					} else if (binding instanceof ICPPNamespaceAlias) {
142
						pdomBinding = new PDOMCPPNamespaceAlias(pdom, parent, name);
143
					} else if (binding instanceof ICPPNamespace) {
144
						pdomBinding = new PDOMCPPNamespace(pdom, parent, name);
145
					} else if (binding instanceof IEnumeration) {
146
						pdomBinding = new PDOMCPPEnumeration(pdom, parent, name);
147
					} else if (binding instanceof IEnumerator) {
148
						IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
149
						PDOMBinding pdomEnumeration = adaptBinding(enumeration);
150
						if (pdomEnumeration instanceof PDOMCPPEnumeration)
151
							pdomBinding = new PDOMCPPEnumerator(pdom, parent, name,
152
									(PDOMCPPEnumeration)pdomEnumeration);
153
					} else if (binding instanceof ITypedef) {
154
						pdomBinding = new PDOMCPPTypedef(pdom, parent, name, (ITypedef)binding);
133
					}
155
					}
134
				} else if (binding instanceof ICPPFunction) {
135
					pdomBinding = new PDOMCPPFunction(pdom, parent, name);
136
				} else if (binding instanceof ICPPClassType) {
137
					pdomBinding = new PDOMCPPClassType(pdom, parent, name);
138
				} else if (binding instanceof ICPPNamespaceAlias) {
139
					pdomBinding = new PDOMCPPNamespaceAlias(pdom, parent, name);
140
				} else if (binding instanceof ICPPNamespace) {
141
					pdomBinding = new PDOMCPPNamespace(pdom, parent, name);
142
				} else if (binding instanceof IEnumeration) {
143
					pdomBinding = new PDOMCPPEnumeration(pdom, parent, name);
144
				} else if (binding instanceof IEnumerator) {
145
					IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
146
					PDOMBinding pdomEnumeration = adaptBinding(enumeration);
147
					if (pdomEnumeration instanceof PDOMCPPEnumeration)
148
						pdomBinding = new PDOMCPPEnumerator(pdom, parent, name,
149
								(PDOMCPPEnumeration)pdomEnumeration);
150
				} else if (binding instanceof ITypedef) {
151
					pdomBinding = new PDOMCPPTypedef(pdom, parent, name, (ITypedef)binding);
152
				}
156
				}
153
			}
157
			}
158
		} catch (DOMException e) {
159
			throw new CoreException(Util.createStatus(e));
154
		}
160
		}
155
		
161
		
156
		// final processing
162
		// final processing
Lines 314-321 Link Here
314
				return resolveBinding(names[0]);
320
				return resolveBinding(names[0]);
315
			IASTName lastName = names[names.length - 1];
321
			IASTName lastName = names[names.length - 1];
316
			PDOMBinding nsBinding = adaptBinding(names[names.length - 2].resolveBinding());
322
			PDOMBinding nsBinding = adaptBinding(names[names.length - 2].resolveBinding());
317
			if (nsBinding instanceof IScope) {
323
			try {
318
				return (PDOMBinding) ((IScope)nsBinding).getBinding(lastName, true);
324
				if (nsBinding instanceof IScope) {
325
					return (PDOMBinding) ((IScope)nsBinding).getBinding(lastName, true);
326
				}
327
			} catch (DOMException e) {
328
				throw new CoreException(Util.createStatus(e));
319
			}
329
			}
320
		}
330
		}
321
		IASTNode parent = name.getParent();
331
		IASTNode parent = name.getParent();
(-)parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java (-1 / +1 lines)
Lines 74-80 Link Here
74
		if (adapter == IPDOMLinkageFactory.class)
74
		if (adapter == IPDOMLinkageFactory.class)
75
			return new PDOMCLinkageFactory();
75
			return new PDOMCLinkageFactory();
76
		else
76
		else
77
			return super.getAdapter(adapter);
77
			return null;
78
	}
78
	}
79
	
79
	
80
	public IASTTranslationUnit getASTTranslationUnit(CodeReader reader, 
80
	public IASTTranslationUnit getASTTranslationUnit(CodeReader reader, 
(-)parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java (-1 / +1 lines)
Lines 73-79 Link Here
73
		if (adapter == IPDOMLinkageFactory.class)
73
		if (adapter == IPDOMLinkageFactory.class)
74
			return new PDOMCPPLinkageFactory();
74
			return new PDOMCPPLinkageFactory();
75
		else
75
		else
76
			return super.getAdapter(adapter);
76
			return null;
77
	}
77
	}
78
	
78
	
79
	
79
	
(-)parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java (-4 lines)
Lines 594-603 Link Here
594
        }
594
        }
595
    }
595
    }
596
596
597
    public ParserLanguage getParserLanguage() {
598
        return ParserLanguage.CPP;
599
    }
600
    
601
    public ILanguage getLanguage() {
597
    public ILanguage getLanguage() {
602
    	// Assuming gnu C++ for now.
598
    	// Assuming gnu C++ for now.
603
    	return new GPPLanguage();
599
    	return new GPPLanguage();
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMPointerType.java (-16 / +22 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
package org.eclipse.cdt.internal.core.pdom.dom;
14
package org.eclipse.cdt.internal.core.pdom.dom;
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IPointerType;
18
import org.eclipse.cdt.core.dom.ast.IPointerType;
18
import org.eclipse.cdt.core.dom.ast.IType;
19
import org.eclipse.cdt.core.dom.ast.IType;
20
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
21
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
20
import org.eclipse.cdt.internal.core.pdom.PDOM;
22
import org.eclipse.cdt.internal.core.pdom.PDOM;
21
import org.eclipse.cdt.internal.core.pdom.db.Database;
23
import org.eclipse.cdt.internal.core.pdom.db.Database;
Lines 44-66 Link Here
44
		
46
		
45
		Database db = pdom.getDB();
47
		Database db = pdom.getDB();
46
		
48
		
47
		// type
49
		try {
48
		IType targetType = ((ITypeContainer)type).getType();
50
			// type
49
		int typeRec = 0;
51
			IType targetType = ((ITypeContainer)type).getType();
50
		if (type != null) {
52
			int typeRec = 0;
51
			PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
53
			if (type != null) {
52
			if (targetTypeNode != null)
54
				PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
53
				typeRec = targetTypeNode.getRecord();
55
				if (targetTypeNode != null)
56
					typeRec = targetTypeNode.getRecord();
57
			}
58
			db.putInt(record + TYPE, typeRec);
59
			
60
			// flags
61
			byte flags = 0;
62
			if (type.isConst())
63
				flags |= CONST;
64
			if (type.isVolatile())
65
				flags |= VOLATILE;
66
			db.putByte(record + FLAGS, flags);
67
		} catch (DOMException e) {
68
			throw new CoreException(Util.createStatus(e));
54
		}
69
		}
55
		db.putInt(record + TYPE, typeRec);
56
		
57
		// flags
58
		byte flags = 0;
59
		if (type.isConst())
60
			flags |= CONST;
61
		if (type.isVolatile())
62
			flags |= VOLATILE;
63
		db.putByte(record + FLAGS, flags);
64
	}
70
	}
65
71
66
	protected int getRecordSize() {
72
	protected int getRecordSize() {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java (-12 / +19 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
package org.eclipse.cdt.internal.core.pdom.dom;
14
package org.eclipse.cdt.internal.core.pdom.dom;
Lines 16-21 Link Here
16
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IQualifierType;
18
import org.eclipse.cdt.core.dom.ast.IQualifierType;
18
import org.eclipse.cdt.core.dom.ast.IType;
19
import org.eclipse.cdt.core.dom.ast.IType;
20
import org.eclipse.cdt.internal.core.Util;
19
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
21
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
20
import org.eclipse.cdt.internal.core.pdom.PDOM;
22
import org.eclipse.cdt.internal.core.pdom.PDOM;
21
import org.eclipse.cdt.internal.core.pdom.db.Database;
23
import org.eclipse.cdt.internal.core.pdom.db.Database;
Lines 46-66 Link Here
46
		Database db = pdom.getDB();
48
		Database db = pdom.getDB();
47
		
49
		
48
		// type
50
		// type
49
		IType targetType = ((ITypeContainer)type).getType();
51
		try {
50
		if (type != null) {
52
			IType targetType = ((ITypeContainer)type).getType();
51
			PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
53
			if (type != null) {
52
			if (targetTypeNode != null) {
54
				PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
53
				db.putInt(record + TYPE, targetTypeNode.getRecord());
55
				if (targetTypeNode != null) {
56
					db.putInt(record + TYPE, targetTypeNode.getRecord());
57
				}
54
			}
58
			}
59
			
60
			// flags
61
			byte flags = 0;
62
			if (type.isConst())
63
				flags |= CONST;
64
			if (type.isVolatile())
65
				flags |= VOLATILE;
66
			db.putByte(record + FLAGS, flags);
67
		} catch (DOMException e) {
68
			throw new CoreException(Util.createStatus(e));
55
		}
69
		}
56
		
70
		
57
		// flags
58
		byte flags = 0;
59
		if (type.isConst())
60
			flags |= CONST;
61
		if (type.isVolatile())
62
			flags |= VOLATILE;
63
		db.putByte(record + FLAGS, flags);
64
	}
71
	}
65
72
66
	protected int getRecordSize() {
73
	protected int getRecordSize() {
(-)parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java (-37 / +43 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
package org.eclipse.cdt.internal.core.pdom.dom;
14
package org.eclipse.cdt.internal.core.pdom.dom;
Lines 15-20 Link Here
15
import org.eclipse.cdt.core.dom.ILinkage;
16
import org.eclipse.cdt.core.dom.ILinkage;
16
import org.eclipse.cdt.core.dom.IName;
17
import org.eclipse.cdt.core.dom.IName;
17
import org.eclipse.cdt.core.dom.IPDOMVisitor;
18
import org.eclipse.cdt.core.dom.IPDOMVisitor;
19
import org.eclipse.cdt.core.dom.ast.DOMException;
18
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
20
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
19
import org.eclipse.cdt.core.dom.ast.IASTName;
21
import org.eclipse.cdt.core.dom.ast.IASTName;
20
import org.eclipse.cdt.core.dom.ast.IASTNode;
22
import org.eclipse.cdt.core.dom.ast.IASTNode;
Lines 27-32 Link Here
27
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
29
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
28
import org.eclipse.cdt.core.index.IIndexBinding;
30
import org.eclipse.cdt.core.index.IIndexBinding;
29
import org.eclipse.cdt.core.index.IIndexLinkage;
31
import org.eclipse.cdt.core.index.IIndexLinkage;
32
import org.eclipse.cdt.internal.core.Util;
30
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
33
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
31
import org.eclipse.cdt.internal.core.pdom.PDOM;
34
import org.eclipse.cdt.internal.core.pdom.PDOM;
32
import org.eclipse.cdt.internal.core.pdom.db.BTree;
35
import org.eclipse.cdt.internal.core.pdom.db.BTree;
Lines 149-198 Link Here
149
	public abstract PDOMBinding resolveBinding(IASTName name) throws CoreException;
152
	public abstract PDOMBinding resolveBinding(IASTName name) throws CoreException;
150
	
153
	
151
	public PDOMNode getAdaptedParent(IBinding binding) throws CoreException {
154
	public PDOMNode getAdaptedParent(IBinding binding) throws CoreException {
152
		IScope scope = binding.getScope();
155
		try {
153
		if (scope == null)
156
			IScope scope = binding.getScope();
154
			return null;
157
			if (scope == null)
155
		
158
				return null;
156
		if (scope instanceof IIndexBinding) {
159
			
157
			IIndexBinding parent= ((IIndexBinding) scope).getParentBinding();
160
			if (scope instanceof IIndexBinding) {
158
			if (parent == null) {
161
				IIndexBinding parent= ((IIndexBinding) scope).getParentBinding();
159
				return this;
162
				if (parent == null) {
163
					return this;
164
				}
165
				return adaptBinding(parent);
160
			}
166
			}
161
			return adaptBinding(parent);
167
				
162
		}
168
			// the scope is from the ast
163
			
169
			
164
		// the scope is from the ast
170
			// mstodo revisit unnamed namespaces
165
		
171
			IScope testScope= scope;
166
		// mstodo revisit unnamed namespaces
172
			while (testScope instanceof ICPPNamespaceScope) {
167
		IScope testScope= scope;
173
				IName name= testScope.getScopeName();
168
		while (testScope instanceof ICPPNamespaceScope) {
174
				if (name != null && name.toCharArray().length == 0) {
169
			IName name= testScope.getScopeName();
175
					testScope= scope.getParent();
170
			if (name != null && name.toCharArray().length == 0) {
176
					if (testScope != null) {
171
				testScope= scope.getParent();
177
						scope= testScope;
172
				if (testScope != null) {
178
					}
173
					scope= testScope;
179
				}
180
				else {
181
					testScope= null;
174
				}
182
				}
175
			}
183
			}
184
			
185
			IASTNode scopeNode = ASTInternal.getPhysicalNodeOfScope(scope);
186
			if (scopeNode instanceof IASTCompoundStatement)
187
				return null;
188
			else if (scopeNode instanceof IASTTranslationUnit)
189
				return this;
176
			else {
190
			else {
177
				testScope= null;
191
				IName scopeName = scope.getScopeName();
178
			}
192
				if (scopeName instanceof IASTName) {
179
		}
193
					IBinding scopeBinding = ((IASTName) scopeName).resolveBinding();
180
		
194
					PDOMBinding scopePDOMBinding = adaptBinding(scopeBinding);
181
		IASTNode scopeNode = ASTInternal.getPhysicalNodeOfScope(scope);
195
					if (scopePDOMBinding != null)
182
		if (scopeNode instanceof IASTCompoundStatement)
196
						return scopePDOMBinding;
183
			return null;
197
				}
184
		else if (scopeNode instanceof IASTTranslationUnit)
185
			return this;
186
		else {
187
			IName scopeName = scope.getScopeName();
188
			if (scopeName instanceof IASTName) {
189
				IBinding scopeBinding = ((IASTName) scopeName).resolveBinding();
190
				PDOMBinding scopePDOMBinding = adaptBinding(scopeBinding);
191
				if (scopePDOMBinding != null)
192
					return scopePDOMBinding;
193
			}
198
			}
199
		} catch (DOMException e) {
200
			throw new CoreException(Util.createStatus(e));
194
		}
201
		}
195
			
196
		return null;
202
		return null;
197
	}
203
	}
198
}
204
}
(-)parser/org/eclipse/cdt/core/dom/ast/DOMException.java (-8 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2005 IBM Corporation and others.
2
 * Copyright (c) 2004, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-23 Link Here
14
 */
14
 */
15
package org.eclipse.cdt.core.dom.ast;
15
package org.eclipse.cdt.core.dom.ast;
16
16
17
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.Status;
21
17
22
/**
18
/**
23
 * This is the general purpose exception that is thrown for resolving semantic
19
 * This is the general purpose exception that is thrown for resolving semantic
Lines 25-31 Link Here
25
 * 
21
 * 
26
 * @author aniefer
22
 * @author aniefer
27
 */
23
 */
28
public class DOMException extends CoreException {
24
public class DOMException extends Exception {
29
	
25
	
30
	private static final long serialVersionUID = 0;
26
	private static final long serialVersionUID = 0;
31
	
27
	
Lines 37-44 Link Here
37
	 * 
33
	 * 
38
	 */
34
	 */
39
	public DOMException(IProblemBinding problem) {
35
	public DOMException(IProblemBinding problem) {
40
		super(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
41
				0, "DOMException", new Exception()));
42
		problemBinding = problem;
36
		problemBinding = problem;
43
	}
37
	}
44
38
(-)parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java (-5 lines)
Lines 210-220 Link Here
210
    
210
    
211
    
211
    
212
    /**
212
    /**
213
     * @return
214
     */
215
    public ParserLanguage getParserLanguage();
216
    
217
    /**
218
     * Return the Index associated with this translation unit.
213
     * Return the Index associated with this translation unit.
219
     * 
214
     * 
220
     * @return the Index for this translation unit
215
     * @return the Index for this translation unit
(-)parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java (-4 lines)
Lines 551-560 Link Here
551
		return resolver.getContainingFilename( offset );
551
		return resolver.getContainingFilename( offset );
552
	}
552
	}
553
553
554
    public ParserLanguage getParserLanguage() {
555
        return ParserLanguage.C;
556
    }
557
558
    public ILanguage getLanguage() {
554
    public ILanguage getLanguage() {
559
    	// Assuming gnu C for now.
555
    	// Assuming gnu C for now.
560
    	return new GCCLanguage();
556
    	return new GCCLanguage();
(-)utils/org/eclipse/cdt/internal/core/Util.java (-1 / +13 lines)
Lines 21-29 Link Here
21
import java.util.MissingResourceException;
21
import java.util.MissingResourceException;
22
import java.util.ResourceBundle;
22
import java.util.ResourceBundle;
23
23
24
import org.eclipse.cdt.core.CCorePlugin;
24
import org.eclipse.core.resources.IContainer;
25
import org.eclipse.core.resources.IContainer;
25
import org.eclipse.core.resources.IResource;
26
import org.eclipse.core.resources.IResource;
26
import org.eclipse.core.runtime.IPath;
27
import org.eclipse.core.runtime.IPath;
28
import org.eclipse.core.runtime.IStatus;
29
import org.eclipse.core.runtime.Status;
27
30
28
public class Util {
31
public class Util {
29
	
32
	
Lines 365-371 Link Here
365
				return true;
368
				return true;
366
		return false;
369
		return false;
367
	}
370
	}
368
		
371
	
372
	/**
373
	 * Returns an IStatus object with severity IStatus.ERROR based on the
374
	 * given Throwable.
375
	 * @param t the Throwable that caused the error.
376
	 * @return an IStatus object based on the given Throwable.
377
	 */
378
	public static IStatus createStatus(Throwable t) {
379
		return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, t.getMessage(), t);
380
	}
369
}
381
}
370
382
371
383
(-)model/org/eclipse/cdt/core/model/AbstractLanguage.java (-2 / +1 lines)
Lines 14-26 Link Here
14
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
14
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
15
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
15
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
16
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.PlatformObject;
18
17
19
/**
18
/**
20
 * Models the differences between various languages.
19
 * Models the differences between various languages.
21
 * @since 4.0
20
 * @since 4.0
22
 */
21
 */
23
public abstract class AbstractLanguage extends PlatformObject implements ILanguage {
22
public abstract class AbstractLanguage implements ILanguage {
24
	
23
	
25
	final public IASTTranslationUnit getASTTranslationUnit(ITranslationUnit file, int style) throws CoreException {
24
	final public IASTTranslationUnit getASTTranslationUnit(ITranslationUnit file, int style) throws CoreException {
26
		throw new UnsupportedOperationException();
25
		throw new UnsupportedOperationException();
(-)src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassWizardUtil.java (+3 lines)
Lines 40-45 Link Here
40
import org.eclipse.cdt.core.browser.ITypeReference;
40
import org.eclipse.cdt.core.browser.ITypeReference;
41
import org.eclipse.cdt.core.browser.TypeSearchScope;
41
import org.eclipse.cdt.core.browser.TypeSearchScope;
42
import org.eclipse.cdt.core.dom.ILinkage;
42
import org.eclipse.cdt.core.dom.ILinkage;
43
import org.eclipse.cdt.core.dom.ast.DOMException;
43
import org.eclipse.cdt.core.dom.ast.IBinding;
44
import org.eclipse.cdt.core.dom.ast.IBinding;
44
import org.eclipse.cdt.core.dom.ast.IEnumeration;
45
import org.eclipse.cdt.core.dom.ast.IEnumeration;
45
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
46
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
Lines 448-453 Link Here
448
				}
449
				}
449
			} catch (CoreException e) {
450
			} catch (CoreException e) {
450
				return SEARCH_MATCH_ERROR;
451
				return SEARCH_MATCH_ERROR;
452
			} catch (DOMException e) {
453
				return SEARCH_MATCH_ERROR;
451
			}
454
			}
452
			return SEARCH_MATCH_NOTFOUND;
455
			return SEARCH_MATCH_NOTFOUND;
453
		}
456
		}
(-)src/org/eclipse/cdt/internal/ui/IndexLabelProvider.java (-1 / +3 lines)
Lines 8-17 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * QNX - Initial API and implementation
9
 * QNX - Initial API and implementation
10
 * Markus Schorn (Wind River Systems)
10
 * Markus Schorn (Wind River Systems)
11
 * IBM Corporation
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
package org.eclipse.cdt.internal.ui;
14
package org.eclipse.cdt.internal.ui;
14
15
16
import org.eclipse.cdt.core.dom.ast.DOMException;
15
import org.eclipse.cdt.core.dom.ast.ICompositeType;
17
import org.eclipse.cdt.core.dom.ast.ICompositeType;
16
import org.eclipse.cdt.core.dom.ast.IFunction;
18
import org.eclipse.cdt.core.dom.ast.IFunction;
17
import org.eclipse.cdt.core.dom.ast.IVariable;
19
import org.eclipse.cdt.core.dom.ast.IVariable;
Lines 71-77 Link Here
71
					desc = CElementImageProvider.getUnionImageDescriptor();
73
					desc = CElementImageProvider.getUnionImageDescriptor();
72
					break;
74
					break;
73
				}
75
				}
74
			} catch (CoreException e) {
76
			} catch (DOMException e) {
75
				CUIPlugin.getDefault().log(e);
77
				CUIPlugin.getDefault().log(e);
76
			}
78
			}
77
		}
79
		}
(-)src/org/eclipse/cdt/internal/ui/search/PDOMSearchPatternQuery.java (+6 lines)
Lines 24-29 Link Here
24
import org.eclipse.core.runtime.OperationCanceledException;
24
import org.eclipse.core.runtime.OperationCanceledException;
25
import org.eclipse.core.runtime.Status;
25
import org.eclipse.core.runtime.Status;
26
26
27
import org.eclipse.cdt.core.dom.ast.DOMException;
27
import org.eclipse.cdt.core.dom.ast.ICompositeType;
28
import org.eclipse.cdt.core.dom.ast.ICompositeType;
28
import org.eclipse.cdt.core.dom.ast.IEnumeration;
29
import org.eclipse.cdt.core.dom.ast.IEnumeration;
29
import org.eclipse.cdt.core.dom.ast.IEnumerator;
30
import org.eclipse.cdt.core.dom.ast.IEnumerator;
Lines 40-45 Link Here
40
import org.eclipse.cdt.core.index.IndexFilter;
41
import org.eclipse.cdt.core.index.IndexFilter;
41
import org.eclipse.cdt.core.model.ICElement;
42
import org.eclipse.cdt.core.model.ICElement;
42
43
44
import org.eclipse.cdt.internal.core.Util;
45
43
import org.eclipse.cdt.internal.ui.util.Messages;
46
import org.eclipse.cdt.internal.ui.util.Messages;
44
47
45
/**
48
/**
Lines 177-183 Link Here
177
			}
180
			}
178
		} catch (CoreException e) {
181
		} catch (CoreException e) {
179
			return e.getStatus();
182
			return e.getStatus();
183
		} catch (DOMException e) {
184
			return Util.createStatus(e);
180
		}
185
		}
186
		
181
		return Status.OK_STATUS;
187
		return Status.OK_STATUS;
182
	}
188
	}
183
189
(-)src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java (-4 / +6 lines)
Lines 12-18 Link Here
12
12
13
package org.eclipse.cdt.internal.ui.editor;
13
package org.eclipse.cdt.internal.ui.editor;
14
14
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
17
import org.eclipse.core.runtime.Status;
16
import org.eclipse.jface.preference.IPreferenceStore;
18
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.jface.preference.PreferenceConverter;
19
import org.eclipse.jface.preference.PreferenceConverter;
18
import org.eclipse.jface.util.PropertyChangeEvent;
20
import org.eclipse.jface.util.PropertyChangeEvent;
Lines 312-318 Link Here
312
				try {
314
				try {
313
					return ((IField)binding).isStatic();
315
					return ((IField)binding).isStatic();
314
				} catch (DOMException exc) {
316
				} catch (DOMException exc) {
315
					CUIPlugin.getDefault().log(exc.getStatus());
317
					CUIPlugin.getDefault().log(exc);
316
				} catch (Error e) /* PDOMNotImplementedError */ {
318
				} catch (Error e) /* PDOMNotImplementedError */ {
317
					// ignore
319
					// ignore
318
				}
320
				}
Lines 945-951 Link Here
945
								return true;
947
								return true;
946
							}
948
							}
947
						} catch (DOMException exc) {
949
						} catch (DOMException exc) {
948
							CUIPlugin.getDefault().log(exc.getStatus());
950
							CUIPlugin.getDefault().log(exc);
949
						} catch (Error e) /* PDOMNotImplementedError */ {
951
						} catch (Error e) /* PDOMNotImplementedError */ {
950
							// ignore
952
							// ignore
951
						}
953
						}
Lines 1023-1029 Link Here
1023
								return true;
1025
								return true;
1024
							}
1026
							}
1025
						} catch (DOMException exc) {
1027
						} catch (DOMException exc) {
1026
							CUIPlugin.getDefault().log(exc.getStatus());
1028
							CUIPlugin.getDefault().log(exc);
1027
						} catch (Error e) /* PDOMNotImplementedError */ {
1029
						} catch (Error e) /* PDOMNotImplementedError */ {
1028
							// ignore
1030
							// ignore
1029
						}
1031
						}
Lines 1112-1118 Link Here
1112
						return true;
1114
						return true;
1113
					}
1115
					}
1114
				} catch (DOMException exc) {
1116
				} catch (DOMException exc) {
1115
					CUIPlugin.getDefault().log(exc.getStatus());
1117
					CUIPlugin.getDefault().log(exc);
1116
				} catch (Error e) /* PDOMNotImplementedError */ {
1118
				} catch (Error e) /* PDOMNotImplementedError */ {
1117
					// ignore
1119
					// ignore
1118
				}
1120
				}
(-)parser/org/eclipse/cdt/internal/pdom/tests/CPPFieldTests.java (-1 / +2 lines)
Lines 14-19 Link Here
14
import junit.framework.Test;
14
import junit.framework.Test;
15
15
16
import org.eclipse.cdt.core.CCorePlugin;
16
import org.eclipse.cdt.core.CCorePlugin;
17
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IBasicType;
18
import org.eclipse.cdt.core.dom.ast.IBasicType;
18
import org.eclipse.cdt.core.dom.ast.IBinding;
19
import org.eclipse.cdt.core.dom.ast.IBinding;
19
import org.eclipse.cdt.core.dom.ast.IField;
20
import org.eclipse.cdt.core.dom.ast.IField;
Lines 120-126 Link Here
120
		assertFieldType(pdom, "Class2::c2b", IBasicType.t_float);
121
		assertFieldType(pdom, "Class2::c2b", IBasicType.t_float);
121
	}
122
	}
122
123
123
	private void assertFieldType(PDOM pdom, String name, int type) throws CoreException {
124
	private void assertFieldType(PDOM pdom, String name, int type) throws CoreException, DOMException {
124
		IBinding[] bindings = findQualifiedName(pdom, name);
125
		IBinding[] bindings = findQualifiedName(pdom, name);
125
		assertEquals(1, bindings.length);
126
		assertEquals(1, bindings.length);
126
		IField field = (IField) bindings[0];
127
		IField field = (IField) bindings[0];
(-)parser/org/eclipse/cdt/internal/pdom/tests/CPPFunctionTests.java (-1 / +2 lines)
Lines 14-19 Link Here
14
import junit.framework.Test;
14
import junit.framework.Test;
15
15
16
import org.eclipse.cdt.core.CCorePlugin;
16
import org.eclipse.cdt.core.CCorePlugin;
17
import org.eclipse.cdt.core.dom.ast.DOMException;
17
import org.eclipse.cdt.core.dom.ast.IBasicType;
18
import org.eclipse.cdt.core.dom.ast.IBasicType;
18
import org.eclipse.cdt.core.dom.ast.IBinding;
19
import org.eclipse.cdt.core.dom.ast.IBinding;
19
import org.eclipse.cdt.core.dom.ast.IFunction;
20
import org.eclipse.cdt.core.dom.ast.IFunction;
Lines 177-183 Link Here
177
		}
178
		}
178
	}
179
	}
179
180
180
	private void assertReturnType(PDOM pdom, String name, int type) throws CoreException {
181
	private void assertReturnType(PDOM pdom, String name, int type) throws CoreException, DOMException {
181
		IBinding[] bindings = findQualifiedName(pdom, name);
182
		IBinding[] bindings = findQualifiedName(pdom, name);
182
		assertEquals(1, bindings.length);
183
		assertEquals(1, bindings.length);
183
		IFunction function = (IFunction) bindings[0];
184
		IFunction function = (IFunction) bindings[0];
(-)parser/org/eclipse/cdt/internal/pdom/tests/PDOMTestBase.java (-1 / +2 lines)
Lines 21-26 Link Here
21
import org.eclipse.cdt.core.CCorePlugin;
21
import org.eclipse.cdt.core.CCorePlugin;
22
import org.eclipse.cdt.core.dom.IName;
22
import org.eclipse.cdt.core.dom.IName;
23
import org.eclipse.cdt.core.dom.IPDOMManager;
23
import org.eclipse.cdt.core.dom.IPDOMManager;
24
import org.eclipse.cdt.core.dom.ast.DOMException;
24
import org.eclipse.cdt.core.dom.ast.IBinding;
25
import org.eclipse.cdt.core.dom.ast.IBinding;
25
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
26
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
26
import org.eclipse.cdt.core.index.IndexFilter;
27
import org.eclipse.cdt.core.index.IndexFilter;
Lines 167-173 Link Here
167
		assertTrue(c.isAssignableFrom(bindings[0].getClass()));
168
		assertTrue(c.isAssignableFrom(bindings[0].getClass()));
168
	}
169
	}
169
170
170
	protected void assertVisibility(PDOM pdom, String name, int visibility) throws CoreException {
171
	protected void assertVisibility(PDOM pdom, String name, int visibility) throws CoreException, DOMException {
171
		IBinding[] bindings = findQualifiedName(pdom, name);
172
		IBinding[] bindings = findQualifiedName(pdom, name);
172
		assertEquals(1, bindings.length);
173
		assertEquals(1, bindings.length);
173
		ICPPMember member = (ICPPMember) bindings[0];
174
		ICPPMember member = (ICPPMember) bindings[0];

Return to bug 160884