Пример #1
0
    bool VisitDecl(Decl* D) {
      if (!m_IsStoringState)
        return true;

      if (!D->hasAttr<AnnotateAttr>())
        return true;

      Annotations_t annotations;
      for(auto attr = D->specific_attr_begin<AnnotateAttr> (),
          end = D->specific_attr_end<AnnotateAttr> ();
          attr != end;
          ++attr)
      {
        if (!attr->isInherited()) {
          auto annot = attr->getAnnotation();
          if (annot.startswith(llvm::StringRef(annoTag, lenAnnoTag))) {
            if (annotations.first.empty()) {
              annotations.first = annot.drop_front(lenAnnoTag);
            } else {
              annotations.second = annot.drop_front(lenAnnoTag);
            }
          }
        }
      }
      InsertIntoAutoloadingState(D, annotations);

      return true;
    }
Пример #2
0
 bool IsAutoloadEntry(Decl *D) {
   for(auto attr = D->specific_attr_begin<AnnotateAttr>(),
            end = D->specific_attr_end<AnnotateAttr> ();
       attr != end;
       ++attr)
   {
     //        cling::errs() << "Annotation: " << c->getAnnotation() << "\n";
     if (!attr->isInherited()) {
       llvm::StringRef annotation = attr->getAnnotation();
       assert(!annotation.empty() && "Empty annotation!");
       if (annotation.startswith(llvm::StringRef(annoTag, lenAnnoTag))) {
         // autoload annotation.
         return true;
       }
     }
   }
   return false;
 }
Пример #3
0
void VariableTable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) {
  if (Option::GenerateInferredTypes) {
    for (unsigned int i = 0; i < m_symbolVec.size(); i++) {
      Symbol *sym = m_symbolVec[i];
      if (isInherited(sym->getName())) continue;

      if (sym->isParameter()) {
        cg_printf("// @param  ");
      } else if (sym->isGlobal()) {
        cg_printf("// @global ");
      } else if (sym->isStatic()) {
        cg_printf("// @static ");
      } else {
        cg_printf("// @local  ");
      }
      cg_printf("%s\t$%s\n", sym->getFinalType()->toString().c_str(),
                sym->getName().c_str());
    }
  }
  if (Option::ConvertSuperGlobals && !getAttribute(ContainsDynamicVariable)) {
    std::set<string> convertibles;
    typedef std::pair<const string,Symbol> symPair;
    BOOST_FOREACH(symPair &sym, m_symbolMap) {
      if (sym.second.isSuperGlobal() && !sym.second.declarationSet()) {
        convertibles.insert(sym.second.getName());
      }
    }
    if (!convertibles.empty()) {
      cg_printf("/* converted super globals */ global ");
      for (std::set<string>::const_iterator iter = convertibles.begin();
           iter != convertibles.end(); ++iter) {
        if (iter != convertibles.begin()) cg_printf(",");
        cg_printf("$%s", iter->c_str());
      }
      cg_printf(";\n");
    }
  }