clang API Documentation

Classes | Functions
PPExpressions.cpp File Reference
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroInfo.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
Include dependency graph for PPExpressions.cpp:

Go to the source code of this file.

Classes

struct  DefinedTracker

Functions

static bool EvaluateDirectiveSubExpr (PPValue &LHS, unsigned MinPrec, Token &PeekTok, bool ValueLive, Preprocessor &PP)
static bool EvaluateDefined (PPValue &Result, Token &PeekTok, DefinedTracker &DT, bool ValueLive, Preprocessor &PP)
 EvaluateDefined - Process a 'defined(sym)' expression.
static bool EvaluateValue (PPValue &Result, Token &PeekTok, DefinedTracker &DT, bool ValueLive, Preprocessor &PP)
static unsigned getPrecedence (tok::TokenKind Kind)

Function Documentation

static bool EvaluateDefined ( PPValue &  Result,
Token PeekTok,
DefinedTracker DT,
bool  ValueLive,
Preprocessor PP 
) [static]
static bool EvaluateDirectiveSubExpr ( PPValue &  LHS,
unsigned  MinPrec,
Token PeekTok,
bool  ValueLive,
Preprocessor PP 
) [static]

EvaluateDirectiveSubExpr - Evaluate the subexpression whose first token is PeekTok, and whose precedence is PeekPrec. This returns the result in LHS.

If ValueLive is false, then this value is being evaluated in a context where the result is not used. As such, avoid diagnostics that relate to evaluation, such as division by zero warnings.

Definition at line 460 of file PPExpressions.cpp.

References clang::Preprocessor::Diag(), EvaluateValue(), clang::Token::getKind(), clang::Preprocessor::getLangOpts(), clang::Token::getLocation(), getPrecedence(), clang::Token::isNot(), and clang::Preprocessor::LexNonComment().

Referenced by EvaluateValue().

static bool EvaluateValue ( PPValue &  Result,
Token PeekTok,
DefinedTracker DT,
bool  ValueLive,
Preprocessor PP 
) [static]
static unsigned getPrecedence ( tok::TokenKind  Kind) [static]

getPrecedence - Return the precedence of the specified binary operator token. This returns: ~0 - Invalid token. 14 -> 3 - various operators. 0 - 'eod' or ')'

Definition at line 424 of file PPExpressions.cpp.

Referenced by EvaluateDirectiveSubExpr().