Aaron Ballman
a6f759e423
Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
...
llvm-svn: 223468
2014-12-05 15:24:55 +00:00
Alexis Hunt
724f14e75c
Create a new 'flag_enum' attribute.
...
This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.
Reviewed by Aaron Ballman.
llvm-svn: 222906
2014-11-28 00:53:20 +00:00
Aaron Ballman
28afa18496
Fixing a use of stringstream to use an LLVM helper function. Drive-by fixing header include order. NFC.
...
llvm-svn: 222151
2014-11-17 18:17:19 +00:00
Aaron Ballman
1860862fe3
MinGW doesn't implement std::to_string; working around it. NFC.
...
llvm-svn: 222033
2014-11-14 20:31:50 +00:00
Aaron Ballman
a0344c5d7b
Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
...
llvm-svn: 221991
2014-11-14 13:44:02 +00:00
Richard Smith
f7514454a7
Refactor tree printing in AST dumping.
...
Instead of manually maintaining a flag indicating whether we're about to print
out the last child of the parent node (to determine whether we print "`" or
"|"), capture a callable to print that child and defer printing it until we
either see a next child or finish the parent.
No functionality change intended.
llvm-svn: 220930
2014-10-30 21:02:37 +00:00
Tyler Nowicki
c724a83e20
Allow constant expressions in pragma loop hints.
...
Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).
Reviewed by Richard Smith
llvm-svn: 219589
2014-10-12 20:46:07 +00:00
Aaron Ballman
36d791023e
Adding some FIXMEs to the attribute emitter code regarding whether pretty printing enumerators should use quoted string literals, or identifiers. NFC.
...
llvm-svn: 217781
2014-09-15 16:16:14 +00:00
Aaron Ballman
25a2cb9dbe
When pretty printing attributes that have enumeration arguments, print the enumerator identifier (as a string literal) instead of the internal enumerator integral value.
...
llvm-svn: 217771
2014-09-15 15:14:13 +00:00
David Blaikie
28f30caf9b
Remove some transient raw pointer ownership in ClangAttrEmitter::createArgument
...
This function might be a bit easier if it were split in two with a lot
of early returns - and that setOptional bit in the outer function, but
anyway.
llvm-svn: 215263
2014-08-08 23:59:38 +00:00
Aaron Ballman
c960f56ab0
The GNU-style aligned attribute has an optional expression, but the generated pretty printing logic was unaware of this. Fixed the pretty printing logic, and added a test to ensure it no longer asserts.
...
Added a FIXME to the code about eliding the parenthesis when pretty printing such a construct.
llvm-svn: 214513
2014-08-01 13:49:00 +00:00
Aaron Ballman
8ed8dbd96a
Automate attribute argument count semantic checking when there are variadic or optional arguments present. With this, the only time you should have to manually check attribute argument counts is when HasCustomParsing is set to true, or when you have variadic arguments that aren't really variadic (like ownership_holds and friends).
...
Updating the diagnostics in the launch_bounds test since they have been improved in that case. Adding a test for nonnull since it has little test coverage, but has truly variadic arguments.
llvm-svn: 214407
2014-07-31 16:37:04 +00:00
Aaron Ballman
173361e7e0
Specifying the diagnostic argument through the attribute table generator instead of having to enter it manually as part of the attribute subject list. This only affects attributes appertaining to ObjC interfaces and protocols.
...
No new tests required as this is covered by existing tests.
llvm-svn: 213193
2014-07-16 20:28:10 +00:00
Aaron Ballman
120c79f231
Fixing the position of the supported syntax marker when generating attribute documentation.
...
llvm-svn: 211692
2014-06-25 12:48:06 +00:00
Craig Topper
d8d43191d8
Replace some assert(0)'s with llvm_unreachable.
...
llvm-svn: 211143
2014-06-18 05:13:13 +00:00
Tyler Nowicki
e8b07ed080
Adds a Pragma spelling for attributes to tablegen and makes use of it for loop
...
hint attributes. Includes tests for pragma printing and for attribute order
which is incorrectly reversed by ParsedAttributes.
Reviewed by Aaron Ballman
llvm-svn: 210925
2014-06-13 17:57:25 +00:00
Richard Trieu
ddd01cec0e
Removing an "if (this == nullptr)" check from two print methods. The condition
...
will never be true in a well-defined context. The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.
llvm-svn: 210498
2014-06-09 22:53:25 +00:00
Hans Wennborg
613807b4d0
Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flags
...
I was bitten by this when working with the dll attributes: when a dll
attribute was cloned from a class template declaration to its
specialization, the Inherited flag didn't get cloned.
Differential Revision: http://reviews.llvm.org/D3972
llvm-svn: 209950
2014-05-31 01:30:30 +00:00
Nikola Smiljanic
01a7598561
Refactoring. Remove release and take methods from ActionResult. Rename takeAs to getAs.
...
llvm-svn: 209800
2014-05-29 10:55:11 +00:00
Aaron Ballman
2f22b94201
Cleaning up some range-based for loops so that the automatic type deduction is more explicit about pointers and const. Did some minor drive-by const correctness fixes and identifier updates as well. No functional changes.
...
llvm-svn: 209233
2014-05-20 19:47:14 +00:00
Aaron Ballman
981ba24156
None of these attributes require FunctionTemplate to be explicitly listed as part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl.
...
The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording.
llvm-svn: 209209
2014-05-20 14:10:53 +00:00
Craig Topper
8ae1203992
[C++11] Use 'nullptr'.
...
llvm-svn: 208163
2014-05-07 06:21:57 +00:00
Aaron Ballman
a82eaa70f1
Updated the attribute tablegen emitter for variadic arguments to emit a range accessor in addition to the iterators. Updated code using iterators to use range-based for loops.
...
llvm-svn: 207837
2014-05-02 13:35:42 +00:00
Aaron Ballman
d6459e5c43
Fixing a FIXME -- no longer using std::memcpy, since that would fail for non-trivial types. Replaced with std::copy. No functional changes intended since all uses of this functionality either use pointers or integers.
...
llvm-svn: 207766
2014-05-01 15:21:03 +00:00
Aaron Ballman
2fbf99429a
Reapplying r204952 a second time.
...
Clean up the __has_attribute implementation without modifying its behavior.
Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).
Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.
llvm-svn: 205181
2014-03-31 13:14:44 +00:00
Aaron Ballman
0efd167f81
Reverting r204968 and r204969; while more build bots are happy with the results, some still have link errors.
...
llvm-svn: 204974
2014-03-27 22:37:56 +00:00
Aaron Ballman
c9ad1ca715
Reapplying r204952 with fixes which should hopefully resolve linking issues with non-MSVC compilers.
...
llvm-svn: 204968
2014-03-27 22:12:09 +00:00
Aaron Ballman
0702d02b31
Reverting r204952, while I figure out what's going on with the makefile build.
...
llvm-svn: 204955
2014-03-27 20:36:32 +00:00
Aaron Ballman
9cac6f5f04
Clean up the __has_attribute implementation without modifying its behavior.
...
Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).
Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.
llvm-svn: 204952
2014-03-27 20:19:24 +00:00
Arnaud A. de Grandmaison
c6b4045d65
When generating the Attribute dumper code, do not dead-initialize MoreChildren
...
No functional change. This will cleanup a bunch of scan-build warnings.
llvm-svn: 204529
2014-03-21 22:35:34 +00:00
Craig Topper
cbce6e9e63
[C++11] Add 'override' keyword to virtual methods that override their base class.
...
llvm-svn: 203543
2014-03-11 06:22:39 +00:00
Craig Topper
3164f33f8f
[C++11] Add 'override' keyword to virtual methods that override their base class.
...
llvm-svn: 203537
2014-03-11 03:39:26 +00:00
Aaron Ballman
8cbf633715
[C++11] Adding override specifiers where appropriate, and removing virtual specifiers where not needed.
...
No functional changes intended.
llvm-svn: 203122
2014-03-06 15:09:50 +00:00
Aaron Ballman
8f1439bd0c
[C++11] Using std::unique_ptr to ensure that Argument objects do not leak (since clang-tblgen isn't long-lived, the old leak is probably acceptable, but it offended my senses nonetheless).
...
llvm-svn: 202989
2014-03-05 16:49:55 +00:00
Benjamin Kramer
9299637dc0
Pass llvm::Triple objects by const reference.
...
Copying isn't cheap as it contains a std::string.
llvm-svn: 202880
2014-03-04 19:31:42 +00:00
Chandler Carruth
757fcd6d1f
[cleanup] Re-sort includes with llvm/utils/sort_includes.py and fix
...
a missing include from CLog.h.
CLog.h referenced most of the core libclang types but never directly
included Index.h that provides them. Previously it got lucky and other
headers were always included first but with the sorting it ended up
first in one case and stopped compiling. Adding the Index.h include
fixes it right up.
llvm-svn: 202810
2014-03-04 10:05:20 +00:00
Aaron Ballman
b097f7fe9a
Simplifying attribute generation with range-based for loops. No functional changes intended.
...
llvm-svn: 202654
2014-03-02 17:38:37 +00:00
Benjamin Kramer
167e999be9
[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.
...
llvm-svn: 202635
2014-03-02 12:20:24 +00:00
Aaron Ballman
ea6668c4e8
Moving the documentation for the type safety checking attributes into AttrDocs. If a custom heading is provided, do not automatically generate the alternate spelling list. This is necessary because some attributes have distinct semantic spellings and meanings, but use the same semantic attribute internally. Such attributes should have multiple elements in their documentation list, but not show all spellings. At some point, it would be nice to have a way to attach the documentation element to a specific spelling for these cases.
...
llvm-svn: 201851
2014-02-21 14:14:04 +00:00
Aaron Ballman
4de1b584cd
Refactored the way attribute category headers are handled so that it is possible to use custom categories. This allows for moving the consumable attributes (consumable, callable_when, return_typestate, etc) to be grouped together, with a content heading, like they were in the language extensions documentation. Moved the consumable attribute documentation from the language extensions into the attribute documentation table.
...
llvm-svn: 201732
2014-02-19 22:59:32 +00:00
Aaron Ballman
c7962868a2
Added a documentation category for statement attributes so that things like clang::fallthrough can be documented.
...
llvm-svn: 201714
2014-02-19 20:55:42 +00:00
Aaron Ballman
06bd44b3e8
Forcing it to be an error when there is no Documentation list specified for an attribute. This is a bit of a (harmless) hack, but the FIXME explains why and when this hack can be removed. It's a justified hack because this prevents attribute authors from forgetting to add documentation when they add a new attribute.
...
llvm-svn: 201524
2014-02-17 18:23:02 +00:00
Aaron Ballman
1a3e5858b9
The default assignment operator could not be generated by all of the bots, but it's required by std::vector to operate properly.
...
llvm-svn: 201518
2014-02-17 16:18:32 +00:00
Aaron Ballman
51d40111b4
Removing a C++11'ism to also fix the build bots.
...
llvm-svn: 201517
2014-02-17 15:59:37 +00:00
Aaron Ballman
a66b574b28
Fixing build bot breakage due to using a local type as a template argument.
...
llvm-svn: 201516
2014-02-17 15:36:08 +00:00
Aaron Ballman
97dba048a3
Implements a declarative approach to documenting individual attributes in Clang via a Documentation tablegen class. Also updates the internals manual with information about how to use this new, required, documentation feature.
...
This patch adds some very, very sparse initial documentation for some attributes. Additional effort from attribute authors is greatly appreciated.
llvm-svn: 201515
2014-02-17 15:27:10 +00:00
Reid Kleckner
f06b266bfa
Attributes: Avoid a big useless copy in the emitter
...
llvm-svn: 201251
2014-02-12 19:26:24 +00:00
Reid Kleckner
f526b94858
Attributes: Emit enumerators in td file declaration order
...
llvm-svn: 201246
2014-02-12 18:22:18 +00:00
David Majnemer
4bb0980d96
MS ABI: Add support for #pragma pointers_to_members
...
Introduce a notion of a 'current representation method' for
pointers-to-members.
When starting out, this is set to 'best case' (representation method is
chosen by examining the class, selecting the smallest representation
that would work given the class definition or lack thereof).
This pragma allows the translation unit to dictate exactly what
representation to use, similar to how the inheritance model keywords
operate.
N.B. PCH support is forthcoming.
Differential Revision: http://llvm-reviews.chandlerc.com/D2723
llvm-svn: 201105
2014-02-10 19:50:15 +00:00
Aaron Ballman
35db2b3d4c
Consolidating several table-generated files containing parser-related string switches into a single file. This reduces build-related complexity by replacing four separate projects (and table-gen instantiations) with a single one.
...
No functional changes intended.
llvm-svn: 200424
2014-01-29 22:13:45 +00:00
Aaron Ballman
c669cc0d77
Add a new attribute meta-spelling called "GCC" -- it widens into being a GNU spelling, and a CXX11 spelling with the namespace "gnu". It also sets a bit on the spelling certifying that it is known to GCC. From this, we can warn about the extension appropriately. As a consequence, the FunctionDefinition functionality is completely removed.
...
Replacing the functionality from r199676, which didn't solve the problem as elegantly.
llvm-svn: 200252
2014-01-27 22:10:04 +00:00
Aaron Ballman
81cb8cbfa6
Adds a getSemanticSpelling function to semantic attribute subclasses which have a meaningful semantic spelling. Adds a sibling function to parsed attribtues (via AttributeList) for getting the semantic spelling, if one were to exist. This can be used for cleaner code that deals directly with the semantic spellings (such as the MSInheritance attribute).
...
llvm-svn: 200041
2014-01-24 21:32:49 +00:00
Aaron Ballman
bc909618f2
If an attribute has a semantically meaningful spelling (such as ArgumentWithTypeTagAttr or MSInheritanceAttr), display the spelling used for the attribute as part of the AST dump. This should ease debugging the AST for these attributes. Attributes without semantically meaningful spelling variations are not affected.
...
llvm-svn: 199834
2014-01-22 21:51:20 +00:00
Aaron Ballman
b9023ed0f6
Exposed a declarative way to specify that an attribute can be duplicated when merging attributes on a declaration. This replaces some hard-coded functionality from Sema.
...
llvm-svn: 199677
2014-01-20 18:07:09 +00:00
Aaron Ballman
9a99e0da5a
Remove some hard-coded specialness for thread-safety attributes from the parser, and made it more declarative. If an attribute is allowed to appear on a function definition when late parsed, it can now use the FunctionDefinition attribute subject. It's treated as a FunctionDecl for most purposes, except it also gets exposed on the AttributeList so that it can be used while parsing.
...
llvm-svn: 199676
2014-01-20 17:18:35 +00:00
Alp Toker
96cf758d3a
Fix comment typos
...
llvm-svn: 199563
2014-01-18 21:49:37 +00:00
Aaron Ballman
07c3d53c88
When generating Spelling enumeration values, do not generate identifiers in the reserved namespace. Strip underscores as appropriate, taking care to not create duplicate identifiers.
...
llvm-svn: 199414
2014-01-16 19:44:01 +00:00
Aaron Ballman
4755304fd1
Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.
...
llvm-svn: 199392
2014-01-16 14:32:03 +00:00
Aaron Ballman
12b9f6535b
Factored some function-like type reasoning out of SemaDeclAttr and onto Decl itself. This allows for more declarative subjects in attribute tablegen where the attribute appertains to something function-like, but not strictly a FunctionDecl.
...
llvm-svn: 199387
2014-01-16 13:55:42 +00:00
Aaron Ballman
36a5350e51
Distinguish between attributes explicitly written at the request of the user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute.
...
Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it.
llvm-svn: 199378
2014-01-16 13:03:14 +00:00
Aaron Ballman
09e98ffa5b
When determining the attribute's parsed kind, pay attention to the syntax used. This fixes bugs where an attribute has differing GNU and Declspec spellings, but they are treated as the same. Eg) __declspec(aligned) when it should be __attribute__((aligned)), and __attribute__((align)) when it should be __declspec(align).
...
llvm-svn: 199144
2014-01-13 21:42:39 +00:00
Aaron Ballman
0fa06d879a
__has_attribute now understands target-specific attributes. So when you ask whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others.
...
llvm-svn: 198897
2014-01-09 22:57:44 +00:00
Aaron Ballman
ab7691c4ce
Removing the notion of TargetAttributesSema and replacing it with one where the parsed attributes are responsible for knowing their target-specific nature, instead of letting Sema figure it out. This is necessary so that __has_attribute can eventually determine whether a parsed attribute applies to the given target or not.
...
llvm-svn: 198896
2014-01-09 22:48:32 +00:00
Aaron Ballman
15b27b97b7
Removing a bit of custom parsing functionality used by the thread safety analysis APIs. Now using tablegen to determine whether an attribute's arguments should be parsed in an unevaluated context instead of relying on a separate, hard-coded list of attributes.
...
llvm-svn: 198883
2014-01-09 19:39:35 +00:00
Chandler Carruth
5553d0d4ca
Sort all the #include lines with LLVM's utils/sort_includes.py which
...
encodes the canonical rules for LLVM's style. I noticed this had drifted
quite a bit when cleaning up LLVM, so wanted to clean up Clang as well.
llvm-svn: 198686
2014-01-07 11:51:46 +00:00
Aaron Ballman
0e468c02bc
This helper method isn't needed, and it's unsafe for it to use StringRef in the first place. Replaced the unsafe code with the proper accessor.
...
llvm-svn: 198569
2014-01-05 21:08:29 +00:00
DeLesley Hutchins
bb79c338ed
Update DataRecursiveASTVisitor so that it visits attributes.
...
llvm-svn: 198249
2013-12-30 21:03:02 +00:00
DeLesley Hutchins
c4a82438a7
Update RecursiveASTVisitor so that it visits attributes. This is currently
...
important for thread safety attributes, which contain expressions that were
not being visited, and were thus invisible to various tools. There are now
Visit*Attr methods that can be overridden for every attribute.
llvm-svn: 198224
2013-12-30 17:24:36 +00:00
Aaron Ballman
3e424b5070
Teach the diagnostics engine about the Attr type to make reporting on semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting.
...
llvm-svn: 198055
2013-12-26 18:30:57 +00:00
Aaron Ballman
aa47d24a47
Reverting r197715 -- it appears that MSVC is happy with the code, but clang is not.
...
llvm-svn: 197716
2013-12-19 19:39:25 +00:00
Aaron Ballman
ced10529fe
No longer leaking Argument objects after calling createArgument. However, since an OwningPtr cannot live in a std::vector yet, there are some manual deletions that have a FIXME attached to them. These will go away once C++11 support is allowed.
...
llvm-svn: 197715
2013-12-19 19:33:35 +00:00
Aaron Ballman
e615393356
Removing the SourceLocation unused attribute argument type.
...
llvm-svn: 197707
2013-12-19 18:10:57 +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
64e6986e39
Allow target-specific attributes to share a spelling between different attributes via the ParseKind field. Attributes will be given a common parsed attribute identifier (the AttributeList::AT_* enum), but retain distinct Attr subclasses.
...
This new functionality is used to implement the ARM and MSP430 interrupt attribute.
Patch reviewed by Richard Smith over IRC.
llvm-svn: 197343
2013-12-15 13:05:48 +00:00
Ted Kremenek
d980da2290
Enhance attribute machinery to include ObjCProtocols as "subjects" in attribute declarations.
...
llvm-svn: 196954
2013-12-10 19:43:42 +00:00
Aaron Ballman
00dcc43b56
Typo caught by Alp Toker: s/appertain/appertains
...
llvm-svn: 196273
2013-12-03 13:45:50 +00:00
Aaron Ballman
93b5cc6db8
Rectifying style issues with generated code. No functional change intended.
...
llvm-svn: 196142
2013-12-02 19:36:42 +00:00
Aaron Ballman
3aff633590
Automate attribute language option checking by specifying the list of options to test in tablegen.
...
llvm-svn: 196138
2013-12-02 19:30:36 +00:00
Aaron Ballman
604dfec8dc
Re-enabled support for the Subjects for the weak attribute. This changes the diagnostic involved to be more accurate -- for C++ code, it will now report that weak applies to variables, functions or classes. Added additional test case for this.
...
llvm-svn: 196120
2013-12-02 17:07:07 +00:00
Aaron Ballman
a358c9051e
Using the proper set key when determining whether a SubsetSubject helper method has been previously generated.
...
llvm-svn: 196103
2013-12-02 14:58:17 +00:00
Aaron Ballman
4cfafb9a85
Fixes a possible assert in the custom SubsetSubject logic for the attr emitter.
...
llvm-svn: 195962
2013-11-29 16:12:29 +00:00
Aaron Ballman
80469038c0
Enables support for custom subject lists for attributes. As a testbed, uses the custom subject for the ibaction attribute.
...
llvm-svn: 195960
2013-11-29 14:57:58 +00:00
Aaron Ballman
c1494bddc1
Renaming Struct to GenericRecord for clarity; could not use Record as the enumerant because that's already taken by the Record class.
...
llvm-svn: 195875
2013-11-27 20:14:30 +00:00
Aaron Ballman
17046b8506
Automated checking for C++ when determining what argument to send to the diagnostic for attribute subjects. In turn, this allows the Subjects to be enabled for some more attributes and improves diagnostics. Updated a test case based on the improved diagnostic.
...
llvm-svn: 195864
2013-11-27 19:16:55 +00:00
Aaron Ballman
74eeeae3d3
Laying the basic groundwork for table generating the diagnostics for attribute subjects. This makes some modifications to the way subjects are listed in Attr.td, and updates the attr emitter to handle the new constructs.
...
I have disabled some attribute subject lines on purpose in Attr.td;
this part is a WIP with the goal being to restore those subjects
incrementally. By commenting them out, it leaves the original behavior
the same as before for those attributes and so those are not
functionality changes.
llvm-svn: 195841
2013-11-27 13:27:02 +00:00
Richard Smith
852e9ce3dd
Remove 'DistinctSpellings' support from Attr.td and change its only user to
...
look at the attribute spelling instead. The 'ownership_*' attributes should
probably be split into separate *Attr classes, but that's more than I wanted to
do here.
llvm-svn: 195805
2013-11-27 01:46:48 +00:00
Aaron Ballman
18a7838e3e
Implemented DefaultIntArgument in the table generator and start using it in semantic analysis. Removes some magic numbers.
...
llvm-svn: 195287
2013-11-21 00:28:23 +00:00
Aaron Ballman
4768b31797
Attributes which accept a type as their sole argument are no longer hard coded into the parser. Instead, they are automatically listed through tablegen.
...
llvm-svn: 193989
2013-11-04 12:55:56 +00:00
Richard Smith
b87c465391
Store a TypeArgument on an attribute as a TypeSourceInfo*, rather than as a
...
QualType with a SourceLocation stashed alongside.
llvm-svn: 193803
2013-10-31 21:23:20 +00:00
Richard Smith
66e7168f8d
PR17666: Instead of allowing an initial identifier argument in any attribute
...
which we don't think can't have one, only allow it in the tiny number of
attributes which opts into this weird parse rule.
I've manually checked that the handlers for all these attributes can in fact
cope with an identifier as the argument. This is still somewhat terrible; we
should move more fully towards picking the parsing rules based on the
attribute, and make the Parse -> Sema interface more type-safe.
llvm-svn: 193295
2013-10-24 01:07:54 +00:00
DeLesley Hutchins
210791a021
Consumed Analysis: Change callable_when so that it can take a list of states
...
that a function can be called in. This reduced the total number of annotations
needed and makes writing more complicated behaviour less burdensome.
Patch by chriswails@gmail.com .
llvm-svn: 191983
2013-10-04 21:28:06 +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
Aaron Ballman
c12aaff2cb
The cleanup attribute no longer uses an unresolved, simple identifier as its argument. Instead, it takes an expression that is fully resolved.
...
llvm-svn: 190476
2013-09-11 01:37:41 +00:00
Aaron Ballman
8ee40b7264
Attribute tablegen now understands that attribute arguments can be optional. This allows for automated checking of the number of arguments expected vs number of arguments given for attributes. Greatly reduces the amount of manual checking required.
...
llvm-svn: 190368
2013-09-09 23:33:17 +00:00
Aaron Ballman
f58070baed
Switched FormatAttr to using an IdentifierArgument instead of a StringArgument since that is a more accurate modeling.
...
llvm-svn: 189851
2013-09-03 21:02:22 +00:00
Aaron Ballman
080cad730a
Fixing an unused variable warning.
...
llvm-svn: 187474
2013-07-31 02:20:22 +00:00
Aaron Ballman
0979e9e130
Added the notion of Type and TargetSpecific attributes to the clang tablegen. In turn, this fixes a mistake with Ptr32, Ptr64, UPtr and SPtr attribtues generating AST nodes that are never actually used.
...
llvm-svn: 187401
2013-07-30 01:44:15 +00:00
Reid Kleckner
4290361b99
Fix copy-pasto in naming of LAST_MS_INHERITANCE[_ATTR]
...
Richard Smith pointed this out over a month ago.
llvm-svn: 181830
2013-05-14 20:55:49 +00:00
Douglas Gregor
231ca1c929
Restore Richard's belief in me.
...
llvm-svn: 181042
2013-05-03 18:51:59 +00:00
Douglas Gregor
d2472d4cdb
Use attribute argument information to determine when to parse attribute arguments as expressions.
...
This change partly addresses a heinous problem we have with the
parsing of attribute arguments that are a lone identifier. Previously,
we would end up parsing the 'align' attribute of this as an expression
"(Align)":
template<unsigned Size, unsigned Align>
class my_aligned_storage
{
__attribute__((align((Align)))) char storage[Size];
};
while this would parse as a "parameter name" 'Align':
template<unsigned Size, unsigned Align>
class my_aligned_storage
{
__attribute__((align(Align))) char storage[Size];
};
The code that handles the alignment attribute would completely ignore
the parameter name, so the while the first of these would do what's
expected, the second would silently be equivalent to
template<unsigned Size, unsigned Align>
class my_aligned_storage
{
__attribute__((align)) char storage[Size];
};
i.e., use the maximal alignment rather than the specified alignment.
Address this by sniffing the "Args" provided in the TableGen
description of attributes. If the first argument is "obviously"
something that should be treated as an expression (rather than an
identifier to be matched later), parse it as an expression.
Fixes <rdar://problem/13700933>.
llvm-svn: 180973
2013-05-02 23:25:32 +00:00