aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-28 23:50:44 +0000
committerChris Lattner <sabre@nondot.org>2008-06-28 23:50:44 +0000
commit49e2d34f74f98bef23e37c415ce90cd783cdea24 (patch)
treeb9ffd6e42109e9a4b6ce4d10b4a1a83f15a16159 /lib/Sema/SemaDeclAttr.cpp
parent065c5a801f46dda8ff0cd6ad954c4e5f94a3be75 (diff)
more minor tidiness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index d2e5c9186b..3fda03145c 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -259,7 +259,7 @@ void Sema::HandlePackedAttribute(Decl *d, const AttributeList &Attr) {
}
if (TagDecl *TD = dyn_cast<TagDecl>(d))
- TD->addAttr(new PackedAttr);
+ TD->addAttr(new PackedAttr());
else if (FieldDecl *FD = dyn_cast<FieldDecl>(d)) {
// If the alignment is less than or equal to 8 bits, the packed attribute
// has no effect.
@@ -269,7 +269,7 @@ void Sema::HandlePackedAttribute(Decl *d, const AttributeList &Attr) {
diag::warn_attribute_ignored_for_field_of_type,
Attr.getName()->getName(), FD->getType().getAsString());
else
- FD->addAttr(new PackedAttr);
+ FD->addAttr(new PackedAttr());
} else
Diag(Attr.getLoc(), diag::warn_attribute_ignored,
Attr.getName()->getName());
@@ -310,7 +310,6 @@ void Sema::HandleNoReturnAttribute(Decl *d, const AttributeList &Attr) {
}
FunctionDecl *Fn = dyn_cast<FunctionDecl>(d);
-
if (!Fn) {
Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type,
"noreturn", "function");
@@ -458,7 +457,7 @@ void Sema::HandleFormatAttribute(Decl *d, const AttributeList &Attr) {
if (!proto) {
Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type,
- "format", "function");
+ "format", "function");
return;
}
@@ -636,25 +635,21 @@ void Sema::HandleAlignedAttribute(Decl *d, const AttributeList &Attr) {
}
unsigned Align = 0;
-
if (Attr.getNumArgs() == 0) {
// FIXME: This should be the target specific maximum alignment.
// (For now we just use 128 bits which is the maximum on X86.
Align = 128;
return;
- } else {
- Expr *alignmentExpr = static_cast<Expr *>(Attr.getArg(0));
- llvm::APSInt alignment(32);
- if (!alignmentExpr->isIntegerConstantExpr(alignment, Context)) {
- Diag(Attr.getLoc(), diag::err_attribute_argument_not_int,
- "aligned", alignmentExpr->getSourceRange());
- return;
- }
-
- Align = alignment.getZExtValue() * 8;
}
-
- d->addAttr(new AlignedAttr(Align));
+
+ Expr *alignmentExpr = static_cast<Expr *>(Attr.getArg(0));
+ llvm::APSInt Alignment(32);
+ if (!alignmentExpr->isIntegerConstantExpr(Alignment, Context)) {
+ Diag(Attr.getLoc(), diag::err_attribute_argument_not_int,
+ "aligned", alignmentExpr->getSourceRange());
+ return;
+ }
+ d->addAttr(new AlignedAttr(Alignment.getZExtValue() * 8));
}
/// HandleModeAttribute - This attribute modifies the width of a decl with