1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +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

@ -650,13 +650,13 @@ public class ASTTypeUtil {
return false;
}
}
private static String[] getQualifiedNameForAnonymous(ICPPBinding binding, boolean normalize) throws DOMException {
LinkedList<String> result= new LinkedList<String>();
result.addFirst(getNameForAnonymous(binding));
IBinding owner= binding.getOwner();
while(owner instanceof ICPPNamespace || owner instanceof IType) {
while (owner instanceof ICPPNamespace || owner instanceof IType) {
char[] name= owner.getNameCharArray();
if (name == null || name.length == 0) {
if (!(binding instanceof ICPPNamespace)) {
@ -721,7 +721,6 @@ public class ASTTypeUtil {
return null;
}
private static int findFileNameStart(char[] fname) {
for (int i= fname.length - 2; i >= 0; i--) {
switch (fname[i]) {

View file

@ -9,6 +9,7 @@
* Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
*******************************************************************************/
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>.
*/
public static IBinding findEnclosingFunction(IASTNode node) {
while(node != null && node instanceof IASTFunctionDefinition == false) {
while (node != null && !(node instanceof IASTFunctionDefinition)) {
node= node.getParent();
}
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;
/**
* Helper class for performing the base class lookup. First a directed graph without loops is computed to represent the base
* class hierarchy up to those bases for which the lookup finds matches. Next, from these leaves we search for virtual bases
* that are hidden. With this information the matches are extracted from the graph.
* Helper class for performing the base class lookup. First a directed graph without loops is computed
* to represent the base class hierarchy up to those bases for which the lookup finds matches. Next, from
* these leaves we search for virtual bases that are hidden. With this information the matches are extracted
* from the graph.
*/
class BaseClassLookup {
public static void lookupInBaseClasses(LookupData data, ICPPClassScope classScope, IIndexFileSet fileSet) {
@ -108,7 +109,7 @@ class BaseClassLookup {
if (fPropagationDone)
return;
fPropagationDone= true;
for (int i=0; i<fChildren.size(); i++) {
for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i);
if (fVirtual.get(i)) {
child.setHiddenAsVirtualBase();
@ -133,7 +134,8 @@ class BaseClassLookup {
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)
return null;
@ -142,7 +144,8 @@ class BaseClassLookup {
if (info != null) {
// avoid loops
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 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();
if (baseClass != null) {
ICPPBase[] grandBases= null;
@ -220,7 +224,8 @@ class BaseClassLookup {
if (!(grandBaseScope instanceof ICPPClassScope))
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)
result.addBase(grandBase.isVirtual(), baseInfo);
} catch (DOMException e) {
@ -232,6 +237,7 @@ class BaseClassLookup {
result.setResult(matches);
return result;
}
static void hideVirtualBases(BaseClassLookup rootInfo, HashMap<IScope, BaseClassLookup> infoMap) {
boolean containsVirtualBase= false;
final BaseClassLookup[] allInfos = infoMap.values().toArray(new BaseClassLookup[infoMap.size()]);
@ -302,7 +308,7 @@ class BaseClassLookup {
fCollected= 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);
child.collectResultForContentAssist(data);
}
@ -324,7 +330,7 @@ class BaseClassLookup {
fCollected= true;
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);
result= child.collectResult(data, fVirtual.get(i), result);
}
@ -349,7 +355,8 @@ class BaseClassLookup {
if (uniqueOwner == null) {
uniqueOwner= 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;
}
}

View file

@ -83,12 +83,9 @@ public class LookupData {
protected CPPASTTranslationUnit tu;
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);
@SuppressWarnings("unchecked")
public ObjectSet<IScope> associated = ObjectSet.EMPTY_SET;
@ -101,9 +98,12 @@ public class LookupData {
public boolean prefixLookup = false;
public boolean typesOnly = false;
public boolean considerConstructors = false;
public boolean checkPointOfDecl= true; // 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 firstArgIsImpliedMethodArg = false; // when computing the cost of a method call treat the first argument as the implied method argument
/** For lookup of unknown bindings the point of declaration can be reversed. */
public boolean checkPointOfDecl= true;
/** 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 ICPPClassType skippedScope;