summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen/ClangAttrEmitter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixes a possible assert in the custom SubsetSubject logic for the attr emitter.Aaron Ballman2013-11-291-2/+3
| | | | llvm-svn: 195962
* Enables support for custom subject lists for attributes. As a testbed, uses ↵Aaron Ballman2013-11-291-10/+53
| | | | | | the custom subject for the ibaction attribute. llvm-svn: 195960
* Renaming Struct to GenericRecord for clarity; could not use Record as the ↵Aaron Ballman2013-11-271-6/+6
| | | | | | enumerant because that's already taken by the Record class. llvm-svn: 195875
* Automated checking for C++ when determining what argument to send to the ↵Aaron Ballman2013-11-271-2/+6
| | | | | | 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
* Laying the basic groundwork for table generating the diagnostics for ↵Aaron Ballman2013-11-271-9/+175
| | | | | | | | | | | | 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
* Remove 'DistinctSpellings' support from Attr.td and change its only user toRichard Smith2013-11-271-56/+27
| | | | | | | | 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
* Implemented DefaultIntArgument in the table generator and start using it in ↵Aaron Ballman2013-11-211-2/+22
| | | | | | semantic analysis. Removes some magic numbers. llvm-svn: 195287
* Attributes which accept a type as their sole argument are no longer hard ↵Aaron Ballman2013-11-041-0/+31
| | | | | | coded into the parser. Instead, they are automatically listed through tablegen. llvm-svn: 193989
* Store a TypeArgument on an attribute as a TypeSourceInfo*, rather than as aRichard Smith2013-10-311-7/+31
| | | | | | QualType with a SourceLocation stashed alongside. llvm-svn: 193803
* PR17666: Instead of allowing an initial identifier argument in any attributeRichard Smith2013-10-241-26/+18
| | | | | | | | | | | | 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
* Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins2013-10-041-1/+94
| | | | | | | | 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
* Tablegen now generates a StringSwitch for attributes containing enumeration ↵Aaron Ballman2013-09-111-0/+25
| | | | | | 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
* The cleanup attribute no longer uses an unresolved, simple identifier as its ↵Aaron Ballman2013-09-111-0/+1
| | | | | | argument. Instead, it takes an expression that is fully resolved. llvm-svn: 190476
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-091-12/+126
| | | | | | 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
* Switched FormatAttr to using an IdentifierArgument instead of a ↵Aaron Ballman2013-09-031-0/+1
| | | | | | StringArgument since that is a more accurate modeling. llvm-svn: 189851
* Fixing an unused variable warning.Aaron Ballman2013-07-311-4/+1
| | | | llvm-svn: 187474
* Added the notion of Type and TargetSpecific attributes to the clang ↵Aaron Ballman2013-07-301-1/+12
| | | | | | 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
* Fix copy-pasto in naming of LAST_MS_INHERITANCE[_ATTR]Reid Kleckner2013-05-141-8/+8
| | | | | | Richard Smith pointed this out over a month ago. llvm-svn: 181830
* Restore Richard's belief in me.Douglas Gregor2013-05-031-1/+1
| | | | llvm-svn: 181042
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert r180970; it's causing breakage.Douglas Gregor2013-05-021-43/+0
| | | | llvm-svn: 180972
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 180970
* [ms-cxxabi] Give the MS inheritance attributes a base classReid Kleckner2013-03-261-1/+16
| | | | | | | | 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
* [Sema][Attr]Fix alignment attribute printing.Michael Han2013-02-011-0/+47
| | | | | | | | | Remove "IsMSDeclspec" argument from Align attribute since the arguments in Attr.td should only model those appear in source code. Introduce attribute Accessor, and teach TableGen to generate syntax kind accessors for Align attribute, and use those accessors to decide if an alignment attribute is a declspec attribute. llvm-svn: 174133
* Add indents to AST dumping and removed parenthesis from AST nodes.Richard Trieu2013-01-311-4/+37
| | | | | | | | | | | | | | | | | | | | | Indents were given the color blue when outputting with color. AST dumping now looks like this: Node |-Node | `-Node `-Node `-Node Compared to the previous: (Node (Node (Node)) (Node (Node))) llvm-svn: 174022
* TableGen backends: use emitSourceFileHeader() to emit the warning aboutDmitri Gribenko2013-01-301-13/+20
| | | | | | file contents being autogenerated llvm-svn: 173979
* Propagate the spelling list index for an attribute across template ↵Richard Smith2013-01-291-1/+1
| | | | | | instantiation. llvm-svn: 173768
* Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelledRichard Smith2013-01-291-1/+5
| | | | | | | | | as a keyword. Rationalize existing attributes to use it as appropriate, and to not lie about some __declspec attributes being GNU attributes. In passing, remove a gross hack which was discarding attributes which we could handle. This results in us actually respecting the __pascal keyword again. llvm-svn: 173746
* Add the missing line return to align parameters of printPretty.Michael Han2013-01-271-1/+1
| | | | llvm-svn: 173597
* PR14922: when printing an attribute, use the real syntax of the attribute ↵Michael Han2013-01-241-21/+140
| | | | | | | | | | | | | (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax. Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td. This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute. When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and name, then passed to Attr that will use the index to print itself. Thanks to Richard Smith for the idea and review. llvm-svn: 173358
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-3/+3
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fixed a number of -Wcovered-switch-default diagnostics in ↵Alexander Kornienko2013-01-071-5/+0
| | | | | | tools/clang/include/clang/AST/AttrDump.inc llvm-svn: 171768
* Implement Attr dumping for -ast-dump.Alexander Kornienko2013-01-071-13/+122
| | | | | | | | http://llvm-reviews.chandlerc.com/D234 Patch by Philip Craig! llvm-svn: 171760
* [PCH] Reading expressions from attributes should be done using ReadExpr(),Argyrios Kyrtzidis2012-11-151-1/+1
| | | | | | | | | | | not ReadExpr(). Also add a test case making sure the thread safety attributes work as expected when they come from a PCH. Fixes rdar://12584141 & http://llvm.org/PR13982 llvm-svn: 168017
* Remove pointless classof()'s.Sean Silva2012-10-111-2/+0
| | | | | | | Updates to llvm/Support/Casting.h have rendered these classof()'s irrelevant. llvm-svn: 165770
* tblgen: Use LLVM-style RTTI in clang-tblgenSean Silva2012-10-101-1/+1
| | | | llvm-svn: 165649
* Don't constant-fold when pretty-printing alignment attribute. This fixes aRichard Smith2012-08-161-3/+6
| | | | | | potential crasher -- Context is sometimes a null reference (!!) here. llvm-svn: 162007
* Remove an unused headerMichael Han2012-07-191-1/+0
| | | | llvm-svn: 160492
* clang/utils/TableGen/ClangAttrEmitter.cpp: Fix abuse of StringRef (from ↵NAKAMURA Takumi2012-07-031-1/+1
| | | | | | getValueAsString()). llvm-svn: 159662
* Fix a thinko and a stray debugging hunk in my attributes patch. Thanks to JordanAlexis Hunt2012-06-201-3/+0
| | | | | | Rose and Richard Smith for catching these. llvm-svn: 158826
* Reapply r158700 and fixup patches, minus one hunk that slipped through andAlexis Hunt2012-06-191-55/+43
| | | | | | | caused a crash in an obscure case. On the plus side, it caused me to catch another bug by inspection. llvm-svn: 158767
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-43/+55
| | | | | | | | The original r158700 caused crashes in the gcc test suite, g++.abi/vtable3a.C among others. It also caused failures in the libc++ test suite. llvm-svn: 158749
* Remove redundant uses of SmallStringAlexis Hunt2012-06-191-7/+3
| | | | llvm-svn: 158731
* Stop abusing StringRef. Fixes the Windows build.Alexis Hunt2012-06-191-12/+12
| | | | | | | I've also removed the duplicate check for PARSED_ATTR since it seems unnecessary, and would have made the code more complicated. llvm-svn: 158716
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-191-53/+45
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* Handle C++11 attribute namespaces automatically.Alexis Hunt2012-06-181-2/+24
| | | | | | | | Now, as long as the 'Namespaces' variable is correct inside Attr.td, the generated code will correctly admit a C++11 attribute only when it has the appropriate namespace(s). llvm-svn: 158661
* Make clang-tblgen backends functions instead of TableGenBackends.Jakob Stoklund Olesen2012-06-131-13/+28
| | | | | | | | Get rid of a bunch of header files. TableGen output should be unaffected. Patch by Sean Silva! llvm-svn: 158388
* Fix our handling of visibility in explicit template instantiations.Rafael Espindola2012-05-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | * Don't copy the visibility attribute during instantiations. We have to be able to distinguish struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template DEFAULT void bar<foo>(); from struct HIDDEN foo {}; template<class T> DEFAULT void bar() {} template void bar<foo>(); * If an instantiation has an attribute, it takes precedence over an attribute in the template. * With instantiation attributes handled with the above logic, we can now select the minimum visibility when looking at template arguments. llvm-svn: 156821
* Teach the parser to deal with multiple spellings for the sameDouglas Gregor2012-05-111-9/+13
| | | | | | | attribute, rather than requiring multiple cases in consumers of this information. llvm-svn: 156666
* Replace the StringSwitch in AttributeList::getKind() with aDouglas Gregor2012-05-021-3/+17
| | | | | | | | TableGen-generated StringMatcher, for a 1.2% speedup in -fparse-only time in <rdar://problem/11004361>. Thanks to Benjamin for pointing me at StringMatcher! llvm-svn: 156003
OpenPOWER on IntegriCloud