summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
* parser: diagnose empty attribute blocksSaleem Abdulrasool2015-06-161-0/+2
| | | | | | | | | | | MS attributes do not permit empty attribute blocks. Correctly diagnose those. We continue to parse to ensure that we recover correctly. Because the block is empty, we do not need to skip any tokens. Bonus: tweak the comment that I updated but forgot to remove the function name in a previous commit. llvm-svn: 239846
* parser: improve diagnostics for MS attributesSaleem Abdulrasool2015-06-151-0/+3
| | | | | | | | Switch to using BalancedDelimiterTracker to get better diagnostics for unbalanced delimiters. This still does not handle any of the attributes, simply improves the parsing. llvm-svn: 239758
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-112-4/+38
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* Correct Loop Hint Diagnostic MessageTyler Nowicki2015-06-081-1/+1
| | | | | | When pragma clang loop unroll() is specified without an argument the diagnostic message should inform that user that 'full' and 'disable' are valid arguments (not 'enable'). llvm-svn: 239363
* __declspec is not a core Clang language extension. Instead, require ↵Aaron Ballman2015-05-261-1/+0
| | | | | | | -fms-extensions or -fborland to enable the language extension. Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets. llvm-svn: 238238
* Add a new error for unexpected semi-colon before closing delimiter.Richard Trieu2015-05-122-3/+17
| | | | | | | | | Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or '}', two errors and one note would emitted, and the parsing would get confused to which scope it was in. This change consumes the semi-colon, recovers parsing better, and emits only one error with a fix-it. llvm-svn: 237192
* Allow empty assembly string literal with -fno-gnu-inline-asmSteven Wu2015-05-121-0/+3
| | | | | | | | | Empty assembly string will not introduce assembly code in the output binary and it is often used as a trick in the header to disable optimizations. It doesn't conflict with the purpose of the option so it is allowed with -fno-gnu-inline-asm flag. llvm-svn: 237073
* Allow AsmLabel with -fno-gnu-inline-asmSteven Wu2015-05-111-0/+4
| | | | | | | | | | | | | | | | | | | Summary: AsmLabel is heavily used in system level and firmware to redirect function and access platform specific labels. They are also extensively used in system headers which makes this option unusable for many users. Since AsmLabel doesn't introduce any assembly code into the output binary, it shouldn't be considered as inline-asm. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9679 llvm-svn: 237048
* Adjust the wording of the "brackets go after the unqualified-id" error ↵Nick Lewycky2015-05-012-16/+24
| | | | | | message. It applies in cases that aren't unqualified-ids. llvm-svn: 236344
* Fix the end location of init-capture annotations in ObjC++Ben Langmuir2015-04-301-0/+13
| | | | | | | | | | | | | And thereby stop asserting. In ObjC++ modes, we tentatively parse the lambda introducer twice: once to disambiguate designators, which we also do in C++, and a second time to disambiguate objc message expressions. During the second tentative parse, the last cached token will be the annotation token we built in the first parse. So use getLastLoc() to get the correct end location for the rebuilt annotation. llvm-svn: 236246
* Fix -fno-gnu-inline-asm doesn't catch file scope asmSteven Wu2015-04-281-0/+1
| | | | | | | | | | | | | | | | | | Summary: FileScopeAsm should be treated the same as funcion level inline asm. -fno-gnu-inline-asm should trigger an error if file scope asm is used. I missed this case from r226340. This should not affect ms-extension because it is not allowed in the file scope. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9328 llvm-svn: 236044
* [MS ABI] Correctly associate align attrs before the class-keyDavid Majnemer2015-04-192-0/+16
| | | | | | | | | | | | __declspec(align(...)) is unlike all other attributes in that it is not applied to a variable if it appears before the class-key. If the tag in question isn't part of a variable declaration, it is not ignored. Instead, the alignment attribute is applied to the tag. This fixes PR18024. llvm-svn: 235272
* [parse] Don't crash on alternative operator spellings from macros in c++11 ↵Benjamin Kramer2015-03-291-0/+7
| | | | | | | | attributes. Found by afl-fuzz. llvm-svn: 233499
* [parser] Push _Atomic locs through DeclaratorChunk.Benjamin Kramer2015-03-291-0/+2
| | | | | | | Otherwise it stays uninitialized with potentially catastrophic results. Found by afl-fuzz. llvm-svn: 233494
* [Parse] Don't crash on ~A::{Benjamin Kramer2015-03-291-0/+1
| | | | | | Found by clang-fuzz. llvm-svn: 233492
* Parse: Don't assume tokens have a lengthDavid Majnemer2015-03-191-0/+5
| | | | | | | Don't crash if the last token in a bad inline method body is an annotation token. llvm-svn: 232694
* Appease clang/test/Parser/opencl-atomics-cl20.cl for 32-bit targets with ↵NAKAMURA Takumi2015-03-181-3/+3
| | | | | | explicit triple. llvm-svn: 232638
* OpenCL: CL2.0 atomic typesAnastasia Stulova2015-03-181-0/+56
| | | | | | | | | | | | OpenCL C Spec v2.0 Section 6.13.11 - Made c11 _Atomic being not accepted for OpenCL - Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef - Added diagnostics for atomics Khronos extension enabling llvm-svn: 232631
* Reverted OpenCL2.0 atomic type commits r231932, r231935Anastasia Stulova2015-03-111-69/+0
| | | | | | (caused undesirable update of -std flag to use _Atomic) llvm-svn: 231942
* OpenCL: CL2.0 atomic type diagnosticsAnastasia Stulova2015-03-111-0/+13
| | | | | | Added restictions for atomic type usage from OpenCL C Spec Section 6.13.11.8 llvm-svn: 231935
* OpenCL: CL2.0 atomic typesAnastasia Stulova2015-03-111-0/+56
| | | | | | | | | | | | OpenCL C Spec v2.0 Section 6.13.11 - Made c11 _Atomic being accepted only for c11 compilations - Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef - Added diagnostics for atomics Khronos extension enabling llvm-svn: 231932
* Add builtins for the 64-bit vector integer arithmetic instructions added in ↵Kit Barton2015-03-112-12/+13
| | | | | | | | | | POWER8. These are the Clang-related changes for the instructions added to LLVM in http://reviews.llvm.org/D7959. Phabricator review: http://reviews.llvm.org/D8041 llvm-svn: 231931
* [PowerPC]Activate "vector bool long long" (and alternate spellings) as a ↵Bill Seurer2015-03-032-5/+22
| | | | | | | | | | | | valid type for Altivec support for Power. There are two test case updates for very basic testing. While I was editing cxx-altivec.cpp I also updated it to better match some other changes in altivec.c. Note: "vector bool long" was not also added because its use is considered deprecated. http://reviews.llvm.org/D7235 llvm-svn: 231118
* Remove obsolete FIXME. override on definitions is fine.Nico Weber2015-03-031-4/+2
| | | | llvm-svn: 231053
* Sema: __assume with side effects shouldn't result in invalid AST nodesDavid Majnemer2015-02-261-1/+17
| | | | | | | | We'd diagnose an __assume expression which contained a function call. This would result in us wrongly returning ExprError, causing mysterious failures later on. llvm-svn: 230597
* Don't crash on missing '{' after __except or __finally, PR22687.Nico Weber2015-02-251-0/+24
| | | | | | Also add some general test/Parser coverage for SEH blocks. llvm-svn: 230449
* Revert "Improve declaration / expression disambiguation around ↵Justin Bogner2015-02-233-18/+2
| | | | | | | | | | | ptr-operators, and use" This seems to break mixing function-style and c-style casts, and is breaking bootstrapping llvm. This reverts r230261. llvm-svn: 230274
* Improve declaration / expression disambiguation around ptr-operators, and useRichard Smith2015-02-233-2/+18
| | | | | | | | the presence of an abstract declarator with a ptr-operator as proof that a construct cannot parse as an expression to improve diagnostics along error recovery paths. llvm-svn: 230261
* Minor tweaks to r229447 to ensure the attribute is properly quoted when ↵Aaron Ballman2015-02-161-4/+4
| | | | | | diagnosed. llvm-svn: 229454
* Sema: diagnose use of unscoped deprecated prior to C++14Saleem Abdulrasool2015-02-161-1/+6
| | | | | | | | | The deprecated attribute was adopted as part of the C++14, however, there is a GNU version available in C++11. When using C++ earlier than C++14, diagnose the use of the attribute without the GNU scope, but only when using the generalised attribute syntax. llvm-svn: 229447
* Add more tests for crashes that happend to be fixed by r229288.Larisse Voufo2015-02-151-0/+214
| | | | llvm-svn: 229294
* Don't crash on `struct ::, struct ::` (and the same for enums).Larisse Voufo2015-02-151-214/+0
| | | | | | | | | | | | | | | | | | | The first part of that line doesn't parse correctly and ParseClassSpecifier() for some reason skips to tok::comma to recover, and then ParseDeclarationSpecifiers() sees the next struct and calls ParseClassSpecifier() again with the same DeclSpec object. However, the first call already called ActOnCXXGlobalScopeSpecifier() on the DeclSpec's CXXScopeSpec, and sema gets confused when this gets called again. As a fix, let ParseClassSpecifier() (and ParseEnumSpecifier()) call ParseOptionalCXXScopeSpec() with a temporary CXXScopeSpec object, and only copy it into the DeclSpec if things work out. (This is also how all the other functions that set the DeclSpec's TypeSpecScope set it.) Found by SLi's bot. llvm-svn: 229293
* Add more tests for crashes that happend to be fixed by r229288.Nico Weber2015-02-151-0/+2
| | | | llvm-svn: 229289
* Don't crash on `struct ::, struct ::` (and the same for enums).Nico Weber2015-02-151-1/+9
| | | | | | | | | | | | | | | | | | | The first part of that line doesn't parse correctly and ParseClassSpecifier() for some reason skips to tok::comma to recover, and then ParseDeclarationSpecifiers() sees the next struct and calls ParseClassSpecifier() again with the same DeclSpec object. However, the first call already called ActOnCXXGlobalScopeSpecifier() on the DeclSpec's CXXScopeSpec, and sema gets confused when this gets called again. As a fix, let ParseClassSpecifier() (and ParseEnumSpecifier()) call ParseOptionalCXXScopeSpec() with a temporary CXXScopeSpec object, and only copy it into the DeclSpec if things work out. (This is also how all the other functions that set the DeclSpec's TypeSpecScope set it.) Found by SLi's bot. llvm-svn: 229288
* Fix REQUIRES lines on tests from r228735. Thanks Kristof for pointing out ↵Pete Cooper2015-02-111-1/+1
| | | | | | the missing commas llvm-svn: 228870
* Add a warning for direct-list-initialization of a variable with a deduced typeRichard Smith2015-02-112-2/+2
| | | | | | | | (or of a lambda init-capture, which is sort-of such a variable). The semantics of such constructs will change when we implement N3922, so we intend to warn on this in Clang 3.6 then change the semantics in Clang 3.7. llvm-svn: 228792
* Check for backtraces in tests which are verifying pretty stack traces from a ↵Pete Cooper2015-02-101-1/+2
| | | | | | | | | | crashing clang. PrettyStackTrace now requires the ENABLE_BACKTRACES option. We need to check for that here or these tests fail llvm-lit. Reviewed by chandlerc llvm-svn: 228735
* Sema: Add support for __declspec(restrict)David Majnemer2015-02-041-1/+1
| | | | | | | | | | __declspec(restrict) and __attribute(malloc) are both handled identically by clang: they are allowed to the noalias LLVM attribute. Seeing as how noalias models the C99 notion of 'restrict', rename the internal clang attribute to Restrict from Malloc. llvm-svn: 228120
* MS ABI: Implement support for 'novtable'David Majnemer2015-02-021-1/+1
| | | | | | | | | | It is common for COM interface classes to be marked as 'novtable' to tell the compiler that constructors and destructors should not reference virtual function tables. This commit implements this feature in clang. llvm-svn: 227796
* Follow-up to r217302: Don't crash on ~A::A in a postfix expr suffix followed ↵Nico Weber2015-02-021-0/+5
| | | | | | | | | | | | | | | | | by '<'. This used to crash, complaining "ObjectType and scope specifier cannot coexist": struct A { } b = b.~A::A <int>; The only other caller of ParseOptionalCXXScopeSpecifier() that passes in a non-empty ObjectType clears the ObjectType of the scope specifier comes back non-empty (see the tok::period case in Parser::ParsePostfixExpressionSuffix()), so do that here too. Found by SLi's bot. llvm-svn: 227781
* Follow-up to r217302 and r227555: Don't crash on inline ~A::A() if A is an int.Nico Weber2015-01-301-0/+15
| | | | | | | | | | | | | | | | | | | Even with r227555, this still crashed: struct S { int A; ~A::A() {} }; That's because ParseOptionalCXXScopeSpecifier()'s call to ActOnCXXNestedNameSpecifier() doesn't mark the scope spec as invalid if sema thought it's a good idea to fixit-correct "::" to ":". For the diagnostic improvement done in r217302, we never want :: to be interpreted as :, so fix this by setting ColonSacred to false temporarily. Found by SLi's bot. llvm-svn: 227581
* Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.Nico Weber2015-01-301-0/+2
| | | | llvm-svn: 227555
* Disable a couple of crash-* tests for now. It seems they might be ↵NAKAMURA Takumi2015-01-291-0/+3
| | | | | | incompatible to win32. llvm-svn: 227434
* Update error message text.Serge Pavlov2015-01-181-9/+9
| | | | | | | | | Previously if an enumeration was used in a nested name specifier in pre-C++11 language dialect, error message was 'XXX is not a class, namespace, or scoped enumeration'. This patch removes the word 'scoped' as in C++11 any enumeration may be used in this context. llvm-svn: 226410
* If a function decl cannot be merged, mark it as invalid.Nico Weber2015-01-172-4/+4
| | | | | | | | | | | | | | | | | | | Clang currently crashes on class C { C() = default; C() = delete; }; My cunning plan for fixing this was to change the `if (!FnD)` in Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but alas, the second constructor decl wasn't marked as invalid. This lets Sema::MergeFunctionDecl() return true on function redeclarations, which leads to them being marked invalid. This also improves error messages when functions are redeclared. llvm-svn: 226365
* Adding option -fno-inline-asm to disallow inline asmSteven Wu2015-01-162-0/+9
| | | | | | | | | | | | | | | | Summary: This patch add a new option to dis-allow all inline asm. Any GCC style inline asm will be reported as an error. Reviewers: rnk, echristo Reviewed By: rnk, echristo Subscribers: bob.wilson, rnk, echristo, rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D6870 llvm-svn: 226340
* Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.Richard Smith2015-01-151-2/+8
| | | | llvm-svn: 226067
* Parse: Don't crash when default argument in typedef consists of sole '='David Majnemer2015-01-131-0/+1
| | | | | | | | We'd crash trying to make the SourceRange for the tokens we'd like to highlight. Don't assume there is more than one token makes up the default argument. llvm-svn: 225774
* Parse: Don't crash if missing an initializer expressionDavid Majnemer2015-01-131-0/+4
| | | | llvm-svn: 225768
* Parse: use the EOF token method to lex inline method bodiesDavid Majnemer2015-01-131-2/+2
| | | | | | | | Mark the end of the method body with an EOF token, collect it once we expect to be done with method body parsing. No functionality change intended. llvm-svn: 225765
OpenPOWER on IntegriCloud