summaryrefslogtreecommitdiff
path: root/include/clang/Basic/DiagnosticParseKinds.td
Commit message (Collapse)AuthorAge
* Provide a better diagnostic when braces are put before the identifier.Richard Trieu2014-06-24
| | | | | | | | | | | | | | | | | | When a user types: int [4] foo; assume that the user means: int foo[4]; Update the information for 'foo' to prevent additional errors, and provide a fix-it hint to move the brackets to the correct location. Additionally, suggest parens for types that require it, such as: int [4] *foo; to: int (*foo)[4]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211641 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR20069: bad loop pragma arguments crash FEEli Bendersky2014-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a crash when handling malformed arguments to loop pragmas such as: "#pragma clang loop vectorize(()". Essentially any argument which is not an identifier or constant resulted in a crash. This patch also changes a couple of the error messages which weren't quite correct. New behavior with this patch vs old behavior: #pragma clang loop vectorize(1) OLD: error: missing keyword; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' #pragma clang loop vectorize() OLD: error: expected ')' NEW: error: missing argument to loop pragma 'vectorize' #pragma clang loop vectorize_width(bad) OLD: error: missing value; expected a positive integer value NEW: error: invalid argument; expected a positive integer value #pragma clang loop vectorize(bad) OLD: invalid keyword 'bad'; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' http://reviews.llvm.org/D4197 Patch by Mark Heffernan git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211292 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++1z] Implement N3994: a range-based for loop can declare a variable with ↵Richard Smith2014-06-19
| | | | | | | | | | | | | super-terse notation for (x : range) { ... } which is equivalent to for (auto &&x : range) { ... } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211267 91177308-0d34-0410-b5e6-96231b3b80d8
* DiagnoseUnknownTypename always emits a diagnostic and returns trueReid Kleckner2014-06-19
| | | | | | | | Make it return void and delete the dead code in the parser that handled the case where it might return false. This has been dead since 2010 when John deleted Action.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211248 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when ↵Richard Smith2014-06-16
| | | | | | declaring a template template parameter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211031 91177308-0d34-0410-b5e6-96231b3b80d8
* Add loop unroll pragma supportEli Bendersky2014-06-11
| | | | | | | | | | http://reviews.llvm.org/D4089 Patch by Mark Heffernan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210667 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix DOS-style newlines.Eli Bendersky2014-06-06
| | | | | | | | | | | A previous patch r210330 (and possibly another) introduced DOS-style newlines into a UNIX newline formatted file. Patch by Mark Heffernan (http://reviews.llvm.org/D4046) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210369 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-06
| | | | | | Patch thanks to Tyler Nowicki! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210330 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-23
| | | | | | | | | | | | | | | | | | 'optnone'. This patch implements support for selectively disabling optimizations on a range of function definitions through a pragma. The implementation is that all function definitions in the range are decorated with attribute 'optnone'. #pragma clang optimize off // All function definitions in here are decorated with 'optnone'. #pragma clang optimize on // Compilation resumes as normal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209510 91177308-0d34-0410-b5e6-96231b3b80d8
* Revised wording for diagnostics in r208299Ismail Pazarbasi2014-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208401 91177308-0d34-0410-b5e6-96231b3b80d8
* Suggest fix-it ':' when '=' used in for-range-declarationIsmail Pazarbasi2014-05-08
| | | | | | | | | | | Fix for PR19176. Clang will suggest a fix-it hint for cases like: int arr[] = {1, 2, 3, 4}; for (auto i = arr) ^ : git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208299 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Implement DR477David Majnemer2014-04-30
| | | | | | | | | | | | Summary: Friend declarations shouldn't mention explicit or virtual. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3562 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207682 91177308-0d34-0410-b5e6-96231b3b80d8
* [Parser] Remove "add -fmodules" from the "use of '@import' when modules are ↵Argyrios Kyrtzidis2014-04-17
| | | | | | | | | disabled, add -fmodules" error. We disable modules for C++, at which point this is confusing. rdar://16641918 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206440 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a typo, updating the diagnostic wording and logic based on ↵Aaron Ballman2014-04-15
| | | | | | post-commit review feedback. Amends r206186. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206229 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly diagnose standard C++ attributes which have optional argument lists ↵Aaron Ballman2014-04-14
| | | | | | | | | | | | when the arguments are elided. eg) [[deprecated()]] // error [[deprecated]] // OK [[deprecated("")]] // OK [[gnu::deprecated()]] // OK git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206186 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve error recovery around colon.Serge Pavlov2014-04-13
| | | | | | | | | | | Parse of nested name spacifier is modified so that it properly recovers if colon is mistyped as double colon in case statement. This patch fixes PR15133. Differential Revision: http://llvm-reviews.chandlerc.com/D2870 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206135 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the msvc pragmas section, bss_seg, code_seg, const_seg and data_seg as well as support for __declspec(allocate()). Additionally it corrects semantics and adds diagnostics for __attribute__((section())) and the interaction between the attribute and the msvc pragmas and declspec. In general conflicts should now be well diganosed within and among these features. In supporting the pragmas new machinery for uniform lexing for msvc pragmas was introduced. The new machinery always lexes the entire pragma and stores it on an annotation token. The parser is responsible for parsing the pragma when the handling the annotation token. There is a known outstanding bug in this implementation in C mode. Because these attributes and pragmas apply _only_ to definitions, we process them at the time we detect a definition. Due to tentative definitions in C, we end up processing the definition late. This means that in C mode, everything that ends up in a BSS section will end up in the _last_ BSS section rather than the one that was live at the time of tentative definition, even if that turns out to be the point of actual definition. This issue is not known to impact anything as of yet because we are not aware of a clear use or use case for #pragma bss_seg but should be fixed at some point. Differential Revision=http://reviews.llvm.org/D3065#inline-16241 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205810 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify __declspec attribute argument parsing with the common attribute ↵Aaron Ballman2014-03-31
| | | | | | | | argument parsing code. This removes a diagnostic that is no longer required (the semantic engine now properly handles attribute syntax so __declspec and __attribute__ spellings no longer get mismatched). This caused several testcases to need updating for a slightly different wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205234 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Improve diagnostic error for '@import' Fariborz Jahanian2014-03-26
| | | | | | | when modules are disabled. // rdar://15505492 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204862 91177308-0d34-0410-b5e6-96231b3b80d8
* Test commitAlexander Musman2014-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204519 91177308-0d34-0410-b5e6-96231b3b80d8
* Gracefully handle an attribute specifier following a lambda introducer when ↵Aaron Ballman2014-03-11
| | | | | | the parameter list wasn't present. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203565 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203302 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused diagnostic.Benjamin Kramer2014-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201796 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] 'if' clause support (no CodeGen support)Alexey Bataev2014-02-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201297 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-12
| | | | | | | | | | | | | | | | | These features are new in VS 2013 and are necessary in order to layout std::ostream correctly. Currently we have an ABI incompatibility when self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper in gtest. This change adds another implicit attribute, MSVtorDispAttr, because implicit attributes are currently the best way to make sure the information stays on class templates through instantiation. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2746 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201274 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-10
| | | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201105 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: Clean up malformed pragma diagnosticsDavid Majnemer2014-02-10
| | | | | | | | Create a new diagnostic, -Wignored-pragmas and use it to handle any case where a pragma would have a side effect but is ignored. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201102 91177308-0d34-0410-b5e6-96231b3b80d8
* Move away from 'general' / 'generalized' as a way of identifying C++11Richard Smith2014-01-17
| | | | | | | | | | | | | attribute syntax. There's nothing generalized about this; it's one of several first-class attribute syntaxes we support, all of which are more-or-less equally general. As discussed on cfe-commits, we may want to revisit this if we start allowing this syntax as an extension in C (or if C adopts the syntax), but hopefully this diagnostic wording will be crystal clear to everyone in the mean time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199443 91177308-0d34-0410-b5e6-96231b3b80d8
* Clarify warn_cxx98_compat_attribute diagnosticAlp Toker2014-01-12
| | | | | | | | Various attribute flavours are supported in C++98. Make it clear that this compatibility warning relates specifically to C++11-style generalized attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199053 91177308-0d34-0410-b5e6-96231b3b80d8
* Bring back magic constants in the digraph diagnosticAlp Toker2014-01-07
| | | | | | | | This backs out changes in commit r198605 and part of r198604, replacing the original tok::kw_template with a slightly more obvious placeholder tok::unknown. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198666 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify diagnostic tag type using the token kind formatterAlp Toker2014-01-06
| | | | | | As far as the parser is concerned the tag type is always a keyword. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198606 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use magic constants in the digraph diagnosticAlp Toker2014-01-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198605 91177308-0d34-0410-b5e6-96231b3b80d8
* Use token kind instead of '%select{.|->}0' in diagnosticAlp Toker2014-01-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198599 91177308-0d34-0410-b5e6-96231b3b80d8
* ExpectAndConsume: Diagnose errors automaticallyAlp Toker2014-01-01
| | | | | | | | | | | | | | 1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics using the generic diagnostic descriptions added in r197972, eliminating another set of trivial err_expected_* variations while maintaining existing behaviour. 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume family of functions are primitive parser operations that now have the well-defined property of operating on single tokens. Factoring out recovery exposes opportunities for more consistent and tailored error recover at the call sites instead of just relying on a bottled SkipUntil formula. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198270 91177308-0d34-0410-b5e6-96231b3b80d8
* Recover from errors in enum definitionSerge Pavlov2013-12-31
| | | | | | | | | | | Previously any error in enum definition body stopped parsing it. With this change parser tries to recover from errors. The patch fixes PR10982. Differential Revision: http://llvm-reviews.chandlerc.com/D2018 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198259 91177308-0d34-0410-b5e6-96231b3b80d8
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-24
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197972 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify type trait parsingAlp Toker2013-12-12
| | | | | | | | | | | | | | | | | Type trait parsing is all over the place at the moment with unary, binary and n-ary C++11 type traits that were developed independently at different points in clang's history. There's no good reason to handle them separately -- there are three parsers, three AST nodes and lots of duplicated handling code with slightly different implementations and diags for each kind. This commit unifies parsing of type traits and sets the stage for further consolidation. No change in behaviour other than more consistent error recovery. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197179 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the -Wkeyword-compat diag message more accurateAlp Toker2013-12-09
| | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196776 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC - Introducing objc_bridge_related attribute Fariborz Jahanian2013-12-04
| | | | | | | | | which specifies couple of (optional) method selectors for bridging a CFobject to or from an ObjectiveC object. This is wip. // rdsr://15499111 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196408 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix several crash-on-invalids when using template-ids that aren'tRichard Smith2013-12-04
| | | | | | | simple-template-ids (eg, 'operator+<int>') in weird places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196333 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit an extension warning when changing system header tokensAlp Toker2013-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | 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; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196212 91177308-0d34-0410-b5e6-96231b3b80d8
* PR17949: Fix crash if someone puts a namespace inside a class template.Richard Smith2013-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194872 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bogus diagnostic wording. There's no such thing as a compound expression.Richard Smith2013-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194849 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to recover a bit better if a close brace is missing from the end of a classRichard Smith2013-11-09
| | | | | | | | definition. If we see something that looks like a namespace definition inside a class, that strongly indicates that a close brace was missing somewhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194319 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Try to correct a mistyped "-" or ">" to "->" for some C++ cases."Kaelyn Uhrain2013-11-05
| | | | | | | Revert this patch until cases of rejected valid code (e.g. identifiers that require ADL to be resolved properly) are fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194088 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to correct a mistyped "-" or ">" to "->" for some C++ cases.Kaelyn Uhrain2013-11-04
| | | | | | | | | | | | Similar C code isn't caught as it seems to hit a different code path. Also, as the check is only done for record pointers, cases involving an overloaded operator-> are not handled either. Note that the reason this check is done in the parser instead of Sema is not related to having enough knowledge about the current state as it is about being able to fix up the parser's state to be able to recover and traverse the correct code paths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194002 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Cleanup and simplify anonymous union diagnosticsDavid Majnemer2013-11-02
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193919 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Flexible array members were introduced in C99, diagnose their use in C++David Majnemer2013-11-02
| | | | | | | | The declaration of a flexible array member was correctly diagnosed as an extension in C89 mode but not in C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193918 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused diagnostic.Benjamin Kramer2013-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193774 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out custom parsing for iboutletcollection and vec_type_hint attributesRichard Smith2013-10-31
| | | | | | | | | | into a separate "parse an attribute that takes a type argument" codepath. This results in both codepaths being a lot cleaner and simpler, and fixes some bugs where the type argument handling bled into the expression argument handling and caused us to both accept invalid and reject valid attribute arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193731 91177308-0d34-0410-b5e6-96231b3b80d8