clang
20.0.0git
include
clang
Basic
OperatorPrecedence.h
Go to the documentation of this file.
1
//===--- OperatorPrecedence.h - Operator precedence levels ------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
///
9
/// \file
10
/// Defines and computes precedence levels for binary/ternary operators.
11
///
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
15
#define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
16
17
#include "
clang/Basic/TokenKinds.h
"
18
19
namespace
clang
{
20
21
/// PrecedenceLevels - These are precedences for the binary/ternary
22
/// operators in the C99 grammar. These have been named to relate
23
/// with the C99 grammar productions. Low precedences numbers bind
24
/// more weakly than high numbers.
25
namespace
prec {
26
enum
Level
{
27
Unknown
= 0,
// Not binary operator.
28
Comma
= 1,
// ,
29
Assignment
= 2,
// =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=
30
Conditional
= 3,
// ?
31
LogicalOr
= 4,
// ||
32
LogicalAnd
= 5,
// &&
33
InclusiveOr
= 6,
// |
34
ExclusiveOr
= 7,
// ^
35
And
= 8,
// &
36
Equality
= 9,
// ==, !=
37
Relational
= 10,
// >=, <=, >, <
38
Spaceship
= 11,
// <=>
39
Shift
= 12,
// <<, >>
40
Additive
= 13,
// -, +
41
Multiplicative
= 14,
// *, /, %
42
PointerToMember
= 15
// .*, ->*
43
};
44
}
45
46
/// Return the precedence of the specified binary operator token.
47
prec::Level
getBinOpPrecedence
(
tok::TokenKind
Kind
,
bool
GreaterThanIsOperator,
48
bool
CPlusPlus11
);
49
50
}
// end namespace clang
51
52
#endif
// LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H
Kind
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
TokenKinds.h
Defines the clang::TokenKind enum and support functions.
clang::prec::Level
Level
Definition:
OperatorPrecedence.h:26
clang::prec::Relational
@ Relational
Definition:
OperatorPrecedence.h:37
clang::prec::Multiplicative
@ Multiplicative
Definition:
OperatorPrecedence.h:41
clang::prec::Unknown
@ Unknown
Definition:
OperatorPrecedence.h:27
clang::prec::LogicalOr
@ LogicalOr
Definition:
OperatorPrecedence.h:31
clang::prec::PointerToMember
@ PointerToMember
Definition:
OperatorPrecedence.h:42
clang::prec::Additive
@ Additive
Definition:
OperatorPrecedence.h:40
clang::prec::LogicalAnd
@ LogicalAnd
Definition:
OperatorPrecedence.h:32
clang::prec::Comma
@ Comma
Definition:
OperatorPrecedence.h:28
clang::prec::Assignment
@ Assignment
Definition:
OperatorPrecedence.h:29
clang::prec::And
@ And
Definition:
OperatorPrecedence.h:35
clang::prec::ExclusiveOr
@ ExclusiveOr
Definition:
OperatorPrecedence.h:34
clang::prec::Spaceship
@ Spaceship
Definition:
OperatorPrecedence.h:38
clang::prec::Conditional
@ Conditional
Definition:
OperatorPrecedence.h:30
clang::prec::Shift
@ Shift
Definition:
OperatorPrecedence.h:39
clang::prec::Equality
@ Equality
Definition:
OperatorPrecedence.h:36
clang::prec::InclusiveOr
@ InclusiveOr
Definition:
OperatorPrecedence.h:33
clang::tok::TokenKind
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition:
TokenKinds.h:25
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
clang::CPlusPlus11
@ CPlusPlus11
Definition:
LangStandard.h:57
clang::getBinOpPrecedence
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
Definition:
OperatorPrecedence.cpp:17
Generated on Thu Dec 5 2024 19:06:45 for clang by
1.9.6