summaryrefslogtreecommitdiff
path: root/test/Parser
Commit message (Collapse)AuthorAge
* Don't allow dllimport variables in constant initializersHans Wennborg2014-06-25
| | | | | | | | | | | | | | | | | This is a follow-up to David's r211677. For the following code, we would end up referring to 'foo' in the initializer for 'arr', and then fail to link, because 'foo' is dllimport and needs to be accessed through the __imp_?foo. __declspec(dllimport) extern const char foo[]; const char* f() { static const char* const arr[] = { foo }; return arr[0]; } Differential Revision: http://reviews.llvm.org/D4299 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211736 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parsing nested __if_exists blocksReid Kleckner2014-06-25
| | | | | | | | | | | Rather than having kw___if_exists be a special case of ParseCompoundStatementBody, we can look for kw___if_exists in the big switch over for valid statement tokens in ParseStatementOrDeclaration. Nested __if_exists blocks are used in the DECLARE_REGISTRY_RESOURCEID macro from atlcom.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211654 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a missing test for the __if_exists extensionReid Kleckner2014-06-25
| | | | | | | MSVC does not create a new scope for the body of an __if_exists compound statement. Clang already gets this right today, but it was untested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211650 91177308-0d34-0410-b5e6-96231b3b80d8
* Split tests for __if_exists out into their own fileReid Kleckner2014-06-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211649 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 PR20081: Parsing templates in the presence of -x cuda -std=c++11Eli Bendersky2014-06-20
| | | | | | | | http://reviews.llvm.org/D4222 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211357 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 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
* [PPC64LE] Run some existing Altivec tests on powerpc64le as wellBill Schmidt2014-06-13
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210928 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
* PR19993: don't assert/crash if a static data member is initialized by '= ↵Richard Smith2014-06-11
| | | | | | delete;'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210617 91177308-0d34-0410-b5e6-96231b3b80d8
* *Really* fix DOS newlines introduced in r210330Reid Kleckner2014-06-10
| | | | | | r210369 didn't quite catch all of them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210593 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
* Preprocessor: make C++ operator names as macro identifiers a compatible ↵Alp Toker2014-05-31
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209978 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a PR reference for XFAILed testAlp Toker2014-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209730 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
* Improved recovery of switch statementSerge Pavlov2014-05-21
| | | | | | | | | | Make better diagnostic produced by erroneous switch statement. It fixes PR19022. Differential Revision: http://reviews.llvm.org/D3137 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209302 91177308-0d34-0410-b5e6-96231b3b80d8
* Preprocessor: support defined() with operator names for MS compatibilityAlp Toker2014-05-21
| | | | | | | | | Also flesh out missing tests, improve diagnostic QOI and fix a couple of corner cases found in the process. Fixes PR10606. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209276 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace completely bogus ambiguous-compound-literal-in-C++ code with somethingRichard Smith2014-05-15
| | | | | | | that isn't always wrong. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208844 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19748: Make sure we don't lose colon protection after the parenthesized ↵Richard Smith2014-05-15
| | | | | | type-id in a cast-expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208843 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
* Fix PR 19630, don't crash when file ends with whitespace.Richard Trieu2014-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207883 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle -fdelayed-template-parsing of out-of-line definitions ofHans Wennborg2014-05-02
| | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207822 91177308-0d34-0410-b5e6-96231b3b80d8
* Print detailed vector type information on diagnostics.Benjamin Kramer2014-04-25
| | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207267 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 Microsoft __declspec attributes which have optional ↵Aaron Ballman2014-04-14
| | | | | | | | | | argument lists when the arguments are elided. eg) __declspec(deprecated()) // error __declspec(deprecated) // OK __declspec(deprecated("")) // OK git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206191 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
* PR19339: Disambiguate lambdas with init-captures from designated initializersRichard Smith2014-04-13
| | | | | | | properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206128 91177308-0d34-0410-b5e6-96231b3b80d8
* Driver: add target definition for Windows on ARMSaleem Abdulrasool2014-04-04
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205650 91177308-0d34-0410-b5e6-96231b3b80d8
* Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda ↵David Blaikie2014-04-02
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205398 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
* Introduced an attribute syntax-neutral method for parsing attribute ↵Aaron Ballman2014-03-31
| | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205226 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Implement DR317David Majnemer2014-03-30
| | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205129 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
* Fix a typo in r204164 that made *all* keywords available in OpenCL mode.Richard Smith2014-03-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204196 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the MS extension __identifier properly: take a token and strip it ofRichard Smith2014-03-15
| | | | | | | its keywordliness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203987 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash if delayed template parsing meets an erroneous trailing return type.Richard Smith2014-03-12
| | | | | | | | Based on a patch and test by Stephan Tolksdorf! Refactoring and fixing adjacent brokenness by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203733 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow GNU-style attributes on lambda expressions.Aaron Ballman2014-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203628 91177308-0d34-0410-b5e6-96231b3b80d8
* Improving test coverage for lambda expressions with attribute specifiers.Aaron Ballman2014-03-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203602 91177308-0d34-0410-b5e6-96231b3b80d8
* Changing this test case to use an unknown attribute, since there are not ↵Aaron Ballman2014-03-11
| | | | | | currently any type attributes which would apply to a lambda, except in MSVC compatibility mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203566 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
* Improve diagnostics for malformed constructor declarations (where lookup forRichard Smith2014-03-03
| | | | | | | the type of the first parameter fails, and it is the only, unnamed, parameter). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202759 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash when both ExpectAndConsume and ConsumeAnyToken emit diagnosticsAlp Toker2014-02-23
| | | | | | | | | The DiagnosticBuilder's lifetime in parser typo recovery was overlapping with the subsequent consume which can itself emit PP diagnostics. Patch by Olivier Goffart! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201965 91177308-0d34-0410-b5e6-96231b3b80d8
* PR13110: Add a -Wignored-qualifiers warning when ignoring a const, volatile, orRichard Smith2014-02-19
| | | | | | | _Atomic qualifier applied to a reference type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201620 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18870: Parse language linkage specifiers properly if the string-literal isRichard Smith2014-02-17
| | | | | | | spelled in an interesting way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201536 91177308-0d34-0410-b5e6-96231b3b80d8
* PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.Richard Smith2014-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201532 91177308-0d34-0410-b5e6-96231b3b80d8