Skip to main content
summaryrefslogtreecommitdiffstats
blob: d31cd9666658bf86ebb15e225a1f447c5f142925 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
 * Copyright (c) 2004, 2011 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:
 *     Doug Schaefer (IBM) - Initial API and implementation
 *     Markus Schorn (Wind River Systems)
 *******************************************************************************/
package org.eclipse.cdt.core.dom.ast;

/**
 * This is the root class of expressions.
 * 
 * @noextend This interface is not intended to be extended by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IASTExpression extends IASTInitializerClause {
	/**
	 * @since 5.3
	 */
	public enum ValueCategory {
		/**
		 * Traditional lvalue
		 */
		LVALUE,
		/**
		 * Expiring value as introduced by c++11.
		 */
		XVALUE,
		/**
		 * Pure rvalue.
		 */
		PRVALUE;
		
		/**
		 * Both prvalues and xvalues are rvalues.
		 */
		public boolean isRValue() {
			return this != LVALUE;
		}

		/**
		 * A generalized lvalue is either an lvalue or an xvalue.
		 */
		public boolean isGLValue() {
			return this != PRVALUE;
		}
	}

	/**
	 * Empty expression array.
	 */
	public static final IASTExpression[] EMPTY_EXPRESSION_ARRAY = {};

	/**
	 * Returns the type of the value the expression evaluates to.
	 */
	public IType getExpressionType();
	
	/**
	 * Returns whether this expression is an lvalue. LValues are for instance required on
	 * the left hand side of an assignment expression.
	 * @since 5.2
	 */
	public boolean isLValue();
	
	/**
	 * Returns the value category of this expression.
	 * @since 5.3
	 */
	ValueCategory getValueCategory();

	/**
	 * @since 5.1
	 */
	@Override
	public IASTExpression copy();

	/**
	 * @since 5.3
	 */
	@Override
	public IASTExpression copy(CopyStyle style);
}

Back to the top