示例#1
0
MediaTime MediaTime::operator-(const MediaTime& rhs) const
{
    if (rhs.isInvalid() || isInvalid())
        return invalidTime();

    if (rhs.isIndefinite() || isIndefinite())
        return indefiniteTime();

    if (isPositiveInfinite()) {
        if (rhs.isPositiveInfinite())
            return invalidTime();
        return positiveInfiniteTime();
    }

    if (isNegativeInfinite()) {
        if (rhs.isNegativeInfinite())
            return invalidTime();
        return negativeInfiniteTime();
    }

    int32_t commonTimeScale;
    if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale)
        commonTimeScale = MaximumTimeScale;
    MediaTime a = *this;
    MediaTime b = rhs;
    a.setTimeScale(commonTimeScale);
    b.setTimeScale(commonTimeScale);
    while (!safeSub(a.m_timeValue, b.m_timeValue, a.m_timeValue)) {
        if (commonTimeScale == 1)
            return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime();
        commonTimeScale /= 2;
        a.setTimeScale(commonTimeScale);
        b.setTimeScale(commonTimeScale);
    }
    return a;
}
示例#2
0
文件: anal_objc.c 项目: l4l/radare2
static bool objc_find_refs(RCore *core) {
	static const char *oldstr = NULL;

	RCoreObjc objc = {0};

	const int objc2ClassSize = 0x28;
	const int objc2ClassInfoOffs = 0x20;
	const int objc2ClassMethSize = 0x18;
	const int objc2ClassBaseMethsOffs = 0x20;
	const int objc2ClassMethImpOffs = 0x10;

	objc.core = core;
	objc.word_size = (core->assembler->bits == 64)? 8: 4;

	RList *sections = r_bin_get_sections (core->bin);
	if (!sections) {
		return false;
	}
	
	RBinSection *s;
	RListIter *iter;
	r_list_foreach (sections, iter, s) {
		const char *name = s->name;
		if (strstr (name, "__objc_data")) {
			objc._data = s;
		} else if (strstr (name, "__objc_selrefs")) {
			objc._selrefs = s;
		} else if (strstr (name, "__objc_msgrefs")) {
			objc._msgrefs = s;
		} else if (strstr (name, "__objc_const")) {
			objc._const = s;
		}
	}
	if (!objc._const) {
		if (core->anal->verbose) {
			eprintf ("Could not find necessary objc_const section\n");
		}
		return false;
	}
	if ((objc._selrefs || objc._msgrefs) && !(objc._data && objc._const)) {
		if (core->anal->verbose) {
			eprintf ("Could not find necessary Objective-C sections...\n");
		}
		return false;
	}

	objc.db = sdb_new0 ();
	if (!objc_build_refs (&objc)) {
		return false;
	}
	oldstr = r_print_rowlog (core->print, "Parsing metadata in ObjC to find hidden xrefs");
	r_print_rowlog_done (core->print, oldstr);

	int total = 0;
	ut64 off;
	for (off = 0; off < objc._data->vsize ; off += objc2ClassSize) {
		ut64 va = objc._data->vaddr + off;
		ut64 classRoVA = readQword (&objc, va + objc2ClassInfoOffs);
		if (isInvalid (classRoVA)) {
			continue;
		}
		ut64 classMethodsVA = readQword (&objc, classRoVA + objc2ClassBaseMethsOffs);
		if (isInvalid (classMethodsVA)) {
			continue;
		}

		int count = readDword (&objc, classMethodsVA + 4);
		classMethodsVA += 8; // advance to start of class methods array
		ut64 from = classMethodsVA;
		ut64 to = from + (objc2ClassMethSize * count);
		ut64 va2;
		for (va2 = from; va2 < to; va2 += objc2ClassMethSize) {
			bool isMsgRef = false;
			ut64 selRefVA = getRefPtr (&objc, va2, &isMsgRef);
			if (!selRefVA) {
				continue;
			}
			// # adjust pointer to beginning of message_ref struct to get xrefs
			if (isMsgRef) {
				selRefVA -= 8;
			}
			ut64 funcVA = readQword (&objc, va2 + objc2ClassMethImpOffs);
			RList *list = r_anal_xrefs_get (core->anal, selRefVA);
			RListIter *iter;
			RAnalRef *ref;
			r_list_foreach (list, iter, ref) {
				r_anal_xrefs_set (core->anal, ref->addr, funcVA, R_META_TYPE_CODE);
				total++;
			}
		}

	}
示例#3
0
bool Cursor::isValid() const
{
   return (!isNull() && !isInvalid());
}
示例#4
0
void nmethod::print() {
  ResourceMark rm;
  printIndent();
  lprintf("(nmethod*)%#lx", this);
  if (scopes->root()->isDataAccessScope()) {
    lprintf(" (data access)");
  } else if (scopes->root()->isDataAssignmentScope()) {
    lprintf(" (data assignment)");
  } else {
    lprintf(" for method %#lx", method());
  }
  lprintf(" { ");
  if (isYoung()) lprintf("YOUNG ");
  switch (compiler()) {
   case NIC: lprintf("NIC "); if (isImpureNIC()) lprintf("impure "); break;
   case SIC: lprintf("SIC level %ld ", level()); break;
   default:  lprintf("!?!unknown compiler!?! "); break;
  }
  if (version())           lprintf("v%d ", version());
  if (isDI())              lprintf("DI ");
  if (isZombie())          lprintf("zombie ");
  if (isInvalid())         lprintf("INVALID ");
  if (isDebug())           lprintf("DEBUG ");
  if (isToBeRecompiled())  lprintf("TBR ");
  if (isUncommon() || isUncommonRecompiled()) lprintf("UNCOMMON ");
  lprintf("}:\n");
 
  lprintf( "incoming_arg_count = %d\n", incoming_arg_count() );
  
  print_platform_specific_data();
  
  Indent ++;
  
  key.print();
  
  printIndent();
  lprintf("code table link: %#lx\n", codeTableLink);
  
  printIndent();
  lprintf("remember link: ");
  rememberLink.print();
  lprintf("\n");
  
  printIndent();
  lprintf("linked sends: ");
  linkedSends.print();
  lprintf("\n");
  
  printIndent();
  lprintf("di link: ");
  diLink.print();
  lprintf("\n");
  
  printIndent();
  lprintf("instructions (%ld bytes): %#lx,%#lx/i / x/%ldi %#lx\n",
         instsLen(), 
         insts(),
         instsEnd() - oopSize,
         instsLen() / oopSize,
         insts());
  printIndent(); lprintf("p ((nmethod*)%#lx)->printCode() \n", this);
  scopes->print();
  // printLocs();
  // printDeps();
  Indent --;
}
示例#5
0
文件: Sphere.cpp 项目: npapier/vgsdk
const bool Sphere::isValid( void ) const
{
	return !isInvalid();
}
示例#6
0
文件: Box.cpp 项目: npapier/vgsdk
const bool Box3f::isValid( void ) const
{
	return !isInvalid();
}
Variant GlobalArrayWrapper::value(ssize_t &pos) const {
  if (isInvalid()) return false;
  Variant k;
  return m_globals->getByIdx(m_pos, k);
}
vector<chain_code*> extractChainCodesLevel(const Mat& src,int level){
    vector<chain_code*> chainCodes;
    Mat I;
    threshold(src, I, THRESHOLDVALUE, 255, CV_THRESH_BINARY);
    
    Mat PNH=Mat(3,3, CV_8UC(1),Scalar(BACKGROUND));
    chain_segment* actchain_ptr=NULL;
    bool actchain_isLeft=true;
    node* frame=new node(NULL,NULL,NULL,"frame");
    node* CurrentHole=frame;
    node* CurrentObject=NULL;
    int isMinPoint = 0;
    int currentCoordinateI;
    int currentCoordinateJ;
    vector<coordinates*> savedCoordinates;
    if(level==-1) level=INT_MAX;
    
    for (int i=0; i<I.rows; i++) {
        for (int j=0; j<I.cols; j++) {
            currentCoordinateI=i;
            currentCoordinateJ=j;
            for( int di = 0; di < 3; di++) {
                for(int dj = 0; dj < 3; dj ++ ) {
                    PNH.at<uchar>(di, dj) = getPixel(I, i + di - 1, j + dj - 1);
                }
            }
            if (!isInvalid(PNH)) {
                if(getPixel(PNH, 1, 1)==BACKGROUND) continue;
                if(isMin0(PNH)&&isMax0(PNH)){
                    chain_code* ch=new chain_code(i,j);
                    chainCodes.push_back(ch);
                    continue;
                }
                searchDirections(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,isMinPoint);
                searchMinPoints(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,isMinPoint,currentCoordinateI,currentCoordinateJ,savedCoordinates);
                searchMaxPoints(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,currentCoordinateI,currentCoordinateJ);
            }
        }
        
    }
    int parentSize=1, childSize=0,le=0;
    node * temp;
    queue<node *> q;
    q.push(frame);
    do
    {
        temp = q.front();
        if(temp!=frame&&temp->coord!=NULL){
            coordinates* c = temp->coord;
            chain_code* newChain=new chain_code(c->x,c->y);
            chain_segment* moveChain;
            if(c->typeMin) moveChain=c->whichNode->right;
            else moveChain=c->whichNode->left;
            chain_segment* copyFirst=moveChain;
            while(true){
                vector<int>& vecs=moveChain->chainCodes->nodes;
                if(moveChain->isLeft) reverse(vecs.begin(), vecs.end());
                for (int m=0; m<vecs.size(); m++) {
                    newChain->nodes.push_back(vecs[m]);
                }
                chain_segment* tobeDeleted = moveChain;
                moveChain=moveChain->connectNext;
                delete tobeDeleted->chainCodes;
                delete tobeDeleted;
                if(moveChain==copyFirst) break;
            }
            delete c;
            chainCodes.push_back(newChain);
        }
        q.pop();
        for(int i=0; i<temp->children.size(); i++){
            if(temp->children[i]) q.push(temp->children[i]);
            childSize ++;
        }
        delete temp;
        parentSize--;
        if(parentSize == 0){
            parentSize = childSize;
            childSize = 0;
            le++;
        }
    } while(!q.empty()&&le<level);
    return chainCodes;
}
示例#9
0
/**
 * Returns the total number of bits this bit set may hold.
 * @param  pThis Bit set.
 * @return       Number of bits this bit set may hold.
 */
size_t elbitsetGetSize(bitset *pThis) {
	if(isInvalid(pThis))
		return 0;

	return pThis->nBitsPerElement * pThis->nCapacity;
}
示例#10
0
bool
FilterGraph::addNode(int node, Speakers spk)
{
  ///////////////////////////////////////////////////////
  // if ofdd filter is in transition state then drop
  // the rest of the chain and set output format to
  // spk_unknown

  if ( spk == Speakers::UNKNOWN )
  {
    ofdd = true;

    end.setInput(spk);
    next[node] = node_end;
    prev[node_end] = node;
    return true;
  }

  ///////////////////////////////////////////////////////
  // find the next node

  int next_node = getNext(node, spk);

  // runtime protection
  // we may check get_next() result only here because
  // in all other cases wrong get_next() result forces
  // chain to rebuild and we'll get here anyway

  if ( isInvalid(next_node) )
    return false;

  ///////////////////////////////////////////////////////
  // end of the filter chain
  // drop the rest of the chain and
  // set output format

  if ( next_node == node_end )
  {
    end.setInput(spk);
    next[node] = node_end;
    prev[node_end] = node;
    return true;
  }

  ///////////////////////////////////////////////////////
  // build new filter into the filter chain

  // create filter

  filter[next_node] = initFilter(next_node, spk);

  // runtime protection
  // must do it BEFORE updating of filter lists
  // otherwise filter list may be broken in case of failure

  if ( ! filter[next_node] )
    return false;

  // init filter
  // must do it BEFORE updating of filter lists
  // otherwise filter list may be broken in case of failure

  if ( ! filter[next_node]->setInput(spk) )
    return false;

  // update filter lists
  next[node] = next_node;
  prev[next_node] = node;
  next[next_node] = node_end;
  prev[node_end] = next_node;
  node_state[next_node] = ns_ok;

  // update ofdd status
  // aggregate is data-dependent if chain has
  // at least one ofdd filter

  ofdd = false;
  node = next[node_start];

  while ( node != node_end )
  {
    ofdd |= filter[node]->isOfdd();
    node = next[node];
  }

  return true;
}
示例#11
0
/**
 * Destroys the bit set.
 * @param pThis Bit set string to be destroyed.
 */
void elbitsetDestroy(bitset *pThis) {
	if(isInvalid(pThis))
		return;

	EL_FREE(pThis);
}
示例#12
0
/**
 * Clears all bits of the bit set.
 * @param pThis Bit set.
 */
void elbitsetResetAll(bitset *pThis) {
	if(isInvalid(pThis))
		return;

	memset(pThis->pBuf, 0, pThis->nCapacity * sizeof(uintmax_t));	
}
示例#13
0
void BusInterfaceItem::updateInterface()
{
    HWConnectionEndpoint::updateInterface();

	Q_ASSERT(busInterface_);

    if (isInvalid())
    {
        setBrush(QBrush(Qt::red));
    }
    else
    {
        switch (busInterface_->getInterfaceMode()) {
        case General::MASTER:
            setBrush(QBrush(QColor(0x32,0xcb,0xcb)));
            break;
        case General::SLAVE:
            setBrush(QBrush(QColor(0x32,0x99,0x64)));
            break;
        case General::MIRROREDMASTER:
            setBrush(QBrush(QColor(0xcb,0xfd,0xfd)));
            break;
        case General::MIRROREDSLAVE:
            setBrush(QBrush(QColor(0x00,0xfd,00)));
            break;
        case General::SYSTEM:
            setBrush(QBrush(QColor(0xf9,0x11,0x11)));
            break;
        case General::MIRROREDSYSTEM:
            setBrush(QBrush(QColor(0xf9,0x9d,0xcb)));
            break;
        case General::MONITOR:
            setBrush(QBrush(QColor(0xfd,0xfd,0xfd)));
            break;
	    // if undefined
	    default:
		    setBrush(QBrush(Qt::black));
		    break;
        }
    }

    // Determine the bus direction.
    General::Direction dir = General::DIRECTION_INVALID;

    if (busInterface_->getPhysicalPortNames().size() > 0)
    {
        foreach (QString const& portName, busInterface_->getPhysicalPortNames())
        {
            QSharedPointer<Port> port = getOwnerComponent()->getPort(portName);

            if (port != 0)
            {
                if (dir == General::DIRECTION_INVALID)
                {
                    dir = port->getDirection();
                }
                else if (dir != port->getDirection())
                {
                    dir = General::INOUT;
                    break;
                }
            }
        }
    }
/**
 * Function name    StringPosRange::isValid
 * Description      returns true if first and last are valid
 * @return          bool
 * @exception       -
 * @see             -
*/
bool StringPosRange::isValid() const 
{ 
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    return ! isInvalid(); 
}
示例#15
0
// ParsePrimaryExpr - Parse a primary expression.
//
//   [R701]:
//     primary :=
//         constant
//      or designator
//      or array-constructor
//      or structure-constructor
//      or function-reference
//      or type-param-inquiry
//      or type-param-name
//      or ( expr )
Parser::ExprResult Parser::ParsePrimaryExpr(bool IsLvalue) {
  ExprResult E;
  SourceLocation Loc = Tok.getLocation();

  // FIXME: Add rest of the primary expressions.
  switch (Tok.getKind()) {
  default:
    if (isTokenIdentifier())
      goto possible_keyword_as_ident;
    Diag.Report(getExpectedLoc(), diag::err_expected_expression);
    return ExprError();
  case tok::error:
    Lex();
    return ExprError();
  case tok::l_paren: {
    ConsumeParen();

    E = ParseExpression();
    // complex constant.
    if(ConsumeIfPresent(tok::comma)) {
      if(E.isInvalid()) return E;
      auto ImPart = ParseExpectedFollowupExpression(",");
      if(ImPart.isInvalid()) return ImPart;
      E = Actions.ActOnComplexConstantExpr(Context, Loc,
                                           getMaxLocationOfCurrentToken(),
                                           E, ImPart);
    }

    ExpectAndConsume(tok::r_paren, 0, "", tok::r_paren);
    break;
  }
  case tok::l_parenslash : {
    return ParseArrayConstructor();
    break;
  }
  case tok::logical_literal_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);

    StringRef Data(NumStr);
    std::pair<StringRef, StringRef> StrPair = Data.split('_');
    E = LogicalConstantExpr::Create(Context, getTokenRange(),
                                    StrPair.first, Context.LogicalTy);
    SetKindSelector(cast<ConstantExpr>(E.get()), StrPair.second);
    ConsumeToken();
    break;
  }
  case tok::binary_boz_constant:
  case tok::octal_boz_constant:
  case tok::hex_boz_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);

    StringRef Data(NumStr);
    std::pair<StringRef, StringRef> StrPair = Data.split('_');
    E = BOZConstantExpr::Create(Context, Loc,
                                getMaxLocationOfCurrentToken(),
                                StrPair.first);
    SetKindSelector(cast<ConstantExpr>(E.get()), StrPair.second);
    ConsumeToken();
    break;
  }
  case tok::char_literal_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);
    E = CharacterConstantExpr::Create(Context, getTokenRange(),
                                      StringRef(NumStr), Context.CharacterTy);
    ConsumeToken();
    // Possible substring
    if(IsPresent(tok::l_paren))
      return ParseSubstring(E);
    break;
  }
  case tok::int_literal_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);

    StringRef Data(NumStr);
    std::pair<StringRef, StringRef> StrPair = Data.split('_');
    E = IntegerConstantExpr::Create(Context, getTokenRange(),
                                    StrPair.first);
    SetKindSelector(cast<ConstantExpr>(E.get()), StrPair.second);

    Lex();
    break;
  }
  case tok::real_literal_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);

    StringRef Data(NumStr);
    std::pair<StringRef, StringRef> StrPair = Data.split('_');
    E = RealConstantExpr::Create(Context, getTokenRange(),
                                 NumStr, Context.RealTy);
    SetKindSelector(cast<ConstantExpr>(E.get()), StrPair.second);
    ConsumeToken();
    break;
  }
  case tok::double_precision_literal_constant: {
    std::string NumStr;
    CleanLiteral(Tok, NumStr);
    // Replace the d/D exponent into e exponent
    for(size_t I = 0, Len = NumStr.length(); I < Len; ++I) {
      if(NumStr[I] == 'd' || NumStr[I] == 'D') {
        NumStr[I] = 'e';
        break;
      } else if(NumStr[I] == '_') break;
    }

    StringRef Data(NumStr);
    std::pair<StringRef, StringRef> StrPair = Data.split('_');
    E = RealConstantExpr::Create(Context, getTokenRange(),
                                 NumStr, Context.DoublePrecisionTy);
    SetKindSelector(cast<ConstantExpr>(E.get()), StrPair.second);
    ConsumeToken();
    break;
  }
  case tok::identifier:
    possible_keyword_as_ident:
    E = Parser::ParseDesignator(IsLvalue);
    if (E.isInvalid()) return E;
    break;
  case tok::minus:
    Lex();
    E = Parser::ParsePrimaryExpr();
    if (E.isInvalid()) return E;
    E = Actions.ActOnUnaryExpr(Context, Loc, UnaryExpr::Minus, E);
    break;
  case tok::plus:
    Lex();
    E = Parser::ParsePrimaryExpr();
    if (E.isInvalid()) return E;
    E = Actions.ActOnUnaryExpr(Context, Loc, UnaryExpr::Plus, E);
    break;
  }

  return E;
}
vector<chain_code*> extractChainCodes(const Mat& src){
    vector<chain_code*> chainCodes;
    Mat I;
    threshold(src, I, THRESHOLDVALUE, 255, CV_THRESH_BINARY);

    Mat PNH=Mat(3,3, CV_8UC(1),Scalar(BACKGROUND));
    chain_segment* actchain_ptr=NULL;
    bool actchain_isLeft=true;
    node* frame=new node(NULL,NULL,NULL,"frame");
    node* CurrentHole=frame;
    node* CurrentObject=NULL;
    int isMinPoint=0;
    int currentCoordinateI;
    int currentCoordinateJ;
    vector<coordinates*> savedCoordinates;

    for (int i=0; i<I.rows; i++) {
        for (int j=0; j<I.cols; j++) {
            currentCoordinateI=i;
            currentCoordinateJ=j;
            for( int di = 0; di < 3; di++) {
                for(int dj = 0; dj < 3; dj ++ ) {
                    PNH.at<uchar>(di, dj) = getPixel(I, i + di - 1, j + dj - 1);
                }
            }
            if (!isInvalid(PNH)) {
                if(getPixel(PNH, 1, 1)==BACKGROUND) continue;
                if(isMin0(PNH)&&isMax0(PNH)){
                    chain_code* ch=new chain_code(i,j);
                    chainCodes.push_back(ch);
                    continue;
                }
                searchDirections(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,isMinPoint);
                searchMinPoints(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,isMinPoint,currentCoordinateI,currentCoordinateJ,savedCoordinates);
                searchMaxPoints(PNH,actchain_isLeft,actchain_ptr,CurrentHole,CurrentObject,currentCoordinateI,currentCoordinateJ);
            }
        }

    }
    for(int n=0;n<savedCoordinates.size();n++){
        coordinates* c = savedCoordinates[n];
        chain_code* newChain=new chain_code(c->x,c->y);
        chain_segment* moveChain;
        if(c->typeMin) moveChain=c->whichNode->right;
        else moveChain=c->whichNode->left;
        chain_segment* copyFirst=moveChain;
        while(true){
            vector<int>& vecs=moveChain->chainCodes->nodes;
            if(moveChain->isLeft) reverse(vecs.begin(), vecs.end());
            for (int m=0; m<vecs.size(); m++) {
                newChain->nodes.push_back(vecs[m]);
            }
            chain_segment* tobeDeleted = moveChain;
            moveChain=moveChain->connectNext;
            delete tobeDeleted->chainCodes;
            delete tobeDeleted;
            if(moveChain==copyFirst) break;
            //if(moveChain==NULL) break;
        }
        delete c->whichNode;
        delete c;
        chainCodes.push_back(newChain);
    }
    delete frame;
    return chainCodes;
}
示例#17
0
/// ParseNameOrCall - Parse a name or a call expression
ExprResult Parser::ParseNameOrCall() {
  auto IDInfo = Tok.getIdentifierInfo();
  assert(IDInfo && "Token isn't an identifier");
  auto IDRange = getTokenRange();
  auto IDLoc = ConsumeToken();

  if(DontResolveIdentifiers)
    return UnresolvedIdentifierExpr::Create(Context,
                                            IDRange, IDInfo);

  // [R504]:
  //   object-name :=
  //       name
  auto Declaration = Actions.ResolveIdentifier(IDInfo);
  if(!Declaration) {
    if(IsPresent(tok::l_paren))
      Declaration = Actions.ActOnImplicitFunctionDecl(Context, IDLoc, IDInfo);
    else
      Declaration = Actions.ActOnImplicitEntityDecl(Context, IDLoc, IDInfo);
    if(!Declaration)
      return ExprError();
  } else {
    // INTEGER f
    // X = f(10) <-- implicit function declaration.
    if(IsPresent(tok::l_paren))
      Declaration = Actions.ActOnPossibleImplicitFunctionDecl(Context, IDLoc, IDInfo, Declaration);
  }

  if(VarDecl *VD = dyn_cast<VarDecl>(Declaration)) {
    // FIXME: function returing array
    if(IsPresent(tok::l_paren) &&
       VD->isFunctionResult() && isa<FunctionDecl>(Actions.CurContext)) {
      // FIXME: accessing function results from inner recursive functions
      return ParseRecursiveCallExpression(IDRange);
    }
    // the VarDecl is obtained from a NamedDecl which does not have a type
    // apply implicit typing rules in case VD does not have a type
    // FIXME: there should be a way to avoid re-applying the implicit rules
    // by returning a VarDecl instead of a NamedDecl when looking up a name in
    // the scope
    if (VD->getType().isNull()) Actions.ApplyImplicitRulesToArgument(VD,IDRange);
    return VarExpr::Create(Context, IDRange, VD);
  }
  else if(IntrinsicFunctionDecl *IFunc = dyn_cast<IntrinsicFunctionDecl>(Declaration)) {
    SmallVector<Expr*, 8> Arguments;
    SourceLocation RParenLoc = Tok.getLocation();
    auto Result = ParseFunctionCallArgumentList(Arguments, RParenLoc);
    if(Result.isInvalid())
      return ExprError();
    return Actions.ActOnIntrinsicFunctionCallExpr(Context, IDLoc, IFunc, Arguments);
  } else if(FunctionDecl *Func = dyn_cast<FunctionDecl>(Declaration)) {
    // FIXME: allow subroutines, but errors in sema
    if(!IsPresent(tok::l_paren))
      return FunctionRefExpr::Create(Context, IDRange, Func);
    if(!Func->isSubroutine()) {
      return ParseCallExpression(IDLoc, Func);
    }
  } else if(isa<SelfDecl>(Declaration) && isa<FunctionDecl>(Actions.CurContext))
    return ParseRecursiveCallExpression(IDRange);
  else if(auto Record = dyn_cast<RecordDecl>(Declaration))
    return ParseTypeConstructor(IDLoc, Record);
  Diag.Report(IDLoc, diag::err_expected_var);
  return ExprError();
}
示例#18
0
const String& ResourceData::o_getClassName() const {
  if (isInvalid()) return s_Unknown;
  return o_getClassNameHook();
}
示例#19
0
Variant GlobalArrayWrapper::key() const {
  if (isInvalid()) return null;
  Variant k;
  m_globals->getByIdx(m_pos, k);
  return k;
}