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/AttributeList.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/AttributeList.cpp')
-rw-r--r-- | lib/Sema/AttributeList.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp index 8ccb2ca..c0a3053 100644 --- a/lib/Sema/AttributeList.cpp +++ b/lib/Sema/AttributeList.cpp @@ -16,37 +16,26 @@ #include "llvm/ADT/StringSwitch.h" using namespace clang; -AttributeList::AttributeList(IdentifierInfo *aName, SourceLocation aLoc, +AttributeList::AttributeList(llvm::BumpPtrAllocator &Alloc, + IdentifierInfo *aName, SourceLocation aLoc, IdentifierInfo *sName, SourceLocation sLoc, IdentifierInfo *pName, SourceLocation pLoc, Expr **ExprList, unsigned numArgs, - AttributeList *n, bool declspec, bool cxx0x) - : AttrName(aName), AttrLoc(aLoc), ScopeName(sName), ScopeLoc(sLoc), - ParmName(pName), ParmLoc(pLoc), NumArgs(numArgs), Next(n), + bool declspec, bool cxx0x) + : AttrName(aName), AttrLoc(aLoc), ScopeName(sName), + ScopeLoc(sLoc), + ParmName(pName), ParmLoc(pLoc), NumArgs(numArgs), Next(0), DeclspecAttribute(declspec), CXX0XAttribute(cxx0x), Invalid(false) { if (numArgs == 0) Args = 0; else { - Args = new Expr*[numArgs]; + // Allocate the Args array using the BumpPtrAllocator. + Args = Alloc.Allocate<Expr*>(numArgs); memcpy(Args, ExprList, numArgs*sizeof(Args[0])); } } -AttributeList::~AttributeList() { - if (Args) { - // FIXME: before we delete the vector, we need to make sure the Expr's - // have been deleted. Since ActionBase::ExprTy is "void", we are dependent - // on the actions module for actually freeing the memory. The specific - // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType, - // ParseField, ParseTag. Once these routines have freed the expression, - // they should zero out the Args slot (to indicate the memory has been - // freed). If any element of the vector is non-null, we should assert. - delete [] Args; - } - delete Next; -} - AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { llvm::StringRef AttrName = Name->getName(); @@ -62,17 +51,17 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { .Case("used", AT_used) .Case("alias", AT_alias) .Case("align", AT_aligned) - .Case("final", AT_final) .Case("cdecl", AT_cdecl) .Case("const", AT_const) + .Case("__const", AT_const) // some GCC headers do contain this spelling .Case("blocks", AT_blocks) .Case("format", AT_format) - .Case("hiding", AT_hiding) .Case("malloc", AT_malloc) .Case("packed", AT_packed) .Case("unused", AT_unused) .Case("aligned", AT_aligned) .Case("cleanup", AT_cleanup) + .Case("naked", AT_naked) .Case("nodebug", AT_nodebug) .Case("nonnull", AT_nonnull) .Case("nothrow", AT_nothrow) @@ -87,12 +76,11 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { .Case("iboutletcollection", AT_IBOutletCollection) .Case("noreturn", AT_noreturn) .Case("noinline", AT_noinline) - .Case("override", AT_override) .Case("sentinel", AT_sentinel) .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) @@ -111,12 +99,18 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { .Case("vec_type_hint", IgnoredAttribute) .Case("objc_exception", AT_objc_exception) .Case("ext_vector_type", AT_ext_vector_type) + .Case("neon_vector_type", AT_neon_vector_type) + .Case("neon_polyvector_type", AT_neon_polyvector_type) .Case("transparent_union", AT_transparent_union) .Case("analyzer_noreturn", AT_analyzer_noreturn) .Case("warn_unused_result", AT_warn_unused_result) .Case("carries_dependency", AT_carries_dependency) + .Case("ns_consumed", AT_ns_consumed) + .Case("ns_consumes_self", AT_ns_consumes_self) + .Case("ns_returns_autoreleased", AT_ns_returns_autoreleased) .Case("ns_returns_not_retained", AT_ns_returns_not_retained) .Case("ns_returns_retained", AT_ns_returns_retained) + .Case("cf_consumed", AT_cf_consumed) .Case("cf_returns_not_retained", AT_cf_returns_not_retained) .Case("cf_returns_retained", AT_cf_returns_retained) .Case("ownership_returns", AT_ownership_returns) @@ -126,11 +120,22 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { .Case("init_priority", AT_init_priority) .Case("no_instrument_function", AT_no_instrument_function) .Case("thiscall", AT_thiscall) + .Case("bounded", IgnoredAttribute) // OpenBSD .Case("pascal", AT_pascal) .Case("__cdecl", AT_cdecl) .Case("__stdcall", AT_stdcall) .Case("__fastcall", AT_fastcall) .Case("__thiscall", AT_thiscall) .Case("__pascal", AT_pascal) + .Case("constant", AT_constant) + .Case("device", AT_device) + .Case("global", AT_global) + .Case("host", AT_host) + .Case("shared", AT_shared) + .Case("launch_bounds", AT_launch_bounds) + .Case("common", AT_common) + .Case("nocommon", AT_nocommon) + .Case("opencl_kernel_function", AT_opencl_kernel_function) + .Case("uuid", AT_uuid) .Default(UnknownAttribute); } |