1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 23:45:23 +02:00

Bug 513345 - A lot of time during indexing is spent inside

CompositeValue.create

Minor code cleanup.

Change-Id: I92ea01711034df5fa88cd41a81a54450fdb0ba6c
This commit is contained in:
Sergey Prigogin 2017-03-10 11:52:02 -08:00
parent 5b22093f47
commit 1735a17c5e

View file

@ -376,7 +376,9 @@ public abstract class PDOMWriter implements IPDOMASTProcessor {
try { try {
final IBinding binding = name.resolveBinding(); final IBinding binding = name.resolveBinding();
if (binding instanceof ICPPInternalDeclaredVariable) { if (binding instanceof ICPPInternalDeclaredVariable) {
variables.add((ICPPInternalDeclaredVariable) binding); ICPPInternalDeclaredVariable variable = (ICPPInternalDeclaredVariable) binding;
if (variables.add(variable))
variable.allDeclarationsDefinitionsAdded();
} }
if (name.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME && if (name.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME &&
@ -424,7 +426,6 @@ public abstract class PDOMWriter implements IPDOMASTProcessor {
// Precalculate types and initial values of all indexed variables to avoid doing it later when writing // Precalculate types and initial values of all indexed variables to avoid doing it later when writing
// to the index. // to the index.
for (ICPPInternalDeclaredVariable variable : variables) { for (ICPPInternalDeclaredVariable variable : variables) {
variable.allDeclarationsDefinitionsAdded();
if (isVariableIndexed(variable)) { if (isVariableIndexed(variable)) {
// Type and initial value will be cached by the variable. // Type and initial value will be cached by the variable.
variable.getType(); variable.getType();
@ -439,7 +440,7 @@ public abstract class PDOMWriter implements IPDOMASTProcessor {
if (variable instanceof ICPPField) if (variable instanceof ICPPField)
return true; return true;
IBinding owner = variable.getOwner(); IBinding owner = variable.getOwner();
if (owner == null || owner instanceof IASTTranslationUnit || owner instanceof ICPPNamespace) if (owner == null || owner instanceof ICPPNamespace)
return true; return true;
return owner instanceof ICPPFunction && ((ICPPFunction) owner).isConstexpr(); return owner instanceof ICPPFunction && ((ICPPFunction) owner).isConstexpr();
} }