当前位置: 首页>>代码示例>>C++>>正文


C++ AttributeList::getName方法代码示例

本文整理汇总了C++中AttributeList::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::getName方法的具体用法?C++ AttributeList::getName怎么用?C++ AttributeList::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeList的用法示例。


在下文中一共展示了AttributeList::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleDLLImportAttr

static void HandleDLLImportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
  // Attribute can be applied only to functions or variables.
  FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
  if (!FD && !isa<VarDecl>(D)) {
    // Apparently Visual C++ thinks it is okay to not emit a warning
    // in this case, so only emit a warning when -fms-extensions is not
    // specified.
    if (!S.getLangOpts().MicrosoftExt)
      S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
        << Attr.getName() << 2 /*variable and function*/;
    return;
  }

  // Currently, the dllimport attribute is ignored for inlined functions.
  // Warning is emitted.
  if (FD && FD->isInlineSpecified()) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
    return;
  }

  unsigned Index = Attr.getAttributeSpellingListIndex();
  DLLImportAttr *NewAttr = S.mergeDLLImportAttr(D, Attr.getRange(), Index);
  if (NewAttr)
    D->addAttr(NewAttr);
}
开发者ID:azurepine,项目名称:clang,代码行数:25,代码来源:TargetAttributesSema.cpp

示例2: NumParams

static void HandleMSP430InterruptAttr(Decl *d,
                                      const AttributeList &Attr, Sema &S) {
  if (Attr.getNumArgs() != 1) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
      << Attr.getName() << 1;
    return;
  }

  if (!Attr.isArgExpr(0)) {
    S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
      << AANT_ArgumentIntegerConstant;
    return;
  }

  // FIXME: Check for decl - it should be void ()(void).
  Expr *NumParamsExpr = Attr.getArgAsExpr(0);
  llvm::APSInt NumParams(32);
  if (!NumParamsExpr->isIntegerConstantExpr(NumParams, S.Context)) {
    S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
      << Attr.getName() << AANT_ArgumentIntegerConstant
      << NumParamsExpr->getSourceRange();
    return;
  }

  unsigned Num = NumParams.getLimitedValue(255);
  if ((Num & 1) || Num > 30) {
    S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
      << "interrupt" << (int)NumParams.getSExtValue()
      << NumParamsExpr->getSourceRange();
    return;
  }

  d->addAttr(::new (S.Context) MSP430InterruptAttr(Attr.getLoc(), S.Context, Num));
  d->addAttr(::new (S.Context) UsedAttr(Attr.getLoc(), S.Context));
}
开发者ID:azurepine,项目名称:clang,代码行数:35,代码来源:TargetAttributesSema.cpp

示例3: startElement

void BulletMLParserXercesSAXHandler::startElement(const XMLCh* const name,
												  AttributeList& attributes)
{
	BulletMLNode* node = parser_->addContent(parser_->uc2string(name));

	if (node->getName() == BulletMLNode::bulletml) {
		for (unsigned int i = 0; i < attributes.getLength(); i++) {
			if (parser_->uc2string(attributes.getName(i)) == "type" &&
				parser_->uc2string(attributes.getValue(i)) == "horizontal")
			{
				parser_->setHorizontal();
			}
		}
	}
	else {
		BulletMLParserXerces::MyAttributes mattr;
		for (unsigned int i = 0; i < attributes.getLength(); i++) {
			mattr.push_back(parser_->uc2string(attributes.getName(i)));
			mattr.push_back(parser_->uc2string(attributes.getValue(i)));
		}
		parser_->addAttribute(mattr, node);
	}

	if (curNode_ != 0) curNode_->addChild(node);
	curNode_ = node;
}
开发者ID:Bracket-,项目名称:psp-ports,代码行数:26,代码来源:bulletmlparser-xerces.cpp

示例4: StoreNameValueAttributes

/*
 * Stores the attributes from a name value type element.
 * Parse out the probe array type into its own member.
 */
void SAXArrayHandlers::StoreNameValueAttributes(AttributeList&  attributes)
{
	unsigned int len = attributes.getLength();
	AttributeNameValueType param;
	for (unsigned int index = 0; index < len; index++)
	{
		if (attributes.getName(index) == NAME_ATTRIBUTE)
		{
			param.name = XMLChToString(attributes.getValue(index));
		}
		else if (attributes.getName(index) == VALUE_ATTRIBUTE)
		{
			param.value = XMLChToString(attributes.getValue(index));
		}
		else if (attributes.getName(index) == TYPE_ATTRIBUTE)
		{
			param.type = XMLChToString(attributes.getValue(index));
			if (param.name == PROBE_ARRAY_TYPE_PARAMETER_NAME)
			{
				arrayData->SetArrayType(param.value);
			}
			else
			{
				arrayData->Attributes().push_back(param);
			}
		}
	}
}
开发者ID:HenrikBengtsson,项目名称:affxparser,代码行数:32,代码来源:SAXDttArrayHandlers.cpp

示例5: HandleARMInterruptAttr

static void HandleARMInterruptAttr(Decl *d,
                                   const AttributeList &Attr, Sema &S) {
  // Check the attribute arguments.
  if (Attr.getNumArgs() > 1) {
    S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments)
      << Attr.getName() << 1;
    return;
  }

  StringRef Str;
  SourceLocation ArgLoc;

  if (Attr.getNumArgs() == 0)
    Str = "";
  else if (!S.checkStringLiteralArgumentAttr(Attr, 0, Str, &ArgLoc))
    return;

  ARMInterruptAttr::InterruptType Kind;
  if (!ARMInterruptAttr::ConvertStrToInterruptType(Str, Kind)) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
        << Attr.getName() << Str << ArgLoc;
    return;
  }

  unsigned Index = Attr.getAttributeSpellingListIndex();
  d->addAttr(::new (S.Context)
             ARMInterruptAttr(Attr.getLoc(), S.Context, Kind, Index));
}
开发者ID:kentuckyfriedtakahe,项目名称:clang,代码行数:28,代码来源:TargetAttributesSema.cpp

示例6: HandleDLLExportAttr

static void HandleDLLExportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
  // check the attribute arguments.
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
      << Attr.getName() << 0;
    return;
  }

  // Attribute can be applied only to functions or variables.
  FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
  if (!FD && !isa<VarDecl>(D)) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
      << Attr.getName() << 2 /*variable and function*/;
    return;
  }

  // Currently, the dllexport attribute is ignored for inlined functions, unless
  // the -fkeep-inline-functions flag has been used. Warning is emitted;
  if (FD && FD->isInlineSpecified()) {
    // FIXME: ... unless the -fkeep-inline-functions flag has been used.
    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllexport";
    return;
  }

  unsigned Index = Attr.getAttributeSpellingListIndex();
  DLLExportAttr *NewAttr = S.mergeDLLExportAttr(D, Attr.getRange(), Index);
  if (NewAttr)
    D->addAttr(NewAttr);
}
开发者ID:nonstriater,项目名称:clang,代码行数:29,代码来源:TargetAttributesSema.cpp

示例7:

static void HandleX86ForceAlignArgPointerAttr(Decl *D,
                                              const AttributeList& Attr,
                                              Sema &S) {
  // Check the attribute arguments.
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
      << Attr.getName() << 0;
    return;
  }

  // If we try to apply it to a function pointer, don't warn, but don't
  // do anything, either. It doesn't matter anyway, because there's nothing
  // special about calling a force_align_arg_pointer function.
  ValueDecl *VD = dyn_cast<ValueDecl>(D);
  if (VD && VD->getType()->isFunctionPointerType())
    return;
  // Also don't warn on function pointer typedefs.
  TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D);
  if (TD && (TD->getUnderlyingType()->isFunctionPointerType() ||
             TD->getUnderlyingType()->isFunctionType()))
    return;
  // Attribute can only be applied to function types.
  if (!isa<FunctionDecl>(D)) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
      << Attr.getName() << /* function */0;
    return;
  }

  D->addAttr(::new (S.Context) X86ForceAlignArgPointerAttr(Attr.getRange(),
                                                           S.Context));
}
开发者ID:nonstriater,项目名称:clang,代码行数:31,代码来源:TargetAttributesSema.cpp

示例8: HandleDLLExportAttr

static void HandleDLLExportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
  // check the attribute arguments.
  if (Attr.getNumArgs() != 0) {
    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
    return;
  }

  // Attribute can be applied only to functions or variables.
  if (isa<VarDecl>(D)) {
    D->addAttr(::new (S.Context) DLLExportAttr(Attr.getLoc(), S.Context));
    return;
  }

  FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
  if (!FD) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
      << Attr.getName() << 2 /*variable and function*/;
    return;
  }

  // Currently, the dllexport attribute is ignored for inlined functions, unless
  // the -fkeep-inline-functions flag has been used. Warning is emitted;
  if (FD->isInlineSpecified()) {
    // FIXME: ... unless the -fkeep-inline-functions flag has been used.
    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllexport";
    return;
  }

  D->addAttr(::new (S.Context) DLLExportAttr(Attr.getLoc(), S.Context));
}
开发者ID:5432935,项目名称:crossbridge,代码行数:30,代码来源:TargetAttributesSema.cpp

示例9:

void SAX_TransAGHandler::structuredMetaStart
(const XMLCh* const name, AttributeList& attr)
{
  string s;
  // if start-of-element is reported,
  // store structured element as XML string in feature value
  // and push structuredMetaEnd handler
  //  storeMetaValueStart(name, attr);
  if ( ! prevValue.empty() ) prevValue += " ";
  prevValue += "<";
  prevValue += set_string(s, name);
  for ( int i = 0; i < attr.getLength(); ++i ) {
    prevValue += " ";
    prevValue += set_string(s, attr.getName(i));
    prevValue += "=\"";
    prevValue += set_string(s, attr.getValue(i));
    prevValue += "\"";
  }

  prevValue += ">";
  prevPos = prevValue.length();

  StartStack.push(&SAX_TransAGHandler::structuredMetaStart);
  EndStack.push(&SAX_TransAGHandler::structuredMetaEnd);
}
开发者ID:eroux,项目名称:transcriber-ag,代码行数:25,代码来源:SAX_TransAGHandler.cpp

示例10: startElement

void SAXPrintHandlers::startElement(const   XMLCh* const    name
                                    ,       AttributeList&  attributes)
{
    // The name has to be representable without any escapes
    fFormatter  << XMLFormatter::NoEscapes
                << chOpenAngle << name;

    unsigned int len = attributes.getLength();
    for (unsigned int index = 0; index < len; index++)
    {
        //
        //  Again the name has to be completely representable. But the
        //  attribute can have refs and requires the attribute style
        //  escaping.
        //
        fFormatter  << XMLFormatter::NoEscapes
                    << chSpace << attributes.getName(index)
                    << chEqual << chDoubleQuote
                    << XMLFormatter::AttrEscapes
		            << attributes.getValue(index)
                    << XMLFormatter::NoEscapes
                    << chDoubleQuote;
    }
    fFormatter << chCloseAngle;
}
开发者ID:xin3liang,项目名称:platform_external_xerces-cpp,代码行数:25,代码来源:SAXPrintHandlers.cpp

示例11: startElement

 void startElement(const XMLCh* const name, AttributeList& attrList)
 {
   string label=XMLString::transcode(name);
   map<string,string> attrs;
   for (unsigned int i=0;i<attrList.getLength();i++)
     attrs[XMLString::transcode(attrList.getName(i))] = XMLString::transcode(attrList.getValue(i));
   myStream.onElement(label, attrs);
 }
开发者ID:arjunroy,项目名称:modelnet-core,代码行数:8,代码来源:xml.cpp

示例12: if

void 
SBlogErrorMapper::MySAXHandler::startElement(const XMLCh* const name,
					     AttributeList& attributes)
{
  // 1. parse module name from the root
  XMLCh2VXIchar(name, tempString, 4096); 
  if(wcscmp(tempString, L"ErrorMessages") == 0)
  {
    for(unsigned int i = 0; i < attributes.getLength(); i++)
    {
      XMLCh2VXIchar(attributes.getName(i), tempString, 4096); 
      if(wcscmp(tempString, L"moduleName") == 0)
      {
        XMLCh2VXIchar(attributes.getValue(i), tempString, 4096);
        moduleName = tempString;
      }
    }
  }
  // 2. only care about <error> elements
  else if(wcscmp(tempString, L"error") == 0) {
    isProcessing = 1;
    errorMessage = L"";

    // Find the error number and severity (tag attributes)
    for (unsigned int i = 0; i < attributes.getLength(); i++) {
      XMLCh2VXIchar(attributes.getName(i), tempString, 4096); 
      if(wcscmp(tempString, L"num") == 0) {
        XMLCh2VXIchar(attributes.getValue(i), tempString, 4096); 
        errorNumber = wtoint(tempString);
      }
      else if(wcscmp(tempString, L"severity") == 0) {
        XMLCh2VXIchar(attributes.getValue(i), tempString, 4096); 
        errorSeverity = wtoint(tempString);
      }
    }
  }
  else if(wcscmp(tempString, L"advice") == 0) {
    // ignore the advice tag, just concate the advice's message    
  }
  else if(isProcessing)
    errorMessage += L"???"; // Runtime-determined value, unknown
}
开发者ID:ausmarton,项目名称:voiceglue-centos-6,代码行数:42,代码来源:SBlogMapper.cpp

示例13: StoreExperimentNameAttribute

/*
 * Stores the experiment name attribute from the experiment element.
 */
void SAXArrayHandlers::StoreExperimentNameAttribute(AttributeList&  attributes)
{
	unsigned int len = attributes.getLength();
	for (unsigned int index = 0; index < len; index++)
	{
		if (attributes.getName(index) == NAME_ATTRIBUTE)
		{
			arrayData->SetExperimentName(XMLChToString(attributes.getValue(index)));
			break;
		}
	}
}
开发者ID:HenrikBengtsson,项目名称:affxparser,代码行数:15,代码来源:SAXDttArrayHandlers.cpp

示例14:

//
// startElement - our SAX handler callback function for startElement.
//                Update the document checksum with the element name
//                and any attribute names and values.
//
 void ThreadParser::SAXHandler::startElement(const XMLCh *const name, AttributeList &attributes)
{
    SAXInstance->addToCheckSum(name);
    XMLSize_t n = attributes.getLength();
    XMLSize_t i;
    for (i=0; i<n; i++)
    {
        const XMLCh *attNam = attributes.getName(i);
        SAXInstance->addToCheckSum(attNam);
        const XMLCh *attVal = attributes.getValue(i);
        SAXInstance->addToCheckSum(attVal);
    }
}
开发者ID:ideasiii,项目名称:ControllerPlatform,代码行数:18,代码来源:ThreadTest.cpp

示例15: startElement

void OptionsLoader::startElement(const XMLCh* const name,
                                 AttributeList& attributes) {
    myItem = TplConvert<XMLCh>::_2str(name);
    for (int i = 0; i < (int) attributes.getLength(); i++) {
        std::string key = TplConvert<XMLCh>::_2str(attributes.getName(i));
        std::string value = TplConvert<XMLCh>::_2str(attributes.getValue(i));
        if (key == "value" || key == "v") {
            key = myItem;
        }
        setValue(key, value);
    }
    myValue = "";
}
开发者ID:NeziheSozen,项目名称:sumo,代码行数:13,代码来源:OptionsLoader.cpp


注:本文中的AttributeList::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。