static best_guess tok_type(clang::Preprocessor &pp, const char *macro_name, const clang::Token &t, StringSet *seen) { using namespace clang; tok::TokenKind k = t.getKind(); if(k == tok::identifier) { IdentifierInfo *ii = t.getIdentifierInfo(); if(ii && !seen->count(ii->getNameStart())) return macro_type(pp, ii->getNameStart(), pp.getMacroInfo(ii), seen); return tok_ok; } if (k == tok::l_paren || k == tok::r_paren || k == tok::amp || k == tok::plus || k == tok::star || k == tok::minus || k == tok::tilde || k == tok::slash || k == tok::percent || k == tok::lessless || k == tok::greatergreater || k == tok::caret || k == tok::pipe || k == tok::exclaim || k == tok::kw_int || k == tok::kw_float || k == tok::kw_double || k == tok::kw_long || k == tok::kw_signed || k == tok::kw_unsigned) return tok_ok; return tok_invalid; }
C2::ExprResult C2Sema::ActOnIdExpression(IdentifierInfo& symII, SourceLocation symLoc) { std::string id(symII.getNameStart(), symII.getLength()); #ifdef SEMA_DEBUG std::cerr << COL_SEMA"SEMA: identifier " << id << " at "; symLoc.dump(SourceMgr); std::cerr << ANSI_NORMAL"\n"; #endif return ExprResult(new IdentifierExpr(symLoc, id)); }
/// \brief Get the ASTContext-specific selector. Selector GlobalSelector::getSelector(ASTContext &AST) const { if (isInvalid()) return Selector(); Selector GlobSel = Selector(reinterpret_cast<uintptr_t>(Val)); llvm::SmallVector<IdentifierInfo *, 8> Ids; for (unsigned i = 0, e = GlobSel.isUnarySelector() ? 1 : GlobSel.getNumArgs(); i != e; ++i) { IdentifierInfo *GlobII = GlobSel.getIdentifierInfoForSlot(i); IdentifierInfo *II = &AST.Idents.get(GlobII->getNameStart(), GlobII->getNameStart() + GlobII->getLength()); Ids.push_back(II); } return AST.Selectors.getSelector(GlobSel.getNumArgs(), Ids.data()); }
/// \brief Get a GlobalSelector for the ASTContext-specific selector. GlobalSelector GlobalSelector::get(Selector Sel, Program &Prog) { if (Sel.isNull()) return GlobalSelector(); ProgramImpl &ProgImpl = *static_cast<ProgramImpl*>(Prog.Impl); llvm::SmallVector<IdentifierInfo *, 8> Ids; for (unsigned i = 0, e = Sel.isUnarySelector() ? 1 : Sel.getNumArgs(); i != e; ++i) { IdentifierInfo *II = Sel.getIdentifierInfoForSlot(i); IdentifierInfo *GlobII = &ProgImpl.getIdents().get(II->getNameStart(), II->getNameStart() + II->getLength()); Ids.push_back(GlobII); } Selector GlobSel = ProgImpl.getSelectors().getSelector(Sel.getNumArgs(), Ids.data()); return GlobalSelector(GlobSel.getAsOpaquePtr()); }
bool FindModule::VisitCXXRecordDecl (CXXRecordDecl * d) { if (_decl->getNumBases () <= 0) { return true; } for (CXXRecordDecl::base_class_iterator bi = _decl->bases_begin (), be = _decl->bases_end (); bi != be; ++bi) { QualType q = bi->getType (); string baseName = q.getAsString (); if (baseName == "::sc_core::sc_module" || baseName == "sc_core::sc_module" || baseName == "class sc_core::sc_module") { _isSystemCModule = true; IdentifierInfo * info = _decl->getIdentifier (); if (info != NULL) { _moduleName = info->getNameStart (); } } } if (_isSystemCModule == false) { return true; } return false; }