#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
#include <cassert>
using namespace clang;
namespace {
class PPValue {
SourceRange Range;
IdentifierInfo *II;
public:
llvm::APSInt Val;
PPValue(unsigned BitWidth) : Val(BitWidth) {}
IdentifierInfo *getIdentifier() const { return II; }
void setIdentifier(IdentifierInfo *II) { this->II = II; }
unsigned getBitWidth() const { return Val.getBitWidth(); }
bool isUnsigned() const { return Val.isUnsigned(); }
SourceRange getRange() const { return Range; }
void setRange(SourceLocation L) { Range.setBegin(L); Range.setEnd(L); }
void setRange(SourceLocation B, SourceLocation E) {
Range.setBegin(B); Range.setEnd(E);
}
void setBegin(SourceLocation L) { Range.setBegin(L); }
void setEnd(SourceLocation L) { Range.setEnd(L); }
};
}
static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec,
Token &PeekTok, bool ValueLive,
bool &IncludedUndefinedIds,
Preprocessor &PP);
struct DefinedTracker {
enum TrackerState {
DefinedMacro, NotDefinedMacro, Unknown } State;
IdentifierInfo *TheMacro;
bool IncludedUndefinedIds = false;
};
static bool EvaluateDefined(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
bool ValueLive, Preprocessor &PP) {
SourceLocation beginLoc(PeekTok.getLocation());
Result.setBegin(beginLoc);
PP.LexUnexpandedNonComment(PeekTok);
SourceLocation LParenLoc;
if (PeekTok.is(tok::l_paren)) {
LParenLoc = PeekTok.getLocation();
PP.LexUnexpandedNonComment(PeekTok);
}
if (PeekTok.is(tok::code_completion)) {
if (PP.getCodeCompletionHandler())
PP.getCodeCompletionHandler()->CodeCompleteMacroName(false);
PP.setCodeCompletionReached();
PP.LexUnexpandedNonComment(PeekTok);
}
if (PP.CheckMacroName(PeekTok, MU_Other))
return true;
IdentifierInfo *II = PeekTok.getIdentifierInfo();
MacroDefinition Macro = PP.getMacroDefinition(II);
Result.Val = !!Macro;
Result.Val.setIsUnsigned(false); DT.IncludedUndefinedIds = !Macro;
PP.emitMacroExpansionWarnings(PeekTok);
if (Result.Val != 0 && ValueLive)
PP.markMacroAsUsed(Macro.getMacroInfo());
Token macroToken(PeekTok);
if (LParenLoc.isValid()) {
Result.setEnd(PeekTok.getLocation());
PP.LexUnexpandedNonComment(PeekTok);
if (PeekTok.isNot(tok::r_paren)) {
PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_after)
<< "'defined'" << tok::r_paren;
PP.Diag(LParenLoc, diag::note_matching) << tok::l_paren;
return true;
}
PP.LexNonComment(PeekTok);
Result.setEnd(PeekTok.getLocation());
} else {
Result.setEnd(PeekTok.getLocation());
PP.LexNonComment(PeekTok);
}
if (beginLoc.isMacroID()) {
bool IsFunctionTypeMacro =
PP.getSourceManager()
.getSLocEntry(PP.getSourceManager().getFileID(beginLoc))
.getExpansion()
.isFunctionMacroExpansion();
if (IsFunctionTypeMacro)
PP.Diag(beginLoc, diag::warn_defined_in_function_type_macro);
else
PP.Diag(beginLoc, diag::warn_defined_in_object_type_macro);
}
if (PPCallbacks *Callbacks = PP.getPPCallbacks()) {
Callbacks->Defined(macroToken, Macro,
SourceRange(beginLoc, PeekTok.getLocation()));
}
DT.State = DefinedTracker::DefinedMacro;
DT.TheMacro = II;
return false;
}
static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
bool ValueLive, Preprocessor &PP) {
DT.State = DefinedTracker::Unknown;
Result.setIdentifier(nullptr);
if (PeekTok.is(tok::code_completion)) {
if (PP.getCodeCompletionHandler())
PP.getCodeCompletionHandler()->CodeCompletePreprocessorExpression();
PP.setCodeCompletionReached();
PP.LexNonComment(PeekTok);
}
switch (PeekTok.getKind()) {
default:
if (IdentifierInfo *II = PeekTok.getIdentifierInfo()) {
if (II->isStr("defined"))
return EvaluateDefined(Result, PeekTok, DT, ValueLive, PP);
if (!II->isCPlusPlusOperatorKeyword()) {
if (ValueLive) {
PP.Diag(PeekTok, diag::warn_pp_undef_identifier) << II;
const DiagnosticsEngine &DiagEngine = PP.getDiagnostics();
if (DiagEngine.isIgnored(diag::warn_pp_undef_identifier,
PeekTok.getLocation())) {
const std::vector<std::string> UndefPrefixes =
DiagEngine.getDiagnosticOptions().UndefPrefixes;
const StringRef IdentifierName = II->getName();
if (llvm::any_of(UndefPrefixes,
[&IdentifierName](const std::string &Prefix) {
return IdentifierName.startswith(Prefix);
}))
PP.Diag(PeekTok, diag::warn_pp_undef_prefix)
<< AddFlagValue{llvm::join(UndefPrefixes, ",")} << II;
}
}
Result.Val = 0;
Result.Val.setIsUnsigned(false); Result.setIdentifier(II);
Result.setRange(PeekTok.getLocation());
DT.IncludedUndefinedIds = true;
PP.LexNonComment(PeekTok);
return false;
}
}
PP.Diag(PeekTok, diag::err_pp_expr_bad_token_start_expr);
return true;
case tok::eod:
case tok::r_paren:
PP.Diag(PeekTok, diag::err_pp_expected_value_in_expr);
return true;
case tok::numeric_constant: {
SmallString<64> IntegerBuffer;
bool NumberInvalid = false;
StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer,
&NumberInvalid);
if (NumberInvalid)
return true;
NumericLiteralParser Literal(Spelling, PeekTok.getLocation(),
PP.getSourceManager(), PP.getLangOpts(),
PP.getTargetInfo(), PP.getDiagnostics());
if (Literal.hadError)
return true;
if (Literal.isFloatingLiteral() || Literal.isImaginary) {
PP.Diag(PeekTok, diag::err_pp_illegal_floating_literal);
return true;
}
assert(Literal.isIntegerLiteral() && "Unknown ppnumber");
if (Literal.hasUDSuffix())
PP.Diag(PeekTok, diag::err_pp_invalid_udl) << 1;
if (!PP.getLangOpts().C99 && Literal.isLongLong) {
if (PP.getLangOpts().CPlusPlus)
PP.Diag(PeekTok,
PP.getLangOpts().CPlusPlus11 ?
diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
else
PP.Diag(PeekTok, diag::ext_c99_longlong);
}
if (Literal.isSizeT)
PP.Diag(PeekTok, PP.getLangOpts().CPlusPlus
? PP.getLangOpts().CPlusPlus2b
? diag::warn_cxx20_compat_size_t_suffix
: diag::ext_cxx2b_size_t_suffix
: diag::err_cxx2b_size_t_suffix);
if (Literal.isBitInt)
PP.Diag(PeekTok, PP.getLangOpts().C2x
? diag::warn_c2x_compat_bitint_suffix
: diag::ext_c2x_bitint_suffix);
if (Literal.GetIntegerValue(Result.Val)) {
if (ValueLive)
PP.Diag(PeekTok, diag::err_integer_literal_too_large)
<< 1;
Result.Val.setIsUnsigned(true);
} else {
Result.Val.setIsUnsigned(Literal.isUnsigned);
if (!Literal.isUnsigned && Result.Val.isNegative()) {
if (ValueLive && Literal.getRadix() == 10)
PP.Diag(PeekTok, diag::ext_integer_literal_too_large_for_signed);
Result.Val.setIsUnsigned(true);
}
}
Result.setRange(PeekTok.getLocation());
PP.LexNonComment(PeekTok);
return false;
}
case tok::char_constant: case tok::wide_char_constant: case tok::utf8_char_constant: case tok::utf16_char_constant: case tok::utf32_char_constant: { if (PeekTok.hasUDSuffix())
PP.Diag(PeekTok, diag::err_pp_invalid_udl) << 0;
SmallString<32> CharBuffer;
bool CharInvalid = false;
StringRef ThisTok = PP.getSpelling(PeekTok, CharBuffer, &CharInvalid);
if (CharInvalid)
return true;
CharLiteralParser Literal(ThisTok.begin(), ThisTok.end(),
PeekTok.getLocation(), PP, PeekTok.getKind());
if (Literal.hadError())
return true;
const TargetInfo &TI = PP.getTargetInfo();
unsigned NumBits;
if (Literal.isMultiChar())
NumBits = TI.getIntWidth();
else if (Literal.isWide())
NumBits = TI.getWCharWidth();
else if (Literal.isUTF16())
NumBits = TI.getChar16Width();
else if (Literal.isUTF32())
NumBits = TI.getChar32Width();
else NumBits = TI.getCharWidth();
llvm::APSInt Val(NumBits);
Val = Literal.getValue();
if (Literal.isWide())
Val.setIsUnsigned(!TargetInfo::isTypeSigned(TI.getWCharType()));
else if (Literal.isUTF16() || Literal.isUTF32())
Val.setIsUnsigned(true);
else if (Literal.isUTF8()) {
if (PP.getLangOpts().CPlusPlus)
Val.setIsUnsigned(
PP.getLangOpts().Char8 ? true : !PP.getLangOpts().CharIsSigned);
else
Val.setIsUnsigned(true);
} else
Val.setIsUnsigned(!PP.getLangOpts().CharIsSigned);
if (Result.Val.getBitWidth() > Val.getBitWidth()) {
Result.Val = Val.extend(Result.Val.getBitWidth());
} else {
assert(Result.Val.getBitWidth() == Val.getBitWidth() &&
"intmax_t smaller than char/wchar_t?");
Result.Val = Val;
}
Result.setRange(PeekTok.getLocation());
PP.LexNonComment(PeekTok);
return false;
}
case tok::l_paren: {
SourceLocation Start = PeekTok.getLocation();
PP.LexNonComment(PeekTok); if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
if (PeekTok.is(tok::r_paren)) {
} else {
if (EvaluateDirectiveSubExpr(Result, 1, PeekTok, ValueLive,
DT.IncludedUndefinedIds, PP))
return true;
if (PeekTok.isNot(tok::r_paren)) {
PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_rparen)
<< Result.getRange();
PP.Diag(Start, diag::note_matching) << tok::l_paren;
return true;
}
DT.State = DefinedTracker::Unknown;
}
Result.setRange(Start, PeekTok.getLocation());
Result.setIdentifier(nullptr);
PP.LexNonComment(PeekTok); return false;
}
case tok::plus: {
SourceLocation Start = PeekTok.getLocation();
PP.LexNonComment(PeekTok);
if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
Result.setBegin(Start);
Result.setIdentifier(nullptr);
return false;
}
case tok::minus: {
SourceLocation Loc = PeekTok.getLocation();
PP.LexNonComment(PeekTok);
if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
Result.setBegin(Loc);
Result.setIdentifier(nullptr);
Result.Val = -Result.Val;
bool Overflow = !Result.isUnsigned() && Result.Val.isMinSignedValue();
if (Overflow && ValueLive)
PP.Diag(Loc, diag::warn_pp_expr_overflow) << Result.getRange();
DT.State = DefinedTracker::Unknown;
return false;
}
case tok::tilde: {
SourceLocation Start = PeekTok.getLocation();
PP.LexNonComment(PeekTok);
if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
Result.setBegin(Start);
Result.setIdentifier(nullptr);
Result.Val = ~Result.Val;
DT.State = DefinedTracker::Unknown;
return false;
}
case tok::exclaim: {
SourceLocation Start = PeekTok.getLocation();
PP.LexNonComment(PeekTok);
if (EvaluateValue(Result, PeekTok, DT, ValueLive, PP)) return true;
Result.setBegin(Start);
Result.Val = !Result.Val;
Result.Val.setIsUnsigned(false);
Result.setIdentifier(nullptr);
if (DT.State == DefinedTracker::DefinedMacro)
DT.State = DefinedTracker::NotDefinedMacro;
else if (DT.State == DefinedTracker::NotDefinedMacro)
DT.State = DefinedTracker::DefinedMacro;
return false;
}
case tok::kw_true:
case tok::kw_false:
Result.Val = PeekTok.getKind() == tok::kw_true;
Result.Val.setIsUnsigned(false); Result.setIdentifier(PeekTok.getIdentifierInfo());
Result.setRange(PeekTok.getLocation());
PP.LexNonComment(PeekTok);
return false;
}
}
static unsigned getPrecedence(tok::TokenKind Kind) {
switch (Kind) {
default: return ~0U;
case tok::percent:
case tok::slash:
case tok::star: return 14;
case tok::plus:
case tok::minus: return 13;
case tok::lessless:
case tok::greatergreater: return 12;
case tok::lessequal:
case tok::less:
case tok::greaterequal:
case tok::greater: return 11;
case tok::exclaimequal:
case tok::equalequal: return 10;
case tok::amp: return 9;
case tok::caret: return 8;
case tok::pipe: return 7;
case tok::ampamp: return 6;
case tok::pipepipe: return 5;
case tok::question: return 4;
case tok::comma: return 3;
case tok::colon: return 2;
case tok::r_paren: return 0; case tok::eod: return 0; }
}
static void diagnoseUnexpectedOperator(Preprocessor &PP, PPValue &LHS,
Token &Tok) {
if (Tok.is(tok::l_paren) && LHS.getIdentifier())
PP.Diag(LHS.getRange().getBegin(), diag::err_pp_expr_bad_token_lparen)
<< LHS.getIdentifier();
else
PP.Diag(Tok.getLocation(), diag::err_pp_expr_bad_token_binop)
<< LHS.getRange();
}
static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec,
Token &PeekTok, bool ValueLive,
bool &IncludedUndefinedIds,
Preprocessor &PP) {
unsigned PeekPrec = getPrecedence(PeekTok.getKind());
if (PeekPrec == ~0U) {
diagnoseUnexpectedOperator(PP, LHS, PeekTok);
return true;
}
while (true) {
if (PeekPrec < MinPrec)
return false;
tok::TokenKind Operator = PeekTok.getKind();
bool RHSIsLive;
if (Operator == tok::ampamp && LHS.Val == 0)
RHSIsLive = false; else if (Operator == tok::pipepipe && LHS.Val != 0)
RHSIsLive = false; else if (Operator == tok::question && LHS.Val == 0)
RHSIsLive = false; else
RHSIsLive = ValueLive;
SourceLocation OpLoc = PeekTok.getLocation();
PP.LexNonComment(PeekTok);
PPValue RHS(LHS.getBitWidth());
DefinedTracker DT;
if (EvaluateValue(RHS, PeekTok, DT, RHSIsLive, PP)) return true;
IncludedUndefinedIds = DT.IncludedUndefinedIds;
unsigned ThisPrec = PeekPrec;
PeekPrec = getPrecedence(PeekTok.getKind());
if (PeekPrec == ~0U) {
diagnoseUnexpectedOperator(PP, RHS, PeekTok);
return true;
}
unsigned RHSPrec;
if (Operator == tok::question)
RHSPrec = getPrecedence(tok::comma);
else RHSPrec = ThisPrec+1;
if (PeekPrec >= RHSPrec) {
if (EvaluateDirectiveSubExpr(RHS, RHSPrec, PeekTok, RHSIsLive,
IncludedUndefinedIds, PP))
return true;
PeekPrec = getPrecedence(PeekTok.getKind());
}
assert(PeekPrec <= ThisPrec && "Recursion didn't work!");
llvm::APSInt Res(LHS.getBitWidth());
switch (Operator) {
case tok::question: case tok::lessless: case tok::greatergreater: case tok::comma: case tok::pipepipe: case tok::ampamp: break; default:
Res.setIsUnsigned(LHS.isUnsigned() || RHS.isUnsigned());
if (ValueLive && Res.isUnsigned()) {
if (!LHS.isUnsigned() && LHS.Val.isNegative())
PP.Diag(OpLoc, diag::warn_pp_convert_to_positive) << 0
<< toString(LHS.Val, 10, true) + " to " +
toString(LHS.Val, 10, false)
<< LHS.getRange() << RHS.getRange();
if (!RHS.isUnsigned() && RHS.Val.isNegative())
PP.Diag(OpLoc, diag::warn_pp_convert_to_positive) << 1
<< toString(RHS.Val, 10, true) + " to " +
toString(RHS.Val, 10, false)
<< LHS.getRange() << RHS.getRange();
}
LHS.Val.setIsUnsigned(Res.isUnsigned());
RHS.Val.setIsUnsigned(Res.isUnsigned());
}
bool Overflow = false;
switch (Operator) {
default: llvm_unreachable("Unknown operator token!");
case tok::percent:
if (RHS.Val != 0)
Res = LHS.Val % RHS.Val;
else if (ValueLive) {
PP.Diag(OpLoc, diag::err_pp_remainder_by_zero)
<< LHS.getRange() << RHS.getRange();
return true;
}
break;
case tok::slash:
if (RHS.Val != 0) {
if (LHS.Val.isSigned())
Res = llvm::APSInt(LHS.Val.sdiv_ov(RHS.Val, Overflow), false);
else
Res = LHS.Val / RHS.Val;
} else if (ValueLive) {
PP.Diag(OpLoc, diag::err_pp_division_by_zero)
<< LHS.getRange() << RHS.getRange();
return true;
}
break;
case tok::star:
if (Res.isSigned())
Res = llvm::APSInt(LHS.Val.smul_ov(RHS.Val, Overflow), false);
else
Res = LHS.Val * RHS.Val;
break;
case tok::lessless: {
if (LHS.isUnsigned())
Res = LHS.Val.ushl_ov(RHS.Val, Overflow);
else
Res = llvm::APSInt(LHS.Val.sshl_ov(RHS.Val, Overflow), false);
break;
}
case tok::greatergreater: {
unsigned ShAmt = static_cast<unsigned>(RHS.Val.getLimitedValue());
if (ShAmt >= LHS.getBitWidth()) {
Overflow = true;
ShAmt = LHS.getBitWidth()-1;
}
Res = LHS.Val >> ShAmt;
break;
}
case tok::plus:
if (LHS.isUnsigned())
Res = LHS.Val + RHS.Val;
else
Res = llvm::APSInt(LHS.Val.sadd_ov(RHS.Val, Overflow), false);
break;
case tok::minus:
if (LHS.isUnsigned())
Res = LHS.Val - RHS.Val;
else
Res = llvm::APSInt(LHS.Val.ssub_ov(RHS.Val, Overflow), false);
break;
case tok::lessequal:
Res = LHS.Val <= RHS.Val;
Res.setIsUnsigned(false); break;
case tok::less:
Res = LHS.Val < RHS.Val;
Res.setIsUnsigned(false); break;
case tok::greaterequal:
Res = LHS.Val >= RHS.Val;
Res.setIsUnsigned(false); break;
case tok::greater:
Res = LHS.Val > RHS.Val;
Res.setIsUnsigned(false); break;
case tok::exclaimequal:
Res = LHS.Val != RHS.Val;
Res.setIsUnsigned(false); break;
case tok::equalequal:
Res = LHS.Val == RHS.Val;
Res.setIsUnsigned(false); break;
case tok::amp:
Res = LHS.Val & RHS.Val;
break;
case tok::caret:
Res = LHS.Val ^ RHS.Val;
break;
case tok::pipe:
Res = LHS.Val | RHS.Val;
break;
case tok::ampamp:
Res = (LHS.Val != 0 && RHS.Val != 0);
Res.setIsUnsigned(false); break;
case tok::pipepipe:
Res = (LHS.Val != 0 || RHS.Val != 0);
Res.setIsUnsigned(false); break;
case tok::comma:
if (!PP.getLangOpts().C99 || ValueLive)
PP.Diag(OpLoc, diag::ext_pp_comma_expr)
<< LHS.getRange() << RHS.getRange();
Res = RHS.Val; break;
case tok::question: {
if (PeekTok.isNot(tok::colon)) {
PP.Diag(PeekTok.getLocation(), diag::err_expected)
<< tok::colon << LHS.getRange() << RHS.getRange();
PP.Diag(OpLoc, diag::note_matching) << tok::question;
return true;
}
PP.LexNonComment(PeekTok);
bool AfterColonLive = ValueLive && LHS.Val == 0;
PPValue AfterColonVal(LHS.getBitWidth());
DefinedTracker DT;
if (EvaluateValue(AfterColonVal, PeekTok, DT, AfterColonLive, PP))
return true;
if (EvaluateDirectiveSubExpr(AfterColonVal, ThisPrec,
PeekTok, AfterColonLive,
IncludedUndefinedIds, PP))
return true;
Res = LHS.Val != 0 ? RHS.Val : AfterColonVal.Val;
RHS.setEnd(AfterColonVal.getRange().getEnd());
Res.setIsUnsigned(RHS.isUnsigned() || AfterColonVal.isUnsigned());
PeekPrec = getPrecedence(PeekTok.getKind());
break;
}
case tok::colon:
PP.Diag(OpLoc, diag::err_pp_colon_without_question)
<< LHS.getRange() << RHS.getRange();
return true;
}
if (Overflow && ValueLive)
PP.Diag(OpLoc, diag::warn_pp_expr_overflow)
<< LHS.getRange() << RHS.getRange();
LHS.Val = Res;
LHS.setEnd(RHS.getRange().getEnd());
RHS.setIdentifier(nullptr);
}
}
Preprocessor::DirectiveEvalResult
Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
SaveAndRestore<bool> PPDir(ParsingIfOrElifDirective, true);
bool DisableMacroExpansionAtStartOfDirective = DisableMacroExpansion;
DisableMacroExpansion = false;
Token Tok;
LexNonComment(Tok);
unsigned BitWidth = getTargetInfo().getIntMaxTWidth();
PPValue ResVal(BitWidth);
DefinedTracker DT;
SourceLocation ExprStartLoc = SourceMgr.getExpansionLoc(Tok.getLocation());
if (EvaluateValue(ResVal, Tok, DT, true, *this)) {
SourceRange ConditionRange = ExprStartLoc;
if (Tok.isNot(tok::eod))
ConditionRange = DiscardUntilEndOfDirective();
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {false,
DT.IncludedUndefinedIds,
{ExprStartLoc, ConditionRange.getEnd()}};
}
if (Tok.is(tok::eod)) {
if (DT.State == DefinedTracker::NotDefinedMacro)
IfNDefMacro = DT.TheMacro;
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {ResVal.Val != 0, DT.IncludedUndefinedIds, ResVal.getRange()};
}
if (EvaluateDirectiveSubExpr(ResVal, getPrecedence(tok::question),
Tok, true, DT.IncludedUndefinedIds, *this)) {
if (Tok.isNot(tok::eod))
DiscardUntilEndOfDirective();
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {false, DT.IncludedUndefinedIds, ResVal.getRange()};
}
if (Tok.isNot(tok::eod)) {
Diag(Tok, diag::err_pp_expected_eol);
DiscardUntilEndOfDirective();
}
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {ResVal.Val != 0, DT.IncludedUndefinedIds, ResVal.getRange()};
}