clang
9.0.0
|
Keeps track of expected type during expression parsing. More...
#include "clang/Sema/Sema.h"
Public Member Functions | |
PreferredTypeBuilder ()=default | |
PreferredTypeBuilder (QualType Type) | |
void | enterCondition (Sema &S, SourceLocation Tok) |
void | enterReturn (Sema &S, SourceLocation Tok) |
void | enterVariableInit (SourceLocation Tok, Decl *D) |
void | enterFunctionArgument (SourceLocation Tok, llvm::function_ref< QualType()> ComputeType) |
Computing a type for the function argument may require running overloading, so we postpone its computation until it is actually needed. More... | |
void | enterParenExpr (SourceLocation Tok, SourceLocation LParLoc) |
void | enterUnary (Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc) |
void | enterBinary (Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op) |
void | enterMemAccess (Sema &S, SourceLocation Tok, Expr *Base) |
void | enterSubscript (Sema &S, SourceLocation Tok, Expr *LHS) |
void | enterTypeCast (SourceLocation Tok, QualType CastType) |
Handles all type casts, including C-style cast, C++ casts, etc. More... | |
QualType | get (SourceLocation Tok) const |
Keeps track of expected type during expression parsing.
The type is tied to a particular token, all functions that update or consume the type take a start location of the token they are looking at as a parameter. This allows to avoid updating the type on hot paths in the parser.
|
default |
|
inlineexplicit |
void PreferredTypeBuilder::enterBinary | ( | Sema & | S, |
SourceLocation | Tok, | ||
Expr * | LHS, | ||
tok::TokenKind | Op | ||
) |
Definition at line 519 of file SemaCodeComplete.cpp.
Referenced by clang::Parser::ParseConstraintExpression().
void PreferredTypeBuilder::enterCondition | ( | Sema & | S, |
SourceLocation | Tok | ||
) |
Definition at line 560 of file SemaCodeComplete.cpp.
void PreferredTypeBuilder::enterFunctionArgument | ( | SourceLocation | Tok, |
llvm::function_ref< QualType()> | ComputeType | ||
) |
Computing a type for the function argument may require running overloading, so we postpone its computation until it is actually needed.
Clients should be very careful when using this funciton, as it stores a function_ref, clients should make sure all calls to get() with the same location happen while function_ref is alive.
Definition at line 395 of file SemaCodeComplete.cpp.
References clang::format::Tok.
Referenced by clang::Parser::ParseUnqualifiedId().
void PreferredTypeBuilder::enterMemAccess | ( | Sema & | S, |
SourceLocation | Tok, | ||
Expr * | Base | ||
) |
Definition at line 526 of file SemaCodeComplete.cpp.
void PreferredTypeBuilder::enterParenExpr | ( | SourceLocation | Tok, |
SourceLocation | LParLoc | ||
) |
Definition at line 402 of file SemaCodeComplete.cpp.
References clang::format::Tok.
void PreferredTypeBuilder::enterReturn | ( | Sema & | S, |
SourceLocation | Tok | ||
) |
Definition at line 370 of file SemaCodeComplete.cpp.
void PreferredTypeBuilder::enterSubscript | ( | Sema & | S, |
SourceLocation | Tok, | ||
Expr * | LHS | ||
) |
Definition at line 546 of file SemaCodeComplete.cpp.
void PreferredTypeBuilder::enterTypeCast | ( | SourceLocation | Tok, |
QualType | CastType | ||
) |
Handles all type casts, including C-style cast, C++ casts, etc.
Definition at line 553 of file SemaCodeComplete.cpp.
References clang::QualType::getCanonicalType(), clang::QualType::isNull(), and clang::format::Tok.
void PreferredTypeBuilder::enterUnary | ( | Sema & | S, |
SourceLocation | Tok, | ||
tok::TokenKind | OpKind, | ||
SourceLocation | OpLoc | ||
) |
Definition at line 538 of file SemaCodeComplete.cpp.
void PreferredTypeBuilder::enterVariableInit | ( | SourceLocation | Tok, |
Decl * | D | ||
) |
Definition at line 388 of file SemaCodeComplete.cpp.
References clang::format::Tok.
|
inline |
Definition at line 307 of file Sema.h.
Referenced by clang::Parser::ParseAssignmentExpression().