Commit Graph

29 Commits

Author SHA1 Message Date
Benjamin Kramer 845e32cd4d Devirtualize Attr and all subclasses.
We know all subclasses in tblgen so just generate a giant switch for
the few virtual methods or turn them into a member variable using spare
bits. The giant jump tables aren't pretty but still much smaller than
a vtable for every attribute, shrinking Release+Asserts clang by ~400k.

Also halves the size of the Attr base class. No functional change
intended.

llvm-svn: 232726
2015-03-19 16:06:49 +00:00
Aaron Ballman 8edb5c2081 Refactor the Microsoft inheritance attribute handling so that it no longer has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes.
llvm-svn: 197629
2013-12-18 23:44:18 +00:00
Aaron Ballman 682ee42550 Tablegen now generates a StringSwitch for attributes containing enumeration arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required.
llvm-svn: 190545
2013-09-11 19:47:58 +00:00
Reid Kleckner 6a476082a6 [ms-cxxabi] Give the MS inheritance attributes a base class
Required making a handful of changes to the table generator.  Also adds
an unspecified inheritance attribute.  This opens the path for us to
apply these attributes to C++ records implicitly.

llvm-svn: 178054
2013-03-26 18:30:28 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Alexis Hunt dcfba7b35b Generate Attr subclasses with TableGen.
Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.

Some other notes about newly-generated attribute classes:

 - The constructor arguments are a SourceLocation and a Context&,
   followed by the attributes arguments in the order that they were
   defined in Attr.td

 - Every argument in Attr.td has an appropriate accessor named getFoo,
   and there are sometimes a few extra ones (such as to get the length
   of a variadic argument).

Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.

llvm-svn: 111455
2010-08-18 23:23:40 +00:00
Fariborz Jahanian b5d59b66c2 Patch to add type parameter support for attribute iboutletcollection.
Radar 8308053.

llvm-svn: 111275
2010-08-17 20:23:12 +00:00
Jordy Rose 5af0e3cbba Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup.
llvm-svn: 110908
2010-08-12 08:54:03 +00:00
Douglas Gregor 4a47bca47d Instead of having a specific CXTranslationUnit_* option flag for
"editing" mode, introduce a separate function
clang_defaultEditingTranslationUnitOptions() that retrieves the set of
options. No functionality change.

llvm-svn: 110613
2010-08-09 22:28:58 +00:00
John Thompson cdb847ba16 Added vecreturn attribute parsing.
llvm-svn: 110609
2010-08-09 21:53:52 +00:00
Eli Friedman 570024a8d9 Implement #pragma GCC visibility.
llvm-svn: 110315
2010-08-05 06:57:20 +00:00
Ted Kremenek d21139a34f After a lengthy design discussion, add support for "ownership attributes" for malloc/free checking. Patch by Andrew McGregor!
llvm-svn: 109939
2010-07-31 01:52:11 +00:00
Douglas Gregor 717ceeae76 I lied. Kill off a few more Destroy methods
llvm-svn: 109379
2010-07-25 18:32:30 +00:00
Chris Lattner 3c77a355e0 implement support for -finstrument-functions, patch by Nelson
Elhage!

llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Fariborz Jahanian ef5f621215 Implements Sema part of init_priority(priority) attribute
(radar 8076356) - wip.

llvm-svn: 106322
2010-06-18 21:44:06 +00:00
Alexis Hunt 344393e9cf Implement first TD-based usage of attributes.
Currently, there are two effective changes:

 - Attr::Kind has been changed to attr::Kind, in a separate namespace
   rather than the Attr class. This is because the enumerator needs to
   be visible to parse.
 - The class definitions for the C++0x attributes other than aligned are
   generated by TableGen.

The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.

llvm-svn: 106172
2010-06-16 23:43:53 +00:00
Daniel Dunbar fc6507ef58 AST: Add AlignMac68kAttr, not yet used.
llvm-svn: 104800
2010-05-27 02:25:39 +00:00
Daniel Dunbar 401304462a AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Rafael Espindola c18086ae17 Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
llvm-svn: 96992
2010-02-23 22:00:30 +00:00
Ted Kremenek d9c6663124 Add 'ns_returns_not_retained' and 'cf_returns_not_retained' attributes to
match 'ns_returns_retained' and 'cf_returns_retained' respectively.  These
are not yet hooked up to the static analyzer.

llvm-svn: 96535
2010-02-18 00:05:45 +00:00
Ted Kremenek 06be968942 Add IBAction attribute to keep the IBOutlet attribute company.
llvm-svn: 96447
2010-02-17 02:37:45 +00:00
Ted Kremenek 9c8a6f5a8e Fix re-allocation in AttrWithString::ReplaceString() to use the allocator assosciated with ASTContext.
llvm-svn: 95931
2010-02-11 22:44:22 +00:00
Ted Kremenek 510ee2594e Use the allocator associated with ASTContext to allocate the args
array associated with NonNullAttr.  This fixes yet another leak when
ASTContext uses a BumpPtrAllocator.

Fixes: <rdar://problem/7637150>
llvm-svn: 95863
2010-02-11 07:31:47 +00:00
Ted Kremenek 7f4945aa9c Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>
llvm-svn: 95853
2010-02-11 05:28:37 +00:00
Charles Davis bbc0aa5166 Add support for the force_align_arg_pointer attribute. This is an x86-specific
attribute, so it uses Anton's new target-specific attribute support. It's
supposed to ensure that the stack is 16-byte aligned, but since necessary
support is lacking from LLVM, this is a no-op for now.

llvm-svn: 95820
2010-02-10 23:06:52 +00:00
Anton Korobeynikov 3d364fddda Make clone() method out-of-line for Attr classes.
llvm-svn: 93120
2010-01-10 14:38:13 +00:00