• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VarDecl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VarDecl的典型用法代码示例。如果您正苦于以下问题:C++ VarDecl类的具体用法?C++ VarDecl怎么用?C++ VarDecl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: EmitDeclDestroy

/// Emit code to cause the destruction of the given variable with
/// static storage duration.
static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
                            llvm::Constant *addr) {
  CodeGenModule &CGM = CGF.CGM;

  // FIXME:  __attribute__((cleanup)) ?
  
  QualType type = D.getType();
  QualType::DestructionKind dtorKind = type.isDestructedType();

  switch (dtorKind) {
  case QualType::DK_none:
    return;

  case QualType::DK_cxx_destructor:
    break;

  case QualType::DK_objc_strong_lifetime:
  case QualType::DK_objc_weak_lifetime:
    // We don't care about releasing objects during process teardown.
    assert(!D.getTLSKind() && "should have rejected this");
    return;
  }

  llvm::Constant *function;
  llvm::Constant *argument;

  // Special-case non-array C++ destructors, where there's a function
  // with the right signature that we can just call.
  const CXXRecordDecl *record = nullptr;
  if (dtorKind == QualType::DK_cxx_destructor &&
      (record = type->getAsCXXRecordDecl())) {
    assert(!record->hasTrivialDestructor());
    CXXDestructorDecl *dtor = record->getDestructor();

    function = CGM.getAddrOfCXXStructor(dtor, StructorType::Complete);
    argument = llvm::ConstantExpr::getBitCast(
        addr, CGF.getTypes().ConvertType(type)->getPointerTo());

  // Otherwise, the standard logic requires a helper function.
  } else {
    function = CodeGenFunction(CGM)
        .generateDestroyHelper(addr, type, CGF.getDestroyer(dtorKind),
                               CGF.needsEHCleanup(dtorKind), &D);
    argument = llvm::Constant::getNullValue(CGF.Int8PtrTy);
  }

  CGM.getCXXABI().registerGlobalDtor(CGF, D, function, argument);
}
开发者ID:Eelis,项目名称:clang,代码行数:50,代码来源:CGDeclCXX.cpp


示例2: generatePrintOfExpression

/// When we see an expression in a TopLevelCodeDecl in the REPL, process it,
/// adding the proper decls back to the top level of the file.
void REPLChecker::processREPLTopLevelExpr(Expr *E) {
  CanType T = E->getType()->getCanonicalType();

  // Don't try to print invalid expressions, module exprs, or void expressions.
  if (isa<ErrorType>(T) || isa<ModuleType>(T) || T->isVoid())
    return;

  // Okay, we need to print this expression.  We generally do this by creating a
  // REPL metavariable (e.g. r4) to hold the result, so it can be referred to
  // in the future.  However, if this is a direct reference to a decl (e.g. "x")
  // then don't create a repl metavariable.
  if (VarDecl *d = getObviousDeclFromExpr(E)) {
    generatePrintOfExpression(d->getName().str(), E);
    return;
  }

  // Remove the expression from being in the list of decls to execute, we're
  // going to reparent it.
  auto TLCD = cast<TopLevelCodeDecl>(SF.Decls.back());

  E = TC.coerceToMaterializable(E);

  // Create the meta-variable, let the typechecker name it.
  Identifier name = TC.getNextResponseVariableName(SF.getParentModule());
  VarDecl *vd = new (Context) VarDecl(/*static*/ false, /*IsLet*/true,
                                      E->getStartLoc(), name,
                                      E->getType(), &SF);
  SF.Decls.push_back(vd);

  // Create a PatternBindingDecl to bind the expression into the decl.
  Pattern *metavarPat = new (Context) NamedPattern(vd);
  metavarPat->setType(E->getType());

  PatternBindingDecl *metavarBinding
    = PatternBindingDecl::create(Context, SourceLoc(), StaticSpellingKind::None,
                                 E->getStartLoc(), metavarPat, E, TLCD);

  // Overwrite the body of the existing TopLevelCodeDecl.
  TLCD->setBody(BraceStmt::create(Context,
                                  metavarBinding->getStartLoc(),
                                  ASTNode(metavarBinding),
                                  metavarBinding->getEndLoc(),
                                  /*implicit*/true));

  // Finally, print the variable's value.
  E = TC.buildCheckedRefExpr(vd, &SF, E->getStartLoc(), /*Implicit=*/true);
  generatePrintOfExpression(vd->getName().str(), E);
}
开发者ID:asdfeng,项目名称:swift,代码行数:50,代码来源:TypeCheckREPL.cpp


示例3: reportGlobalToASan

void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
                                           const VarDecl &D, bool IsDynInit) {
  if (!CGM.getLangOpts().Sanitize.hasOneOf(SanitizerKind::Address |
                                           SanitizerKind::KernelAddress))
    return;
  std::string QualName;
  llvm::raw_string_ostream OS(QualName);
  D.printQualifiedName(OS);

  bool IsBlacklisted = false;
  for (auto Attr : D.specific_attrs<NoSanitizeAttr>())
    if (Attr->getMask() & SanitizerKind::Address)
      IsBlacklisted = true;
  reportGlobalToASan(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit,
                     IsBlacklisted);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:16,代码来源:SanitizerMetadata.cpp


示例4: EmitCXXGlobalVarDeclInit

void CodeGenFunction::EmitCXXGlobalVarDeclInit(const VarDecl &D,
                                               llvm::Constant *DeclPtr) {

  const Expr *Init = D.getInit();
  QualType T = D.getType();

  if (!T->isReferenceType()) {
    EmitDeclInit(*this, D, DeclPtr);
    EmitDeclDestroy(*this, D, DeclPtr);
    return;
  }

  unsigned Alignment = getContext().getDeclAlign(&D).getQuantity();
  RValue RV = EmitReferenceBindingToExpr(Init, &D);
  EmitStoreOfScalar(RV.getScalarVal(), DeclPtr, false, Alignment, T);
}
开发者ID:ACSOP,项目名称:android_external_clang,代码行数:16,代码来源:CGDeclCXX.cpp


示例5: assert

// Like applyConstQualifier, this must not return null (its callers do not
// null check). Instead, return the input type on error.
Type *
TypeResolver::applyByRef(TypeSpecifier *spec, Type *type, TypeSpecHelper *helper)
{
  if (!type->canBeUsedAsRefType()) {
    cc_.report(spec->byRefLoc(), rmsg::type_cannot_be_ref) << type;
    return type;
  }

  VarDecl* decl = helper ? helper->decl() : nullptr;
  if (decl) {
    assert(decl->sym()->isByRef());
    assert(decl->sym()->isArgument());
  }

  return cc_.types()->newReference(type);
}
开发者ID:collinsmith,项目名称:sourcepawn,代码行数:18,代码来源:type-resolver.cpp


示例6: addOneRecordDecl

bool SimplifyStructUnionDecl::HandleTopLevelDecl(DeclGroupRef DGR) 
{
  DeclGroupRef::iterator DI = DGR.begin();
  const RecordDecl *RD = dyn_cast<RecordDecl>(*DI);
  if (RD) {
    addOneRecordDecl(RD, DGR);
    return true;
  }

  VarDecl *VD = dyn_cast<VarDecl>(*DI);
  if (!VD)
    return true;

  const Type *T = VD->getType().getTypePtr();

  RD = getBaseRecordDecl(T);
  if (!RD)
    return true;

  const Decl *CanonicalD = RD->getCanonicalDecl();
  void *DGRPointer = RecordDeclToDeclGroup[CanonicalD];
  if (!DGRPointer)
    return true;

  ValidInstanceNum++;
  if (ValidInstanceNum != TransformationCounter)
    return true;

  TheRecordDecl = dyn_cast<RecordDecl>(CanonicalD);
  TheDeclGroupRefs.push_back(DGRPointer);
  TheDeclGroupRefs.push_back(DGR.getAsOpaquePtr());

  for (DeclGroupRef::iterator I = DGR.begin(), E = DGR.end(); I != E; ++I) {
    VarDecl *VD = dyn_cast<VarDecl>(*I);
    TransAssert(VD && "Bad VarDecl!");
    CombinedVars.insert(VD);
  }

  DeclGroupRef DefDGR = DeclGroupRef::getFromOpaquePtr(DGRPointer);
  for (DeclGroupRef::iterator I = DefDGR.begin(), 
       E = DefDGR.end(); I != E; ++I) {
    VarDecl *VD = dyn_cast<VarDecl>(*I);
    if (VD)
      CombinedVars.insert(VD);
  }
  return true;
}
开发者ID:annulen,项目名称:creduce,代码行数:47,代码来源:SimplifyStructUnionDecl.cpp


示例7: assert

  bool SymbolResolverCallback::LookupObject(LookupResult& R, Scope* S) {
    if (!ShouldResolveAtRuntime(R, S))
      return false;

    if (m_IsRuntime) {
      // We are currently parsing an EvaluateT() expression
      if (!m_Resolve)
        return false;

      // Only for demo resolve all unknown objects to cling::test::Tester
      if (!m_TesterDecl) {
        clang::Sema& SemaR = m_Interpreter->getSema();
        clang::NamespaceDecl* NSD = utils::Lookup::Namespace(&SemaR, "cling");
        NSD = utils::Lookup::Namespace(&SemaR, "test", NSD);
        m_TesterDecl = utils::Lookup::Named(&SemaR, "Tester", NSD);
      }
      assert (m_TesterDecl && "Tester not found!");
      R.addDecl(m_TesterDecl);
      return true; // Tell clang to continue.
    }

    // We are currently NOT parsing an EvaluateT() expression.
    // Escape the expression into an EvaluateT() expression.
    ASTContext& C = R.getSema().getASTContext();
    DeclContext* DC = 0;
    // For DeclContext-less scopes like if (dyn_expr) {}
    while (!DC) {
      DC = static_cast<DeclContext*>(S->getEntity());
      S = S->getParent();
    }
    DeclarationName Name = R.getLookupName();
    IdentifierInfo* II = Name.getAsIdentifierInfo();
    SourceLocation Loc = R.getNameLoc();
    VarDecl* Res = VarDecl::Create(C, DC, Loc, Loc, II, C.DependentTy,
        /*TypeSourceInfo*/0, SC_None);

    // Annotate the decl to give a hint in cling. FIXME: Current implementation
    // is a gross hack, because TClingCallbacks shouldn't know about
    // EvaluateTSynthesizer at all!
    SourceRange invalidRange;
    Res->addAttr(new (C) AnnotateAttr(invalidRange, C, "__ResolveAtRuntime", 0));
    R.addDecl(Res);
    DC->addDecl(Res);
    // Say that we can handle the situation. Clang should try to recover
    return true;
  }
开发者ID:CristinaCristescu,项目名称:root,代码行数:46,代码来源:InterpreterCallbacks.cpp


示例8: VisitDeclStmt

void TransferFunctions::VisitDeclStmt(DeclStmt *S) {
  // iterate over all declarations of this DeclStmt
  for (auto decl : S->decls()) {
    if (isa<VarDecl>(decl)) {
      VarDecl *VD = dyn_cast<VarDecl>(decl);
      if (VD->hasInit()) {
        if (checkImageAccess(VD->getInit(), READ_ONLY)) {
          KS.curStmtVectorize = (VectorInfo) (KS.curStmtVectorize|VECTORIZE);
        }
      }
      KS.declsToVector[VD] = KS.curStmtVectorize;
    }
  }

  // reset vectorization status for next statement
  KS.curStmtVectorize = SCALAR;
}
开发者ID:jingpu,项目名称:hipacc-vivado,代码行数:17,代码来源:KernelStatistics.cpp


示例9: cr

void
SemanticAnalysis::checkCall(FunctionSignature *sig, ExpressionList *args)
{
    VarDecl *vararg = nullptr;
    for (size_t i = 0; i < args->length(); i++) {
        Expression *expr = args->at(i);

        VarDecl *arg = nullptr;
        if (i >= sig->parameters()->length()) {
            if (!vararg) {
                cc_.report(expr->loc(), rmsg::wrong_argcount)
                        << args->length(), sig->parameters()->length();
                return;
            }
            arg = vararg;
        } else {
            arg = sig->parameters()->at(i);
        }
        (void)arg;

        visitForValue(expr);

#if 0
        Coercion cr(cc_,
                    Coercion::Reason::arg,
                    expr,
                    arg->te().resolved());
        if (cr.coerce() != Coercion::Result::ok) {
            auto builder = cc_.report(expr->loc(), rmsg::cannot_coerce_for_arg)
                           << expr->type()
                           << arg->te().resolved();

            if (i < args->length() && arg->name())
                builder << arg->name();
            else
                builder << i;

            builder << cr.diag(expr->loc());
            break;
        }

        // Rewrite the tree for the coerced result.
        args->at(i) = cr.output();
#endif
    }
}
开发者ID:jaredballou,项目名称:sourcepawn,代码行数:46,代码来源:semantic-analysis.cpp


示例10: Diag

OMPThreadPrivateDecl *Sema::CheckOMPThreadPrivateDecl(
                                 SourceLocation Loc,
                                 ArrayRef<Expr *> VarList) {
  SmallVector<Expr *, 8> Vars;
  for (ArrayRef<Expr *>::iterator I = VarList.begin(),
                                         E = VarList.end();
       I != E; ++I) {
    DeclRefExpr *DE = cast<DeclRefExpr>(*I);
    VarDecl *VD = cast<VarDecl>(DE->getDecl());
    SourceLocation ILoc = DE->getExprLoc();

    // OpenMP [2.9.2, Restrictions, C/C++, p.10]
    //   A threadprivate variable must not have an incomplete type.
    if (RequireCompleteType(ILoc, VD->getType(),
                            diag::err_omp_threadprivate_incomplete_type)) {
      continue;
    }

    // OpenMP [2.9.2, Restrictions, C/C++, p.10]
    //   A threadprivate variable must not have a reference type.
    if (VD->getType()->isReferenceType()) {
      Diag(ILoc, diag::err_omp_ref_type_arg)
        << getOpenMPDirectiveName(OMPD_threadprivate)
        << VD->getType();
      bool IsDecl = VD->isThisDeclarationADefinition(Context) ==
                    VarDecl::DeclarationOnly;
      Diag(VD->getLocation(), IsDecl ? diag::note_previous_decl :
                                       diag::note_defined_here) << VD;
      continue;
    }

    // Check if this is a TLS variable.
    if (VD->getTLSKind()) {
      Diag(ILoc, diag::err_omp_var_thread_local) << VD;
      bool IsDecl = VD->isThisDeclarationADefinition(Context) ==
                    VarDecl::DeclarationOnly;
      Diag(VD->getLocation(), IsDecl ? diag::note_previous_decl :
                                       diag::note_defined_here) << VD;
      continue;
    }

    Vars.push_back(*I);
  }
  OMPThreadPrivateDecl *D = 0;
  if (!Vars.empty()) {
    D = OMPThreadPrivateDecl::Create(Context, getCurLexicalContext(), Loc,
                                     Vars);
    D->setAccess(AS_public);
  }
  return D;
}
开发者ID:gix,项目名称:clang,代码行数:51,代码来源:SemaOpenMP.cpp


示例11: VisitDeclStmt

bool VarCollector::VisitDeclStmt(DeclStmt *S) {

  DeclGroupRef::iterator it;
  
  for (it = S->decl_begin(); it != S->decl_end(); it++) {

    VarDecl * VD = dyn_cast<VarDecl>(*it);
    assert(VD);
    FullDirectives->InsertPrivateDecl(VD);
    
    
    if (!VD->hasInit()) {
      continue;
    }

    bool IsArray = false;

    const Type * T = VD->getType().getTypePtr();

    do {

      if (T->isPointerType()) {

        string TS = GetType(VD->getType()->getUnqualifiedDesugaredType());

        if (IsArray) {
          HandleArrayInit(VD, TS, S->getLocStart());
        } else {
          HandlePointerInit(VD, TS, S->getLocStart());
        }
        T = NULL;
      } else if (T->isArrayType()) {
        IsArray = true;
        T = T->getAsArrayTypeUnsafe()->getElementType().getTypePtr();
      } else {
        T = NULL;
      }

    } while (T);

  }

  return true;
  
}
开发者ID:divot,项目名称:SpecCodeConv,代码行数:45,代码来源:VarCollector.cpp


示例12: print_globals

void print_globals(){

  vector<VarDecl *> globals = get_reg_decls();
  for(vector<VarDecl *>::const_iterator it = globals.begin();
	it != globals.end(); it++){
	VarDecl *s = *it;
	cout << s->tostring() << endl;
  }

  cout << "var mem:reg8_t[reg32_t];" << endl;

  vector<Stmt *> helpers = gen_eflags_helpers();
  for(vector<Stmt *>::const_iterator it = helpers.begin();
      it != helpers.end(); it++){
    Stmt *s = *it;
    cout << s->tostring() << endl;
  }
}
开发者ID:bengheng,项目名称:Expose,代码行数:18,代码来源:ir_printer.cpp


示例13:

const Type *CombLocalVarCollectionVisitor::getTypeFromDeclStmt(DeclStmt *DS)
{
  Decl *D;
  if (DS->isSingleDecl()) {
    D = DS->getSingleDecl();
  }
  else {
    DeclGroupRef DGR = DS->getDeclGroup();
    DeclGroupRef::iterator I = DGR.begin();
    D = (*I);
  }

  VarDecl *VD = dyn_cast<VarDecl>(D);
  if (!VD)
    return NULL;
  
  return VD->getType().getTypePtr();
}
开发者ID:JIghtuse,项目名称:creduce,代码行数:18,代码来源:CombineLocalVarDecl.cpp


示例14: EmitCXXGlobalVarDeclInit

void CodeGenFunction::EmitCXXGlobalVarDeclInit(const VarDecl &D,
                                               llvm::Constant *DeclPtr) {

  const Expr *Init = D.getInit();
  QualType T = D.getType();

  if (!T->isReferenceType()) {
    EmitDeclInit(*this, D, DeclPtr);
    return;
  }
  if (Init->isLvalue(getContext()) == Expr::LV_Valid) {
    RValue RV = EmitReferenceBindingToExpr(Init, /*IsInitializer=*/true);
    EmitStoreOfScalar(RV.getScalarVal(), DeclPtr, false, T);
    return;
  }
  ErrorUnsupported(Init, 
                   "global variable that binds reference to a non-lvalue");
}
开发者ID:jhoush,项目名称:dist-clang,代码行数:18,代码来源:CGDeclCXX.cpp


示例15: dump

 void dump(FunctionSignature *sig) {
   dump(sig->returnType(), nullptr);
   if (!sig->parameters()->length()) {
     fprintf(fp_, " ()\n");
     return;
   }
   fprintf(fp_, " (\n");
   indent();
   for (size_t i = 0; i < sig->parameters()->length(); i++) {
     prefix();
     VarDecl *param = sig->parameters()->at(i);
     dump(param->te(), param->name());
     fprintf(fp_, "\n");
   }
   unindent();
   prefix();
   fprintf(fp_, ")");
 }
开发者ID:LittleKu,项目名称:sourcepawn,代码行数:18,代码来源:ast-printer.cpp


示例16: registerGlobalDtor

void CGCXXABI::registerGlobalDtor(CodeGenFunction &CGF,
                                  const VarDecl &D,
                                  llvm::Constant *dtor,
                                  llvm::Constant *addr) {
  if (D.getTLSKind())
    CGM.ErrorUnsupported(&D, "non-trivial TLS destruction");

  // The default behavior is to use atexit.
  CGF.registerGlobalDtorWithAtExit(D, dtor, addr);
}
开发者ID:ADonut,项目名称:LLVM-GPGPU,代码行数:10,代码来源:CGCXXABI.cpp


示例17: DeclGroupVector

bool CombineGlobalVarDecl::HandleTopLevelDecl(DeclGroupRef DGR) 
{
  DeclGroupRef::iterator DI = DGR.begin();
  VarDecl *VD = dyn_cast<VarDecl>(*DI);
  if (!VD || isInIncludedFile(VD))
    return true;
  SourceRange Range = VD->getSourceRange();
  if (Range.getBegin().isInvalid() || Range.getEnd().isInvalid())
    return true;

  const Type *T = VD->getType().getTypePtr();
  const Type *CanonicalT = Context->getCanonicalType(T);
  
  DeclGroupVector *DV;
  TypeToDeclMap::iterator TI = AllDeclGroups.find(CanonicalT);
  if (TI == AllDeclGroups.end()) {
    DV = new DeclGroupVector();
    AllDeclGroups[CanonicalT] = DV;
  }
  else {
    ValidInstanceNum++;
    DV = (*TI).second;

    if (ValidInstanceNum == TransformationCounter) {
      if (DV->size() >= 1) {
        void* DP1 = *(DV->begin());
        TheDeclGroupRefs.push_back(DP1);
        TheDeclGroupRefs.push_back(DGR.getAsOpaquePtr());
      }
    }
  }

  // Note that it's unnecessary to keep all encountered
  // DeclGroupRefs. We could choose a light way similar
  // to what we implemented in CombineLocalVarDecl.
  // I kept the code here because I feel we probably 
  // need more combinations, i.e., not only combine the
  // first DeclGroup with others, but we could combine
  // the second one and the third one. 
  DV->push_back(DGR.getAsOpaquePtr());
  return true;
}
开发者ID:JIghtuse,项目名称:creduce,代码行数:42,代码来源:CombineGlobalVarDecl.cpp


示例18: assert

C2::StmtResult C2Sema::ActOnDeclaration(const char* name, SourceLocation loc, Expr* type, Expr* InitValue) {
    assert(type);
#ifdef SEMA_DEBUG
    std::cerr << COL_SEMA"SEMA: decl at ";
    loc.dump(SourceMgr);
    std::cerr << ANSI_NORMAL"\n";
#endif
    if (name[0] == '_' && name[1] == '_') {
        Diag(loc, diag::err_invalid_symbol_name) << name;
        delete type;
        delete InitValue;
        return StmtResult(true);
    }
    // TEMP extract here to Type and delete rtype Expr
    TypeExpr* typeExpr = cast<TypeExpr>(type);
    bool hasLocal = typeExpr->hasLocalQualifier();
    VarDecl* V =  createVarDecl(VARDECL_LOCAL, name, loc, typeExpr, InitValue, false);
    if (hasLocal) V->setLocalQualifier();
    return StmtResult(new DeclStmt(V));
}
开发者ID:8l,项目名称:c2compiler,代码行数:20,代码来源:C2Sema.cpp


示例19: while

/// Returns a string representation of the SubPath
/// suitable for use in diagnostic text. Only supports the Projections
/// that stored-property relaxation supports: struct stored properties
/// and tuple elements.
std::string AccessSummaryAnalysis::getSubPathDescription(
    SILType baseType, const IndexTrieNode *subPath, SILModule &M) {
  // Walk the trie to the root to collect the sequence (in reverse order).
  llvm::SmallVector<unsigned, 4> reversedIndices;
  const IndexTrieNode *I = subPath;
  while (!I->isRoot()) {
    reversedIndices.push_back(I->getIndex());
    I = I->getParent();
  }

  std::string sbuf;
  llvm::raw_string_ostream os(sbuf);

  SILType containingType = baseType;
  for (unsigned index : reversed(reversedIndices)) {
    os << ".";

    if (StructDecl *D = containingType.getStructOrBoundGenericStruct()) {
      auto iter = D->getStoredProperties().begin();
      std::advance(iter, index);
      VarDecl *var = *iter;
      os << var->getBaseName();
      containingType = containingType.getFieldType(var, M);
      continue;
    }

    if (auto tupleTy = containingType.getAs<TupleType>()) {
      Identifier elementName = tupleTy->getElement(index).getName();
      if (elementName.empty())
        os << index;
      else
        os << elementName;
      containingType = containingType.getTupleElementType(index);
      continue;
    }

    llvm_unreachable("Unexpected type in projection SubPath!");
  }

  return os.str();
}
开发者ID:YanlongMa,项目名称:swift,代码行数:45,代码来源:AccessSummaryAnalysis.cpp


示例20: EmitCXXGuardedInit

void CodeGenFunction::EmitCXXGuardedInit(const VarDecl &D,
                                         llvm::GlobalVariable *DeclPtr) {
  // If we've been asked to forbid guard variables, emit an error now.
  // This diagnostic is hard-coded for Darwin's use case;  we can find
  // better phrasing if someone else needs it.
  if (CGM.getCodeGenOpts().ForbidGuardVariables)
    CGM.Error(D.getLocation(),
              "this initialization requires a guard variable, which "
              "the kernel does not support");

  CGM.getCXXABI().EmitGuardedInit(*this, D, DeclPtr);
}
开发者ID:ACSOP,项目名称:android_external_clang,代码行数:12,代码来源:CGDeclCXX.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VarDeclaration类代码示例发布时间:2022-05-31
下一篇:
C++ Var类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap