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; }
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; }