예제 #1
0
void DefaultVisitor::visitDeclarator(DeclaratorAST *node)
{
  visit(node->sub_declarator);
  visitNodes(this, node->ptr_ops);
  visit(node->id);
  visit(node->bit_expression);
  visitNodes(this, node->array_dimensions);
  visit(node->parameter_declaration_clause);
  visit(node->exception_spec);
}
예제 #2
0
파일: dir.c 프로젝트: alhazred/onarm
/*
 *  traverseDir()
 *	For use with all FATs outside of the initial root directory on
 *	12 and 16 bit FAT file systems.  This is a general purpose routine
 *	that can be used simply to visit all of the nodes in the metadata or
 *	to find the first instance of something, e.g., the first directory
 *	entry where the file is marked deleted.
 *
 *	Unique Input is:
 *	startAt
 *		starting cluster of the directory
 *
 *	This is the cluster that is the first one in this directory.
 *	We read it right away, so we can provide it as data to visitNodes().
 *	Note that we cache this cluster as we read it, because it is
 *	metadata and we cache all metadata.  By doing so, we can
 *	keep pointers to directory entries for quickly moving around and
 *	fixing up any problems we find.  Of course if we get a big
 *	filesystem with a huge amount of metadata we may be hosed, as
 *	we'll likely run out of memory.
 *
 *	I believe in the future this will have to be addressed.  It
 *	may be possible to do more of the processing of problems
 *	within directories as they are cached, so that when memory
 *	runs short we can free cached directories we are already
 *	finished visiting.
 *
 *	The remainder of inputs are described in visitNodes() comments.
 */
void
traverseDir(int fd, int32_t startAt, int depth, int descend, int operation,
    char matchRequired,  struct pcdir **found, int32_t *lastDirCluster,
    struct pcdir **dirEnd, char *recordPath, int *pathLen)
{
	ClusterContents dirdata;
	int32_t dirdatasize = 0;

	if (startAt < FIRST_CLUSTER || startAt > LastCluster)
		return;

	if (readCluster(fd, startAt, &(dirdata.bytes), &dirdatasize,
	    RDCLUST_DO_CACHE) != RDCLUST_GOOD) {
		(void) fprintf(stderr,
		    gettext("Unable to get more directory entries!\n"));
		return;
	}

	if (operation == PCFS_TRAVERSE_ALL) {
		if (Verbose)
			(void) fprintf(stderr,
			    gettext("Directory traversal enters "
			    "allocation unit %d.\n"), startAt);
	}
	visitNodes(fd, startAt, &dirdata, dirdatasize, depth, descend,
	    operation, matchRequired, found, lastDirCluster, dirEnd,
	    recordPath, pathLen);
}
예제 #3
0
void DefaultVisitor::visitTypeParameter(TypeParameterAST *node)
{
  visit(node->name);
  visit(node->type_id);
  visitNodes(this, node->template_parameters);
  visit(node->template_name);
}
예제 #4
0
void DefaultVisitor::visitClassSpecifier(ClassSpecifierAST *node)
{
  visit(node->win_decl_specifiers);
  visit(node->name);
  visit(node->base_clause);
  visitNodes(this, node->member_specs);
}
예제 #5
0
void CodeModelFinder::visitName(NameAST *node)
{
  visitNodes(this, node->qualified_names);

  if (_M_resolve_policy == ResolveItem)
    visit(node->unqualified_name);
}
예제 #6
0
파일: dir.c 프로젝트: alhazred/onarm
/*
 *  traverseFromRoot()
 *	For use with 12 and 16 bit FATs that have a root directory outside
 *	of the file system.  This is a general purpose routine that
 *	can be used simply to visit all of the nodes in the metadata or
 *	to find the first instance of something, e.g., the first directory
 *	entry where the file is marked deleted.
 *
 *	Inputs are described in the commentary for visitNodes() above.
 */
void
traverseFromRoot(int fd, int depth, int descend, int operation,
    char matchRequired,  struct pcdir **found, int32_t *lastDirCluster,
    struct pcdir **dirEnd, char *recordPath, int *pathLen)
{
	visitNodes(fd, FAKE_ROOTDIR_CLUST, &TheRootDir, RootDirSize, depth,
	    descend, operation, matchRequired, found, lastDirCluster, dirEnd,
	    recordPath, pathLen);
}
예제 #7
0
void TypeCompiler::run(const ListNode< PtrOperatorAST* > *ptr_ops)
{
    visitNodes(this, ptr_ops);
    if (isRef) m_realType.setIsRef(true);
    int offset = m_realType.pointerDepth();
    m_realType.setPointerDepth(offset + pointerDepth.count());
    for (int i = 0; i < pointerDepth.count(); i++) {
        if (pointerDepth[i])
        m_realType.setIsConstPointer(offset + i, true);
    }
}
예제 #8
0
void DeclaratorCompiler::run(DeclaratorAST *node)
{
  _M_id.clear();
  _M_parameters.clear();
  _M_array.clear();
  _M_function = false;
  _M_reference = false;
  _M_variadics = false;
  _M_indirection = 0;

  if (node)
    {
      NameCompiler name_cc(_M_binder);

      DeclaratorAST *decl = node;
      while (decl && decl->sub_declarator)
        decl = decl->sub_declarator;

      Q_ASSERT (decl != 0);

      name_cc.run(decl->id);
      _M_id = name_cc.name();
      _M_function = (node->parameter_declaration_clause != 0);
      if (node->parameter_declaration_clause && node->parameter_declaration_clause->ellipsis)
        _M_variadics = true;

      visitNodes(this, node->ptr_ops);
      visit(node->parameter_declaration_clause);

      if (const ListNode<ExpressionAST*> *it = node->array_dimensions)
        {
          it->toFront();
          const ListNode<ExpressionAST*> *end = it;

          do
            {
              QString elt;
              if (ExpressionAST *expr = it->element)
                {
                  const Token &start_token = _M_token_stream->token((int) expr->start_token);
                  const Token &end_token = _M_token_stream->token((int) expr->end_token);

                  elt += QString::fromUtf8(&start_token.text[start_token.position],
                                           (int) (end_token.position - start_token.position)).trimmed();
                }

              _M_array.append (elt);

              it = it->next;
            }
          while (it != end);
        }
    }
}
예제 #9
0
void NameCompiler::visitUnqualifiedName(UnqualifiedNameAST *node)
{
  QString tmp_name;

  if (node->tilde)
    tmp_name += QLatin1String("~");

  if (node->id)
    tmp_name += _M_token_stream->symbol(node->id)->as_string();

  if (OperatorFunctionIdAST *op_id = node->operator_id)
    {
#if defined(__GNUC__)
#warning "NameCompiler::visitUnqualifiedName() -- implement me"
#endif

      if (op_id->op && op_id->op->op)
        {
          tmp_name += QLatin1String("operator");
          tmp_name += decode_operator(op_id->op->op);
          if (op_id->op->close)
            tmp_name += decode_operator(op_id->op->close);
        }
      else if (op_id->type_specifier)
        {
#if defined(__GNUC__)
#warning "don't use an hardcoded string as cast' name"
#endif
          Token const &tk = _M_token_stream->token ((int) op_id->start_token);
          Token const &end_tk = _M_token_stream->token ((int) op_id->end_token);
          tmp_name += QString::fromLatin1 (&tk.text[tk.position],
                                           (int) (end_tk.position - tk.position)).trimmed ();
      }
    }

  _M_name += tmp_name;
  if (node->template_arguments)
    {
      // ### cleanup
      _M_name.last() += QLatin1String("<");
      visitNodes(this, node->template_arguments);
      _M_name.last().truncate(_M_name.last().count() - 1); // remove the last ','
      _M_name.last() += QLatin1String(">");
    }

}
void DefaultVisitor::visitQPropertyDeclaration(QPropertyDeclarationAST *node)
{
  visit(node->type);
  visitNodes(this, node->ptr_ops);
  visit(node->name);

  if (node->getter)
    visit(node->getter);
  if (node->setter)
    visit(node->setter);
  if (node->resetter)
    visit(node->resetter);
  if (node->notifier)
    visit(node->notifier);
  if (node->designableMethod)
    visit(node->designableMethod);
  if (node->scriptableMethod)
    visit(node->scriptableMethod);
}
예제 #11
0
void NameCompiler::visitUnqualifiedName(UnqualifiedNameAST *node)
{
  IndexedString tmp_name;

  if (node->id)
    tmp_name = m_session->token_stream->token(node->id).symbol();

  if (node->tilde)
    tmp_name = IndexedString('~' + tmp_name.byteArray());

  if (OperatorFunctionIdAST *op_id = node->operator_id)
    {
#if defined(__GNUC__)
      /* FIXME: unimplemented */
#endif
      static QString operatorString("operator");
      QString tmp = operatorString;

      if (op_id->op && op_id->op->op)
        tmp +=  decode(m_session, op_id->op, true);
      else
        tmp += QLatin1String("{...cast...}");

      tmp_name = IndexedString(tmp);
      m_typeSpecifier = op_id->type_specifier;
    }

  m_currentIdentifier = tmp_name.str();
  m_name.push_back(m_currentIdentifier);
  if (node->template_arguments)
    {
      visitNodes(this, node->template_arguments);
    }/*else if(node->end_token == node->start_token + 3 && node->id == node->start_token && m_session->token_stream->token(node->id+1).symbol() == KDevelop::IndexedString('<')) {
      ///@todo Represent this nicer in the AST
      ///It's probably a type-specifier with instantiation of the default-parameter, like "Bla<>".
      m_currentIdentifier.appendTemplateIdentifier( IndexedTypeIdentifier() );
    }*/
}
예제 #12
0
void DefaultVisitor::visitUnqualifiedName(UnqualifiedNameAST *node)
{
  visit(node->operator_id);
  visitNodes(this, node->template_arguments);
}
예제 #13
0
void DefaultVisitor::visitTypedef(TypedefAST *node)
{
  visit(node->type_specifier);
  visitNodes(this, node->init_declarators);
}
void DefaultVisitor::visitTryBlockStatement(TryBlockStatementAST *node)
{
  visit(node->try_block);
  visitNodes(this, node->catch_blocks);
}
예제 #15
0
void DefaultVisitor::visitTranslationUnit(TranslationUnitAST *node)
{
  visitNodes(this, node->declarations);
}
예제 #16
0
void DefaultVisitor::visitCppCastExpression(CppCastExpressionAST *node)
{
  visit(node->type_id);
  visit(node->expression);
  visitNodes(this, node->sub_expressions);
}
예제 #17
0
void DefaultVisitor::visitCompoundStatement(CompoundStatementAST *node)
{
  visitNodes(this, node->statements);
}
예제 #18
0
void DefaultVisitor::visitParameterDeclarationClause(ParameterDeclarationClauseAST *node)
{
  visitNodes(this, node->parameter_declarations);
}
예제 #19
0
void DefaultVisitor::visitNewDeclarator(NewDeclaratorAST *node)
{
  visit(node->ptr_op);
  visit(node->sub_declarator);
  visitNodes(this, node->expressions);
}
예제 #20
0
void DefaultVisitor::visitName(NameAST *node)
{
  visitNodes(this, node->qualified_names);
  visit(node->unqualified_name);
}
예제 #21
0
void DefaultVisitor::visitLinkageBody(LinkageBodyAST *node)
{
  visitNodes(this, node->declarations);
}
예제 #22
0
void DefaultVisitor::visitExceptionSpecification(ExceptionSpecificationAST *node)
{
  visitNodes(this, node->type_ids);
}
예제 #23
0
void DefaultVisitor::visitEnumSpecifier(EnumSpecifierAST *node)
{
  visit(node->name);
  visitNodes(this, node->enumerators);
}
예제 #24
0
void DefaultVisitor::visitBaseClause(BaseClauseAST *node)
{
  visitNodes(this, node->base_specifiers);
}
void DefaultVisitor::visitInitializerClause(InitializerClauseAST *node)
{
  visit(node->expression);
  visitNodes(this, node->initializer_list);
}
예제 #26
0
void DefaultVisitor::visitPostfixExpression(PostfixExpressionAST *node)
{
  visit(node->type_specifier);
  visit(node->expression);
  visitNodes(this, node->sub_expressions);
}
예제 #27
0
void DefaultVisitor::visitSimpleDeclaration(SimpleDeclarationAST *node)
{
  visit(node->type_specifier);
  visitNodes(this, node->init_declarators);
  visit(node->win_decl_specifiers);
}
예제 #28
0
void DefaultVisitor::visitTemplateDeclaration(TemplateDeclarationAST *node)
{
  visitNodes(this, node->template_parameters);
  visit(node->declaration);
}
예제 #29
0
void DefaultVisitor::visitOperatorFunctionId(OperatorFunctionIdAST *node)
{
  visit(node->op);
  visit(node->type_specifier);
  visitNodes(this, node->ptr_ops);
}
예제 #30
0
void DefaultVisitor::visitCtorInitializer(CtorInitializerAST *node)
{
  visitNodes(this, node->member_initializers);
}