summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/AttributeList.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Rename clang::AttributeList to clang::ParsedAttrErich Keane2018-07-131-243/+0
| | | | | | | Since The type no longer contains the 'next' item anymore, it isn't a list, so rename it to ParsedAttr to be more accurate. llvm-svn: 337005
* AttributeList de-listifying:Erich Keane2018-07-121-41/+26
| | | | | | | | | | | Basically, "AttributeList" loses all list-like mechanisms, ParsedAttributes is switched to use a TinyPtrVector (and a ParsedAttributesView is created to have a non-allocating attributes list). DeclaratorChunk gets the later kind, Declarator/DeclSpec keep ParsedAttributes. Iterators are added to the ParsedAttribute types so that for-loops work. llvm-svn: 336945
* [NFC] Fix AttributeList allocated_size for ParsedType.Erich Keane2018-06-221-0/+2
| | | | | | | | | This if/elseif structure seems to be missing this case. Previously, this would report a size of 1 pointer too small. This didn't really change anything besides failing to reclaim a very small amount of memory. llvm-svn: 335372
* [Sema] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-02-201-7/+12
| | | | | | other minor fixes (NFC). llvm-svn: 325544
* Add -f[no-]double-square-bracket-attributes as new driver options to control ↵Aaron Ballman2017-10-151-2/+3
| | | | | | use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later. llvm-svn: 315856
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+21
| | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300556
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-181-21/+0
| | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. llvm-svn: 300543
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+21
| | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300539
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-1/+1
| | | | | | No functionality change intended. llvm-svn: 284730
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* P0188R1: add support for standard [[fallthrough]] attribute. This is almostRichard Smith2016-03-081-0/+5
| | | | | | | | | | | | | | exactly the same as clang's existing [[clang::fallthrough]] attribute, which has been updated to have the same semantics. The one significant difference is that [[fallthrough]] is ill-formed if it's not used immediately before a switch label (even when -Wimplicit-fallthrough is disabled). To support that, we now build a CFG of any function that uses a '[[fallthrough]];' statement to check. In passing, fix some bugs with our support for statement attributes -- in particular, diagnose their use on declarations, rather than asserting. llvm-svn: 262881
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* [Sema] Handle leading and trailing __ for GNU attributesDavid Majnemer2015-08-251-8/+16
| | | | | | | | | | GNU attributes can have a leading and trailing __ appended/prepended to the attribute name. While the parser and AttributeList::getKind did the right thing, AttributeList::getAttributeSpellingListIndex did not. This fixes PR24565. llvm-svn: 245953
* Ignore the "novtable" declspec when not using the Microsoft C++ ABI.Bob Wilson2015-07-201-3/+4
| | | | | | | | | | | | | | Clang used to silently ignore __declspec(novtable). It is implemented now, but leaving the vtable uninitialized does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so this changes clang to simply ignore novtable when not using the Microsoft C++ ABI. llvm-svn: 242730
* Automate attribute argument count semantic checking when there are variadic ↵Aaron Ballman2014-07-311-0/+8
| | | | | | | | 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
* Remove uses of SmallString::equals in favor of SmallVectorImpl<char>'s ↵David Blaikie2014-03-091-1/+1
| | | | | | operator== llvm-svn: 203373
* Pass llvm::Triple objects by const reference.Benjamin Kramer2014-03-041-2/+2
| | | | | | Copying isn't cheap as it contains a std::string. llvm-svn: 202880
* Add a new attribute meta-spelling called "GCC" -- it widens into being a GNU ↵Aaron Ballman2014-01-271-3/+3
| | | | | | | | 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
* Adds a getSemanticSpelling function to semantic attribute subclasses which ↵Aaron Ballman2014-01-241-0/+5
| | | | | | 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
* Remove some hard-coded specialness for thread-safety attributes from the ↵Aaron Ballman2014-01-201-0/+5
| | | | | | 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
* Removing some attribute magic related to the OpenCL keyword attributes. ↵Aaron Ballman2014-01-141-8/+0
| | | | | | Instead of mapping them to their semantics as a custom part of the parser, they instead map declaratively through the rest of the attribute system. llvm-svn: 199175
* When determining the attribute's parsed kind, pay attention to the syntax ↵Aaron Ballman2014-01-131-1/+1
| | | | | | 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
* Removing the notion of TargetAttributesSema and replacing it with one where ↵Aaron Ballman2014-01-091-0/+15
| | | | | | 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
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-2/+2
| | | | | | | 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
* No longer accepting attribute spellings with prefix and suffix underscores ↵Aaron Ballman2013-12-111-9/+13
| | | | | | except for GNU attributes, or C++11-style attributes in the GNU namespace. This prevents attributes such as __declspec(__dllexport__) or [[__noreturn__]] from being treated as known attributes. llvm-svn: 197082
* AttributeList: tweak the conditional order to avoid two strcmpsAlp Toker2013-12-051-2/+2
| | | | llvm-svn: 196518
* Automate attribute language option checking by specifying the list of ↵Aaron Ballman2013-12-021-0/+5
| | | | | | options to test in tablegen. llvm-svn: 196138
* Laying the basic groundwork for table generating the diagnostics for ↵Aaron Ballman2013-11-271-0/+10
| | | | | | | | | | | | 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
* Make helper function static.Benjamin Kramer2013-09-281-1/+1
| | | | llvm-svn: 191615
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-091-0/+25
| | | | | | 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
* Factor out parsing and allocation of IdentifierLoc objects.Richard Smith2013-09-031-0/+8
| | | | llvm-svn: 189833
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-311-4/+3
| | | | | | argument list. llvm-svn: 189711
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+2
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* PR14922: when printing an attribute, use the real syntax of the attribute ↵Michael Han2013-01-241-0/+11
| | | | | | | | | | | | | (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
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | 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
* Add support for "type safety" attributes that allow checking that 'void *'Dmitri Gribenko2012-08-171-0/+2
| | | | | | | | | | | | | | function arguments and arguments for variadic functions are of a particular type which is determined by some other argument to the same function call. Usecases include: * MPI library implementations, where these attributes enable checking that buffer type matches the passed MPI_Datatype; * for HDF5 library there is a similar usecase as MPI; * checking types of variadic functions' arguments for functions like fcntl() and ioctl(). llvm-svn: 162067
* Drop the ASTContext.h include from Stmt.h and fix up transitive users.Benjamin Kramer2012-07-041-0/+1
| | | | | | | | | | | | | | This required moving the ctors for IntegerLiteral and FloatingLiteral out of line which shouldn't change anything as they are usually called through Create methods that are already out of line. ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector and make it independent from ASTContext.h Pass the StorageAllocator directly to AccessedEntity so it doesn't need to have a definition of ASTContext around. llvm-svn: 159718
* Handle C++11 attribute namespaces automatically.Alexis Hunt2012-06-181-6/+12
| | | | | | | | 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
* Add -Wimplicit-fallthrough warning flag, which warns on fallthrough betweenRichard Smith2012-05-031-1/+8
| | | | | | | | | | | | cases in switch statements. Also add a [[clang::fallthrough]] attribute, which can be used to suppress the warning in the case of intentional fallthrough. Patch by Alexander Kornienko! The handling of C++11 attribute namespaces in this patch is temporary, and will be replaced with a cleaner mechanism in a subsequent patch. llvm-svn: 156086
* Replace the StringSwitch in AttributeList::getKind() with aDouglas Gregor2012-05-021-3/+3
| | | | | | | | 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
* Introduce the notion of 'ignored' attributes, so that all attributesDouglas Gregor2012-05-021-2/+0
| | | | | | we accept are not modeled somehow via Attr.td. llvm-svn: 155998
* Introduce the notion of an attribute that has no direct representationDouglas Gregor2012-05-021-11/+0
| | | | | | as an AST node, and fold a number of such attributes into Attr.td. llvm-svn: 155995
* Implement the alternate spellings of attributes aligned (as "align")Douglas Gregor2012-05-021-2/+0
| | | | | | | and const (as "__const") using tblgen, rather than explicitly hacking them in. llvm-svn: 155991
* Revert my optimization to AttributeList::getKind() in r155987;Douglas Gregor2012-05-021-31/+19
| | | | | | Benjamin has suggested a better approach. llvm-svn: 155989
* Replace the StringSwitch in AttributeList::getKind(constDouglas Gregor2012-05-021-19/+31
| | | | | | | IdentifierInfo *) with a static StringMap, improving -fsyntax-only performance by 1% for the example in <rdar://problem/11004361>. llvm-svn: 155987
* Refactor Clang sema attribute handling.Michael Han2012-03-071-122/+10
| | | | | | | | | | | | | | | | | 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
* Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (andRichard Smith2012-02-251-1/+2
| | | | | | likewise for __has_extension). Patch by Jonathan Sauer! llvm-svn: 151445
* The following patch adds __attribute__((no_address_safety_analysis)) which ↵Kostya Serebryany2012-01-241-0/+1
| | | | | | | | | | | | | | | will allow to disable address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function. When building with AddressSanitizer, add AddressSafety function attribute to every generated function except for those that have __attribute__((no_address_safety_analysis)). With this patch we will be able to 1. disable AddressSanitizer for a particular function 2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on. llvm-svn: 148842
* After further discussion, rename attribute ↵Ted Kremenek2012-01-051-1/+1
| | | | | | 'objc_disable_automatic_synthesis' to 'objc_requires_property_definitions'. llvm-svn: 147622
OpenPOWER on IntegriCloud