summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix PR20069: bad loop pragma arguments crash FEEli Bendersky2014-06-191-12/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 211292
* [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when ↵Richard Smith2014-06-161-0/+6
| | | | | | declaring a template template parameter. llvm-svn: 211031
* [PPC64LE] Run some existing Altivec tests on powerpc64le as wellBill Schmidt2014-06-133-0/+5
| | | | | | | | | | | There are several Altivec tests that formerly ran only on big-endian targets (and in some cases only on 32-bit targets). It is useful to verify these on little-endian targets as well. While testing these, I discovered a typo in <altivec.h>. This is also fixed by this patch. llvm-svn: 210928
* Add loop unroll pragma supportEli Bendersky2014-06-111-4/+22
| | | | | | | | http://reviews.llvm.org/D4089 Patch by Mark Heffernan. llvm-svn: 210667
* PR19993: don't assert/crash if a static data member is initialized by '= ↵Richard Smith2014-06-111-0/+4
| | | | | | delete;'. llvm-svn: 210617
* *Really* fix DOS newlines introduced in r210330Reid Kleckner2014-06-101-132/+132
| | | | | | r210369 didn't quite catch all of them. llvm-svn: 210593
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-0/+132
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* Preprocessor: make C++ operator names as macro identifiers a compatible ↵Alp Toker2014-05-311-0/+3
| | | | | | | | | | | extension With recent changes, this is now a compatible language extension and can be safely enabled with -ms-extensions instead of requiring the full -ms-compatibility MSVC drop-in mode. As such we can now also emit an extension warning under -Wmicrosoft to help users port their code. llvm-svn: 209978
* Add a PR reference for XFAILed testAlp Toker2014-05-281-0/+2
| | | | llvm-svn: 209730
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-231-0/+28
| | | | | | | | | | | | | | | | '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. llvm-svn: 209510
* Improved recovery of switch statementSerge Pavlov2014-05-211-0/+50
| | | | | | | | | Make better diagnostic produced by erroneous switch statement. It fixes PR19022. Differential Revision: http://reviews.llvm.org/D3137 llvm-svn: 209302
* Preprocessor: support defined() with operator names for MS compatibilityAlp Toker2014-05-211-1/+1
| | | | | | | | | Also flesh out missing tests, improve diagnostic QOI and fix a couple of corner cases found in the process. Fixes PR10606. llvm-svn: 209276
* Replace completely bogus ambiguous-compound-literal-in-C++ code with somethingRichard Smith2014-05-151-1/+3
| | | | | | that isn't always wrong. llvm-svn: 208844
* PR19748: Make sure we don't lose colon protection after the parenthesized ↵Richard Smith2014-05-151-0/+11
| | | | | | type-id in a cast-expression. llvm-svn: 208843
* Revised wording for diagnostics in r208299Ismail Pazarbasi2014-05-091-3/+3
| | | | llvm-svn: 208401
* Suggest fix-it ':' when '=' used in for-range-declarationIsmail Pazarbasi2014-05-081-1/+33
| | | | | | | | | | Fix for PR19176. Clang will suggest a fix-it hint for cases like: int arr[] = {1, 2, 3, 4}; for (auto i = arr) ^ : llvm-svn: 208299
* Fix PR 19630, don't crash when file ends with whitespace.Richard Trieu2014-05-021-0/+13
| | | | llvm-svn: 207883
* Handle -fdelayed-template-parsing of out-of-line definitions ofHans Wennborg2014-05-021-0/+58
| | | | | | | | | | | class template member classes (PR19613) Also improve this code in general by implementing suggestions from Richard. Differential Revision: http://reviews.llvm.org/D3555?id=9020 llvm-svn: 207822
* Print detailed vector type information on diagnostics.Benjamin Kramer2014-04-253-5/+5
| | | | | | | | | | | | | | | | | | | | | | We never aka vector types because our attributed syntax for it is less comprehensible than the typedefs. This leaves the user in the dark when the typedef isn't named that well. Example: v2s v; v4f w; w = v; The naming in this cases isn't even that bad, but the error we give is useless without looking up the actual typedefs. t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s' Now: t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from incompatible type 'v2s' (vector of 2 'int' values) We do this for all diagnostics that print a vector type. llvm-svn: 207267
* [Parser] Remove "add -fmodules" from the "use of '@import' when modules are ↵Argyrios Kyrtzidis2014-04-171-1/+1
| | | | | | | | | disabled, add -fmodules" error. We disable modules for C++, at which point this is confusing. rdar://16641918 llvm-svn: 206440
* Fixing a typo, updating the diagnostic wording and logic based on ↵Aaron Ballman2014-04-152-2/+2
| | | | | | post-commit review feedback. Amends r206186. llvm-svn: 206229
* Properly diagnose Microsoft __declspec attributes which have optional ↵Aaron Ballman2014-04-141-0/+6
| | | | | | | | | | argument lists when the arguments are elided. eg) __declspec(deprecated()) // error __declspec(deprecated) // OK __declspec(deprecated("")) // OK llvm-svn: 206191
* Properly diagnose standard C++ attributes which have optional argument lists ↵Aaron Ballman2014-04-142-2/+8
| | | | | | | | | | | when the arguments are elided. eg) [[deprecated()]] // error [[deprecated]] // OK [[deprecated("")]] // OK [[gnu::deprecated()]] // OK llvm-svn: 206186
* Improve error recovery around colon.Serge Pavlov2014-04-131-0/+67
| | | | | | | | | | 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 llvm-svn: 206135
* PR19339: Disambiguate lambdas with init-captures from designated initializersRichard Smith2014-04-131-1/+9
| | | | | | properly. llvm-svn: 206128
* Driver: add target definition for Windows on ARMSaleem Abdulrasool2014-04-041-0/+10
| | | | | | | | | This introduces the definitions needed for the Windows on ARM target. Add target definitions for both the MSVC environment and the MSVC + Itanium C++ ABI environment. The Visual Studio definitions correspond to the definitions provided by Visual Studio 2012. llvm-svn: 205650
* Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda ↵David Blaikie2014-04-021-1/+1
| | | | | | | | | | | | at ... )') For namespaces, this is consistent with mangling and GCC's debug info behavior. For structs, GCC uses <anonymous struct> but we prefer consistency between all anonymous entities but don't want to confuse them with template arguments, etc, so we'll just go with parens in all cases. llvm-svn: 205398
* Unify __declspec attribute argument parsing with the common attribute ↵Aaron Ballman2014-03-311-3/+3
| | | | | | | | 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. llvm-svn: 205234
* Introduced an attribute syntax-neutral method for parsing attribute ↵Aaron Ballman2014-03-311-8/+9
| | | | | | arguments that is currently being used by GNU and C++-style attributes. This allows C++11 attributes with argument lists to be handled properly, fixing the "deprecated", "type_visibility", and capability-related attributes with arguments. llvm-svn: 205226
* Sema: Implement DR317David Majnemer2014-03-301-1/+1
| | | | | | | | | | | | | | | Summary: Declaring a function as inline after it has been defined is in violation of [dcl.fct.spec]p4. The program would get a strong definition instead of getting a function with linkonce_odr linkage. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3220 llvm-svn: 205129
* Objective-C. Improve diagnostic error for '@import' Fariborz Jahanian2014-03-261-1/+3
| | | | | | when modules are disabled. // rdar://15505492 llvm-svn: 204862
* Fix a typo in r204164 that made *all* keywords available in OpenCL mode.Richard Smith2014-03-181-0/+8
| | | | llvm-svn: 204196
* Implement the MS extension __identifier properly: take a token and strip it ofRichard Smith2014-03-151-0/+23
| | | | | | its keywordliness. llvm-svn: 203987
* Fix crash if delayed template parsing meets an erroneous trailing return type.Richard Smith2014-03-121-0/+2
| | | | | | | Based on a patch and test by Stephan Tolksdorf! Refactoring and fixing adjacent brokenness by me. llvm-svn: 203733
* Allow GNU-style attributes on lambda expressions.Aaron Ballman2014-03-121-1/+7
| | | | llvm-svn: 203628
* Improving test coverage for lambda expressions with attribute specifiers.Aaron Ballman2014-03-111-1/+12
| | | | llvm-svn: 203602
* Changing this test case to use an unknown attribute, since there are not ↵Aaron Ballman2014-03-111-1/+1
| | | | | | currently any type attributes which would apply to a lambda, except in MSVC compatibility mode. llvm-svn: 203566
* Gracefully handle an attribute specifier following a lambda introducer when ↵Aaron Ballman2014-03-111-0/+1
| | | | | | the parameter list wasn't present. llvm-svn: 203565
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-076-11/+11
| | | | llvm-svn: 203302
* Improve diagnostics for malformed constructor declarations (where lookup forRichard Smith2014-03-031-1/+17
| | | | | | the type of the first parameter fails, and it is the only, unnamed, parameter). llvm-svn: 202759
* Fix crash when both ExpectAndConsume and ConsumeAnyToken emit diagnosticsAlp Toker2014-02-231-0/+6
| | | | | | | | | The DiagnosticBuilder's lifetime in parser typo recovery was overlapping with the subsequent consume which can itself emit PP diagnostics. Patch by Olivier Goffart! llvm-svn: 201965
* PR13110: Add a -Wignored-qualifiers warning when ignoring a const, volatile, orRichard Smith2014-02-192-2/+2
| | | | | | _Atomic qualifier applied to a reference type. llvm-svn: 201620
* PR18870: Parse language linkage specifiers properly if the string-literal isRichard Smith2014-02-171-1/+1
| | | | | | spelled in an interesting way. llvm-svn: 201536
* PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.Richard Smith2014-02-171-0/+32
| | | | llvm-svn: 201532
* Allow virt-specifiers after GNU attributes in member-declarators. GCC doesn'tRichard Smith2014-01-241-1/+2
| | | | | | | | | | | allow this, and we should warn on it, but it turns out that people were already relying on this. We should introduce a -Wgcc-compat warning for this if the attributes are known to GCC, but we don't currently track enough information about attributes to do so reliably. llvm-svn: 200045
* Factor out repeated parsing of a member-declarator when parsing aRichard Smith2014-01-231-0/+6
| | | | | | | | | | member-declaration. In the process, fix a couple of bugs that had crept in where we would parse the first and subsequent member-declarators differently (in particular, we didn't accept an asm-label on a member function definition within a class, and we would accept virt-specifiers and attributes in the wrong order on the first declarator but not on subsequent ones). llvm-svn: 199957
* Fix to PR8880 (clang dies processing a for loop)Serge Pavlov2014-01-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | 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; }); ) This code is rejected by GCC if compiled in C mode but is accepted in C++ code. GCC bug 44715 tracks this discrepancy. Clang used code generation that differs from GCC in both modes: only statement of the third expression of 'for' behaves as if it was inside loop body. This change makes code generation more close to GCC, considering 'break' or 'continue' statement in condition and increment expressions of a loop as it was inside the loop body. It also adds error for the cases when 'break'/'continue' appear outside loop due to this syntax. If code generation differ from GCC, warning is issued. Differential Revision: http://llvm-reviews.chandlerc.com/D2518 llvm-svn: 199897
* Move a bunch of tests to directly use the CC1 layer. This at least savesChandler Carruth2014-01-151-1/+1
| | | | | | | | | | | a subprocess invocation which is pretty significant on Windows. It also likely saves a bunch of thrashing the host machine needlessly. Finally it makes the tests much more predictable and less dependent on the host. For example 'header_lookup1.c' was passing '-fno-ms-extensions' just to thwart the host detection adding it into the compilation. By runnig CC1 directly we don't have to deal with such oddities. llvm-svn: 199308
* Downgrade bogus ExtWarn on duplicate 'friend' specifier to a Warning, and add aRichard Smith2014-01-102-6/+24
| | | | | | Warning for a duplicate 'constexpr' specifier. llvm-svn: 198956
* Fix bungled parse recovery in K&R function declarationsAlp Toker2014-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void knrNoSemi(i) int i { } Adherents of The C Programming Language unfortunate enough to miss a semicolon as above would be met with a cascade of errors spanning the remainder of the TU. This patch introduces a beautiful parse error recovery, complete with helpful FixIt to restore sanity. Before (output redacted for brevity): error: 'error' diagnostics seen but not expected: File declarators.c Line 119: declaration does not declare a parameter File declarators.c Line 123: declaration does not declare a parameter File declarators.c Line 127: parameter named 'func_E12' is missing File declarators.c Line 127: expected ';' at end of declaration File declarators.c Line 133: parameter named 'func_E13' is missing File declarators.c Line 133: expected ';' at end of declaration File declarators.c Line 139: parameter named 'func_E14' is missing File declarators.c Line 139: expected ';' at end of declaration File declarators.c Line 145: parameter named 'func_E15' is missing File declarators.c Line 145: expected ';' at end of declaration File declarators.c Line 150: expected function body after function declarator File declarators.c Line 119: declaration of 'enum E11' will not be visible outside of this function File declarators.c Line 123: declaration of 'enum E12' will not be visible outside of this function File declarators.c Line 133: ISO C forbids forward references to 'enum' types File declarators.c Line 133: declaration of 'enum E13' will not be visible outside of this function File declarators.c Line 139: ISO C forbids forward references to 'enum' types File declarators.c Line 139: declaration of 'enum E14' will not be visible outside of this function File declarators.c Line 145: ISO C forbids forward references to 'enum' types File declarators.c Line 145: declaration of 'enum E15' will not be visible outside of this function ... After: declarators.c:103:24: error: expected ';' at end of declaration void knrNoSemi(i) int i { } ^ ; Patch found in a sealed envelope dated 1978 with the message "Do not open until January 2014" llvm-svn: 198540
OpenPOWER on IntegriCloud