예제 #1
0
bool PragmaRecorder::GetPragmaNameFromToken(const clang::Token &Token,
        std::string &PragmaName) {
    if (Token.isLiteral())
        PragmaName.assign(Token.getLiteralData(), Token.getLength());
    else if (Token.is(clang::tok::identifier))
        PragmaName.assign(Token.getIdentifierInfo()->getNameStart(),
                          Token.getIdentifierInfo()->getLength());
    else
        return false;
    return true;
}
예제 #2
0
파일: Expr.cpp 프로젝트: furunkel/c2ffi
static best_guess num_type(clang::Preprocessor &pp,
                           const clang::Token &t) {
    llvm::StringRef sr(t.getLiteralData(), t.getLength());
    clang::NumericLiteralParser parser(sr, t.getLocation(), pp);

    if(parser.isIntegerLiteral())
        return tok_int;
    if(parser.isFloatingLiteral())
        return tok_float;

    return tok_invalid;
}