1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Modeling extern "C" in the index (part of bug 191989).

This commit is contained in:
Markus Schorn 2007-11-27 17:14:46 +00:00
parent a68086ca96
commit 8581b3ac48
31 changed files with 318 additions and 46 deletions

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
@ -756,4 +757,47 @@ public class IndexUpdateTests extends IndexTestBase {
fIndex.releaseReadLock();
}
}
// int globalVar;
// void func();
// extern "C" {
// int globalVar;
// void func();
// }
// int globalVar;
// void func();
// extern "C" int globalVar;
// extern "C" void func();
// int globalVar;
// void func();
public void testExternC() throws Exception {
setupFile(5, true);
checkExternC(false);
updateFile();
checkExternC(true);
updateFile();
checkExternC(false);
updateFile();
checkExternC(true);
updateFile();
checkExternC(false);
}
private void checkExternC(boolean value) throws Exception {
fIndex.acquireReadLock();
try {
ICPPVariable var = (ICPPVariable) findBinding("globalVar");
assertEquals(value, var.isExternC());
ICPPFunction func = (ICPPFunction) findBinding("func");
assertEquals(value, func.isExternC());
} finally {
fIndex.releaseReadLock();
}
}
}

View file

@ -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
@ -7,15 +7,15 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
/*
* Created on Mar 15, 2005
*/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
package org.import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IFunction;
pse.cdt.core.dom.ast.IFunction;
/**
* @author aniefer
@ -33,4 +33,9 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
* is this an inline function
*/
public boolean isInline() throws DOMException;
/**
* Returns whether this function is declared as extern "C".
*/
public boolean isExternC() throws DOMException;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* Copyright (c) 2004, 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
/*
@ -27,4 +28,9 @@ public interface ICPPVariable extends IVariable, ICPPBinding {
* @throws DOMException
*/
public boolean isMutable() throws DOMException;
/**
* Returns whether this variable is declared as extern "C".
*/
public boolean isExternC() throws DOMException;
}

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
@ -2409,6 +2409,10 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
return false;
}
public boolean isExternC() {
return false;
}
/**
* returns false
*/

View file

@ -133,6 +133,13 @@ public class CPPDeferredFunctionInstance extends CPPInstance implements ICPPFunc
return ((ICPPFunction)getTemplateDefinition()).isInline();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
*/
public boolean isExternC() throws DOMException {
return ((ICPPFunction)getTemplateDefinition()).isExternC();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IFunction#isExtern()
*/

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
/*
* Created on Mar 29, 2005
@ -78,6 +79,10 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
return getField().isMutable();
}
public boolean isExternC() {
return false;
}
public ICPPDelegate createDelegate(IASTName name) {
return new CPPFieldDelegate( name, this );
}

View file

@ -71,6 +71,9 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
public boolean isInline() throws DOMException {
return ((ICPPFunction)getBinding()).isInline();
}
public boolean isExternC() throws DOMException {
return ((ICPPFunction)getBinding()).isExternC();
}
public boolean isExtern() throws DOMException {
return ((ICPPFunction)getBinding()).isExtern();
}
@ -128,6 +131,9 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
public boolean isInline() throws DOMException {
throw new DOMException( this );
}
public boolean isExternC() throws DOMException {
throw new DOMException( this );
}
public boolean isExtern() throws DOMException {
throw new DOMException( this );
}
@ -582,6 +588,24 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
*/
public boolean isExternC() throws DOMException {
if (CPPVisitor.isExternC(getDefinition())) {
return true;
}
IASTNode[] ds= getDeclarations();
if (ds != null) {
for (int i = 0; i < ds.length; i++) {
if (CPPVisitor.isExternC(ds[i])) {
return true;
}
}
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IFunction#isExtern()
*/

View file

@ -106,6 +106,13 @@ public class CPPFunctionInstance extends CPPInstance implements ICPPFunction, IC
return ((ICPPFunction)getTemplateDefinition()).isInline();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
*/
public boolean isExternC() throws DOMException {
return ((ICPPFunction)getTemplateDefinition()).isExternC();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IFunction#isExtern()
*/

View file

@ -95,6 +95,14 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
}
return getFunction().isInline();
}
public boolean isExternC() throws DOMException {
if (CPPVisitor.isExternC(getDefinition())) {
return true;
}
return getFunction().isExternC();
}
public boolean isStatic() {
return isStatic(true, true);
}

View file

@ -65,6 +65,9 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
public boolean isInline() throws DOMException {
throw new DOMException( this );
}
public boolean isExternC() throws DOMException {
throw new DOMException( this );
}
public IParameter[] getParameters() throws DOMException {
throw new DOMException( this );
}
@ -357,6 +360,21 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
return false;
}
public boolean isExternC() throws DOMException {
if (CPPVisitor.isExternC(getDefinition())) {
return true;
}
IASTNode[] ds= getDeclarations();
if (ds != null) {
for (int i = 0; i < ds.length; i++) {
if (CPPVisitor.isExternC(ds[i])) {
return true;
}
}
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IFunction#isExtern()
*/

View file

@ -64,6 +64,9 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
public boolean hasDefaultValue() {
return ((ICPPParameter)getBinding()).hasDefaultValue();
}
public boolean isExternC() {
return false;
}
}
public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter {
@ -100,6 +103,9 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
public boolean isGloballyQualified() throws DOMException {
throw new DOMException( this );
}
public boolean isExternC() {
return false;
}
}
private IType type = null;
@ -320,4 +326,8 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
public boolean isExternC() {
return false;
}
}

View file

@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2005, 2006 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
/*
* Created on Mar 29, 2005
@ -94,4 +94,8 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
public ICPPDelegate createDelegate(IASTName name) {
return new CPPParameterDelegate( name, this );
}
public boolean isExternC() {
return false;
}
}

View file

@ -53,6 +53,9 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
public boolean isExtern() throws DOMException {
return ((ICPPVariable)getBinding()).isExtern();
}
public boolean isExternC() throws DOMException {
return ((ICPPVariable)getBinding()).isExternC();
}
public boolean isAuto() throws DOMException {
return ((ICPPVariable)getBinding()).isAuto();
}
@ -87,6 +90,9 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
public boolean isExtern() throws DOMException {
throw new DOMException( this );
}
public boolean isExternC() throws DOMException {
throw new DOMException( this );
}
public boolean isAuto() throws DOMException {
throw new DOMException( this );
}
@ -352,6 +358,24 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return hasStorageClass( IASTDeclSpecifier.sc_extern, true);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/
public boolean isExternC() {
if (CPPVisitor.isExternC(getDefinition())) {
return true;
}
IASTNode[] ds= getDeclarations();
if (ds != null) {
for (int i = 0; i < ds.length; i++) {
if (CPPVisitor.isExternC(ds[i])) {
return true;
}
}
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/

View file

@ -90,6 +90,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
@ -2133,4 +2134,16 @@ public class CPPVisitor {
}
return parentScope;
}
public static boolean isExternC(IASTNode node) {
while (node != null) {
node= node.getParent();
if (node instanceof ICPPASTLinkageSpecification) {
if ("\"C\"".equals(((ICPPASTLinkageSpecification) node).getLiteral())) { //$NON-NLS-1$
return true;
}
}
}
return false;
}
}

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -31,6 +32,10 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
super(cf, rbinding);
}
public boolean isExternC() throws DOMException {
return ((ICPPFunction)rbinding).isExternC();
}
public boolean isInline() throws DOMException {
return ((ICPPFunction)rbinding).isInline();
}

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -30,6 +31,10 @@ class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable,
return ((ICPPVariable)rbinding).isMutable();
}
public boolean isExternC() throws DOMException {
return ((ICPPVariable)rbinding).isExternC();
}
public IType getType() throws DOMException {
IType rtype = ((ICPPVariable)rbinding).getType();
return cf.getCompositeType((IIndexType)rtype);

View file

@ -82,7 +82,7 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
*/
public static final String FRAGMENT_PROPERTY_VALUE_FORMAT_ID= "org.eclipse.cdt.internal.core.pdom.PDOM"; //$NON-NLS-1$
public static final int CURRENT_VERSION = 50;
public static final int CURRENT_VERSION = 51;
public static final int MIN_SUPPORTED_VERSION= CURRENT_VERSION;
/**
@ -140,7 +140,9 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
* #37#- added index for nested bindings (189811), compatible with version 36 - <<CDT 4.0.1>>
* 38 - added b-tree for macros (193056), compatible with version 36 and 37
* #39#- added flag for function-style macros (208558), compatible with version 36,37,38 - <<CDT 4.0.2>>
* 40 - string optimizations, removed compatibility with prior versions.
*
* 50 - support for complex, imaginary and long long (bug 209049).
* 51 - modeling extern "C" (bug 191989)
*/
public static final int LINKAGES = Database.DATA_AREA;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation.
* Copyright (c) 2006, 2007 IBM Corporation.
* 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
@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -15,16 +16,20 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
class PDOMCPPAnnotation {
// "Mutable" shares the same offset as "inline" because
// only fields can be mutable and only functions can be inline.
public static final int MUTABLE_OFFSET = 2;
public static final int MUTABLE_OFFSET = PDOMCAnnotation.INLINE_OFFSET;
// extern C shares the same offset as visibility because
// only members have visibility and cannot be extern C.
public static final int EXTERN_C_OFFSET= 6;
public static final int VISIBILITY_OFFSET = 6;
private static final int VISIBILITY_MASK = 0x03;
@ -46,15 +51,28 @@ class PDOMCPPAnnotation {
*/
public static byte encodeAnnotation(IBinding binding) throws DOMException {
byte modifiers = PDOMCAnnotation.encodeAnnotation(binding);
if (binding instanceof ICPPField) {
ICPPField variable = (ICPPField) binding;
modifiers |= (variable.isMutable() ? 1 : 0) << MUTABLE_OFFSET;
}
if (binding instanceof ICPPMember) {
ICPPMember member = (ICPPMember) binding;
int mask = ~(VISIBILITY_MASK << VISIBILITY_OFFSET);
modifiers &= mask;
modifiers |= (member.getVisibility() & VISIBILITY_MASK) << VISIBILITY_OFFSET;
if (binding instanceof ICPPField) {
ICPPField variable = (ICPPField) binding;
modifiers |= (variable.isMutable() ? 1 : 0) << MUTABLE_OFFSET;
}
}
else {
if (binding instanceof ICPPFunction) {
if (((ICPPFunction) binding).isExternC()) {
modifiers |= 1 << EXTERN_C_OFFSET;
}
}
if (binding instanceof ICPPVariable) {
if (((ICPPVariable) binding).isExternC()) {
modifiers |= 1 << EXTERN_C_OFFSET;
}
}
}
return modifiers;
}

View file

@ -6,8 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* IBM Corporation
* QNX - Initial API and implementation
* IBM Corporation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -79,6 +80,11 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField, ICPPDelegateCre
return false;
}
// @Override
public boolean isExternC() {
return false;
}
// @Override
public boolean isRegister() {
// ISO/IEC 14882:2003 9.2.6

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -93,6 +94,10 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements
return getField().isExtern();
}
public boolean isExternC() {
return false;
}
public boolean isRegister() throws DOMException {
return getField().isRegister();
}

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* IBM Corporation
* Markus Schorn (Wind River Systems)
* QNX - Initial API and implementation
* IBM Corporation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -181,6 +181,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
return getBit(getByte(record + ANNOTATION), PDOMCAnnotation.INLINE_OFFSET);
}
public boolean isExternC() throws DOMException {
return getBit(getByte(record + ANNOTATION), PDOMCPPAnnotation.EXTERN_C_OFFSET);
}
public boolean isMutable() throws DOMException {
throw new PDOMNotImplementedError();
}

View file

@ -6,8 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* Andrew Ferguson (Symbian)
* QNX - Initial API and implementation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -156,6 +157,10 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements ICPPFunction {
return ((ICPPFunction)getTemplateDefinition()).isExtern();
}
public boolean isExternC() throws DOMException {
return ((ICPPFunction)getTemplateDefinition()).isExternC();
}
public boolean isRegister() throws DOMException {
return ((ICPPFunction)getTemplateDefinition()).isRegister();
}

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -170,6 +171,10 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
return getBit(getByte(record + ANNOTATION), PDOMCAnnotation.EXTERN_OFFSET);
}
public boolean isExternC() throws DOMException {
return getBit(getByte(record + ANNOTATION), PDOMCPPAnnotation.EXTERN_C_OFFSET);
}
public boolean isRegister() throws DOMException {
// ISO/IEC 14882:2003 7.1.1.2
return false;

View file

@ -6,10 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* IBM Corporation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
* QNX - Initial API and implementation
* IBM Corporation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -117,6 +117,10 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
return false;
}
public boolean isExternC() {
return false;
}
public boolean isAuto() throws DOMException {
// ISO/IEC 14882:2003 9.2.6
return false;

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -51,6 +52,10 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements
return ((ICPPMethod)getTemplateDefinition()).isDestructor();
}
public boolean isExternC() {
return false;
}
public boolean isImplicit() {
return ((ICPPMethod)getTemplateDefinition()).isImplicit();
}

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -89,6 +90,10 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization
return false;
}
public boolean isExternC() {
return false;
}
public ICPPClassType getClassOwner() throws DOMException {
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if( f != null )

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -112,6 +113,10 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements
// ISO/IEC 14882:2003 9.2.6
return false;
}
public boolean isExternC() {
return false;
}
public boolean isAuto() throws DOMException {
// ISO/IEC 14882:2003 9.2.6

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -88,4 +89,8 @@ class PDOMCPPMethodTemplateSpecialization extends
}
return 0;
}
public boolean isExternC() {
return false;
}
}

View file

@ -171,6 +171,10 @@ class PDOMCPPParameter extends PDOMNamedNode
return false;
}
public boolean isExternC() {
return false;
}
public boolean isRegister() throws DOMException {
throw new PDOMNotImplementedError();
}

View file

@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -16,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
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;
@ -80,7 +82,7 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC
}
public int getNodeType() {
return PDOMCPPLinkage.CPP_PARAMETER_SPECIALIZATION;
return IIndexCPPBindingConstants.CPP_PARAMETER_SPECIALIZATION;
}
public void setNextParameter(PDOMCPPParameterSpecialization nextParam) throws CoreException {
@ -122,7 +124,11 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC
public boolean isExtern() throws DOMException {
return false;
}
public boolean isExternC() {
return false;
}
public boolean isStatic() throws DOMException {
return false;
}

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -130,6 +130,10 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable, ICPPDelega
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET);
}
public boolean isExternC() throws DOMException {
return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.EXTERN_C_OFFSET);
}
public boolean isRegister() throws DOMException {
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.REGISTER_OFFSET);
}