summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TargetAttributesSema.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-12-04 23:07:58 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-12-04 23:07:58 +0000
commitaad23ecadb78a6c57719765817276746c23bd3ff (patch)
treecb2a44ad7b2239ccabbda7d477f6cb38764cef4e /clang/lib/Sema/TargetAttributesSema.cpp
parent3b0ce937e580c2ab22ff364f83087eac8cf1434b (diff)
downloadbcm5719-llvm-aad23ecadb78a6c57719765817276746c23bd3ff.tar.gz
bcm5719-llvm-aad23ecadb78a6c57719765817276746c23bd3ff.zip
Common functionality is already checked within SemaDeclAttr.cpp and so it does not need to be re-checked for each target.
llvm-svn: 196428
Diffstat (limited to 'clang/lib/Sema/TargetAttributesSema.cpp')
-rw-r--r--clang/lib/Sema/TargetAttributesSema.cpp69
1 files changed, 4 insertions, 65 deletions
diff --git a/clang/lib/Sema/TargetAttributesSema.cpp b/clang/lib/Sema/TargetAttributesSema.cpp
index 034e460eeb2..80168480ac7 100644
--- a/clang/lib/Sema/TargetAttributesSema.cpp
+++ b/clang/lib/Sema/TargetAttributesSema.cpp
@@ -72,13 +72,6 @@ namespace {
static void HandleMSP430InterruptAttr(Decl *d,
const AttributeList &Attr, Sema &S) {
- // Check the attribute arguments.
- if (Attr.getNumArgs() != 1) {
- S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
- << Attr.getName() << 1;
- return;
- }
-
// FIXME: Check for decl - it should be void ()(void).
Expr *NumParamsExpr = static_cast<Expr *>(Attr.getArgAsExpr(0));
@@ -122,13 +115,6 @@ namespace {
static void HandleX86ForceAlignArgPointerAttr(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)
- << Attr.getName() << 0;
- return;
- }
-
// If we try to apply it to a function pointer, don't warn, but don't
// do anything, either. It doesn't matter anyway, because there's nothing
// special about calling a force_align_arg_pointer function.
@@ -175,13 +161,6 @@ DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D, SourceRange Range,
}
static void HandleDLLImportAttr(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)
- << Attr.getName() << 0;
- return;
- }
-
// Attribute can be applied only to functions or variables.
FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
if (!FD && !isa<VarDecl>(D)) {
@@ -222,13 +201,6 @@ DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range,
}
static void HandleDLLExportAttr(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)
- << Attr.getName() << 0;
- return;
- }
-
// Attribute can be applied only to functions or variables.
FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
if (!FD && !isa<VarDecl>(D)) {
@@ -278,41 +250,6 @@ namespace {
};
}
-static void HandleMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) {
- // check the attribute arguments.
- if (Attr.getNumArgs()) {
- S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
- << Attr.getName() << 0;
- return;
- }
- // Attribute can only be applied to function types.
- if (!isa<FunctionDecl>(D)) {
- S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
- << Attr.getName() << /* function */0;
- return;
- }
- D->addAttr(::new (S.Context) Mips16Attr(Attr.getRange(), S.Context,
- Attr.getAttributeSpellingListIndex()));
-}
-
-static void HandleNoMips16Attr(Decl *D, const AttributeList &Attr, Sema &S) {
- // check the attribute arguments.
- if (Attr.getNumArgs()) {
- S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
- << Attr.getName() << 0;
- return;
- }
- // Attribute can only be applied to function types.
- if (!isa<FunctionDecl>(D)) {
- S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
- << Attr.getName() << /* function */0;
- return;
- }
- D->addAttr(::new (S.Context)
- NoMips16Attr(Attr.getRange(), S.Context,
- Attr.getAttributeSpellingListIndex()));
-}
-
namespace {
class MipsAttributesSema : public TargetAttributesSema {
public:
@@ -320,10 +257,12 @@ namespace {
bool ProcessDeclAttribute(Scope *scope, Decl *D, const AttributeList &Attr,
Sema &S) const {
if (Attr.getKind() == AttributeList::AT_Mips16) {
- HandleMips16Attr(D, Attr, S);
+ D->addAttr(::new (S.Context) Mips16Attr(Attr.getRange(), S.Context,
+ Attr.getAttributeSpellingListIndex()));
return true;
} else if (Attr.getKind() == AttributeList::AT_NoMips16) {
- HandleNoMips16Attr(D, Attr, S);
+ D->addAttr(::new (S.Context) NoMips16Attr(Attr.getRange(), S.Context,
+ Attr.getAttributeSpellingListIndex()));
return true;
}
return false;
OpenPOWER on IntegriCloud