void UnwrappedLineParser::parsePPIf() { nextToken(); if ((FormatTok->Tok.isLiteral() && StringRef(FormatTok->Tok.getLiteralData(), FormatTok->Tok.getLength()) == "0") || FormatTok->Tok.is(tok::kw_false)) { PPStack.push_back(PP_Unreachable); } else { pushPPConditional(); } parsePPUnknown(); }
void UnwrappedLineParser::parsePPElse() { if (!PPStack.empty()) PPStack.pop_back(); assert(PPBranchLevel < (int)PPLevelBranchIndex.size()); if (!PPChainBranchIndex.empty()) ++PPChainBranchIndex.top(); if (PPBranchLevel >= 0 && !PPChainBranchIndex.empty() && PPLevelBranchIndex[PPBranchLevel] != PPChainBranchIndex.top()) { PPStack.push_back(PP_Unreachable); } else { pushPPConditional(); } parsePPUnknown(); }
void UnwrappedLineParser::parsePPIf(bool IfDef) { ++PPBranchLevel; assert(PPBranchLevel >= 0 && PPBranchLevel <= (int)PPLevelBranchIndex.size()); if (PPBranchLevel == (int)PPLevelBranchIndex.size()) { PPLevelBranchIndex.push_back(0); PPLevelBranchCount.push_back(0); } PPChainBranchIndex.push(0); nextToken(); bool IsLiteralFalse = (FormatTok->Tok.isLiteral() && StringRef(FormatTok->Tok.getLiteralData(), FormatTok->Tok.getLength()) == "0") || FormatTok->Tok.is(tok::kw_false); if ((!IfDef && IsLiteralFalse) || PPLevelBranchIndex[PPBranchLevel] > 0) { PPStack.push_back(PP_Unreachable); } else { pushPPConditional(); } parsePPUnknown(); }
void UnwrappedLineParser::parsePPElse() { if (!PPStack.empty()) PPStack.pop_back(); pushPPConditional(); parsePPUnknown(); }
void UnwrappedLineParser::parsePPIfdef() { pushPPConditional(); parsePPUnknown(); }