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 64651 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]
constructor instances
patch167098v5.txt (text/plain), 14.62 KB, created by
Bryan Wilkinson
on 2007-04-23 16:11:15 EDT
(
hide
)
Description:
constructor instances
Filename:
MIME Type:
Creator:
Bryan Wilkinson
Created:
2007-04-23 16:11:15 EDT
Size:
14.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.70 >diff -u -r1.70 PDOM.java >--- parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 23 Apr 2007 17:37:31 -0000 1.70 >+++ parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 23 Apr 2007 19:51:50 -0000 >@@ -75,7 +75,7 @@ > public class PDOM extends PlatformObject implements IIndexFragment, IPDOM { > protected Database db; > >- public static final int VERSION = 31; >+ public static final int VERSION = 32; > // 0 - the beginning of it all > // 1 - first change to kick off upgrades > // 2 - added file inclusions >@@ -108,7 +108,8 @@ > // 29 - includes: fixed modelling of unresolved includes (180159) > // 30 - templates: method/constructor templates, typedef specializations > // 31 - macros: added file locations >- >+ // 32 - templates: constructor instances >+ > public static final int LINKAGES = Database.DATA_AREA; > public static final int FILE_INDEX = Database.DATA_AREA + 4; > public static final int PROPERTIES = Database.DATA_AREA + 8; >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java,v >retrieving revision 1.160 >diff -u -r1.160 CPPSemantics.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java 23 Apr 2007 14:34:18 -0000 1.160 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java 23 Apr 2007 19:51:49 -0000 >@@ -638,6 +638,11 @@ > return binding; > } > >+ protected static IBinding postResolution( IBinding binding, IASTName name) { >+ LookupData data = createLookupData( name, true ); >+ return postResolution(binding, data); >+ } >+ > /** > * @param binding > * @param data >@@ -702,10 +707,10 @@ > } > if( binding instanceof ICPPClassType && data.considerConstructors ){ > ICPPClassType cls = (ICPPClassType) binding; >- if( data.astName instanceof ICPPASTTemplateId && cls instanceof ICPPInternalTemplate ){ >+ if( data.astName instanceof ICPPASTTemplateId && cls instanceof ICPPTemplateDefinition ){ > ICPPASTTemplateId id = (ICPPASTTemplateId) data.astName; > IType [] args = CPPTemplates.createTypeArray( id.getTemplateArguments() ); >- IBinding inst = ((ICPPInternalTemplate)cls).instantiate( args ); >+ IBinding inst = ((ICPPInternalTemplateInstantiator)cls).instantiate( args ); > cls = inst instanceof ICPPClassType ? (ICPPClassType)inst : cls; > } > if( cls != null ){ >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplates.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplates.java,v >retrieving revision 1.28 >diff -u -r1.28 CPPTemplates.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplates.java 9 Apr 2007 16:13:05 -0000 1.28 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplates.java 23 Apr 2007 19:51:49 -0000 >@@ -276,7 +276,8 @@ > if( template != null && template instanceof ICPPInternalTemplateInstantiator){ > IASTNode [] args = id.getTemplateArguments(); > IType [] types = CPPTemplates.createTypeArray( args ); >- return ((ICPPInternalTemplateInstantiator) template).instantiate(types); >+ template = ((ICPPInternalTemplateInstantiator) template).instantiate(types); >+ return CPPSemantics.postResolution(template, id); > } > } else { > //functions are instatiated as part of the resolution process >@@ -616,6 +617,8 @@ > ICPPTemplateInstance instance = null; > if( decl instanceof ICPPClassType ){ > instance = new CPPClassInstance( scope, decl, argMap, args ); >+ } else if( decl instanceof ICPPConstructor ) { >+ instance = new CPPConstructorInstance( scope, decl, argMap, args ); > } else if( decl instanceof ICPPMethod ) { > instance = new CPPMethodInstance( scope, decl, argMap, args ); > } else if( decl instanceof ICPPFunction ) { >@@ -1493,6 +1496,18 @@ > if( map != null && pType != null && map.containsKey( pType ) ){ > pType = (IType) map.get( pType ); > } >+ >+ //14.1s8 function to pointer and array to pointer conversions >+ if( pType instanceof IFunctionType ) >+ { >+ pType = new CPPPointerType( pType ); >+ } else if( pType instanceof IArrayType ){ >+ try { >+ pType = new CPPPointerType( ((IArrayType)pType).getType() ); >+ } catch (DOMException e) { >+ pType = e.getProblem(); >+ } >+ } > Cost cost = CPPSemantics.checkStandardConversionSequence( argument, pType ); > > if( cost == null || cost.rank == Cost.NO_MATCH_RANK ){ >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.70 >diff -u -r1.70 PDOMCPPLinkage.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java 20 Apr 2007 16:20:21 -0000 1.70 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java 23 Apr 2007 19:51:50 -0000 >@@ -114,23 +114,22 @@ > 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; >+ public static final int CPP_CONSTRUCTOR_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 23; >+ public static final int CPP_DEFERRED_FUNCTION_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 24; >+ public static final int CPP_CLASS_INSTANCE= PDOMLinkage.LAST_NODE_TYPE + 25; >+ public static final int CPP_DEFERRED_CLASS_INSTANCE= PDOMCPPLinkage.LAST_NODE_TYPE + 26; >+ public static final int CPP_PARAMETER_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 27; >+ public static final int CPP_FIELD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 28; >+ public static final int CPP_FUNCTION_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 29; >+ public static final int CPP_METHOD_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 30; >+ public static final int CPP_CONSTRUCTOR_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 31; >+ public static final int CPP_CLASS_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 32; >+ public static final int CPP_FUNCTION_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 33; >+ public static final int CPP_METHOD_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 34; >+ public static final int CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 35; >+ public static final int CPP_CLASS_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 36; >+ public static final int CPP_TYPEDEF_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 37; >+ public static final int CPP_TEMPLATE_TYPE_PARAMETER= PDOMLinkage.LAST_NODE_TYPE + 38; > > private class ConfigureTemplate implements Runnable { > ICPPTemplateDefinition template; >@@ -299,7 +298,10 @@ > parent, (ICPPClassType) binding, pdomSpecialized); > } > } else if (binding instanceof ICPPTemplateInstance) { >- if (binding instanceof ICPPMethod && pdomSpecialized instanceof ICPPMethod) { >+ if (binding instanceof ICPPConstructor && pdomSpecialized instanceof ICPPConstructor) { >+ pdomBinding = new PDOMCPPConstructorInstance(pdom, parent, >+ (ICPPConstructor) binding, pdomSpecialized); >+ } else if (binding instanceof ICPPMethod && pdomSpecialized instanceof ICPPMethod) { > pdomBinding = new PDOMCPPMethodInstance(pdom, parent, > (ICPPMethod) binding, pdomSpecialized); > } else if (binding instanceof ICPPFunction && pdomSpecialized instanceof ICPPFunction) { >@@ -455,6 +457,8 @@ > if (binding instanceof ICPPClassType) > return CPP_DEFERRED_CLASS_INSTANCE; > } else if (binding instanceof ICPPTemplateInstance) { >+ if (binding instanceof ICPPConstructor) >+ return CPP_CONSTRUCTOR_INSTANCE; > if (binding instanceof ICPPMethod) > return CPP_METHOD_INSTANCE; > else if (binding instanceof ICPPFunction) >@@ -662,6 +666,8 @@ > return new PDOMCPPFunctionInstance(pdom, record); > case CPP_METHOD_INSTANCE: > return new PDOMCPPMethodInstance(pdom, record); >+ case CPP_CONSTRUCTOR_INSTANCE: >+ return new PDOMCPPConstructorInstance(pdom, record); > case CPP_DEFERRED_FUNCTION_INSTANCE: > return new PDOMCPPDeferredFunctionInstance(pdom, record); > case CPP_CLASS_INSTANCE: >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java >diff -N parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * 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.dom.parser.cpp; >+ >+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.ICPPConstructor; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; >+import org.eclipse.cdt.core.parser.util.ObjectMap; >+ >+/** >+ * @author Bryan Wilkinson >+ * >+ */ >+public class CPPConstructorInstance extends CPPMethodInstance implements >+ ICPPConstructor { >+ >+ /** >+ * @param scope >+ * @param orig >+ * @param argMap >+ * @param args >+ */ >+ public CPPConstructorInstance(ICPPScope scope, IBinding orig, ObjectMap argMap, IType[] args) { >+ super(scope, orig, argMap, args); >+ } >+ >+ public boolean isExplicit() throws DOMException { >+ return ((ICPPConstructor)getTemplateDefinition()).isExplicit(); >+ } >+} >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java >diff -N parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * 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.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 >+ * >+ */ >+public class PDOMCPPConstructorInstance extends PDOMCPPMethodInstance implements >+ ICPPConstructor { >+ >+ /** >+ * The size in bytes of a PDOMCPPConstructorInstance record in the database. >+ */ >+ protected static final int RECORD_SIZE = PDOMCPPMethodInstance.RECORD_SIZE + 0; >+ >+ public PDOMCPPConstructorInstance(PDOM pdom, PDOMNode parent, ICPPMethod method, PDOMBinding instantiated) >+ throws CoreException { >+ super(pdom, parent, method, instantiated); >+ } >+ >+ public PDOMCPPConstructorInstance(PDOM pdom, int bindingRecord) { >+ super(pdom, bindingRecord); >+ } >+ >+ protected int getRecordSize() { >+ return RECORD_SIZE; >+ } >+ >+ public int getNodeType() { >+ return PDOMCPPLinkage.CPP_METHOD_INSTANCE; >+ } >+ >+ public boolean isExplicit() throws DOMException { >+ return ((ICPPConstructor)getTemplateDefinition()).isExplicit(); >+ } >+}
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
Actions:
View
|
Diff
Attachments on
bug 167098
:
61328
|
62811
|
63901
|
64365
|
64651
|
64767