diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /lib/Sema/TargetAttributesSema.cpp | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'lib/Sema/TargetAttributesSema.cpp')
-rw-r--r-- | lib/Sema/TargetAttributesSema.cpp | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/lib/Sema/TargetAttributesSema.cpp b/lib/Sema/TargetAttributesSema.cpp index 1854e74..c3415cb 100644 --- a/lib/Sema/TargetAttributesSema.cpp +++ b/lib/Sema/TargetAttributesSema.cpp @@ -71,6 +71,55 @@ namespace { }; } +static void HandleMBlazeInterruptHandlerAttr(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) << 1; + return; + } + + // FIXME: Check for decl - it should be void ()(void). + + d->addAttr(::new (S.Context) MBlazeInterruptHandlerAttr(Attr.getLoc(), + S.Context)); + d->addAttr(::new (S.Context) UsedAttr(Attr.getLoc(), S.Context)); +} + +static void HandleMBlazeSaveVolatilesAttr(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) << 1; + return; + } + + // FIXME: Check for decl - it should be void ()(void). + + d->addAttr(::new (S.Context) MBlazeSaveVolatilesAttr(Attr.getLoc(), + S.Context)); + d->addAttr(::new (S.Context) UsedAttr(Attr.getLoc(), S.Context)); +} + + +namespace { + class MBlazeAttributesSema : public TargetAttributesSema { + public: + MBlazeAttributesSema() { } + bool ProcessDeclAttribute(Scope *scope, Decl *D, const AttributeList &Attr, + Sema &S) const { + if (Attr.getName()->getName() == "interrupt_handler") { + HandleMBlazeInterruptHandlerAttr(D, Attr, S); + return true; + } else if (Attr.getName()->getName() == "save_volatiles") { + HandleMBlazeSaveVolatilesAttr(D, Attr, S); + return true; + } + return false; + } + }; +} + static void HandleX86ForceAlignArgPointerAttr(Decl *D, const AttributeList& Attr, Sema &S) { @@ -189,8 +238,7 @@ namespace { const AttributeList &Attr, Sema &S) const { const llvm::Triple &Triple(S.Context.Target.getTriple()); if (Triple.getOS() == llvm::Triple::Win32 || - Triple.getOS() == llvm::Triple::MinGW32 || - Triple.getOS() == llvm::Triple::MinGW64) { + Triple.getOS() == llvm::Triple::MinGW32) { switch (Attr.getKind()) { case AttributeList::AT_dllimport: HandleDLLImportAttr(D, Attr, S); return true; @@ -220,8 +268,9 @@ const TargetAttributesSema &Sema::getTargetAttributesSema() const { case llvm::Triple::msp430: return *(TheTargetAttributesSema = new MSP430AttributesSema); + case llvm::Triple::mblaze: + return *(TheTargetAttributesSema = new MBlazeAttributesSema); case llvm::Triple::x86: return *(TheTargetAttributesSema = new X86AttributesSema); } } - |