clang
6.0.0
include
clang
Basic
OperatorPrecedence.h
Go to the documentation of this file.
1
//===--- OperatorPrecedence.h - Operator precedence levels ------*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
///
10
/// \file
11
/// \brief Defines and computes precedence levels for binary/ternary operators.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
16
#define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
17
18
#include "
clang/Basic/TokenKinds.h
"
19
20
namespace
clang
{
21
22
/// PrecedenceLevels - These are precedences for the binary/ternary
23
/// operators in the C99 grammar. These have been named to relate
24
/// with the C99 grammar productions. Low precedences numbers bind
25
/// more weakly than high numbers.
26
namespace
prec {
27
enum
Level
{
28
Unknown
= 0,
// Not binary operator.
29
Comma
= 1,
// ,
30
Assignment
= 2,
// =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=
31
Conditional
= 3,
// ?
32
LogicalOr
= 4,
// ||
33
LogicalAnd
= 5,
// &&
34
InclusiveOr
= 6,
// |
35
ExclusiveOr
= 7,
// ^
36
And
= 8,
// &
37
Equality
= 9,
// ==, !=
38
Relational
= 10,
// >=, <=, >, <
39
Spaceship
= 11,
// <=>
40
Shift
= 12,
// <<, >>
41
Additive
= 13,
// -, +
42
Multiplicative
= 14,
// *, /, %
43
PointerToMember
= 15
// .*, ->*
44
};
45
}
46
47
/// \brief Return the precedence of the specified binary operator token.
48
prec::Level
getBinOpPrecedence
(
tok::TokenKind
Kind
,
bool
GreaterThanIsOperator,
49
bool
CPlusPlus11
);
50
51
}
// end namespace clang
52
53
#endif // LLVM_CLANG_OPERATOR_PRECEDENCE_H
clang::prec::Unknown
Definition:
OperatorPrecedence.h:28
clang::prec::Additive
Definition:
OperatorPrecedence.h:41
clang::prec::Relational
Definition:
OperatorPrecedence.h:38
clang::prec::InclusiveOr
Definition:
OperatorPrecedence.h:34
clang::prec::LogicalOr
Definition:
OperatorPrecedence.h:32
clang::prec::Assignment
Definition:
OperatorPrecedence.h:30
clang::prec::Conditional
Definition:
OperatorPrecedence.h:31
clang::prec::Spaceship
Definition:
OperatorPrecedence.h:39
clang::prec::PointerToMember
Definition:
OperatorPrecedence.h:43
Kind
Kind
Definition:
ChrootChecker.cpp:29
clang::prec::LogicalAnd
Definition:
OperatorPrecedence.h:33
clang::prec::Shift
Definition:
OperatorPrecedence.h:40
clang::tok::TokenKind
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition:
TokenKinds.h:25
clang
Dataflow Directional Tag Classes.
Definition:
CFGReachabilityAnalysis.h:22
clang::prec::And
Definition:
OperatorPrecedence.h:36
clang::prec::Equality
Definition:
OperatorPrecedence.h:37
clang::prec::ExclusiveOr
Definition:
OperatorPrecedence.h:35
clang::frontend::CPlusPlus11
Definition:
LangStandard.h:27
TokenKinds.h
Defines the clang::TokenKind enum and support functions.
clang::getBinOpPrecedence
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
Definition:
OperatorPrecedence.cpp:18
clang::prec::Comma
Definition:
OperatorPrecedence.h:29
clang::prec::Multiplicative
Definition:
OperatorPrecedence.h:42
clang::prec::Level
Level
Definition:
OperatorPrecedence.h:27
Generated on Mon Feb 26 2018 11:34:03 for clang by
1.8.13