ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
Scope *S);
// Decl attributes - this routine is the top level dispatcher.
- void HandleDeclAttributes(Decl *New, AttributeList *declspec_prefix,
- AttributeList *declarator_postfix);
- void HandleDeclAttribute(Decl *New, AttributeList *rawAttr);
+ void HandleDeclAttributes(Decl *New, const AttributeList *DeclSpecAttrs,
+ const AttributeList *DeclaratorAttrs);
+ void HandleDeclAttribute(Decl *New, const AttributeList *rawAttr);
/// HandleAddressSpaceTypeAttribute - this attribute is only applicable to
/// objects without automatic storage duration.
/// primitive type. Note that this is a variable attribute, and not
/// a type attribute.
QualType HandleModeTypeAttribute(QualType curType,
- AttributeList *rawAttr);
+ const AttributeList *rawAttr);
// HandleVectorTypeAttribute - this attribute is only applicable to
// integral and float scalars, although arrays, pointers, and function
// The raw attribute should contain precisely 1 argument, the vector size
// for the variable, measured in bytes. If curType and rawAttr are well
// formed, this routine will return a new vector type.
- QualType HandleVectorTypeAttribute(QualType curType, AttributeList *rawAttr);
- void HandleExtVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
-
- void HandleAlignedAttribute(Decl *d, AttributeList *rawAttr);
- void HandleAliasAttribute(Decl *d, AttributeList *rawAttr);
- void HandlePackedAttribute(Decl *d, AttributeList *rawAttr);
- void HandleAnnotateAttribute(Decl *d, AttributeList *rawAttr);
- void HandleNoReturnAttribute(Decl *d, AttributeList *rawAttr);
- void HandleDeprecatedAttribute(Decl *d, AttributeList *rawAttr);
- void HandleWeakAttribute(Decl *d, AttributeList *rawAttr);
- void HandleDLLImportAttribute(Decl *d, AttributeList *rawAttr);
- void HandleDLLExportAttribute(Decl *d, AttributeList *rawAttr);
- void HandleVisibilityAttribute(Decl *d, AttributeList *rawAttr);
- void HandleNothrowAttribute(Decl *d, AttributeList *rawAttr);
- void HandleFormatAttribute(Decl *d, AttributeList *rawAttr);
- void HandleStdCallAttribute(Decl *d, AttributeList *rawAttr);
- void HandleFastCallAttribute(Decl *d, AttributeList *rawAttr);
- void HandleTransparentUnionAttribute(Decl *d, AttributeList *rawAttr);
+ QualType HandleVectorTypeAttribute(QualType curType,
+ const AttributeList *rawAttr);
+ void HandleExtVectorTypeAttribute(TypedefDecl *d,
+ const AttributeList *rawAttr);
+
+ void HandleAlignedAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleAliasAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandlePackedAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleAnnotateAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleNoReturnAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleDeprecatedAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleWeakAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleDLLImportAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleDLLExportAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleVisibilityAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleNothrowAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleFormatAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleStdCallAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleFastCallAttribute(Decl *d, const AttributeList *rawAttr);
+ void HandleTransparentUnionAttribute(Decl *d, const AttributeList *rawAttr);
void WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
bool &IncompleteImpl);
/// to introduce parameters into function prototype scope.
Sema::DeclTy *
Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
- DeclSpec &DS = D.getDeclSpec();
+ const DeclSpec &DS = D.getDeclSpec();
// Verify C99 6.7.5.3p2: The only SCS allowed is 'register'.
if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified &&
DS.getStorageClassSpec() != DeclSpec::SCS_register) {
Diag(DS.getStorageClassSpecLoc(),
diag::err_invalid_storage_class_in_func_decl);
- DS.ClearStorageClassSpecs();
+ D.getMutableDeclSpec().ClearStorageClassSpecs();
}
if (DS.isThreadSpecified()) {
Diag(DS.getThreadSpecLoc(),
diag::err_invalid_storage_class_in_func_decl);
- DS.ClearStorageClassSpecs();
+ D.getMutableDeclSpec().ClearStorageClassSpecs();
}
// Check that there are no default arguments inside the type of this
return LinkageSpecDecl::Create(Context, Loc, Language, dcl);
}
-void Sema::HandleDeclAttribute(Decl *New, AttributeList *Attr) {
+void Sema::HandleDeclAttribute(Decl *New, const AttributeList *Attr) {
switch (Attr->getKind()) {
case AttributeList::AT_vector_size:
}
}
-void Sema::HandleDeclAttributes(Decl *New, AttributeList *declspec_prefix,
- AttributeList *declarator_postfix) {
- if (declspec_prefix == 0 && declarator_postfix == 0) return;
+void Sema::HandleDeclAttributes(Decl *New, const AttributeList *DeclSpecAttrs,
+ const AttributeList *DeclaratorAttrs) {
+ if (DeclSpecAttrs == 0 && DeclaratorAttrs == 0) return;
- while (declspec_prefix) {
- HandleDeclAttribute(New, declspec_prefix);
- declspec_prefix = declspec_prefix->getNext();
+ while (DeclSpecAttrs) {
+ HandleDeclAttribute(New, DeclSpecAttrs);
+ DeclSpecAttrs = DeclSpecAttrs->getNext();
}
// If there are any type attributes that were in the declarator, apply them to
// its top level type.
if (ValueDecl *VD = dyn_cast<ValueDecl>(New)) {
QualType DT = VD->getType();
- ProcessTypeAttributes(DT, declarator_postfix);
+ ProcessTypeAttributes(DT, DeclaratorAttrs);
VD->setType(DT);
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(New)) {
QualType DT = TD->getUnderlyingType();
- ProcessTypeAttributes(DT, declarator_postfix);
+ ProcessTypeAttributes(DT, DeclaratorAttrs);
TD->setUnderlyingType(DT);
}
- while (declarator_postfix) {
- HandleDeclAttribute(New, declarator_postfix);
- declarator_postfix = declarator_postfix->getNext();
+ while (DeclaratorAttrs) {
+ HandleDeclAttribute(New, DeclaratorAttrs);
+ DeclaratorAttrs = DeclaratorAttrs->getNext();
}
}
void Sema::HandleExtVectorTypeAttribute(TypedefDecl *tDecl,
- AttributeList *rawAttr) {
+ const AttributeList *rawAttr) {
QualType curType = tDecl->getUnderlyingType();
// check the attribute arguments.
if (rawAttr->getNumArgs() != 1) {
}
QualType Sema::HandleVectorTypeAttribute(QualType curType,
- AttributeList *rawAttr) {
+ const AttributeList *rawAttr) {
// check the attribute arugments.
if (rawAttr->getNumArgs() != 1) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
return Context.getVectorType(curType, vectorSize/typeSize);
}
-void Sema::HandlePackedAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandlePackedAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() > 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
rawAttr->getName()->getName());
}
-void Sema::HandleAliasAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleAliasAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 1) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new AliasAttr(std::string(Alias, AliasLen)));
}
-void Sema::HandleNoReturnAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleNoReturnAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new NoReturnAttr());
}
-void Sema::HandleDeprecatedAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleDeprecatedAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new DeprecatedAttr());
}
-void Sema::HandleVisibilityAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleVisibilityAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 1) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new VisibilityAttr(type));
}
-void Sema::HandleWeakAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleWeakAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new WeakAttr());
}
-void Sema::HandleDLLImportAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleDLLImportAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new DLLImportAttr());
}
-void Sema::HandleDLLExportAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleDLLExportAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new DLLExportAttr());
}
-void Sema::HandleStdCallAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleStdCallAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new StdCallAttr());
}
-void Sema::HandleFastCallAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleFastCallAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
d->addAttr(new FastCallAttr());
}
-void Sema::HandleNothrowAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleNothrowAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
/// Handle __attribute__((format(type,idx,firstarg))) attributes
/// based on http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
-void Sema::HandleFormatAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleFormatAttribute(Decl *d, const AttributeList *rawAttr) {
if (!rawAttr->getParameterName()) {
Diag(rawAttr->getLoc(), diag::err_attribute_argument_n_not_string,
Idx.getZExtValue(), FirstArg.getZExtValue()));
}
-void Sema::HandleTransparentUnionAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleTransparentUnionAttribute(Decl *d,
+ const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 0) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
// Ty->addAttr(new TransparentUnionAttr());
}
-void Sema::HandleAnnotateAttribute(Decl *d, AttributeList *rawAttr) {
+void Sema::HandleAnnotateAttribute(Decl *d, const AttributeList *rawAttr) {
// check the attribute arguments.
if (rawAttr->getNumArgs() != 1) {
Diag(rawAttr->getLoc(), diag::err_attribute_wrong_number_arguments,
SE->getByteLength())));
}
-void Sema::HandleAlignedAttribute(Decl *d, AttributeList *rawAttr)
+void Sema::HandleAlignedAttribute(Decl *d, const AttributeList *rawAttr)
{
// check the attribute arguments.
if (rawAttr->getNumArgs() > 1) {