1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-17 13:15:44 +02:00

Comment adjustments.

This commit is contained in:
Sergey Prigogin 2009-10-11 06:22:33 +00:00
parent 8ca2d38570
commit 76f3a77313
5 changed files with 30 additions and 23 deletions

View file

@ -656,7 +656,7 @@ public class ASTTypeUtil {
result.addFirst(getNameForAnonymous(binding)); result.addFirst(getNameForAnonymous(binding));
IBinding owner= binding.getOwner(); IBinding owner= binding.getOwner();
while(owner instanceof ICPPNamespace || owner instanceof IType) { while (owner instanceof ICPPNamespace || owner instanceof IType) {
char[] name= owner.getNameCharArray(); char[] name= owner.getNameCharArray();
if (name == null || name.length == 0) { if (name == null || name.length == 0) {
if (!(binding instanceof ICPPNamespace)) { if (!(binding instanceof ICPPNamespace)) {
@ -721,7 +721,6 @@ public class ASTTypeUtil {
return null; return null;
} }
private static int findFileNameStart(char[] fname) { private static int findFileNameStart(char[] fname) {
for (int i= fname.length - 2; i >= 0; i--) { for (int i= fname.length - 2; i >= 0; i--) {
switch (fname[i]) { switch (fname[i]) {

View file

@ -9,6 +9,7 @@
* Andrew Niefer (IBM Corporation) - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser; package org.eclipse.cdt.internal.core.dom.parser;

View file

@ -1643,7 +1643,7 @@ public class CVisitor extends ASTQueries {
* Searches for the function enclosing the given node. May return <code>null</code>. * Searches for the function enclosing the given node. May return <code>null</code>.
*/ */
public static IBinding findEnclosingFunction(IASTNode node) { public static IBinding findEnclosingFunction(IASTNode node) {
while(node != null && node instanceof IASTFunctionDefinition == false) { while (node != null && !(node instanceof IASTFunctionDefinition)) {
node= node.getParent(); node= node.getParent();
} }
if (node == null) if (node == null)

View file

@ -34,9 +34,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
/** /**
* Helper class for performing the base class lookup. First a directed graph without loops is computed to represent the base * Helper class for performing the base class lookup. First a directed graph without loops is computed
* class hierarchy up to those bases for which the lookup finds matches. Next, from these leaves we search for virtual bases * to represent the base class hierarchy up to those bases for which the lookup finds matches. Next, from
* that are hidden. With this information the matches are extracted from the graph. * these leaves we search for virtual bases that are hidden. With this information the matches are extracted
* from the graph.
*/ */
class BaseClassLookup { class BaseClassLookup {
public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope, IIndexFileSet fileSet) { public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope, IIndexFileSet fileSet) {
@ -108,7 +109,7 @@ class BaseClassLookup {
if (fPropagationDone) if (fPropagationDone)
return; return;
fPropagationDone= true; fPropagationDone= true;
for (int i=0; i<fChildren.size(); i++) { for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i); BaseClassLookup child = fChildren.get(i);
if (fVirtual.get(i)) { if (fVirtual.get(i)) {
child.setHiddenAsVirtualBase(); child.setHiddenAsVirtualBase();
@ -133,7 +134,8 @@ class BaseClassLookup {
return false; return false;
} }
static BaseClassLookup lookupInBaseClass(LookupData data, ICPPClassScope baseClassScope, boolean isVirtual, ICPPClassType root, IIndexFileSet fileSet, HashMap<IScope, BaseClassLookup> infoMap, int depth) { static BaseClassLookup lookupInBaseClass(LookupData data, ICPPClassScope baseClassScope, boolean isVirtual,
ICPPClassType root, IIndexFileSet fileSet, HashMap<IScope, BaseClassLookup> infoMap, int depth) {
if (depth++ > CPPSemantics.MAX_INHERITANCE_DEPTH) if (depth++ > CPPSemantics.MAX_INHERITANCE_DEPTH)
return null; return null;
@ -142,7 +144,8 @@ class BaseClassLookup {
if (info != null) { if (info != null) {
// avoid loops // avoid loops
if (info.getResult() == null) { if (info.getResult() == null) {
data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, root.getNameCharArray()); data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE,
root.getNameCharArray());
return null; return null;
} }
return info; return info;
@ -180,7 +183,8 @@ class BaseClassLookup {
} }
} }
// there is no result in the baseClass itself or we do content assist, we have to examine its base-classes // There is no result in the baseClass itself or we do content assist, we have to examine its
// base-classes
ICPPClassType baseClass= result.getClassType(); ICPPClassType baseClass= result.getClassType();
if (baseClass != null) { if (baseClass != null) {
ICPPBase[] grandBases= null; ICPPBase[] grandBases= null;
@ -220,7 +224,8 @@ class BaseClassLookup {
if (!(grandBaseScope instanceof ICPPClassScope)) if (!(grandBaseScope instanceof ICPPClassScope))
continue; continue;
BaseClassLookup baseInfo= lookupInBaseClass(data, (ICPPClassScope) grandBaseScope, grandBase.isVirtual(), root, fileSet, infoMap, depth); BaseClassLookup baseInfo= lookupInBaseClass(data, (ICPPClassScope) grandBaseScope,
grandBase.isVirtual(), root, fileSet, infoMap, depth);
if (baseInfo != null) if (baseInfo != null)
result.addBase(grandBase.isVirtual(), baseInfo); result.addBase(grandBase.isVirtual(), baseInfo);
} catch (DOMException e) { } catch (DOMException e) {
@ -232,6 +237,7 @@ class BaseClassLookup {
result.setResult(matches); result.setResult(matches);
return result; return result;
} }
static void hideVirtualBases(BaseClassLookup rootInfo, HashMap<IScope, BaseClassLookup> infoMap) { static void hideVirtualBases(BaseClassLookup rootInfo, HashMap<IScope, BaseClassLookup> infoMap) {
boolean containsVirtualBase= false; boolean containsVirtualBase= false;
final BaseClassLookup[] allInfos = infoMap.values().toArray(new BaseClassLookup[infoMap.size()]); final BaseClassLookup[] allInfos = infoMap.values().toArray(new BaseClassLookup[infoMap.size()]);
@ -302,7 +308,7 @@ class BaseClassLookup {
fCollected= true; fCollected= true;
data.foundItems = CPPSemantics.mergePrefixResults((CharArrayObjectMap) data.foundItems, fBindings, true); data.foundItems = CPPSemantics.mergePrefixResults((CharArrayObjectMap) data.foundItems, fBindings, true);
for (int i=0; i<fChildren.size(); i++) { for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i); BaseClassLookup child = fChildren.get(i);
child.collectResultForContentAssist(data); child.collectResultForContentAssist(data);
} }
@ -324,7 +330,7 @@ class BaseClassLookup {
fCollected= true; fCollected= true;
result= (IBinding[]) ArrayUtil.addAll(IBinding.class, result, fBindings); result= (IBinding[]) ArrayUtil.addAll(IBinding.class, result, fBindings);
for (int i=0; i<fChildren.size(); i++) { for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i); BaseClassLookup child = fChildren.get(i);
result= child.collectResult(data, fVirtual.get(i), result); result= child.collectResult(data, fVirtual.get(i), result);
} }
@ -349,7 +355,8 @@ class BaseClassLookup {
if (uniqueOwner == null) { if (uniqueOwner == null) {
uniqueOwner= classOwner; uniqueOwner= classOwner;
} else if (!uniqueOwner.isSameType(classOwner)) { } else if (!uniqueOwner.isSameType(classOwner)) {
data.problem= new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, bindings); data.problem= new ProblemBinding(data.astName,
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, bindings);
return; return;
} }
} }

View file

@ -83,12 +83,9 @@ public class LookupData {
protected CPPASTTranslationUnit tu; protected CPPASTTranslationUnit tu;
public Map<ICPPNamespaceScope, List<ICPPNamespaceScope>> usingDirectives= Collections.emptyMap(); public Map<ICPPNamespaceScope, List<ICPPNamespaceScope>> usingDirectives= Collections.emptyMap();
/* /** Used to ensure we don't visit things more than once. */
* Used to ensure we don't visit things more than once
*/
public ObjectSet<IScope> visited= new ObjectSet<IScope>(1); public ObjectSet<IScope> visited= new ObjectSet<IScope>(1);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public ObjectSet<IScope> associated = ObjectSet.EMPTY_SET; public ObjectSet<IScope> associated = ObjectSet.EMPTY_SET;
@ -101,9 +98,12 @@ public class LookupData {
public boolean prefixLookup = false; public boolean prefixLookup = false;
public boolean typesOnly = false; public boolean typesOnly = false;
public boolean considerConstructors = false; public boolean considerConstructors = false;
public boolean checkPointOfDecl= true; // for lookup of unknown bindings the point of declaration can be reversed. /** For lookup of unknown bindings the point of declaration can be reversed. */
public boolean usesEnclosingScope= true; // for field references or qualified names, enclosing template declarations are ignored. public boolean checkPointOfDecl= true;
public boolean firstArgIsImpliedMethodArg = false; // when computing the cost of a method call treat the first argument as the implied method argument /** For field references or qualified names, enclosing template declarations are ignored. */
public boolean usesEnclosingScope= true;
/** When computing the cost of a method call, treat the first argument as the implied method argument. */
public boolean firstArgIsImpliedMethodArg = false;
public boolean ignoreMembers = false; public boolean ignoreMembers = false;
public ICPPClassType skippedScope; public ICPPClassType skippedScope;