summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Updated the wording of two attribute-related diagnostics so that they print ↵Aaron Ballman2014-01-024-8/+8
| | | | | | the offending attribute name. Also updates the associated test cases. llvm-svn: 198355
* Teach the diagnostics engine about the Attr type to make reporting on ↵Aaron Ballman2013-12-261-4/+4
| | | | | | 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
* Removed a string literal for an attribute name, which means the attribute ↵Aaron Ballman2013-12-261-4/+4
| | | | | | name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate. llvm-svn: 198054
* This diagnostic did not accept arguments, and did not have any test ↵Aaron Ballman2013-12-261-0/+1
| | | | | | | | coverage. Parameterized the diagnostic, and made it more consistent with other attribute diagnostic wordings. Added test coverage. Since this warning was generalized, it was also given a sensible warning group flag and the corresponding test was updated to reflect this. llvm-svn: 198053
* Removing the alloc_size attribute. The attribute was semantically handled, ↵Aaron Ballman2013-12-211-27/+0
| | | | | | but silently ignored. Most of this feature was already reverted in June 2012 (r159016), this just cleans up the pieces left over. llvm-svn: 197866
* Implemented delayed processing of 'unavailable' checking, just like with ↵Ted Kremenek2013-12-189-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | | 'deprecated'. Fixes <rdar://problem/15584219> and <rdar://problem/12241361>. This change looks large, but all it does is reuse and consolidate the delayed diagnostic logic for deprecation warnings with unavailability warnings. By doing so, it showed various inconsistencies between the diagnostics, which were close, but not consistent. It also revealed some missing "note:"'s in the deprecated diagnostics that were showing up in the unavailable diagnostics, etc. This change also changes the wording of the core deprecation diagnostics. Instead of saying "function has been explicitly marked deprecated" we now saw "'X' has been been explicitly marked deprecated". It turns out providing a bit more context is useful, and often we got the actual term wrong or it was not very precise (e.g., "function" instead of "destructor"). By just saying the name of the thing that is deprecated/deleted/unavailable we define this issue away. This diagnostic can likely be further wordsmithed to be shorter. llvm-svn: 197627
* Documentation comment parsing: when checking if we have typedef to somethingDmitri Gribenko2013-12-171-0/+12
| | | | | | | that we consider a function for the purposes of checking \param and \returns, look through reference types. llvm-svn: 197530
* Documentation comment parsing: allow \param and \returns on std::function,Dmitri Gribenko2013-12-171-0/+31
| | | | | | boost::function and similar function-like objects llvm-svn: 197528
* Documentation comment parsing: rearrange tests to clarify the intent of ↵Dmitri Gribenko2013-12-171-14/+22
| | | | | | these tests llvm-svn: 197517
* Stop crashing on empty asm input constraintsDuncan P. N. Exon Smith2013-12-161-0/+3
| | | | | | | | | | An empty string for an ASM input constraint is invalid, and will crash during clang CodeGen. Change TargetInfo::validateInputConstraint to reject an empty string. <rdar://problem/15552191> llvm-svn: 197362
* Allow target-specific attributes to share a spelling between different ↵Aaron Ballman2013-12-151-0/+6
| | | | | | | | | | 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
* Revert "Don't require -re suffix on -verify directives with regexes."Alp Toker2013-12-143-8/+8
| | | | | | | | | | This patch was submitted to the list for review and didn't receive a LGTM. (In fact one explicit objection and one query were raised.) This reverts commit r197295. llvm-svn: 197299
* Don't require -re suffix on -verify directives with regexes.Hans Wennborg2013-12-143-8/+8
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2392 llvm-svn: 197295
* Added a Subjects clause to the section attribute and made its diagnostics ↵Aaron Ballman2013-12-121-1/+3
| | | | | | more consistent with other attributes. llvm-svn: 197104
* Change semantics of regex expectations in the diagnostic verifierHans Wennborg2013-12-113-10/+10
| | | | | | | | | | | | | | | | | | | | | | | Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 llvm-svn: 197092
* No longer accepting attribute spellings with prefix and suffix underscores ↵Aaron Ballman2013-12-111-0/+2
| | | | | | 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
* Make the -Wkeyword-compat diag message more accurateAlp Toker2013-12-091-1/+1
| | | | | | | | | | | | | | | | Changed from: keyword '__is_empty' will be treated as an identifier for the remainder of the translation unit To: keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit This is a more accurate description of clang's keyword compatibility feature, given that some of the keywords are turned into context-sensitive keywords (e.g. REVERTIBLE_TYPE_TRAIT) rather than being fully disabled. llvm-svn: 196776
* Remove an old stdio.h include from the invalid-array testAlp Toker2013-12-081-3/+1
| | | | | | | This should get it up and running on win and other builders without system headers. llvm-svn: 196738
* Fix three tests that weren't checking anythingAlp Toker2013-12-083-6/+6
| | | | | | | | Add -verify and update the test directives to match current expectations. Also add a FIXME to an ObjC test that has expected-* directives but no -verify. llvm-svn: 196737
* Re-enable verification of test and update outdated diag checksAlp Toker2013-12-081-3/+3
| | | | | | | Going by PR6913 it looks like this one can no longer reach CodeGen so remove the redundant -emit-llvm case and treat it as an ordinary Sema test. llvm-svn: 196736
* There's no such thing as %clang_cc1_onlyAlp Toker2013-12-082-2/+2
| | | | | | | | These were being substituted into approximately the following: clang -cc1 -internal-isystem ../lib/clang/3.5/include_only llvm-svn: 196730
* Fix a test that hasn't worked since 2007Alp Toker2013-12-081-3/+3
| | | | | | | | Due to a missing -verify, 2007-10-01-BuildArrayRef.c was a no-op. The message was changed 5 years ago so also update the test to reflect the new wording. llvm-svn: 196729
* ARM: teach Sema that "r" can match 64-bit valuesTim Northover2013-12-081-0/+5
| | | | | | | | We already support using "r" on 64-bit values (a GPRPair is allocated), but Sema doesn't know this yet so issues a warning. This should fix it. llvm-svn: 196724
* -Wassign-enum: compare unqualified typesDmitri Gribenko2013-12-051-0/+18
| | | | | | | | | | | | | | This commit changes -Wassign-enum to compare unqualified types. One could think that this does not matter much, because who wants a value of enum type that is const-qualified? But this breaks the intended pattern to silence this warning with an explicit cast: static const enum Foo z = (enum Foo) 42; In this case, source type is 'enum Foo', and destination type is 'const enum Foo', and if we compare qualified types, they don't match, so we used warn. llvm-svn: 196548
* Allow the warning 'case value not in enumerated type' to be silenced withDmitri Gribenko2013-12-051-0/+26
| | | | | | | | | | the following pattern. If 'case' expression refers to a static const variable of the correct enum type, then we count this as a sufficient declaration of intent by the user, so we silence the warning. llvm-svn: 196546
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-052-2/+2
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Getting rid of some hard-coded strings. No functional changes intended, ↵Aaron Ballman2013-12-041-4/+4
| | | | | | though some test cases needed to be updated for attribute names becoming quoted. llvm-svn: 196417
* When parsing ignored attribute arguments, presuming the first argument is an ↵Aaron Ballman2013-12-041-0/+15
| | | | | | unresolved identifier the same way that we do for unknown arguments. This resolves PR18075, where we regressed the handling of OpenBSD's bounded attribute. llvm-svn: 196387
* clang/test: REQUIRES: s/x86-64-registered-target/x86-registered-target/NAKAMURA Takumi2013-12-041-1/+1
| | | | llvm-svn: 196350
* Emit an extension warning when changing system header tokensAlp Toker2013-12-032-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | clang converts keywords to identifiers for compatibility with various system headers such as GNU libc. Implement a -Wkeyword-compat extension warning to diagnose those cases. The warning is on by default but will generally be ignored in system headers. It can however be enabled globally to aid standards conformance testing. This also changes the __uptr keyword avoidance from r195710 to no longer special-case system headers, bringing it in line with other similar workarounds in clang. Implementation returns bool for symmetry with token annotation functions. Some examples: warning: keyword '__is_pod' will be treated as an identifier for the remainder of the translation unit [-Wkeyword-compat] struct __is_pod warning: keyword '__uptr' will be treated as an identifier here [-Wkeyword-compat] union w *__uptr; llvm-svn: 196212
* MS inline asm: When LLVM called back to Clang to parse a name and do nameDmitri Gribenko2013-12-031-0/+18
| | | | | | | | lookup, if parsing failed, we did not restore the lexer state properly, and eventually crashed. This change ensures that we always consume all the tokens from the new token stream we started to parse the name from inline asm. llvm-svn: 196182
* CommentLexer: When proceeding with a typo corrected name don't clobber the ↵Benjamin Kramer2013-12-011-0/+6
| | | | | | | | token. This would crash if the token is used in another diagnostic. PR18051. llvm-svn: 196048
* Reenable ms inline asm test.Benjamin Kramer2013-12-011-6/+6
| | | | | | LLVM r196044 should make it pass. llvm-svn: 196045
* Automated checking for C++ when determining what argument to send to the ↵Aaron Ballman2013-11-271-2/+2
| | | | | | 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
* Replacing a custom diagnostic with a more standard one. No functional change ↵Aaron Ballman2013-11-261-1/+1
| | | | | | intended. llvm-svn: 195770
* Unbreak -fms-extensions with GNU libc headersAlp Toker2013-11-262-0/+21
| | | | | | | | | | | | | GNU libc uses '__uptr' as a member name in C mode, conflicting with the eponymous MSVC pointer modifier keyword. Detect and mark the token as an identifier when these specific conditions are met. __uptr will continue to work as a keyword for the remainder of the translation unit. Fixes PR17824. llvm-svn: 195710
* Making type_tag_for_datatype consistent with its declared subject from ↵Aaron Ballman2013-11-251-2/+2
| | | | | | | | Attr.td. Also updated the related testcase. Reviewed by Dmitri Gribenko. llvm-svn: 195675
* __declspec(uuid) is only supported for C++ code according to MSDN (as well ↵Aaron Ballman2013-11-241-4/+1
| | | | | | as behaviorally in MSVC). This adds a generic diagnostic that we use for uuid, and can use for some other attributes as well, and adds a testcase. llvm-svn: 195580
* PR10837: Warn if a null pointer constant is formed by a zero integer constantRichard Smith2013-11-211-0/+11
| | | | | | | expression that is not a zero literal, in C. This is a different, and more targeted, approach than that in r194540. llvm-svn: 195303
* Refactored integer argument checking code into a helper method. Removes a ↵Aaron Ballman2013-11-211-2/+2
| | | | | | considerable amount of duplicated code. llvm-svn: 195302
* There is no such thing as __declspec(ms_struct), this is a GNU attribute. ↵Aaron Ballman2013-11-201-4/+6
| | | | | | Switched the attribute to have the proper spelling, gave it a subject, updated the warning to be more accurate, and updated the test case as appropriate. llvm-svn: 195277
* Removing a custom error diagnostic and replacing it with a stock one. Added ↵Aaron Ballman2013-11-201-0/+1
| | | | | | a test case to ensure the diagnostic was firing properly. llvm-svn: 195188
* Revert r194540, it breaks various C++ programs.Joerg Sonnenberger2013-11-191-6/+0
| | | | llvm-svn: 195126
* Improving calling convention test coverage by adding tests for things not ↵Aaron Ballman2013-11-191-0/+2
| | | | | | currently handled. Specifically: the diagnostics in SemaDeclAttr.cpp, and ensuring that calling convention attributes are applied to ObjC method declarations. No functional changes. llvm-svn: 195098
* PR8455: Handle an attribute between a goto label and a variable declaration perRichard Smith2013-11-151-0/+4
| | | | | | | the GNU documentation: the attribute only appertains to the label if it is followed by a semicolon. Based on a patch by Aaron Ballman! llvm-svn: 194869
* Only provide MS builtins when -fms-extensions is onReid Kleckner2013-11-131-0/+6
| | | | | | | | | | | We already have builtins that are only available in GNU mode, so this mirrors that. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2128 llvm-svn: 194615
* Warn on duplicate function specifierSerge Pavlov2013-11-131-0/+13
| | | | | | | | | This patch fixes PR8264. Duplicate qualifiers already are diagnozed, now the same diagnostics is issued for duplicate function specifiers. Differential Revision: http://llvm-reviews.chandlerc.com/D2025 llvm-svn: 194559
* PR10837: Warn if a null pointer constant is formed by a zero integer constantRichard Smith2013-11-131-0/+6
| | | | | | expression that is not a zero literal, in C. Patch by Ivan A. Kosarev! llvm-svn: 194540
* Fixed bug in return type of __builtin_va_start().Enea Zaffanella2013-11-071-0/+7
| | | | llvm-svn: 194197
* Sema: Cleanup and simplify anonymous union diagnosticsDavid Majnemer2013-11-021-1/+1
| | | | | | | | | | | | | | | | The determination of which diagnostics would be issued for certain anonymous unions started to get a little ridiculous. Clean this up by inverting the condition-tree's logic from dialect -> issue to issue -> diagnostic. As part of this cleanup, move ext_c99_flexible_array_member from DiagnosticParseKinds.td to DiagnosticSemaKinds.td because it's driven by Sema, not Parse. Also, the liberty was taken to edit ext_c99_flexible_array_member to match other, similar, diagnostics. llvm-svn: 193919
OpenPOWER on IntegriCloud