aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-28 00:17:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-28 00:17:57 +0000
commitaf668b0e7d3581dea3b4f29a9262686e83887e5b (patch)
treeadd7786bd9fa6186a49745d88b23a1f832bfbc7f /lib
parent83e61e566b493c53fad75d505ee60e978f5032a3 (diff)
Add attribute always_inline support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp3
-rw-r--r--lib/Parse/AttributeList.cpp1
-rw-r--r--lib/Sema/SemaDeclAttr.cpp14
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index a1cd6f1e6c..aaca21bab3 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -274,6 +274,9 @@ void CodeGenModule::SetFunctionAttributesForDefinition(const Decl *D,
if (!Features.Exceptions)
F->addFnAttr(llvm::Attribute::NoUnwind);
+
+ if (D->getAttr<AlwaysInlineAttr>())
+ F->addFnAttr(llvm::Attribute::AlwaysInline);
}
void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,
diff --git a/lib/Parse/AttributeList.cpp b/lib/Parse/AttributeList.cpp
index 825570dce2..342c87f1fe 100644
--- a/lib/Parse/AttributeList.cpp
+++ b/lib/Parse/AttributeList.cpp
@@ -97,6 +97,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
break;
case 13:
if (!memcmp(Str, "address_space", 13)) return AT_address_space;
+ if (!memcmp(Str, "always_inline", 13)) return AT_always_inline;
break;
case 15:
if (!memcmp(Str, "ext_vector_type", 15)) return AT_ext_vector_type;
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 41fe4ed044..e1afd6d924 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -396,6 +396,18 @@ static void HandleAliasAttr(Decl *d, const AttributeList &Attr, Sema &S) {
d->addAttr(new AliasAttr(std::string(Alias, AliasLen)));
}
+static void HandleAlwaysInlineAttr(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,
+ std::string("0"));
+ return;
+ }
+
+ d->addAttr(new AlwaysInlineAttr());
+}
+
static void HandleNoReturnAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
@@ -1121,6 +1133,8 @@ static void ProcessDeclAttribute(Decl *D, const AttributeList &Attr, Sema &S) {
break;
case AttributeList::AT_alias: HandleAliasAttr (D, Attr, S); break;
case AttributeList::AT_aligned: HandleAlignedAttr (D, Attr, S); break;
+ case AttributeList::AT_always_inline:
+ HandleAlwaysInlineAttr (D, Attr, S); break;
case AttributeList::AT_annotate: HandleAnnotateAttr (D, Attr, S); break;
case AttributeList::AT_constructor: HandleConstructorAttr(D, Attr, S); break;
case AttributeList::AT_deprecated: HandleDeprecatedAttr(D, Attr, S); break;