summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen/TableGen.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR17666: Instead of allowing an initial identifier argument in any attributeRichard Smith2013-10-241-15/+16
| | | | | | | | | | | | 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
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-091-6/+13
| | | | | | 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
* clang-format utils/TableGen/TableGen.cpp.Rafael Espindola2013-08-161-82/+76
| | | | | | | I have a patch that edits the file. Running clang-format first makes the patch a lot easier to review. llvm-svn: 188562
* Remove option emitter from clang-tblgenReid Kleckner2013-06-181-12/+1
| | | | | | | The CMake build was still using it because I forgot to s/CLANG/LLVM/ in the tablegen() call. The Makefile build is already using llvm-tblgen. llvm-svn: 184192
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+0
| | | | llvm-svn: 180972
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Comment parsing: improve the fidelity of XML output for many block commandsDmitri Gribenko2013-02-011-0/+8
| | | | | | | | | | | | | | This change introduces a 'kind' attribute for the <Para> tag, that captures the kind of the parent block command. For example: \todo Meow. used to be just <Para>Meow.</Para>, but now it is <Para kind="todo">Meow.</Para> llvm-svn: 174216
* Comment parsing: resolve more named character referencesDmitri Gribenko2013-01-301-0/+8
| | | | | | | | | This reimplements r173850 with a better approach: (1) use a TableGen-generated matcher instead of doing a linear search; (2) avoid allocations for new strings by converting code points to string iterals with TableGen. llvm-svn: 173931
* PR14922: when printing an attribute, use the real syntax of the attribute ↵Michael Han2013-01-241-0/+7
| | | | | | | | | | | | | (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
* Implement Attr dumping for -ast-dump.Alexander Kornienko2013-01-071-0/+6
| | | | | | | | http://llvm-reviews.chandlerc.com/D234 Patch by Philip Craig! llvm-svn: 171760
* Sort the #include lines under utils/...Chandler Carruth2012-12-041-1/+0
| | | | llvm-svn: 169245
* tblgen: Migrate clang-tblgen to new TableGenMain API.Sean Silva2012-10-031-87/+82
| | | | llvm-svn: 165167
* Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.Dmitri Gribenko2012-09-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we have a list of all commands. This is a good thing in itself, but it also enables us to easily implement typo correction for command names. With this change we have objects that contain information about each command, so it makes sense to resolve command name just once during lexing (currently we store command names as strings and do a linear search every time some property value is needed). Thus comment token and AST nodes were changed to contain a command ID -- index into a tables of builtin and registered commands. Unknown commands are registered during parsing and thus are also uniformly assigned an ID. Using an ID instead of a StringRef is also a nice memory optimization since ID is a small integer that fits into a common bitfield in Comment class. This change implies that to get any information about a command (even a command name) we need a CommandTraits object to resolve the command ID to CommandInfo*. Currently a fresh temporary CommandTraits object is created whenever it is needed since it does not have any state. But with this change it has state -- new commands can be registered, so a CommandTraits object was added to ASTContext. Also, in libclang CXComment has to be expanded to include a CXTranslationUnit so that all functions working on comment AST nodes can get a CommandTraits object. This breaks binary compatibility of CXComment APIs. Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't need TU parameter anymore, so it was removed. This is a source-incompatible change for this C API. llvm-svn: 163540
* Comment HTML tag name machers: move from StringSwitch to an efficientDmitri Gribenko2012-08-311-0/+16
| | | | | | TableGen-generated string matcher. llvm-svn: 162969
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-0/+6
| | | | | | | | | | | | | | very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790
* Make clang-tblgen backends functions instead of TableGenBackends.Jakob Stoklund Olesen2012-06-131-28/+24
| | | | | | | | Get rid of a bunch of header files. TableGen output should be unaffected. Patch by Sean Silva! llvm-svn: 158388
* Refactor Clang sema attribute handling.Michael Han2012-03-071-0/+14
| | | | | | | | | | | | | | | | | This submission improves Clang sema handling by using Clang tablegen to generate common boilerplate code. As a start, it implements AttributeList enumerator generation and case statements for AttributeList::getKind. A new field "SemaHandler" is introduced in Attr.td and by default set to 1 as most of attributes in Attr.td have semantic checking in Sema. For a small number of attributes that don't appear in Sema, the value is set to 0. Also there are a small number of attributes that only appear in Sema but not in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList. Reviewed by Delesley Hutchins. llvm-svn: 152169
* Instantiate dependent attributes when instantiating templates.DeLesley Hutchins2012-01-201-0/+7
| | | | llvm-svn: 148592
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-3/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Unweaken vtables as per ↵David Blaikie2011-12-201-1/+1
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Add the Clang tblgen backends to Clang, and flip the switch to causePeter Collingbourne2011-10-061-0/+176
the build systems to use clang-tblgen. llvm-svn: 141291
OpenPOWER on IntegriCloud