;
+ // void foo() {
+ // TAlias ;
+ // void foo() {
+ // S > myA;
+ // myA.t = S >;
+ // void foo() {
+ // TAlias > myA;
+ // myA.t = S__float128 i;
+ * @since 5.5
+ */
+ public static final int t_float128 = 14;
+
/**
* @since 5.1
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
index e13798ce231..86a69376d77 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
@@ -23,7 +23,8 @@ public interface IBasicType extends IType {
*/
enum Kind {
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble,
- eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr, /** @since 5.5 */ eInt128
+ eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr,
+ /** @since 5.5 */ eInt128, /** @since 5.5 */ eFloat128
}
/** @since 5.2 */
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAliasDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAliasDeclaration.java
new file mode 100644
index 00000000000..f8ab21dfab8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAliasDeclaration.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
+import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
+
+/**
+ * Represents a C++ alias declaration.
+ * e.g. struct Type {}; using Alias = Type;
+ * @since 5.5
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICPPASTAliasDeclaration extends IASTDeclaration, IASTNameOwner {
+ public static final ICPPASTAliasDeclaration[] EMPTY_ALIAS_DECLARATION_ARRAY = {};
+
+ /**
+ * ALIAS_NAME
is the name that is brought into the local scope.
+ */
+ public static final ASTNodeProperty ALIAS_NAME = new ASTNodeProperty(
+ "ICPPASTAliasDeclaration.ALIAS_NAME - Introduced alias name"); //$NON-NLS-1$
+
+ /**
+ * MAPPING_TYPE
IASTName
+ */
+ public IASTName getAlias();
+
+ /**
+ * Sets the alias name.
+ *
+ * @param aliasName IASTName
+ */
+ public void setAlias(IASTName aliasName);
+
+ /**
+ * Returns the mapping type id.
+ *
+ * @return ICPPASTTypeId
+ */
+ public ICPPASTTypeId getMappingTypeId();
+
+ /**
+ * Sets the mapping type id.
+ *
+ * @param mappingTypeId ICPPASTTypeId
+ */
+ public void setMappingTypeId(ICPPASTTypeId mappingTypeId);
+
+ @Override
+ public ICPPASTAliasDeclaration copy();
+
+ @Override
+ public ICPPASTAliasDeclaration copy(CopyStyle style);
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
index cab1df9c5ef..e26f62e256e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTypeId.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
+ * Thomas Corbat (IFS) - Added copy methods
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@@ -20,4 +21,15 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
* @since 5.2
*/
public interface ICPPASTTypeId extends IASTTypeId, ICPPASTPackExpandable {
+ /**
+ * @since 5.5
+ */
+ @Override
+ public ICPPASTTypeId copy();
+
+ /**
+ * @since 5.5
+ */
+ @Override
+ public ICPPASTTypeId copy(CopyStyle style);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTUsingDirective.java
index 6d96e99672f..9f9c639547a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTUsingDirective.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTUsingDirective.java
@@ -24,7 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTUsingDirective extends IASTDeclaration, IASTNameOwner, IASTAttributeOwner {
- public static final ICPPASTUsingDirective[] EMPTY_USINGDIRECTIVE_ARRAY = new ICPPASTUsingDirective[0];
+ public static final ICPPASTUsingDirective[] EMPTY_USINGDIRECTIVE_ARRAY = {};
/**
* QUALIFIED_NAME
is the name that is brought into local
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java
new file mode 100644
index 00000000000..ed1d537cd8a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IType;
+
+/**
+ * Represents an alias template (14.5.7).
+ * @since 5.5
+ */
+public interface ICPPAliasTemplate extends IType, ICPPTemplateDefinition {
+ /**
+ * Returns the aliased type.
+ */
+ public IType getType();
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplateInstance.java
new file mode 100644
index 00000000000..4c2d7d6d9e8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplateInstance.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.ITypedef;
+
+/**
+ * Represents an instance of an alias template (14.5.7).
+ * @since 5.5
+ */
+public interface ICPPAliasTemplateInstance extends ITypedef, ICPPBinding {
+ /**
+ * Returns the alias template specialized by this instance.
+ */
+ public ICPPAliasTemplate getTemplateDefinition();
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
index 3348938c563..101613b3ba4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
@@ -8,6 +8,7 @@
* Contributors:
* Mike Kucera (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@@ -354,4 +355,9 @@ public interface ICPPNodeFactory extends INodeFactory {
@Override
public ICPPASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body);
+
+ /**
+ * @since 5.5
+ */
+ public ICPPASTAliasDeclaration newAliasDeclaration(IASTName aliasName, ICPPASTTypeId aliasedType);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
index fc9a3ac3758..4ffd8ac64b3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
@@ -68,6 +68,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
addMacro("__builtin_offsetof(T,m)", "((size_t) &((T *)0)->m)");
if (version >= VERSION_4_7) {
+ addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128);
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java
index b643cd4652b..ffd4111d06a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java
@@ -104,6 +104,7 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
addKeyword(GCCKeywords.cp__is_trivial, IGCCToken.tTT_is_trivial);
}
if (version >= VERSION_4_7) {
+ addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128);
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java
index 765f962c5de..a774647e288 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java
@@ -25,6 +25,8 @@ public class GCCKeywords {
public static final String __DECLSPEC = "__declspec";
/** @since 5.5 */
public static final String __INT128 = "__int128";
+ /** @since 5.5 */
+ public static final String __FLOAT128 = "__float128";
public static final char[]
cpTYPEOF = TYPEOF.toCharArray(),
@@ -69,6 +71,7 @@ public class GCCKeywords {
/** @since 5.5 */
public static final char[]
+ cp__float128= __FLOAT128.toCharArray(),
cp__int128= __INT128.toCharArray(),
cp__is_literal_type= "__is_literal_type".toCharArray(),
cp__is_standard_layout= "__is_standard_layout".toCharArray(),
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java
index a1c0f9606c0..a8a5d2498f9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java
@@ -45,5 +45,6 @@ public interface IGCCToken extends IToken {
/** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
/** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
- /** @since 5.5 */ int t__int128 = FIRST_RESERVED_IGCCToken + 25;
+ /** @since 5.5 */ int t__int128= FIRST_RESERVED_IGCCToken + 25;
+ /** @since 5.5 */ int t__float128= FIRST_RESERVED_IGCCToken + 26;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
index cc8f38428db..05511bf2379 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
@@ -2591,12 +2591,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
case IToken.t_short:
case IToken.t_int:
case IToken.t_long:
- case IGCCToken.t__int128:
case IToken.t_float:
case IToken.t_double:
case IToken.t__Bool:
case IToken.t__Complex:
case IToken.t__Imaginary:
+ case IGCCToken.t__int128:
+ case IGCCToken.t__float128:
case IToken.t_signed:
case IToken.t_unsigned:
case IToken.t_decltype:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
index 8b465ba06c9..d3c7b188e17 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
+ * Thomas Corbat
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
@@ -34,6 +35,7 @@ public interface ITypeMarshalBuffer {
final static byte UNKNOWN_MEMBER= 12;
final static byte UNKNOWN_MEMBER_CLASS_INSTANCE= 13;
final static byte DEFERRED_CLASS_INSTANCE= 14;
+ final static byte ALIAS_TEMPLATE = 15;
final static byte
EVAL_BINARY= 1,
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
index d04bacd3eb6..a084775601e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
@@ -73,6 +73,8 @@ public class SizeofCalculator {
public final SizeAndAlignment sizeof_complex_double;
public final SizeAndAlignment sizeof_long_double;
public final SizeAndAlignment sizeof_complex_long_double;
+ public final SizeAndAlignment sizeof_float128;
+ public final SizeAndAlignment sizeof_complex_float128;
private final IASTTranslationUnit ast;
@@ -135,6 +137,8 @@ public class SizeofCalculator {
sizeof_complex_double = getSizeOfPair(sizeof_double);
sizeof_long_double = getSize(sizeofMacros, "__SIZEOF_LONG_DOUBLE__", maxAlignment); //$NON-NLS-1$
sizeof_complex_long_double = getSizeOfPair(sizeof_long_double);
+ sizeof_float128 = size_16; // GCC does not define __SIZEOF_FLOAT128__
+ sizeof_complex_float128 = getSizeOfPair(sizeof_float128);
}
private SizeofCalculator() {
@@ -156,6 +160,8 @@ public class SizeofCalculator {
sizeof_complex_double = null;
sizeof_long_double = null;
sizeof_complex_long_double = null;
+ sizeof_float128 = size_16;
+ sizeof_complex_float128 = getSizeOfPair(sizeof_float128);
ast = null;
}
@@ -215,6 +221,8 @@ public class SizeofCalculator {
return type.isComplex() ?
(type.isLong() ? sizeof_long_double : sizeof_double) :
(type.isLong() ? sizeof_complex_long_double : sizeof_complex_double);
+ case eFloat128:
+ return type.isComplex() ? sizeof_complex_float128 : sizeof_float128;
case eWChar:
return sizeof_wchar_t;
case eChar16:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
index f2cf88daf27..02165d095a4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * John Camelon (IBM Rational Software) - Initial API and implementation
- * Yuan Zhang / Beth Tibbitts (IBM Research)
- * Markus Schorn (Wind River Systems)
+ * John Camelon (IBM Rational Software) - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@@ -19,17 +19,16 @@ import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
-public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements ICASTSimpleDeclSpecifier,
- IASTAmbiguityParent {
-
+public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier
+ implements ICASTSimpleDeclSpecifier, IASTAmbiguityParent {
private int simpleType;
private boolean isSigned;
private boolean isUnsigned;
private boolean isShort;
private boolean isLong;
private boolean longlong;
- private boolean complex=false;
- private boolean imaginary=false;
+ private boolean complex;
+ private boolean imaginary;
private IASTExpression fDeclTypeExpression;
@Override
@@ -110,6 +109,8 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return t_double;
case eFloat:
return t_float;
+ case eFloat128:
+ return t_float;
case eInt:
return t_int;
case eInt128:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
index 3409058e745..bd3d0b23c36 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 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
+ * Copyright (c) 2005, 2010 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:
- * Devin Steffler (IBM Rational Software) - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * Contributors:
+ * Devin Steffler (IBM Rational Software) - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@@ -24,8 +24,8 @@ import org.eclipse.core.runtime.CoreException;
public class CBasicType implements ICBasicType, ISerializableType {
private final Kind fKind;
- private int fModifiers = 0;
- private IASTExpression value = null;
+ private int fModifiers;
+ private IASTExpression value;
public CBasicType(Kind kind, int modifiers, IASTExpression value) {
if (kind == Kind.eUnspecified) {
@@ -69,6 +69,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
return Kind.eDouble;
case IASTSimpleDeclSpecifier.t_float:
return Kind.eFloat;
+ case IASTSimpleDeclSpecifier.t_float128:
+ return Kind.eFloat128;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
@@ -122,16 +124,16 @@ public class CBasicType implements ICBasicType, ISerializableType {
if (obj instanceof ITypedef)
return obj.isSameType(this);
- if (!(obj instanceof ICBasicType)) return false;
+ if (!(obj instanceof ICBasicType))
+ return false;
ICBasicType cObj = (ICBasicType)obj;
- if (fKind != cObj.getKind()) {
+ if (fKind != cObj.getKind())
return false;
- }
if (fKind == Kind.eInt) {
- //signed int and int are equivalent
+ // Signed int and int are equivalent
return (fModifiers & ~IS_SIGNED) == (cObj.getModifiers() & ~IS_SIGNED);
} else {
return (fModifiers == cObj.getModifiers());
@@ -144,7 +146,7 @@ public class CBasicType implements ICBasicType, ISerializableType {
try {
t = (IType) super.clone();
} catch (CloneNotSupportedException e) {
- //not going to happen
+ // Not going to happen
}
return t;
}
@@ -155,17 +157,11 @@ public class CBasicType implements ICBasicType, ISerializableType {
return value;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isComplex()
- */
@Override
public boolean isComplex() {
return (fModifiers & IS_COMPLEX) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isImaginary()
- */
@Override
public boolean isImaginary() {
return (fModifiers & IS_IMAGINARY) != 0;
@@ -220,6 +216,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
case eUnspecified:
return t_unspecified;
case eNullPtr:
+ case eInt128:
+ case eFloat128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
index 7aa0db02fd8..d74fefd9ea1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
@@ -1030,6 +1030,13 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
+ case IGCCToken.t__float128:
+ if (encounteredTypename)
+ break declSpecifiers;
+ simpleType = IASTSimpleDeclSpecifier.t_float128;
+ encounteredRawType= true;
+ endOffset= consume().getEndOffset();
+ break;
case IToken.t_signed:
if (encounteredTypename)
break declSpecifiers;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java
new file mode 100644
index 00000000000..a1cbff32b7a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.dom.parser.cpp;
+
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId;
+import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+
+public class CPPASTAliasDeclaration extends ASTNode implements ICPPASTAliasDeclaration {
+ private IASTName aliasName;
+ private ICPPASTTypeId mappingTypeId;
+
+ public CPPASTAliasDeclaration(IASTName aliasName, ICPPASTTypeId mappingTypeId){
+ setAlias(aliasName);
+ setMappingTypeId(mappingTypeId);
+ }
+
+ @Override
+ public int getRoleForName(IASTName name) {
+ if (aliasName == name) return r_definition;
+ if (mappingTypeId == name) return r_reference;
+ return r_unclear;
+ }
+
+ @Override
+ public IASTName getAlias() {
+ return aliasName;
+ }
+
+ @Override
+ public void setAlias(IASTName aliasName) {
+ assertNotFrozen();
+ this.aliasName = aliasName;
+ if (aliasName != null) {
+ aliasName.setParent(this);
+ aliasName.setPropertyInParent(ALIAS_NAME);
+ }
+ }
+
+ @Override
+ public ICPPASTTypeId getMappingTypeId() {
+ return mappingTypeId;
+ }
+
+ @Override
+ public void setMappingTypeId(ICPPASTTypeId mappingTypeId) {
+ assertNotFrozen();
+ this.mappingTypeId = mappingTypeId;
+ if (mappingTypeId != null) {
+ mappingTypeId.setParent(this);
+ mappingTypeId.setPropertyInParent(TARGET_TYPEID);
+ }
+ }
+
+ @Override
+ public ICPPASTAliasDeclaration copy() {
+ return copy(CopyStyle.withoutLocations);
+ }
+
+ @Override
+ public ICPPASTAliasDeclaration copy(CopyStyle style) {
+ CPPASTAliasDeclaration copy = new CPPASTAliasDeclaration(
+ aliasName == null ? null : aliasName.copy(style),
+ mappingTypeId == null ? null : mappingTypeId.copy(style));
+ copy.setOffsetAndLength(this);
+ if (style == CopyStyle.withLocations) {
+ copy.setCopyLocation(this);
+ }
+ return copy;
+ }
+
+ @Override
+ public boolean accept(ASTVisitor action) {
+ if (action.shouldVisitDeclarations) {
+ switch (action.visit(this)) {
+ case ASTVisitor.PROCESS_ABORT: return false;
+ case ASTVisitor.PROCESS_SKIP: return true;
+ default: break;
+ }
+ }
+
+ if (aliasName != null && !aliasName.accept(action)) return false;
+ if (mappingTypeId != null && !mappingTypeId.accept(action)) return false;
+
+ if (action.shouldVisitDeclarations) {
+ switch (action.leave(this)) {
+ case ASTVisitor.PROCESS_ABORT: return false;
+ case ASTVisitor.PROCESS_SKIP: return true;
+ default: break;
+ }
+ }
+ return true;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
index 6c7333ffc2c..809a4b283fc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
@@ -90,6 +90,8 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
return t_double;
case eFloat:
return t_float;
+ case eFloat128:
+ return t_float128;
case eInt:
return t_int;
case eInt128:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java
new file mode 100644
index 00000000000..4d8257a99bf
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.dom.parser.cpp;
+
+import org.eclipse.cdt.core.dom.ILinkage;
+import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
+import org.eclipse.cdt.core.parser.util.ArrayUtil;
+import org.eclipse.cdt.internal.core.dom.Linkage;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
+import org.eclipse.core.runtime.PlatformObject;
+
+public class CPPAliasTemplate extends PlatformObject implements ICPPAliasTemplate {
+ private final IASTName aliasName;
+ private final IType aliasedType;
+ private ICPPTemplateParameter[] templateParameters;
+
+ public CPPAliasTemplate(IASTName aliasName, IType aliasedType) {
+ this.aliasName = aliasName;
+ this.aliasedType = aliasedType;
+ aliasName.setBinding(this);
+ }
+
+ @Override
+ public IType getType() {
+ return aliasedType;
+ }
+
+ @Override
+ public String getName() {
+ return new String(getNameCharArray());
+ }
+
+ @Override
+ public char[] getNameCharArray() {
+ return aliasName.getSimpleID();
+ }
+
+ @Override
+ public ILinkage getLinkage() {
+ return Linkage.CPP_LINKAGE;
+ }
+
+ @Override
+ public IBinding getOwner() {
+ return CPPVisitor.findDeclarationOwner(aliasName, true);
+ }
+
+ @Override
+ public IScope getScope() throws DOMException {
+ return CPPVisitor.getContainingScope(aliasName.getParent());
+ }
+
+ @Override
+ public boolean isSameType(IType type) {
+ if (type == null) {
+ return false;
+ }
+ IType aliasedType = getType();
+ return type.isSameType(aliasedType);
+ }
+
+ @Override
+ public Object clone() {
+ IType t = null;
+ try {
+ t = (IType) super.clone();
+ } catch (CloneNotSupportedException e) {
+ // Not going to happen
+ }
+ return t;
+ }
+
+ @Override
+ public String[] getQualifiedName() throws DOMException {
+ return CPPVisitor.getQualifiedName(this);
+ }
+
+ @Override
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ return CPPVisitor.getQualifiedNameCharArray(this);
+ }
+
+ @Override
+ public boolean isGloballyQualified() throws DOMException {
+ return true;
+ }
+
+ @Override
+ public ICPPTemplateParameter[] getTemplateParameters() {
+ if (templateParameters == null) {
+ ICPPASTTemplateDeclaration template = CPPTemplates.getTemplateDeclaration(aliasName);
+ if (template == null)
+ return ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
+ ICPPASTTemplateParameter[] params = template.getTemplateParameters();
+ IBinding p = null;
+ ICPPTemplateParameter[] result = null;
+ for (ICPPASTTemplateParameter param : params) {
+ p= CPPTemplates.getTemplateParameterName(param).resolveBinding();
+ if (p instanceof ICPPTemplateParameter) {
+ result = ArrayUtil.append(ICPPTemplateParameter.class, result, (ICPPTemplateParameter) p);
+ }
+ }
+ templateParameters = ArrayUtil.trim(ICPPTemplateParameter.class, result);
+ }
+ return templateParameters;
+ }
+
+ @Override
+ public String toString() {
+ return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java
new file mode 100644
index 00000000000..4435b4020dc
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.dom.parser.cpp;
+
+import org.eclipse.cdt.core.dom.ILinkage;
+import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
+import org.eclipse.cdt.internal.core.dom.Linkage;
+import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
+import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.PlatformObject;
+
+public class CPPAliasTemplateInstance extends PlatformObject
+ implements ICPPAliasTemplateInstance, ISerializableType {
+ private final char[] name;
+ private final IType aliasedType;
+ private final ICPPAliasTemplate aliasTemplate;
+
+ public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) {
+ this.name = name;
+ this.aliasedType = aliasedType;
+ this.aliasTemplate = aliasTemplate;
+ }
+
+ @Override
+ public ICPPAliasTemplate getTemplateDefinition() {
+ return aliasTemplate;
+ }
+
+ @Override
+ public boolean isSameType(IType other) {
+ if (other == aliasedType)
+ return true;
+ if (aliasedType != null) {
+ return aliasedType.isSameType(other);
+ }
+ return false;
+ }
+
+ @Override
+ public IType getType() {
+ return aliasedType;
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ }
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return new String(getNameCharArray());
+ }
+
+ @Override
+ public char[] getNameCharArray() {
+ if (name != null) {
+ return name;
+ }
+ return new char[0];
+ }
+
+ @Override
+ public ILinkage getLinkage() {
+ return Linkage.CPP_LINKAGE;
+ }
+
+ @Override
+ public IBinding getOwner() {
+ if (aliasTemplate != null) {
+ return aliasTemplate.getOwner();
+ }
+ return null;
+ }
+
+ @Override
+ public IScope getScope() throws DOMException {
+ if (aliasTemplate != null) {
+ return aliasTemplate.getScope();
+ }
+ return null;
+ }
+
+ @Override
+ public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
+ int firstByte = ITypeMarshalBuffer.ALIAS_TEMPLATE;
+ buffer.putByte((byte) firstByte);
+ buffer.putCharArray(name);
+ buffer.marshalType(aliasedType);
+ buffer.marshalBinding(aliasTemplate);
+ }
+
+ public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException {
+ char[] name = buffer.getCharArray();
+ IType unmarshalledAliasedTypeInstance = buffer.unmarshalType();
+ ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding();
+ return new CPPAliasTemplateInstance(name, unmarshalledAliasedTypeInstance, unmarshalledAlias);
+ }
+
+ @Override
+ public String toString() {
+ return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$
+ }
+
+ @Override
+ public String[] getQualifiedName() {
+ return CPPVisitor.getQualifiedName(this);
+ }
+
+ @Override
+ public char[][] getQualifiedNameCharArray() {
+ return CPPVisitor.getQualifiedNameCharArray(this);
+ }
+
+ @Override
+ public boolean isGloballyQualified() throws DOMException {
+ return ((ICPPBinding) aliasTemplate).isGloballyQualified();
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
index 0dd4aba9b71..12a06267a49 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
@@ -100,6 +100,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return Kind.eDouble;
case IASTSimpleDeclSpecifier.t_float:
return Kind.eFloat;
+ case IASTSimpleDeclSpecifier.t_float128:
+ return Kind.eFloat128;
case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128:
@@ -275,6 +277,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
case eUnspecified:
return t_unspecified;
case eNullPtr:
+ case eInt128:
+ case eFloat128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
index 575873a4e67..fedcacd8a32 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
@@ -51,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.IASTToken;
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
@@ -747,4 +748,9 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
public ICPPASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body) {
return new CPPASTWhileStatement(condition, body);
}
+
+ @Override
+ public ICPPASTAliasDeclaration newAliasDeclaration(IASTName aliasName, ICPPASTTypeId mappingTypeId) {
+ return new CPPASTAliasDeclaration(aliasName, mappingTypeId);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index a23acd37a51..b7082f7aa78 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -66,6 +66,7 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
@@ -1891,7 +1892,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
default:
throw backtrack;
}
-
ICPPASTUsingDirective astUD = nodeFactory.newUsingDirective(name);
if (attributes != null) {
for (IASTAttribute attribute : attributes) {
@@ -1902,10 +1902,33 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return astUD;
}
+ if(LT(1) == IToken.tIDENTIFIER && LT(2) == IToken.tASSIGN){
+ return aliasDeclaration(offset);
+
+ }
ICPPASTUsingDeclaration result = usingDeclaration(offset);
return result;
}
+ private IASTDeclaration aliasDeclaration(final int offset) throws EndOfFileException,
+ BacktrackException {
+ IToken identifierToken = consume();
+ IASTName aliasName = buildName(-1, identifierToken);
+
+ consume();
+
+ ICPPASTTypeId aliasedType = typeId(DeclarationOptions.TYPEID);
+
+ if(LT(1) != IToken.tSEMI){
+ throw backtrack;
+ }
+ int endOffset = consume().getEndOffset();
+
+ ICPPASTAliasDeclaration aliasDeclaration = nodeFactory.newAliasDeclaration(aliasName, aliasedType);
+ setRange(aliasDeclaration, offset, endOffset);
+ return aliasDeclaration;
+ }
+
private ICPPASTUsingDeclaration usingDeclaration(final int offset) throws EndOfFileException, BacktrackException {
boolean typeName = false;
if (LT(1) == IToken.t_typename) {
@@ -2851,6 +2874,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true;
endOffset= consume().getEndOffset();
break;
+ case IGCCToken.t__float128:
+ if (encounteredTypename)
+ break declSpecifiers;
+ simpleType = IASTSimpleDeclSpecifier.t_float128;
+ encounteredRawType= true;
+ endOffset= consume().getEndOffset();
+ break;
case IToken.t_void:
if (encounteredTypename)
break declSpecifiers;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
index 4032094ee4b..4c5ff020493 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
@@ -586,22 +586,24 @@ class BuiltinOperators {
return type instanceof ICPPPointerToMemberType;
}
- private boolean isBoolean(IType type) {
+ private static boolean isBoolean(IType type) {
return type instanceof IBasicType && ((IBasicType) type).getKind() == Kind.eBoolean;
}
- private boolean isFloatingPoint(IType type) {
+ private static boolean isFloatingPoint(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
case eDouble:
case eFloat:
+ case eFloat128:
return true;
case eBoolean:
case eChar:
case eChar16:
case eChar32:
case eInt:
+ case eInt128:
case eWChar:
case eUnspecified:
case eVoid:
@@ -612,7 +614,7 @@ class BuiltinOperators {
return false;
}
- private boolean isArithmetic(IType type) {
+ private static boolean isArithmetic(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
@@ -622,7 +624,9 @@ class BuiltinOperators {
case eChar32:
case eDouble:
case eFloat:
+ case eFloat128:
case eInt:
+ case eInt128:
case eWChar:
return true;
case eUnspecified:
@@ -634,7 +638,7 @@ class BuiltinOperators {
return false;
}
- private boolean isIntegral(IType type) {
+ private static boolean isIntegral(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
@@ -643,10 +647,12 @@ class BuiltinOperators {
case eChar16:
case eChar32:
case eInt:
+ case eInt128:
case eWChar:
return true;
case eDouble:
case eFloat:
+ case eFloat128:
case eUnspecified:
case eVoid:
case eNullPtr:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index 98bcf4830b8..3f4d58c7b84 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -12,6 +12,7 @@
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
* Mike Kucera (IBM)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
@@ -92,6 +93,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
@@ -1668,6 +1670,9 @@ public class CPPSemantics {
} else if (declaration instanceof ICPPASTNamespaceAlias) {
IASTName alias = ((ICPPASTNamespaceAlias) declaration).getAlias();
ASTInternal.addName(scope, alias);
+ } else if (declaration instanceof ICPPASTAliasDeclaration) {
+ IASTName alias = ((ICPPASTAliasDeclaration) declaration).getAlias();
+ ASTInternal.addName(scope, alias);
} else if (declaration instanceof IASTFunctionDefinition) {
IASTFunctionDefinition functionDef = (IASTFunctionDefinition) declaration;
final IASTDeclSpecifier declSpec = functionDef.getDeclSpecifier();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 276c7903673..465d3a0e4ef 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -10,6 +10,7 @@
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
@@ -66,6 +67,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
@@ -103,6 +105,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
import org.eclipse.cdt.internal.core.dom.parser.Value;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPAliasTemplateInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassSpecialization;
@@ -393,7 +396,7 @@ public class CPPTemplates {
return instance;
}
- private static ICPPTemplateArgument[] addDefaultArguments(ICPPClassTemplate template,
+ private static ICPPTemplateArgument[] addDefaultArguments(ICPPTemplateDefinition template,
ICPPTemplateArgument[] arguments, IASTNode point) throws DOMException {
if (template instanceof ICPPClassTemplatePartialSpecialization)
return arguments;
@@ -642,17 +645,30 @@ public class CPPTemplates {
}
}
try {
- // Class template instance.
IBinding result= null;
IASTName templateName = id.getTemplateName();
IBinding template = templateName.resolvePreBinding();
+ // Alias Template.
+ if (template instanceof ICPPAliasTemplate) {
+ ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) template;
+ IType aliasedType = aliasTemplate.getType();
+ ICPPTemplateArgument[] args = createTemplateArgumentArray(id);
+ args = addDefaultArguments(aliasTemplate, args, id);
+ ICPPTemplateParameterMap parameterMap = createParameterMap(aliasTemplate, args);
+ IBinding owner = template.getOwner();
+ ICPPClassSpecialization within = getSpecializationContext(owner);
+ IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id);
+ return new CPPAliasTemplateInstance(id.toCharArray(), instantiatedType, aliasTemplate);
+ }
+
+ // Class template.
if (template instanceof ICPPConstructor) {
template= template.getOwner();
}
if (template instanceof ICPPUnknownMemberClass) {
- IType owner= ((ICPPUnknownMemberClass)template).getOwnerType();
+ IType owner= ((ICPPUnknownMemberClass) template).getOwnerType();
ICPPTemplateArgument[] args= createTemplateArgumentArray(id);
args= SemanticUtil.getSimplifiedArguments(args);
return new CPPUnknownClassInstance(owner, id.getSimpleID(), args);
@@ -716,8 +732,9 @@ public class CPPTemplates {
if (parentOfName instanceof ICPPASTElaboratedTypeSpecifier ||
parentOfName instanceof ICPPASTCompositeTypeSpecifier ||
parentOfName instanceof ICPPASTNamedTypeSpecifier ||
- parentOfName instanceof ICPPASTBaseSpecifier)
+ parentOfName instanceof ICPPASTBaseSpecifier) {
return true;
+ }
if (parentOfName instanceof IASTDeclarator) {
IASTDeclarator rel= ASTQueries.findTypeRelevantDeclarator((IASTDeclarator) parentOfName);
@@ -726,7 +743,6 @@ public class CPPTemplates {
return false;
}
-
public static ICPPTemplateInstance createInstance(IBinding owner, ICPPTemplateDefinition template,
CPPTemplateParameterMap tpMap, ICPPTemplateArgument[] args, IASTNode point) {
if (owner instanceof ICPPSpecialization) {
@@ -811,6 +827,10 @@ public class CPPTemplates {
} else if (decl instanceof ITypedef) {
IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
+ } else if (decl instanceof ICPPAliasTemplate) {
+ ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
+ IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
+ spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), type, aliasTemplate);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
spec = decl;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 31ad69b6196..71937b1296e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
@@ -93,6 +94,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
@@ -172,6 +174,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTUnaryExpression;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPAliasTemplate;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplate;
@@ -654,10 +657,32 @@ public class CPPVisitor extends ASTQueries {
binding = new ProblemBinding(alias.getAlias(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
}
}
-
return binding;
+ } else if (declaration instanceof ICPPASTAliasDeclaration) {
+ ICPPASTAliasDeclaration alias = (ICPPASTAliasDeclaration) declaration;
+ ICPPScope scope = (ICPPScope) getContainingScope(declaration);
+ IBinding binding = scope.getBinding(alias.getAlias(), false);
+ if (!(binding instanceof ICPPInternalBinding)) {
+ IType type = createType(alias.getMappingTypeId());
+ if (type instanceof IProblemBinding) {
+ IProblemBinding problem = (IProblemBinding) type;
+ type = new CPPClassType.CPPClassTypeProblem(problem.getASTNode(), problem.getID(),
+ alias.getMappingTypeId().getAbstractDeclarator().getName().toCharArray());
+ }
+ if (type != null) {
+ if (alias.getParent() instanceof ICPPASTTemplateDeclaration) {
+ binding = new CPPAliasTemplate(alias.getAlias(), type);
+ } else {
+ CPPTypedef typedef = new CPPTypedef(alias.getAlias());
+ typedef.setType(type);
+ binding = typedef;
+ }
+ } else {
+ binding = new ProblemBinding(alias.getAlias(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
+ }
+ }
+ return binding;
}
-
return null;
}
@@ -1766,7 +1791,7 @@ public class CPPVisitor extends ASTQueries {
if (pDtor != null) {
pt = createType(pt, pDtor);
}
- pt= adjustParameterType(pt, forFuncType);
+ pt= adjustParameterType(pt, forFuncType);
if (pDtor != null && CPPVisitor.findInnermostDeclarator(pDtor).declaresParameterPack()) {
pt= new CPPParameterPackType(pt);
@@ -1810,13 +1835,12 @@ public class CPPVisitor extends ASTQueries {
return pTypes;
}
-
/**
* Adjusts the parameter type according to 8.3.5-3:
* cv-qualifiers are deleted, arrays and function types are converted to pointers.
*/
static IType adjustParameterType(final IType pt, boolean forFunctionType) {
- // bug 239975
+ // Bug 239975
IType t= SemanticUtil.getNestedType(pt, TDEF);
if (t instanceof IArrayType) {
IArrayType at = (IArrayType) t;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
index 267b5c018dd..0707a73c5db 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
@@ -183,7 +183,7 @@ public class Conversions {
return cost;
}
}
- // � otherwise, the program is ill-formed.
+ // otherwise, the program is ill-formed.
return Cost.NO_CONVERSION;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
index 2c3cc53bf77..4cbea3195e5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
@@ -336,7 +336,7 @@ public class EvalID extends CPPEvaluation {
@Override
public int determinePackSize(ICPPTemplateParameterMap tpMap) {
- int r = fFieldOwner.determinePackSize(tpMap);
+ int r = fFieldOwner != null ? fFieldOwner.determinePackSize(tpMap) : CPPTemplates.PACK_SIZE_NOT_FOUND;
for (ICPPTemplateArgument arg : fTemplateArgs) {
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(arg, tpMap));
}
@@ -345,6 +345,6 @@ public class EvalID extends CPPEvaluation {
@Override
public boolean referencesTemplateParameter() {
- return fFieldOwner.referencesTemplateParameter();
+ return fFieldOwner != null && fFieldOwner.referencesTemplateParameter();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
index df7e77c86cf..f4610043e90 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
@@ -87,6 +87,8 @@ public class DeclSpecWriter extends NodeWriter {
return Keywords.FLOAT;
case IASTSimpleDeclSpecifier.t_double:
return Keywords.DOUBLE;
+ case IASTSimpleDeclSpecifier.t_float128:
+ return GCCKeywords.__FLOAT128;
case IASTSimpleDeclSpecifier.t_bool:
return isCpp ? Keywords.BOOL : Keywords._BOOL;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
index dc15a60bdc3..8776a2a3df9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
@@ -10,6 +10,7 @@
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@@ -18,9 +19,11 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
@@ -32,6 +35,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
@@ -93,6 +97,8 @@ public class DeclarationWriter extends NodeWriter {
writeUsingDirective((ICPPASTUsingDirective) declaration);
} else if (declaration instanceof ICPPASTVisibilityLabel) {
writeVisibilityLabel((ICPPASTVisibilityLabel) declaration);
+ } else if (declaration instanceof ICPPASTAliasDeclaration) {
+ writeAliasDeclaration((ICPPASTAliasDeclaration) declaration);
}
writeTrailingComments(declaration, addNewLine);
@@ -104,6 +110,20 @@ public class DeclarationWriter extends NodeWriter {
}
}
+ private void writeAliasDeclaration(ICPPASTAliasDeclaration aliasDeclaration) {
+ scribe.printStringSpace(Keywords.USING);
+ IASTName alias = aliasDeclaration.getAlias();
+ if (alias != null) {
+ alias.accept(visitor);
+ }
+ scribe.print(EQUALS);
+ ICPPASTTypeId aliasedType = aliasDeclaration.getMappingTypeId();
+ if (aliasedType != null) {
+ aliasedType.accept(visitor);
+ }
+ scribe.printSemicolon();
+ }
+
private void writeVisibilityLabel(ICPPASTVisibilityLabel visiblityLabel) {
scribe.decrementIndentationLevel();
switch (visiblityLabel.getVisibility()) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java
index ac8795b0018..7aab87f9d8d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java
@@ -8,6 +8,7 @@
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index;
@@ -60,4 +61,5 @@ public interface IIndexCPPBindingConstants {
int CPP_UNKNOWN_FIELD = IIndexBindingConstants.LAST_CONSTANT + 48;
int CPP_USING_DECLARATION_SPECIALIZATION= IIndexBindingConstants.LAST_CONSTANT + 49;
int CPP_UNKNOWN_METHOD = IIndexBindingConstants.LAST_CONSTANT + 50;
+ int CPP_TEMPLATE_ALIAS = IIndexBindingConstants.LAST_CONSTANT + 51;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
index 2c067f2bbab..66d8f36bef8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
@@ -22,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
@@ -129,9 +130,9 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
return new CompositeCPPNamespaceScope(this, namespaces);
}
throw new CompositingNotImplementedError(rscope.getClass().getName());
- } catch(CoreException ce) {
- CCorePlugin.log(ce);
- throw new CompositingNotImplementedError(ce.getMessage());
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ throw new CompositingNotImplementedError(e.getMessage());
}
}
@@ -482,7 +483,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunction) {
return new CompositeCPPFunctionInstance(this, (ICPPFunction) binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
} else if (binding instanceof ICPPTemplateDefinition) {
@@ -499,7 +500,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunctionType) {
return new CompositeCPPFunctionTemplateSpecialization(this, (ICPPFunction) binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
if (binding instanceof ICPPClassType) {
@@ -519,10 +520,10 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPUsingDeclaration) {
return new CompositeCPPUsingDeclarationSpecialization(this, (ICPPUsingDeclaration) binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
- } else if(binding instanceof ICPPTemplateParameter) {
+ } else if (binding instanceof ICPPTemplateParameter) {
if (binding instanceof ICPPTemplateTypeParameter) {
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
} else if (binding instanceof ICPPTemplateNonTypeParameter) {
@@ -530,7 +531,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPTemplateTemplateParameter) {
result = new CompositeCPPTemplateTemplateParameter(this, (ICPPTemplateTemplateParameter) binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (binding instanceof ICPPTemplateDefinition) {
if (binding instanceof ICPPClassTemplate) {
@@ -542,8 +543,10 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
return new CompositeCPPMethodTemplate(this, (ICPPMethod) binding);
} else if (binding instanceof ICPPFunctionTemplate) {
return new CompositeCPPFunctionTemplate(this, (ICPPFunction) binding);
+ } else if (binding instanceof ICPPAliasTemplate) {
+ return new CompositeCPPAliasTemplate(this, (ICPPBinding) binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (binding instanceof ICPPParameter) {
result = new CompositeCPPParameter(this, (ICPPParameter) binding);
@@ -569,7 +572,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
return new CompositeCPPUnknownMethod(b, def.getNameCharArray());
}
}
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} else if (binding instanceof ICPPClassType) {
ICPPClassType def = (ICPPClassType) findOneBinding(binding);
result = def == null ? null : new CompositeCPPClassType(this, def);
@@ -596,11 +599,11 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof IIndexMacroContainer) {
result= new CompositeMacroContainer(this, binding);
} else {
- throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
}
- } catch(CoreException ce) {
- CCorePlugin.log(ce);
- throw new CompositingNotImplementedError(ce.getMessage());
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ throw new CompositingNotImplementedError(e.getMessage());
}
return result;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPAliasTemplate.java
new file mode 100644
index 00000000000..96d7b06a739
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPAliasTemplate.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc 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:
+ * Sergey Prigogin (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.index.composite.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
+import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
+
+class CompositeCPPAliasTemplate extends CompositeCPPBinding implements ICPPAliasTemplate {
+ public CompositeCPPAliasTemplate(ICompositesFactory cf, ICPPBinding delegate) {
+ super(cf, delegate);
+ }
+
+ @Override
+ public Object clone() {
+ fail(); return null;
+ }
+
+ @Override
+ public IType getType() {
+ IType type = ((ICPPAliasTemplate) rbinding).getType();
+ return cf.getCompositeType(type);
+ }
+
+ @Override
+ public boolean isSameType(IType type) {
+ return ((ICPPAliasTemplate) rbinding).isSameType(type);
+ }
+
+ @Override
+ public ICPPTemplateParameter[] getTemplateParameters() {
+ return TemplateInstanceUtil.convert(cf, ((ICPPAliasTemplate) rbinding).getTemplateParameters());
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumeration.java
index 50c3a63b530..dbae723aa2f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumeration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPEnumeration.java
@@ -36,7 +36,7 @@ class CompositeCPPEnumeration extends CompositeCPPBinding implements ICPPEnumera
@Override
public boolean isSameType(IType type) {
- return ((IEnumeration)rbinding).isSameType(type);
+ return ((IEnumeration) rbinding).isSameType(type);
}
@Override
@@ -48,17 +48,17 @@ class CompositeCPPEnumeration extends CompositeCPPBinding implements ICPPEnumera
}
@Override
public long getMinValue() {
- return ((IEnumeration)rbinding).getMinValue();
+ return ((IEnumeration) rbinding).getMinValue();
}
@Override
public long getMaxValue() {
- return ((IEnumeration)rbinding).getMaxValue();
+ return ((IEnumeration) rbinding).getMaxValue();
}
@Override
public boolean isScoped() {
- return ((ICPPEnumeration)rbinding).isScoped();
+ return ((ICPPEnumeration) rbinding).isScoped();
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTypedef.java
index 51820cbe782..956951914e4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTypedef.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTypedef.java
@@ -25,13 +25,13 @@ class CompositeCPPTypedef extends CompositeCPPBinding implements ITypedef, IInde
@Override
public IType getType() {
- IType type = ((ITypedef)rbinding).getType();
+ IType type = ((ITypedef) rbinding).getType();
return cf.getCompositeType(type);
}
@Override
public boolean isSameType(IType type) {
- return ((ITypedef)rbinding).isSameType(type);
+ return ((ITypedef) rbinding).isSameType(type);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java
new file mode 100644
index 00000000000..7cf0c3c4971
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik
+ * Rapperswil, University of applied sciences.
+ * 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:
+ * Thomas Corbat (IFS) - 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.cpp.ICPPAliasTemplate;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
+import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
+import org.eclipse.cdt.internal.core.pdom.db.Database;
+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * PDOM binding for alias template.
+ */
+class PDOMCPPAliasTemplate extends PDOMCPPBinding implements ICPPAliasTemplate {
+ private static final int ALIASED_TYPE_SIZE = Database.TYPE_SIZE;
+ private static final int TEMPLATE_PARAMS_SIZE = PDOMCPPTemplateTemplateParameter.RECORD_SIZE;
+ @SuppressWarnings("hiding")
+ protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + ALIASED_TYPE_SIZE + TEMPLATE_PARAMS_SIZE;
+
+ private static final int ALIASED_TYPE_OFFSET = PDOMCPPBinding.RECORD_SIZE + 0;
+ private static final int TEMPLATE_PARAMS_OFFSET = ALIASED_TYPE_OFFSET + ALIASED_TYPE_SIZE;
+
+ private volatile IPDOMCPPTemplateParameter[] parameters;
+
+ public PDOMCPPAliasTemplate(PDOMCPPLinkage linkage, PDOMNode parent,
+ ICPPAliasTemplate templateAlias) throws CoreException, DOMException {
+ super(linkage, parent, templateAlias.getNameCharArray());
+ setTemplateParameters(linkage, templateAlias.getTemplateParameters());
+ setType(linkage, templateAlias.getType());
+ }
+
+ public PDOMCPPAliasTemplate(PDOMCPPLinkage linkage, long record) {
+ super(linkage, record);
+ }
+
+ private void setTemplateParameters(PDOMCPPLinkage linkage,
+ final ICPPTemplateParameter[] origParams) throws CoreException, DOMException {
+ parameters = PDOMTemplateParameterArray.createPDOMTemplateParameters(linkage, this, origParams);
+ final Database db = getDB();
+ long rec= PDOMTemplateParameterArray.putArray(db, parameters);
+ db.putRecPtr(record + TEMPLATE_PARAMS_OFFSET, rec);
+ linkage.new ConfigureTemplateParameters(origParams, parameters);
+ }
+
+ private void setType(PDOMCPPLinkage linkage, IType aliasedType) throws CoreException {
+ linkage.storeType(record + ALIASED_TYPE_OFFSET, aliasedType);
+ }
+
+ @Override
+ public int getNodeType() {
+ return IIndexCPPBindingConstants.CPP_TEMPLATE_ALIAS;
+ }
+
+ @Override
+ public boolean isSameType(IType type) {
+ if(type == null){
+ return false;
+ }
+ IType aliasedType = getType();
+ return type.isSameType(aliasedType);
+ }
+
+ @Override
+ public ICPPTemplateParameter[] getTemplateParameters() {
+ if (parameters == null) {
+ try {
+ Database db = getDB();
+ long rec= db.getRecPtr(record + TEMPLATE_PARAMS_OFFSET);
+ if (rec == 0) {
+ parameters= IPDOMCPPTemplateParameter.EMPTY_ARRAY;
+ } else {
+ parameters= PDOMTemplateParameterArray.getArray(this, rec);
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ parameters = IPDOMCPPTemplateParameter.EMPTY_ARRAY;
+ }
+ }
+ return parameters;
+ }
+
+ @Override
+ public IType getType() {
+ try {
+ return getLinkage().loadType(record + ALIASED_TYPE_OFFSET);
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ return null;
+ }
+ }
+
+ @Override
+ protected int getRecordSize() {
+ return RECORD_SIZE;
+ }
+
+ @Override
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
index 0160143f331..920b06a2789 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
@@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
+ * Thomas Corbat (IFS)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@@ -60,6 +61,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
@@ -86,6 +89,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPAliasTemplateInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownMember;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
@@ -409,6 +413,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
} else if (binding instanceof ITypedef) {
pdomBinding = new PDOMCPPTypedef(this, parent, (ITypedef) binding);
+ } else if (binding instanceof ICPPAliasTemplate) {
+ pdomBinding = new PDOMCPPAliasTemplate(this, parent, (ICPPAliasTemplate) binding);
}
if (pdomBinding != null) {
@@ -601,11 +607,18 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return CPPENUMERATOR;
} else if (binding instanceof ITypedef) {
return CPPTYPEDEF;
+ } else if (binding instanceof ICPPAliasTemplate) {
+ return CPP_TEMPLATE_ALIAS;
}
return 0;
}
+ @Override
+ protected boolean cannotAdapt(final IBinding inputBinding) throws CoreException {
+ return super.cannotAdapt(inputBinding) || inputBinding instanceof ICPPAliasTemplateInstance;
+ }
+
@Override
public final PDOMBinding adaptBinding(final IBinding inputBinding, boolean includeLocal) throws CoreException {
return adaptBinding(null, inputBinding, includeLocal ? FILE_LOCAL_REC_DUMMY : null);
@@ -825,6 +838,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return new PDOMCPPTypedefSpecialization(this, record);
case CPP_USING_DECLARATION_SPECIALIZATION:
return new PDOMCPPUsingDeclarationSpecialization(this, record);
+ case CPP_TEMPLATE_ALIAS:
+ return new PDOMCPPAliasTemplate(this, record);
}
assert false : "nodeid= " + nodeType; //$NON-NLS-1$
return null;
@@ -1044,6 +1059,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return CPPUnknownClassInstance.unmarshal(getPDOM(), firstByte, buffer);
case ITypeMarshalBuffer.DEFERRED_CLASS_INSTANCE:
return CPPDeferredClassInstance.unmarshal(getPDOM(), firstByte, buffer);
+ case ITypeMarshalBuffer.ALIAS_TEMPLATE:
+ return CPPAliasTemplateInstance.unmarshal(firstByte, buffer);
}
throw new CoreException(CCorePlugin.createStatus("Cannot unmarshal a type, first byte=" + firstByte)); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
index 98f8937bfb8..2f493a5fd81 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/EnvironmentVariableManager.java
@@ -91,10 +91,12 @@ public class EnvironmentVariableManager implements IEnvironmentVariableManager {
protected int getVarMacroSupplierNum(EnvVarDescriptor var, IVariableContextInfo varMacroInfo) {
int varSupplierNum = -1;
ICdtVariableSupplier macroSuppliers[] = varMacroInfo.getSuppliers();
- for(int i = 0; i < macroSuppliers.length; i++) {
- if (macroSuppliers[i] instanceof EnvironmentVariableSupplier) {
- varSupplierNum = i;
- break;
+ if (macroSuppliers != null) {
+ for(int i = 0; i < macroSuppliers.length; i++) {
+ if (macroSuppliers[i] instanceof EnvironmentVariableSupplier) {
+ varSupplierNum = i;
+ break;
+ }
}
}
return varSupplierNum;