summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Sema: Flexible array members were introduced in C99, diagnose their use in C++David Majnemer2013-11-021-1/+1
| | | | | | | The declaration of a flexible array member was correctly diagnosed as an extension in C89 mode but not in C++. llvm-svn: 193918
* Fix a C struct diagnostic regression introduced by r187504 (PR17762).Kaelyn Uhrain2013-10-311-1/+4
| | | | llvm-svn: 193799
* ARM: fix AST for __builtin_arm_strex callTim Northover2013-10-291-0/+8
| | | | | | | | | | | The AST was constructed so that this builtin returned the default BoolTy and since I'd opted for custom SemaChecking, I should have set it properly at that point. This caused an assertion failure when the types didn't match up with what we generated. This makes it return an IntTy, which is as good as anything. llvm-svn: 193606
* Remove REQUIRES aarch64-registered-target from testAlp Toker2013-10-261-1/+0
| | | | | | Registered targets don't matter for Sema tests, this passes fine. llvm-svn: 193485
* Add -Wstring-plus-char, which warns when adding char literals to C strings.Jordan Rose2013-10-251-0/+15
| | | | | | | | | | | Specifically, this warns when a character literal is added (using '+') to a variable with type 'char *' (or any other pointer to character type). Like -Wstring-plus-int, there is a fix-it to change "foo + 'a'" to "&foo['a']" iff the character literal is on the right side of the string. Patch by Anders Rönnholm! llvm-svn: 193418
* PR17666: Instead of allowing an initial identifier argument in any attributeRichard Smith2013-10-241-2/+2
| | | | | | | | | | | | 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
* Implements 64 bit microsoft record layout and adds lit tests to cover Warren Hunt2013-10-231-0/+2
| | | | | | | | | it. Also removes all of the microsoft C++ ABI related code from the itanium layout builder. Differential Revision: http://llvm-reviews.chandlerc.com/D2003 llvm-svn: 193290
* Consider hidden decls for isUsed checks.Rafael Espindola2013-10-221-0/+9
| | | | | | | | | | | | | | | | | This fixes pr17624. A FIXME from Richard Smith: It seems to me that the root cause is that a per-Decl 'used' flag doesn't really make much sense in the way we use it now. I think we should either track whether that particular declaration is used (with isUsed scanning the entire redecl chain), or we should only have one flag for the entire redeclaration chain (perhaps by always looking at the flag on either the most recent decl or the canonical decl). Modeling it as "is this declaration or any previous declaration used" is weird, and requires contortions like the loop at the end of Sema::MarkFunctionReferenced. llvm-svn: 193202
* Treat aliases as definitions.Rafael Espindola2013-10-222-0/+55
| | | | | | | | | | | | | | This fixes pr17639. Before this patch clang would consider void foo(void) __attribute((alias("__foo"))); a declaration. It now correctly handles it as a definition. Initial patch by Alp Toker. I added support for variables. llvm-svn: 193200
* New fix for pr17535.Rafael Espindola2013-10-221-0/+54
| | | | | | | | | | | | | | | | | | | This is a fixed version of r193161. In order to handle void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); it is not enough to delay aliases to the end of the TU, we have to do two passes over them to find if they are defined or not. This can be implemented by producing alias as we go and just doing the second pass at the end. This has the advantage that other parts of clang that were expecting alias to be processed in order don't have to be changed. This patch also handles cyclic aliases. llvm-svn: 193188
* Revert r193073 and the attempt to fix it in r193170.Chandler Carruth2013-10-221-1/+1
| | | | | | | | | | This patch wasn't reviewed, and isn't correctly preserving the behaviors relied upon by QT. I don't have a direct example of fallout, but it should go through the standard code review process. For example, it should never have removed the QT test case that was added when fixing those users. llvm-svn: 193174
* Revert "This patch causes clang to reject alias attributes that point to ↵Rafael Espindola2013-10-221-22/+0
| | | | | | | | | | | | | | | | undefined names. For example, with this patch we now reject" This reverts commit r193161. It broke void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); Looks like we have to fix pr17639 first :-( llvm-svn: 193162
* This patch causes clang to reject alias attributes that point to undefinedRafael Espindola2013-10-221-0/+22
| | | | | | | | | | | | names. For example, with this patch we now reject void f1(void) __attribute__((alias("g1"))); This patch is implemented in CodeGen. It is quiet a bit simpler and more compatible with gcc than implementing it in Sema. The downside is that the errors only fire during -emit-llvm. llvm-svn: 193161
* Fix to PR8880 (clang dies processing a for loop).Serge Pavlov2013-10-211-1/+1
| | | | | | | | | | | | | | | | Due to statement expressions supported as GCC extension, it is possible to put 'break' or 'continue' into a loop/switch statement but outside its body, for example: for ( ; ({ if (first) { first = 0; continue; } 0; }); ) Such usage must be diagnosed as an error, GCC rejects it. To recognize this and similar patterns the flags BreakScope and ContinueScope are temporarily turned off while parsing condition expression. Differential Revision: http://llvm-reviews.chandlerc.com/D1762 llvm-svn: 193073
* Switch attribute test line endings from CRLFAlp Toker2013-10-201-19/+19
| | | | | | The convention is LF unless specifically testing line endings. llvm-svn: 193056
* This is now passing. Uncomment and close out PR6281.Bill Wendling2013-10-171-4/+2
| | | | llvm-svn: 192869
OpenPOWER on IntegriCloud