Example #1
0
static bool ParseReductionId(Parser &P, CXXScopeSpec &ReductionIdScopeSpec,
                             UnqualifiedId &ReductionId) {
    SourceLocation TemplateKWLoc;
    if (ReductionIdScopeSpec.isEmpty()) {
        auto OOK = OO_None;
        switch (P.getCurToken().getKind()) {
        case tok::plus:
            OOK = OO_Plus;
            break;
        case tok::minus:
            OOK = OO_Minus;
            break;
        case tok::star:
            OOK = OO_Star;
            break;
        case tok::amp:
            OOK = OO_Amp;
            break;
        case tok::pipe:
            OOK = OO_Pipe;
            break;
        case tok::caret:
            OOK = OO_Caret;
            break;
        case tok::ampamp:
            OOK = OO_AmpAmp;
            break;
        case tok::pipepipe:
            OOK = OO_PipePipe;
            break;
        default:
            break;
        }
        if (OOK != OO_None) {
            SourceLocation OpLoc = P.ConsumeToken();
            SourceLocation SymbolLocations[] = {OpLoc, OpLoc, SourceLocation()};
            ReductionId.setOperatorFunctionId(OpLoc, OOK, SymbolLocations);
            return false;
        }
    }
    return P.ParseUnqualifiedId(ReductionIdScopeSpec, /*EnteringContext*/ false,
                                /*AllowDestructorName*/ false,
                                /*AllowConstructorName*/ false, ParsedType(),
                                TemplateKWLoc, ReductionId);
}