Lines Matching defs:NewVD
3056 static bool mergeTypeWithPrevious(Sema &S, VarDecl *NewVD, VarDecl *OldVD,
3074 return NewVD->isPreviousDeclInSameBlockScope() ||
3076 !NewVD->getLexicalDeclContext()->isFunctionOrMethod());
3081 OldVD->getLexicalDeclContext() == NewVD->getLexicalDeclContext();
3937 if (VarDecl *NewVD = dyn_cast<VarDecl>(Anon)) {
3938 if (getLangOpts().CPlusPlus && NewVD->isStaticLocal()) {
3941 getCurrentMangleNumberContext(NewVD->getDeclContext(),
3943 Context.setManglingNumber(NewVD, MCtx->getManglingNumber(NewVD, S->getMSLocalManglingNumber()));
3944 Context.setStaticLocalNumber(NewVD, MCtx->getStaticLocalNumber(NewVD));
5318 VarDecl *NewVD = nullptr;
5322 NewVD = VarDecl::Create(Context, DC, D.getLocStart(),
5327 NewVD->setInvalidDecl();
5440 NewVD = cast<VarDecl>(Res.get());
5443 NewVD = VarDecl::Create(Context, DC, D.getLocStart(),
5450 TemplateParams, NewVD);
5451 NewVD->setDescribedVarTemplate(NewTemplate);
5457 ParsingInitForAutoVars.insert(NewVD);
5460 NewVD->setInvalidDecl();
5465 SetNestedNameSpecifier(NewVD, D);
5471 NewVD->setTemplateParameterListsInfo(
5476 NewVD->setConstexpr(true);
5481 NewVD->setLexicalDeclContext(CurContext);
5486 NewVD->setLocalExternDecl();
5489 if (NewVD->hasLocalStorage()) {
5499 NewVD->setTSCSpec(TSCS);
5508 NewVD->setTSCSpec(TSCS);
5521 !NewVD->getType().isConstQualified()) {
5532 Diag(NewVD->getLocation(), diag::err_module_private_specialization)
5537 Diag(NewVD->getLocation(), diag::err_module_private_specialization)
5540 else if (NewVD->hasLocalStorage())
5541 Diag(NewVD->getLocation(), diag::err_module_private_local)
5542 << 0 << NewVD->getDeclName()
5546 NewVD->setModulePrivate();
5553 ProcessDeclAttributes(S, NewVD, D);
5559 (NewVD->hasAttr<CUDASharedAttr>() ||
5560 NewVD->hasAttr<CUDAConstantAttr>())) {
5561 NewVD->setStorageClass(SC_Static);
5568 assert(!NewVD->hasAttr<DLLImportAttr>() ||
5569 NewVD->getAttr<DLLImportAttr>()->isInherited() ||
5570 NewVD->isStaticDataMember() || NewVD->getStorageClass() != SC_None);
5574 if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewVD))
5575 NewVD->setInvalidDecl();
5605 NewVD->setInvalidDecl(true);
5609 NewVD->addAttr(::new (Context) AsmLabelAttr(SE->getStrTokenLoc(0),
5613 ExtnameUndeclaredIdentifiers.find(NewVD->getIdentifier());
5615 NewVD->addAttr(I->second);
5622 CheckShadow(S, NewVD, Previous);
5627 FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewVD),
5635 NewVD->isLocalVarDecl() && NewVD->hasExternalStorage())
5636 NewVD->setPreviousDeclInSameBlockScope(
5641 D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
5644 if (IsExplicitSpecialization && !NewVD->isInvalidDecl() &&
5645 CheckMemberSpecialization(NewVD, Previous))
5646 NewVD->setInvalidDecl();
5655 Diag(NewVD->getLocation(), diag::err_nonstatic_member_out_of_line)
5658 NewVD->setInvalidDecl();
5665 NewVD->setInvalidDecl();
5669 D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
5673 NewVD->getPreviousDecl()
5674 ? NewVD->getPreviousDecl()->getDescribedVarTemplate()
5688 NewVD->setInvalidDecl();
5698 ProcessPragmaWeak(S, NewVD);
5702 if (NewVD->isFirstDecl() && !NewVD->isInvalidDecl() &&
5703 isIncompleteDeclExternC(*this, NewVD))
5704 RegisterLocallyScopedExternCDecl(NewVD, S);
5706 if (getLangOpts().CPlusPlus && NewVD->isStaticLocal()) {
5709 getCurrentMangleNumberContext(NewVD->getDeclContext(),
5712 NewVD, MCtx->getManglingNumber(NewVD, S->getMSLocalManglingNumber()));
5713 Context.setStaticLocalNumber(NewVD, MCtx->getStaticLocalNumber(NewVD));
5719 *this, dyn_cast<NamedDecl>(Previous.getRepresentativeDecl()), NewVD,
5724 if (NewVD->isInvalidDecl())
5730 return NewVD;
5943 void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
5945 if (NewVD->isInvalidDecl())
5948 TypeSourceInfo *TInfo = NewVD->getTypeSourceInfo();
5955 if (NewVD->hasAttrs())
5956 CheckAlignasUnderalignment(NewVD);
5959 Diag(NewVD->getLocation(), diag::err_statically_allocated_object)
5960 << FixItHint::CreateInsertion(NewVD->getLocation(), "*");
5962 NewVD->setType(T);
5969 if (NewVD->hasLocalStorage() && T.getAddressSpace() != 0) {
5970 Diag(NewVD->getLocation(), diag::err_as_qualified_auto_decl);
5971 NewVD->setInvalidDecl();
5977 if (getLangOpts().OpenCL && NewVD->isFileVarDecl()
5980 Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space);
5981 NewVD->setInvalidDecl();
5988 && NewVD->isStaticLocal()) {
5989 Diag(NewVD->getLocation(), diag::err_static_function_scope);
5990 NewVD->setInvalidDecl();
5994 if (NewVD->hasLocalStorage() && T.isObjCGCWeak()
5995 && !NewVD->hasAttr<BlocksAttr>()) {
5997 Diag(NewVD->getLocation(), diag::warn_gc_attribute_weak_on_local);
6000 Diag(NewVD->getLocation(), diag::warn_attribute_weak_on_local);
6005 if (isVM || NewVD->hasAttr<CleanupAttr>() ||
6006 NewVD->hasAttr<BlocksAttr>())
6009 if ((isVM && NewVD->hasLinkage()) ||
6010 (T->isVariableArrayType() && NewVD->hasGlobalStorage())) {
6022 if (NewVD->isFileVarDecl())
6023 Diag(NewVD->getLocation(), diag::err_vla_decl_in_file_scope)
6025 else if (NewVD->isStaticLocal())
6026 Diag(NewVD->getLocation(), diag::err_vla_decl_has_static_storage)
6029 Diag(NewVD->getLocation(), diag::err_vla_decl_has_extern_linkage)
6031 NewVD->setInvalidDecl();
6036 if (NewVD->isFileVarDecl())
6037 Diag(NewVD->getLocation(), diag::err_vm_decl_in_file_scope);
6039 Diag(NewVD->getLocation(), diag::err_vm_decl_has_extern_linkage);
6040 NewVD->setInvalidDecl();
6044 Diag(NewVD->getLocation(), diag::warn_illegal_constant_array_size);
6045 NewVD->setType(FixedTInfo->getType());
6046 NewVD->setTypeSourceInfo(FixedTInfo);
6052 if (NewVD->isThisDeclarationADefinition() || getLangOpts().CPlusPlus) {
6053 Diag(NewVD->getLocation(), diag::err_typecheck_decl_incomplete_type)
6055 NewVD->setInvalidDecl();
6060 if (!NewVD->hasLocalStorage() && NewVD->hasAttr<BlocksAttr>()) {
6061 Diag(NewVD->getLocation(), diag::err_block_on_nonlocal);
6062 NewVD->setInvalidDecl();
6066 if (isVM && NewVD->hasAttr<BlocksAttr>()) {
6067 Diag(NewVD->getLocation(), diag::err_block_on_vm);
6068 NewVD->setInvalidDecl();
6072 if (NewVD->isConstexpr() && !T->isDependentType() &&
6073 RequireLiteralType(NewVD->getLocation(), T,
6075 NewVD->setInvalidDecl();
6089 /// Sets NewVD->isInvalidDecl() if an error was encountered.
6092 bool Sema::CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous) {
6093 CheckVariableDeclarationType(NewVD);
6096 if (NewVD->isInvalidDecl())
6102 checkForConflictWithNonVisibleExternC(*this, NewVD, Previous))
6106 filterNonConflictingPreviousDecls(Context, NewVD, Previous);
6109 MergeVarDecl(NewVD, Previous);