forked from OSchip/llvm-project
Front-end support for __attribute__((may_alias)). This is not
yet hooked up to anything yet. llvm-svn: 119407
This commit is contained in:
parent
712f07de0e
commit
bbb7d62546
|
@ -241,6 +241,10 @@ def MaxFieldAlignment : Attr {
|
|||
let Args = [UnsignedArgument<"Alignment">];
|
||||
}
|
||||
|
||||
def MayAlias : Attr {
|
||||
let Spellings = ["may_alias"];
|
||||
}
|
||||
|
||||
def MSP430Interrupt : Attr {
|
||||
let Spellings = [];
|
||||
let Args = [UnsignedArgument<"Number">];
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
AT_gnu_inline,
|
||||
AT_hiding,
|
||||
AT_malloc,
|
||||
AT_may_alias,
|
||||
AT_mode,
|
||||
AT_neon_polyvector_type, // Clang-specific.
|
||||
AT_neon_vector_type, // Clang-specific.
|
||||
|
|
|
@ -83,7 +83,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
|
|||
.Case("NSObject", AT_nsobject)
|
||||
.Case("dllimport", AT_dllimport)
|
||||
.Case("dllexport", AT_dllexport)
|
||||
.Case("may_alias", IgnoredAttribute) // FIXME: TBAA
|
||||
.Case("may_alias", AT_may_alias)
|
||||
.Case("base_check", AT_base_check)
|
||||
.Case("deprecated", AT_deprecated)
|
||||
.Case("visibility", AT_visibility)
|
||||
|
|
|
@ -731,6 +731,22 @@ static void HandleMallocAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
|||
S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only);
|
||||
}
|
||||
|
||||
static void HandleMayAliasAttr(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;
|
||||
}
|
||||
|
||||
if (!isa<TypeDecl>(d)) {
|
||||
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
|
||||
<< Attr.getName() << 2 /*variable and function*/;
|
||||
return;
|
||||
}
|
||||
|
||||
d->addAttr(::new (S.Context) MayAliasAttr(Attr.getLoc(), S.Context));
|
||||
}
|
||||
|
||||
static void HandleNoReturnAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
||||
/* Diagnostics (if any) was emitted by Sema::ProcessFnAttr(). */
|
||||
assert(Attr.isInvalid() == false);
|
||||
|
@ -2361,6 +2377,7 @@ static void ProcessDeclAttribute(Scope *scope, Decl *D,
|
|||
case AttributeList::AT_hiding: HandleHidingAttr (D, Attr, S); break;
|
||||
case AttributeList::AT_mode: HandleModeAttr (D, Attr, S); break;
|
||||
case AttributeList::AT_malloc: HandleMallocAttr (D, Attr, S); break;
|
||||
case AttributeList::AT_may_alias: HandleMayAliasAttr (D, Attr, S); break;
|
||||
case AttributeList::AT_nonnull: HandleNonNullAttr (D, Attr, S); break;
|
||||
case AttributeList::AT_ownership_returns:
|
||||
case AttributeList::AT_ownership_takes:
|
||||
|
|
Loading…
Reference in New Issue