virtual void SourceRangeSkipped(SourceRange Range) {
}
+ enum ConditionValueKind {
+ CVK_NotEvaluated, CVK_False, CVK_True
+ };
+
/// \brief Hook called whenever an \#if is seen.
/// \param Loc the source location of the directive.
/// \param ConditionRange The SourceRange of the expression being tested.
///
// FIXME: better to pass in a list (or tree!) of Tokens.
virtual void If(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue) {
+ ConditionValueKind ConditionValue) {
}
/// \brief Hook called whenever an \#elif is seen.
/// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive.
// FIXME: better to pass in a list (or tree!) of Tokens.
virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue, SourceLocation IfLoc) {
+ ConditionValueKind ConditionValue, SourceLocation IfLoc) {
}
/// \brief Hook called whenever an \#ifdef is seen.
/// \brief Hook called whenever an \#if is seen.
virtual void If(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue) {
+ ConditionValueKind ConditionValue) {
First->If(Loc, ConditionRange, ConditionValue);
Second->If(Loc, ConditionRange, ConditionValue);
}
/// \brief Hook called whenever an \#elif is seen.
virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue, SourceLocation IfLoc) {
+ ConditionValueKind ConditionValue, SourceLocation IfLoc) {
First->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
Second->Elif(Loc, ConditionRange, ConditionValue, IfLoc);
}
private:
virtual void If(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue);
+ ConditionValueKind ConditionValue);
virtual void Elif(SourceLocation Loc, SourceRange ConditionRange,
- bool ConditionValue, SourceLocation IfLoc);
+ ConditionValueKind ConditionValue, SourceLocation IfLoc);
virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
const MacroDirective *MD);
virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
void PPConditionalDirectiveRecord::If(SourceLocation Loc,
SourceRange ConditionRange,
- bool ConditionValue) {
+ ConditionValueKind ConditionValue) {
addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
CondDirectiveStack.push_back(Loc);
}
void PPConditionalDirectiveRecord::Elif(SourceLocation Loc,
SourceRange ConditionRange,
- bool ConditionValue,
+ ConditionValueKind ConditionValue,
SourceLocation IfLoc) {
addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
CondDirectiveStack.back() = Loc;
const SourceLocation CondEnd = CurPPLexer->getSourceLocation();
Callbacks->Elif(Tok.getLocation(),
SourceRange(CondBegin, CondEnd),
- CondValue, CondInfo.IfLoc);
+ (CondValue ? PPCallbacks::CVK_True : PPCallbacks::CVK_False), CondInfo.IfLoc);
}
// If this condition is true, enter it!
if (CondValue) {
if (Callbacks)
Callbacks->If(IfToken.getLocation(),
SourceRange(ConditionalBegin, ConditionalEnd),
- ConditionalTrue);
+ (ConditionalTrue ? PPCallbacks::CVK_True : PPCallbacks::CVK_False));
// Should we include the stuff contained by this directive?
if (ConditionalTrue) {
if (Callbacks)
Callbacks->Elif(ElifToken.getLocation(),
SourceRange(ConditionalBegin, ConditionalEnd),
- true, CI.IfLoc);
+ PPCallbacks::CVK_NotEvaluated, CI.IfLoc);
// Finally, skip the rest of the contents of this block.
SkipExcludedConditionalBlock(CI.IfLoc, /*Foundnonskip*/true,