Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63901 Details for
Bug 167098
Index: no support for templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
method and constructor templates
patch167098v3.txt (text/plain), 51.95 KB, created by
Bryan Wilkinson
on 2007-04-16 09:48:56 EDT
(
hide
)
Description:
method and constructor templates
Filename:
MIME Type:
Creator:
Bryan Wilkinson
Created:
2007-04-16 09:48:56 EDT
Size:
51.95 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui.tests >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java,v >retrieving revision 1.11 >diff -u -r1.11 CompletionTests.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java 4 Apr 2007 11:26:54 -0000 1.11 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java 16 Apr 2007 13:41:54 -0000 >@@ -650,7 +650,7 @@ > } > > //void gfunc(){C3 c3; c3.t/*cursor*/ >- public void _testTemplateMethod() throws Exception { >+ public void testTemplateMethod() throws Exception { > // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172436 > final String[] expected= { > "tConvert(void)" >#P org.eclipse.cdt.core >Index: parser/org/eclipse/cdt/internal/core/pdom/PDOM.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java,v >retrieving revision 1.66 >diff -u -r1.66 PDOM.java >--- parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 10 Apr 2007 18:02:13 -0000 1.66 >+++ parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 16 Apr 2007 13:41:56 -0000 >@@ -72,7 +72,7 @@ > public class PDOM extends PlatformObject implements IIndexFragment, IPDOM { > protected Database db; > >- public static final int VERSION = 29; >+ public static final int VERSION = 30; > // 0 - the beginning of it all > // 1 - first change to kick off upgrades > // 2 - added file inclusions >@@ -103,6 +103,7 @@ > // 27 - templates: classes, functions, limited nesting support, only template type parameters > // 28 - templates: class instance/specialization base classes > // 29 - includes: fixed modelling of unresolved includes (180159) >+ // 30 - templates: method/constructor templates, typedef specializations > > public static final int LINKAGES = Database.DATA_AREA; > public static final int FILE_INDEX = Database.DATA_AREA + 4; >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java,v >retrieving revision 1.2 >diff -u -r1.2 PDOMCPPClassTemplateSpecialization.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java 4 Apr 2007 15:30:06 -0000 1.2 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java 16 Apr 2007 13:41:56 -0000 >@@ -24,6 +24,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance; > import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates; > import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator; > import org.eclipse.cdt.internal.core.pdom.PDOM; >@@ -36,7 +37,7 @@ > * @author Bryan Wilkinson > * > */ >-public class PDOMCPPClassTemplateSpecialization extends >+class PDOMCPPClassTemplateSpecialization extends > PDOMCPPClassSpecialization implements ICPPClassTemplate, ICPPInternalTemplateInstantiator { > > private static final int INSTANCES = PDOMCPPClassSpecialization.RECORD_SIZE + 0; >@@ -74,7 +75,11 @@ > } > > public ICPPSpecialization deferredInstance(IType[] arguments) { >- return getInstance( arguments ); >+ ICPPSpecialization instance = getInstance( arguments ); >+ if( instance == null ){ >+ instance = new CPPDeferredClassInstance( this, arguments ); >+ } >+ return instance; > } > > private static class InstanceFinder implements IPDOMVisitor { >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java,v >retrieving revision 1.2 >diff -u -r1.2 PDOMCPPFunctionTemplate.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java 4 Apr 2007 15:30:06 -0000 1.2 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java 16 Apr 2007 13:41:56 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope; > import org.eclipse.cdt.core.index.IIndexBinding; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredFunctionInstance; > import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics; > import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates; > import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator; >@@ -43,7 +44,7 @@ > * @author Bryan Wilkinson > * > */ >-public class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements >+class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements > ICPPFunctionTemplate, ICPPInternalTemplateInstantiator, > IPDOMMemberOwner, ICPPTemplateScope, IIndexScope { > >@@ -101,7 +102,11 @@ > } > > public ICPPSpecialization deferredInstance(IType[] arguments) { >- return getInstance(arguments); >+ ICPPSpecialization instance = getInstance(arguments); >+ if( instance == null ){ >+ instance = new CPPDeferredFunctionInstance( this, arguments ); >+ } >+ return instance; > } > > private static class InstanceFinder implements IPDOMVisitor { >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPOverloaderUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPOverloaderUtil.java,v >retrieving revision 1.3 >diff -u -r1.3 PDOMCPPOverloaderUtil.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPOverloaderUtil.java 4 Apr 2007 15:30:06 -0000 1.3 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPOverloaderUtil.java 16 Apr 2007 13:41:56 -0000 >@@ -36,7 +36,7 @@ > * > * @author Bryan Wilkinson > */ >-public class PDOMCPPOverloaderUtil { >+class PDOMCPPOverloaderUtil { > > /** > * Returns the signature for the binding. Returns an empty string if a >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java,v >retrieving revision 1.68 >diff -u -r1.68 PDOMCPPLinkage.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java 13 Apr 2007 16:35:08 -0000 1.68 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java 16 Apr 2007 13:41:56 -0000 >@@ -48,7 +48,6 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; >-import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; >@@ -109,44 +108,51 @@ > public static final int CPP_CONSTRUCTOR= PDOMLinkage.LAST_NODE_TYPE + 14; > public static final int CPP_REFERENCE_TYPE= PDOMLinkage.LAST_NODE_TYPE + 15; > public static final int CPP_FUNCTION_TEMPLATE= PDOMLinkage.LAST_NODE_TYPE + 16; >- public static final int CPP_CLASS_TEMPLATE= PDOMLinkage.LAST_NODE_TYPE + 17; >- public static final int CPP_CLASS_TEMPLATE_PARTIAL_SPEC= PDOMLinkage.LAST_NODE_TYPE + 18; >- public static final int CPP_FUNCTION_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 19; >- public static final int CPP_DEFERRED_FUNCTION_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 20; >- public static final int CPP_CLASS_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 21; >- public static final int CPP_DEFERRED_CLASS_INSTANCE= PDOMCPPLinkage.LAST_NODE_TYPE + 22; >- public static final int CPP_TEMPLATE_TYPE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 23; >- public static final int CPP_TEMPLATE_NON_TYPE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 24; >- public static final int CPP_PARAMETER_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 25; >- public static final int CPP_FIELD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 26; >- public static final int CPP_FUNCTION_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 27; >- public static final int CPP_METHOD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 28; >- public static final int CPP_CONSTRUCTOR_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 29; >- public static final int CPP_CLASS_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 30; >- public static final int CPP_CLASS_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 31; >+ public static final int CPP_METHOD_TEMPLATE= PDOMLinkage.LAST_NODE_TYPE + 17; >+ public static final int CPP_CONSTRUCTOR_TEMPLATE= PDOMLinkage.LAST_NODE_TYPE + 18; >+ public static final int CPP_CLASS_TEMPLATE= PDOMLinkage.LAST_NODE_TYPE + 19; >+ public static final int CPP_CLASS_TEMPLATE_PARTIAL_SPEC= PDOMLinkage.LAST_NODE_TYPE + 20; >+ public static final int CPP_FUNCTION_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 21; >+ public static final int CPP_METHOD_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 22; >+ public static final int CPP_DEFERRED_FUNCTION_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 23; >+ public static final int CPP_CLASS_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 24; >+ public static final int CPP_DEFERRED_CLASS_INSTANCE= PDOMCPPLinkage.LAST_NODE_TYPE + 25; >+ public static final int CPP_TEMPLATE_TYPE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 26; >+ public static final int CPP_TEMPLATE_TEMPLATE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 27; >+ public static final int CPP_TEMPLATE_NON_TYPE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 28; >+ public static final int CPP_PARAMETER_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 29; >+ public static final int CPP_FIELD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 30; >+ public static final int CPP_FUNCTION_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 31; >+ public static final int CPP_METHOD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 32; >+ public static final int CPP_CONSTRUCTOR_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 33; >+ public static final int CPP_CLASS_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 34; >+ public static final int CPP_FUNCTION_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 35; >+ public static final int CPP_METHOD_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 36; >+ public static final int CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 37; >+ public static final int CPP_CLASS_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 38; >+ public static final int CPP_TYPEDEF_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 39; > > private class ConfigureTemplate implements Runnable { >- PDOMBinding template; >- ICPPTemplateDefinition binding; >+ ICPPTemplateDefinition template; > >- public ConfigureTemplate(PDOMBinding template, ICPPTemplateDefinition binding) { >+ public ConfigureTemplate(ICPPTemplateDefinition template) { > this.template = template; >- this.binding = binding; > } > > public void run() { > try { >- ICPPTemplateParameter[] params = binding.getTemplateParameters(); >+ ICPPTemplateParameter[] params = template.getTemplateParameters(); > for (int i = 0; i < params.length; i++) { > if (params[i] != null && !(params[i] instanceof ProblemBinding)) { > addBinding(params[i]); > } > } > } catch (CoreException e) { >+ CCorePlugin.log(e); > } catch (DOMException e) { >+ CCorePlugin.log(e); > } finally { > template = null; >- binding = null; > } > } > } >@@ -167,7 +173,9 @@ > partial.addArgument(args[i]); > } > } catch (CoreException e) { >+ CCorePlugin.log(e); > } catch (DOMException e) { >+ CCorePlugin.log(e); > } finally { > partial = null; > binding = null; >@@ -197,7 +205,9 @@ > template.setFirstParameter(new PDOMCPPParameter(pdom, PDOMCPPLinkage.this, params[i], pt)); > } > } catch (CoreException e) { >+ CCorePlugin.log(e); > } catch (DOMException e) { >+ CCorePlugin.log(e); > } finally { > template = null; > binding = null; >@@ -289,7 +299,10 @@ > parent, (ICPPClassType) binding, pdomSpecialized); > } > } else if (binding instanceof ICPPTemplateInstance) { >- if (binding instanceof ICPPFunction && pdomSpecialized instanceof ICPPFunction) { >+ if (binding instanceof ICPPMethod && pdomSpecialized instanceof ICPPMethod) { >+ pdomBinding = new PDOMCPPMethodInstance(pdom, parent, >+ (ICPPMethod) binding, pdomSpecialized); >+ } else if (binding instanceof ICPPFunction && pdomSpecialized instanceof ICPPFunction) { > pdomBinding = new PDOMCPPFunctionInstance(pdom, parent, > (ICPPFunction) binding, pdomSpecialized); > } else if (binding instanceof ICPPClassType && pdomSpecialized instanceof ICPPClassType) { >@@ -309,6 +322,17 @@ > } else if (binding instanceof ICPPMethod) { > pdomBinding = new PDOMCPPMethodSpecialization(pdom, parent, > (ICPPMethod) binding, pdomSpecialized); >+ } else if (binding instanceof ICPPFunctionTemplate) { >+ if (binding instanceof ICPPConstructor) { >+ pdomBinding = new PDOMCPPConstructorTemplateSpecialization( >+ pdom, parent, (ICPPConstructor) binding, pdomSpecialized); >+ } else if (binding instanceof ICPPMethod) { >+ pdomBinding = new PDOMCPPMethodTemplateSpecialization( >+ pdom, parent, (ICPPMethod) binding, pdomSpecialized); >+ } else if (binding instanceof ICPPFunction) { >+ pdomBinding = new PDOMCPPFunctionTemplateSpecialization( >+ pdom, parent, (ICPPFunctionTemplate) binding, pdomSpecialized); >+ } > } else if (binding instanceof ICPPFunction) { > pdomBinding = new PDOMCPPFunctionSpecialization(pdom, parent, > (ICPPFunction) binding, pdomSpecialized); >@@ -318,7 +342,20 @@ > } else if (binding instanceof ICPPClassType) { > pdomBinding = new PDOMCPPClassSpecialization(pdom, parent, > (ICPPClassType) binding, pdomSpecialized); >- } >+ } else if (binding instanceof ITypedef) { >+ pdomBinding = new PDOMCPPTypedefSpecialization(pdom, parent, >+ (ITypedef) binding, pdomSpecialized); >+ } >+ } else if (binding instanceof ICPPTemplateParameter) { >+ if (binding instanceof ICPPTemplateTypeParameter) { >+ pdomBinding = new PDOMCPPTemplateTypeParameter(pdom, parent, (ICPPTemplateTypeParameter)binding); >+ } >+// TODO other template parameter types >+// else if (binding instanceof ICPPTemplateTemplateParameter) { >+// pdomBinding = new PDOMCPPTemplateTemplateParameter(pdom, parent, (ICPPTemplateTemplateParameter)binding); >+// } else if (binding instanceof ICPPTemplateNonTypeParameter) { >+// pdomBinding = new PDOMCPPTemplateNonTypeParameter(pdom, parent, (ICPPTemplateNonTypeParameter)binding); >+// } > } else if (binding instanceof ICPPField ) { > if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) { > pdomBinding = new PDOMCPPField(pdom, parent, (ICPPField) binding); >@@ -330,9 +367,9 @@ > } > } else if (binding instanceof ICPPFunctionTemplate) { > if (binding instanceof ICPPConstructor) { >- //TODO >+ pdomBinding= new PDOMCPPConstructorTemplate(pdom, parent, (ICPPConstructor) binding); > } else if (binding instanceof ICPPMethod) { >- //TODO >+ pdomBinding= new PDOMCPPMethodTemplate(pdom, parent, (ICPPMethod) binding); > } else if (binding instanceof ICPPFunction) { > pdomBinding= new PDOMCPPFunctionTemplate(pdom, parent, (ICPPFunctionTemplate) binding); > } >@@ -364,35 +401,32 @@ > (PDOMCPPEnumeration)pdomEnumeration); > } else if (binding instanceof ITypedef) { > pdomBinding = new PDOMCPPTypedef(pdom, parent, (ITypedef)binding); >- } else if (binding instanceof ICPPTemplateTypeParameter) { >- pdomBinding = new PDOMCPPTemplateTypeParameter(pdom, parent, (ICPPTemplateTypeParameter)binding); > } > > if(pdomBinding!=null) { > parent.addChild(pdomBinding); > } > >- pushPostProcess(pdomBinding, binding); >+ pushPostProcesses(pdomBinding, binding); > > return pdomBinding; > } > >- private void pushPostProcess(PDOMBinding pdomBinding, IBinding binding) throws CoreException, DOMException { >+ private void pushPostProcesses(PDOMBinding pdomBinding, IBinding binding) throws CoreException, DOMException { > if (pdomBinding instanceof PDOMCPPClassTemplatePartialSpecialization && > binding instanceof ICPPClassTemplatePartialSpecialization) { > PDOMCPPClassTemplatePartialSpecialization pdomSpec = (PDOMCPPClassTemplatePartialSpecialization) pdomBinding; > ICPPClassTemplatePartialSpecialization spec = (ICPPClassTemplatePartialSpecialization) binding; >- postProcesses.add(postProcesses.size(), new ConfigurePartialSpecialization(pdomSpec, spec)); >+ pushPostProcess(new ConfigurePartialSpecialization(pdomSpec, spec)); > } > if (pdomBinding instanceof PDOMCPPFunctionTemplate && binding instanceof ICPPFunction) { > PDOMCPPFunctionTemplate pdomTemplate = (PDOMCPPFunctionTemplate) pdomBinding; > ICPPFunction function = (ICPPFunction) binding; >- postProcesses.add(postProcesses.size(), new ConfigureFunctionTemplate(pdomTemplate, function)); >+ pushPostProcess(new ConfigureFunctionTemplate(pdomTemplate, function)); > } >- if ((pdomBinding instanceof PDOMCPPClassTemplate || pdomBinding instanceof PDOMCPPFunctionTemplate) && >- binding instanceof ICPPTemplateDefinition) { >+ if (pdomBinding instanceof ICPPTemplateDefinition && binding instanceof ICPPTemplateDefinition) { > ICPPTemplateDefinition template = (ICPPTemplateDefinition) binding; >- postProcesses.add(postProcesses.size(), new ConfigureTemplate(pdomBinding, template)); >+ pushPostProcess(new ConfigureTemplate(template)); > } > } > >@@ -421,7 +455,9 @@ > if (binding instanceof ICPPClassType) > return CPP_DEFERRED_CLASS_INSTANCE; > } else if (binding instanceof ICPPTemplateInstance) { >- if (binding instanceof ICPPFunction) >+ if (binding instanceof ICPPMethod) >+ return CPP_METHOD_INSTANCE; >+ else if (binding instanceof ICPPFunction) > return CPP_FUNCTION_INSTANCE; > else if (binding instanceof ICPPClassType) > return CPP_CLASS_INSTANCE; >@@ -433,12 +469,29 @@ > return CPP_CONSTRUCTOR_SPECIALIZATION; > else if (binding instanceof ICPPMethod) > return CPP_METHOD_SPECIALIZATION; >- else if (binding instanceof ICPPFunction) >+ else if (binding instanceof ICPPFunctionTemplate) { >+ if (binding instanceof ICPPConstructor) >+ return CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION; >+ else if (binding instanceof ICPPMethod) >+ return CPP_METHOD_TEMPLATE_SPECIALIZATION; >+ else if (binding instanceof ICPPFunction) >+ return CPP_FUNCTION_TEMPLATE_SPECIALIZATION; >+ } else if (binding instanceof ICPPFunction) > return CPP_FUNCTION_SPECIALIZATION; > else if (binding instanceof ICPPClassTemplate) > return CPP_CLASS_TEMPLATE_SPECIALIZATION; > else if (binding instanceof ICPPClassType) > return CPP_CLASS_SPECIALIZATION; >+ else if (binding instanceof ITypedef) >+ return CPP_TYPEDEF_SPECIALIZATION; >+ } else if (binding instanceof ICPPTemplateParameter) { >+ if (binding instanceof ICPPTemplateTypeParameter) >+ return CPP_TEMPLATE_TYPE_PARAMETER; >+// TODO other template parameter types >+// else if (binding instanceof ICPPTemplateTemplateParameter) >+// return CPP_TEMPLATE_TEMPLATE_PARAMETER; >+// else if (binding instanceof ICPPTemplateNonTypeParameter) >+// return CPP_TEMPLATE_NON_TYPE_PARAMETER; > } else if (binding instanceof ICPPField) > // this must be before variables > return CPPFIELD; >@@ -446,13 +499,12 @@ > return CPPVARIABLE; > else if (binding instanceof ICPPFunctionTemplate) { > // this must be before functions >- if (binding instanceof ICPPConstructor) { >- //TODO >- } else if (binding instanceof ICPPMethod) { >- //TODO >- } else if (binding instanceof ICPPFunction) { >+ if (binding instanceof ICPPConstructor) >+ return CPP_CONSTRUCTOR_TEMPLATE; >+ else if (binding instanceof ICPPMethod) >+ return CPP_METHOD_TEMPLATE; >+ else if (binding instanceof ICPPFunction) > return CPP_FUNCTION_TEMPLATE; >- } > } else if (binding instanceof ICPPConstructor) > // before methods > return CPP_CONSTRUCTOR; >@@ -476,10 +528,6 @@ > return CPPENUMERATOR; > else if (binding instanceof ITypedef) > return CPPTYPEDEF; >- else if (binding instanceof ICPPTemplateTypeParameter) >- return CPP_TEMPLATE_TYPE_PARAMETER; >- else if (binding instanceof ICPPTemplateNonTypeParameter) >- return CPP_TEMPLATE_NON_TYPE_PARAMETER; > > return 0; > } >@@ -557,6 +605,10 @@ > } > } > >+ private void pushPostProcess(Runnable process) { >+ postProcesses.add(postProcesses.size(), process); >+ } >+ > private Runnable popPostProcess() { > return (Runnable) postProcesses.remove(postProcesses.size() - 1); > } >@@ -598,12 +650,18 @@ > return new PDOMCPPReferenceType(pdom, record); > case CPP_FUNCTION_TEMPLATE: > return new PDOMCPPFunctionTemplate(pdom, record); >+ case CPP_METHOD_TEMPLATE: >+ return new PDOMCPPMethodTemplate(pdom, record); >+ case CPP_CONSTRUCTOR_TEMPLATE: >+ return new PDOMCPPConstructorTemplate(pdom, record); > case CPP_CLASS_TEMPLATE: > return new PDOMCPPClassTemplate(pdom, record); > case CPP_CLASS_TEMPLATE_PARTIAL_SPEC: > return new PDOMCPPClassTemplatePartialSpecialization(pdom, record); > case CPP_FUNCTION_INSTANCE: > return new PDOMCPPFunctionInstance(pdom, record); >+ case CPP_METHOD_INSTANCE: >+ return new PDOMCPPMethodInstance(pdom, record); > case CPP_DEFERRED_FUNCTION_INSTANCE: > return new PDOMCPPDeferredFunctionInstance(pdom, record); > case CPP_CLASS_INSTANCE: >@@ -612,6 +670,11 @@ > return new PDOMCPPDeferredClassInstance(pdom, record); > case CPP_TEMPLATE_TYPE_PARAMETER: > return new PDOMCPPTemplateTypeParameter(pdom, record); >+// TODO other template parameter types >+// case CPP_TEMPLATE_TEMPLATE_PARAMETER: >+// return new PDOMCPPTemplateTemplateParameter(pdom, record); >+// case CPP_TEMPLATE_NON_TYPE_PARAMETER: >+// return new PDOMCPPTemplateNonTypeParameter(pdom, record); > case CPP_FIELD_SPECIALIZATION: > return new PDOMCPPFieldSpecialization(pdom, record); > case CPP_FUNCTION_SPECIALIZATION: >@@ -622,8 +685,16 @@ > return new PDOMCPPConstructorSpecialization(pdom, record); > case CPP_CLASS_SPECIALIZATION: > return new PDOMCPPClassSpecialization(pdom, record); >+ case CPP_FUNCTION_TEMPLATE_SPECIALIZATION: >+ return new PDOMCPPFunctionTemplateSpecialization(pdom, record); >+ case CPP_METHOD_TEMPLATE_SPECIALIZATION: >+ return new PDOMCPPMethodTemplateSpecialization(pdom, record); >+ case CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION: >+ return new PDOMCPPConstructorTemplateSpecialization(pdom, record); > case CPP_CLASS_TEMPLATE_SPECIALIZATION: > return new PDOMCPPClassTemplateSpecialization(pdom, record); >+ case CPP_TYPEDEF_SPECIALIZATION: >+ return new PDOMCPPTypedefSpecialization(pdom, record); > default: > return super.getNode(record); > } >Index: parser/org/eclipse/cdt/internal/core/index/composite/cpp/InternalTemplateInstantiatorUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/InternalTemplateInstantiatorUtil.java,v >retrieving revision 1.2 >diff -u -r1.2 InternalTemplateInstantiatorUtil.java >--- parser/org/eclipse/cdt/internal/core/index/composite/cpp/InternalTemplateInstantiatorUtil.java 4 Apr 2007 15:30:06 -0000 1.2 >+++ parser/org/eclipse/cdt/internal/core/index/composite/cpp/InternalTemplateInstantiatorUtil.java 16 Apr 2007 13:41:55 -0000 >@@ -22,7 +22,12 @@ > public class InternalTemplateInstantiatorUtil { > public static ICPPSpecialization deferredInstance(IType[] arguments, ICompositesFactory cf, IIndexBinding rbinding) { > ICPPSpecialization spec= ((ICPPInternalTemplateInstantiator)rbinding).deferredInstance(arguments); >- return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)spec); >+ if (spec instanceof IIndexFragmentBinding) { >+ return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)spec); >+ } else { >+ //can result in a non-index binding >+ return spec; >+ } > } > > public static ICPPSpecialization getInstance(IType[] arguments, ICompositesFactory cf, IIndexBinding rbinding) { >@@ -35,7 +40,7 @@ > if (ins instanceof IIndexFragmentBinding) { > return (IBinding) cf.getCompositeBinding((IIndexFragmentBinding)ins); > } else { >- //instantiation of an index template can result in a non-index binding >+ //can result in a non-index binding > return ins; > } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java,v >retrieving revision 1.7 >diff -u -r1.7 CPPFunctionInstance.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java 23 Jun 2005 16:02:12 -0000 1.7 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionInstance.java 16 Apr 2007 13:41:55 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 IBM Corporation 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 >@@ -136,7 +136,16 @@ > * @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalFunction#isStatic(boolean) > */ > public boolean isStatic( boolean resolveAll ) { >- return ((ICPPInternalFunction)getTemplateDefinition()).isStatic( resolveAll ); >+ ICPPFunction func = (ICPPFunction) getTemplateDefinition(); >+ if (func instanceof ICPPInternalFunction) { >+ return ((ICPPInternalFunction)getTemplateDefinition()).isStatic( resolveAll ); >+ } else { >+ try { >+ return func.isStatic(); >+ } catch (DOMException e) { >+ return false; >+ } >+ } > } > > /* (non-Javadoc) >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements >+ ICPPConstructor { >+ >+ public PDOMCPPConstructorTemplate(PDOM pdom, PDOMNode parent, ICPPConstructor method) throws CoreException { >+ super(pdom, parent, method); >+ } >+ >+ public PDOMCPPConstructorTemplate(PDOM pdom, int record) { >+ super(pdom, record); >+ } >+ >+ public boolean isExplicit() throws DOMException { >+ return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.EXPLICIT_CONSTRUCTOR_OFFSET); >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_CONSTRUCTOR_TEMPLATE; >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPConstructorTemplateSpecialization extends >+ PDOMCPPMethodTemplateSpecialization implements ICPPConstructor { >+ >+ /** >+ * The size in bytes of a PDOMCPPConstructorTemplateSpecialization record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPMethodTemplateSpecialization.RECORD_SIZE + 0; >+ >+ public PDOMCPPConstructorTemplateSpecialization(PDOM pdom, PDOMNode parent, ICPPConstructor constructor, PDOMBinding specialized) >+ throws CoreException { >+ super(pdom, parent, constructor, specialized); >+ } >+ >+ public PDOMCPPConstructorTemplateSpecialization(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION; >+ } >+ >+ public boolean isExplicit() throws DOMException { >+ return ((ICPPConstructor)getSpecializedBinding()).isExplicit(); >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,146 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.dom.IPDOMNode; >+import org.eclipse.cdt.core.dom.IPDOMVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.IType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredFunctionInstance; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList; >+import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPFunctionTemplateSpecialization extends >+ PDOMCPPFunctionSpecialization implements ICPPFunctionTemplate, >+ ICPPInternalTemplateInstantiator, IPDOMMemberOwner { >+ >+ private static final int INSTANCES = PDOMCPPFunctionSpecialization.RECORD_SIZE + 0; >+ private static final int SPECIALIZATIONS = PDOMCPPFunctionSpecialization.RECORD_SIZE + 4; >+ >+ /** >+ * The size in bytes of a PDOMCPPFunctionTemplateSpecialization record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPFunctionSpecialization.RECORD_SIZE + 8; >+ >+ public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, PDOMNode parent, ICPPFunctionTemplate template, PDOMBinding specialized) >+ throws CoreException { >+ super(pdom, parent, (ICPPFunction) template, specialized); >+ } >+ >+ public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_FUNCTION_TEMPLATE_SPECIALIZATION; >+ } >+ >+ public ICPPTemplateParameter[] getTemplateParameters() throws DOMException { >+ ICPPFunctionTemplate template = (ICPPFunctionTemplate) getSpecializedBinding(); >+ return template.getTemplateParameters(); >+ } >+ >+ public ICPPSpecialization deferredInstance(IType[] arguments) { >+ ICPPSpecialization instance = getInstance(arguments); >+ if( instance == null ){ >+ instance = new CPPDeferredFunctionInstance( this, arguments ); >+ } >+ return instance; >+ } >+ >+ private static class InstanceFinder implements IPDOMVisitor { >+ private ICPPSpecialization instance = null; >+ private IType[] arguments; >+ >+ public InstanceFinder(IType[] arguments) { >+ this.arguments = arguments; >+ } >+ >+ public boolean visit(IPDOMNode node) throws CoreException { >+ if (instance == null && node instanceof PDOMCPPSpecialization) { >+ PDOMCPPSpecialization spec = (PDOMCPPSpecialization) node; >+ if (spec.matchesArguments(arguments)) { >+ instance = spec; >+ } >+ } >+ return false; >+ } >+ public void leave(IPDOMNode node) throws CoreException { >+ } >+ public ICPPSpecialization getInstance() { >+ return instance; >+ } >+ } >+ >+ public ICPPSpecialization getInstance(IType[] arguments) { >+ try { >+ InstanceFinder visitor = new InstanceFinder(arguments); >+ >+ PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + INSTANCES, getLinkageImpl()); >+ list.accept(visitor); >+ >+ if (visitor.getInstance() == null) { >+ list = new PDOMNodeLinkedList(pdom, record + SPECIALIZATIONS, getLinkageImpl()); >+ list.accept(visitor); >+ } >+ >+ return visitor.getInstance(); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ } >+ return null; >+ } >+ >+ public IBinding instantiate(IType[] arguments) { >+ return CPPTemplates.instantiateTemplate(this, arguments, getArgumentMap()); >+ } >+ >+ public void addChild(PDOMNode child) throws CoreException { >+ addMember(child); >+ } >+ >+ public void addMember(PDOMNode member) throws CoreException { >+ if (member instanceof ICPPTemplateInstance) { >+ PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + INSTANCES, getLinkageImpl()); >+ list.addMember(member); >+ } else if (member instanceof ICPPSpecialization) { >+ PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + SPECIALIZATIONS, getLinkageImpl()); >+ list.addMember(member); >+ } >+ } >+ >+ public void accept(IPDOMVisitor visitor) throws CoreException { >+ super.accept(visitor); >+ PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + INSTANCES, getLinkageImpl()); >+ list.accept(visitor); >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements >+ ICPPMethod { >+ >+ /** >+ * The size in bytes of a PDOMCPPMethodInstance record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPFunctionInstance.RECORD_SIZE + 0; >+ >+ public PDOMCPPMethodInstance(PDOM pdom, PDOMNode parent, ICPPMethod method, PDOMBinding instantiated) >+ throws CoreException { >+ super(pdom, parent, method, instantiated); >+ } >+ >+ public PDOMCPPMethodInstance(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_METHOD_INSTANCE; >+ } >+ >+ public boolean isDestructor() throws DOMException { >+ return ((ICPPMethod)getTemplateDefinition()).isDestructor(); >+ } >+ >+ public boolean isImplicit() { >+ return ((ICPPMethod)getTemplateDefinition()).isImplicit(); >+ } >+ >+ public boolean isVirtual() throws DOMException { >+ return ((ICPPMethod)getTemplateDefinition()).isVirtual(); >+ } >+ >+ public ICPPClassType getClassOwner() throws DOMException { >+ return ((ICPPMethod)getTemplateDefinition()).getClassOwner(); >+ } >+ >+ public int getVisibility() throws DOMException { >+ return ((ICPPMethod)getTemplateDefinition()).getVisibility(); >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,125 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.internal.core.Util; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.db.Database; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements >+ ICPPMethod { >+ >+ /** >+ * Offset of remaining annotation information (relative to the beginning of >+ * the record). >+ */ >+ protected static final int ANNOTATION1 = PDOMCPPFunctionTemplate.RECORD_SIZE; // byte >+ >+ /** >+ * The size in bytes of a PDOMCPPMethodTemplate record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPFunctionTemplate.RECORD_SIZE + 1; >+ >+ /** >+ * The bit offset of CV qualifier flags within ANNOTATION1. >+ */ >+ private static final int CV_OFFSET = PDOMCPPAnnotation.MAX_EXTRA_OFFSET + 1; >+ >+ public PDOMCPPMethodTemplate(PDOM pdom, PDOMNode parent, >+ ICPPMethod method) throws CoreException { >+ super(pdom, parent, (ICPPFunctionTemplate) method); >+ >+ Database db = pdom.getDB(); >+ >+ try { >+ ICPPFunctionType type = (ICPPFunctionType) method.getType(); >+ byte annotation = 0; >+ annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET; >+ annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method); >+ db.putByte(record + ANNOTATION1, annotation); >+ } catch (DOMException e) { >+ throw new CoreException(Util.createStatus(e)); >+ } >+ } >+ >+ public PDOMCPPMethodTemplate(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_METHOD_TEMPLATE; >+ } >+ >+ public boolean isDestructor() throws DOMException { >+ return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.DESTRUCTOR_OFFSET); >+ } >+ >+ public boolean isImplicit() { >+ return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.IMPLICIT_METHOD_OFFSET); >+ } >+ >+ public boolean isVirtual() throws DOMException { >+ return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.VIRTUAL_OFFSET); >+ } >+ >+ public ICPPClassType getClassOwner() throws DOMException { >+ try { >+ return (ICPPClassType) getParentNode(); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ return null; >+ } >+ } >+ >+ public int getVisibility() throws DOMException { >+ return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATION)); >+ } >+ >+ public boolean isConst() { >+ return getBit(getByte(record + ANNOTATION1), PDOMCAnnotation.CONST_OFFSET + CV_OFFSET); >+ } >+ >+ public boolean isVolatile() { >+ return getBit(getByte(record + ANNOTATION1), PDOMCAnnotation.VOLATILE_OFFSET + CV_OFFSET); >+ } >+ >+ public boolean isExtern() throws DOMException { >+ // ISO/IEC 14882:2003 9.2.6 >+ return false; >+ } >+ >+ public boolean isAuto() throws DOMException { >+ // ISO/IEC 14882:2003 9.2.6 >+ return false; >+ } >+ >+ public boolean isRegister() throws DOMException { >+ // ISO/IEC 14882:2003 9.2.6 >+ return false; >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedefSpecialization.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,111 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.IType; >+import org.eclipse.cdt.core.dom.ast.ITypedef; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; >+import org.eclipse.cdt.internal.core.Util; >+import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; >+import org.eclipse.cdt.internal.core.index.IIndexType; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization >+ implements ITypedef, ITypeContainer, IIndexType { >+ >+ >+ private static final int TYPE = PDOMCPPSpecialization.RECORD_SIZE + 0; >+ >+ protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 4; >+ >+ public PDOMCPPTypedefSpecialization(PDOM pdom, PDOMNode parent, ITypedef typedef, PDOMBinding specialized) >+ throws CoreException { >+ super(pdom, parent, (ICPPSpecialization) typedef, specialized); >+ >+ try { >+ IType type = typedef.getType(); >+ PDOMNode typeNode = parent.getLinkageImpl().addType(this, type); >+ if (typeNode != null) >+ pdom.getDB().putInt(record + TYPE, typeNode.getRecord()); >+ } catch (DOMException e) { >+ throw new CoreException(Util.createStatus(e)); >+ } >+ } >+ >+ public PDOMCPPTypedefSpecialization(PDOM pdom, int record) { >+ super(pdom, record); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_TYPEDEF_SPECIALIZATION; >+ } >+ >+ public IType getType() throws DOMException { >+ try { >+ PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + TYPE)); >+ return node instanceof IType ? (IType)node : null; >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ return null; >+ } >+ } >+ >+ public boolean isSameType(IType o) { >+ if( o.equals(this) ) >+ return true; >+ if( o instanceof ITypedef ) >+ try { >+ IType t = getType(); >+ if( t != null ) >+ return t.isSameType( ((ITypedef)o).getType()); >+ return false; >+ } catch ( DOMException e ) { >+ return false; >+ } >+ >+ try { >+ IType t = getType(); >+ if( t != null ) >+ return t.isSameType( o ); >+ } catch ( DOMException e ) { >+ return false; >+ } >+ return false; >+ } >+ >+ public void setType(IType type) { fail(); } >+ >+ /* (non-Javadoc) >+ * @see java.lang.Object#clone() >+ */ >+ public Object clone() { >+ IType t = null; >+ try { >+ t = (IType) super.clone(); >+ } catch ( CloneNotSupportedException e ) { >+ //not going to happen >+ } >+ return t; >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,91 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.internal.core.pdom.dom.cpp; >+ >+import org.eclipse.cdt.core.dom.ast.DOMException; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+class PDOMCPPMethodTemplateSpecialization extends >+ PDOMCPPFunctionTemplateSpecialization implements ICPPMethod { >+ >+ /** >+ * The size in bytes of a PDOMCPPMethodTemplateSpecialization record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPFunctionTemplateSpecialization.RECORD_SIZE + 0; >+ >+ public PDOMCPPMethodTemplateSpecialization(PDOM pdom, PDOMNode parent, ICPPMethod method, PDOMBinding specialized) >+ throws CoreException { >+ super(pdom, parent, (ICPPFunctionTemplate) method, specialized); >+ } >+ >+ public PDOMCPPMethodTemplateSpecialization(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_METHOD_TEMPLATE_SPECIALIZATION; >+ } >+ >+ public boolean isDestructor() throws DOMException { >+ IBinding spec = getSpecializedBinding(); >+ if (spec instanceof ICPPMethod) { >+ ((ICPPMethod)spec).isDestructor(); >+ } >+ return false; >+ } >+ >+ public boolean isImplicit() { >+ IBinding spec = getSpecializedBinding(); >+ if (spec instanceof ICPPMethod) { >+ ((ICPPMethod)spec).isImplicit(); >+ } >+ return false; >+ } >+ >+ public boolean isVirtual() throws DOMException { >+ IBinding spec = getSpecializedBinding(); >+ if (spec instanceof ICPPMethod) { >+ ((ICPPMethod)spec).isVirtual(); >+ } >+ return false; >+ } >+ >+ public ICPPClassType getClassOwner() throws DOMException { >+ IBinding spec = getSpecializedBinding(); >+ if (spec instanceof ICPPMethod) { >+ ((ICPPMethod)spec).getClassOwner(); >+ } >+ return null; >+ } >+ >+ public int getVisibility() throws DOMException { >+ IBinding spec = getSpecializedBinding(); >+ if (spec instanceof ICPPMethod) { >+ ((ICPPMethod)spec).getVisibility(); >+ } >+ return 0; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
bjorn.freeman-benson
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 167098
:
61328
|
62811
| 63901 |
64365
|
64651
|
64767