summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify EnterTokenStream API to make it more robust for memory managementDavid Blaikie2016-02-097-98/+69
| | | | | | | | | | | | | | | While this won't help fix things like the bug that r260219 addressed, it seems like good tidy up to have anyway. (it might be nice if "makeArrayRef" always produced a MutableArrayRef & let it decay to an ArrayRef when needed - then I'd use that for the MutableArrayRefs in this patch) If we had std::dynarray I'd use that instead of unique_ptr+size_t, ideally (but then it'd have to be threaded down through the Preprocessor all the way - no idea how painful that would be) llvm-svn: 260246
* [Parser] Perform CachedTokens update dependent on token consumptionBruno Cardoso Lopes2016-02-051-2/+6
| | | | | | | | | | | | | | In the context where we break one tok::greatergreater into two tok::greater in order to correctly update the cached tokens; update the CachedTokens with two tok::greater only if ParseGreaterThanInTemplateList clients asks to consume the last token. Otherwise we only need to add one because the second is already added later on, as a not yet cached token. Differential Revision: http://reviews.llvm.org/D16906 rdar://problem/24488367 llvm-svn: 259910
* PR23057: fix use-after-free due to local token buffer in ↵Alexey Bataev2016-02-041-1/+19
| | | | | | | | | | ParseCXXAmbiguousParenExpression, by Dmitry Polukhin Differential Revision: http://reviews.llvm.org/D16572 A test/Parser/cxx-ambig-paren-expr-asan.cpp M lib/Parse/ParseExprCXX.cpp llvm-svn: 259750
* Fix regression from r259622: the operand of an increment that is the operand ofRichard Smith2016-02-031-2/+2
| | | | | | | a cast expression is not the operand of a cast expression itself, so if it's parenthesized we need to form a ParenExpr not a ParenListExpr. llvm-svn: 259677
* [OpenMP] Parsing + sema for target parallel for directive.Arpith Chacko Jacob2016-02-031-3/+6
| | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel for directive along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16759 llvm-svn: 259654
* [OpenCL] Adding reserved operator logical xor for OpenCLAnastasia Stulova2016-02-031-0/+3
| | | | | | | | | | | | | | | | | | This patch adds the reserved operator ^^ when compiling for OpenCL (spec v1.1 s6.3.g), which results in a more meaningful error message. Patch by Neil Hickey! Review: http://reviews.llvm.org/D13280 M test/SemaOpenCL/unsupported.cl M include/clang/Basic/TokenKinds.def M include/clang/Basic/DiagnosticParseKinds.td M lib/Basic/OperatorPrecedence.cpp M lib/Lex/Lexer.cpp M lib/Parse/ParseExpr.cpp llvm-svn: 259651
* -inline-asm][X86] Add ability to use AVX512 in MS inline asmMarina Yatsina2016-02-031-1/+6
| | | | | | | | | Defined the new AVX512 registers in clang inline asm. Fixed a bug in the MC subtarget info creation during the parsing of MS asm statement - now it receives the actual CPU and target features information. Differential Revision: http://reviews.llvm.org/D16757 llvm-svn: 259639
* Fix miscompile and rejects-valids when disambiguating after an ambiguousRichard Smith2016-02-031-3/+12
| | | | | | | C-style-cast to function/array type or parenthesized function-style cast/array indexing. llvm-svn: 259622
* Fix rejects-valid when forming a pointer-to-member with 'decltype(expr)::*'.Richard Smith2016-02-021-1/+1
| | | | llvm-svn: 259604
* PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid ↵Denis Zobnin2016-02-021-1/+3
| | | | | | | | | | | for-range expression. Fix the issue discovered by fuzzing (PR23057, comment 18) by handling nullptr in Sema::ActOnCXXForRangeDecl and correct delayed typos in for-range expression before calling Sema::ActOnCXXForRangeStmt. Also fixes PR26288. Differential Revision: http://reviews.llvm.org/D16630 llvm-svn: 259532
* [Parser] Update CachedTokens while parsing ObjectiveC template argument listBruno Cardoso Lopes2016-01-311-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the following ObjC++ snippet: -- @protocol PA; @protocol PB; @class NSArray<ObjectType>; typedef int some_t; id<PA> FA(NSArray<id<PB>> *h, some_t group); -- This would hit an assertion in the parser after generating an annotation token while trying to update the token cache: Assertion failed: (CachedTokens[CachedLexPos-1].getLastLoc() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token") ... 7 clang::Preprocessor::AnnotatePreviousCachedTokens(clang::Token const&) + 494 8 clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool, bool, clang::CXXScopeSpec&, bool) + 1163 9 clang::Parser::TryAnnotateTypeOrScopeToken(bool, bool) + 361 10 clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*) + 598 ... The cached preprocessor token in this case is: greatergreater '>>' Loc=<testcase.mm:7:24> while the annotation ("NSArray<id<PB>>") ends at "testcase.mm:7:25", hence the assertion. Properly update the CachedTokens during template parsing to contain two greater tokens instead of a greatergreater. Differential Revision: http://reviews.llvm.org/D15173 rdar://problem/23494277 llvm-svn: 259311
* Class Property: parse @dynamic (class).Manman Ren2016-01-291-0/+26
| | | | | | rdar://23891898 llvm-svn: 259224
* Include RecordDecls from anonymous unions in the AST.Nico Weber2016-01-284-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For void f() { union { int i; }; } clang used to omit the RecordDecl from the anonymous union from the AST. That's because the code creating it only called PushOnScopeChains(), which adds it to the current DeclContext, which here is the function's DeclContext. But RecursiveASTVisitor doesn't descent into all decls in a FunctionDecl. Instead, for DeclContexts that contain statements, return the RecordDecl so that it can be included in the DeclStmt containing the VarDecl for the union. Interesting bits from the AST before this change: |-FunctionDecl | `-CompoundStmt | |-DeclStmt | | `-VarDecl 0x589cd60 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit After this change: -FunctionDecl | `-CompoundStmt | |-DeclStmt | | |-CXXRecordDecl 0x4612e48 <col:3, col:18> col:3 union definition | | | |-FieldDecl 0x4612f70 <col:11, col:15> col:15 referenced i 'int' | | `-VarDecl 0x4613010 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit This is now closer to how anonymous struct and unions are represented as members of structs. It also enabled deleting some one-off code in the template instantiation code. Finally, it fixes a crash with ASTMatchers, see the included test case (this fixes http://crbug.com/580749). llvm-svn: 259079
* Class Property: class property and instance property can have the same name.Manman Ren2016-01-281-4/+8
| | | | | | | | | | | | | | | | | | | Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name of the property: ObjCPropertyDecl::findPropertyDecl, ObjCContainerDecl::FindPropertyDeclaration, ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass, ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl. ObjCPropertyQueryKind currently has 3 values: OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class This extra parameter specifies that we are looking for an instance property with the given name, or a class property with the given name, or any property with the given name (if both exist, the instance property will be returned). rdar://23891898 llvm-svn: 259070
* Update for LLVM change.Benjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258918
* Remove autoconf supportChris Bieneman2016-01-261-18/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Class Property: parse property attribute (class).Manman Ren2016-01-261-0/+3
| | | | | | | | | This is the third patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258834
* [OpenMP] Parsing + sema for target parallel directive.Arpith Chacko Jacob2016-01-261-2/+6
| | | | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel directive and its clauses along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16553 Rebased to current trunk and updated test cases. llvm-svn: 258832
* [OpenMP] Parsing + sema for defaultmap clause.Arpith Chacko Jacob2016-01-261-0/+26
| | | | | | | | | | | Summary: This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others). Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16527 llvm-svn: 258817
* [OpenMP] Update map clause SEMA to support OpenMP 4.5 possible list items.Samuel Antao2016-01-221-6/+5
| | | | | | | | | | | | | | | | | Summary: Extend support in the map clause SEMA for the expressions supported in the OpenMP 4.5 specification, namely member expressions. Fix some bugs in the previous implementation of SEMA related with expressions that do not consist of single variable references. Fix bug in parsing when the expression in the map clause do not start with an identifier: accept any expression in the map clause and check for validity in SEMA instead of just ignoring it. Reviewers: hfinkel, kkwli0, arpith-jacob, carlo.bertolli, ABataev Subscribers: cfe-commits, fraggamuffin, caomhin Differential Revision: http://reviews.llvm.org/D16385 llvm-svn: 258543
* Fix infinite loop when ::new or ::delete are found in member initializer ↵Alexey Bataev2016-01-201-12/+14
| | | | | | | | | list, by Denis Zobnin Fix for an infinite loop on parsing ::new or ::delete in member initializer list, found by fuzzing PR23057, comment #33. Skip the rest of the member initializers if the previous initializer was invalid. Differential Revision: http://reviews.llvm.org/D16216 llvm-svn: 258290
* [OpenMP] Detect implicit map type to report unspecified map type for target ↵Samuel Antao2016-01-191-2/+7
| | | | | | | | | | | | | | | | | | | | enter/exit data directives. Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data': - A map-type must be specified in all map clauses. I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case: #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}} and distinguish it from: #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}} Patch by Arpith Jacob. Thanks! llvm-svn: 258179
* [OpenMP] Parsing + sema for "target exit data" directive.Samuel Antao2016-01-191-4/+12
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258177
* [OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao2016-01-191-5/+14
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258165
* OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedefDavid Blaikie2016-01-1510-156/+115
| | | | llvm-svn: 257958
* OpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedefDavid Blaikie2016-01-151-5/+4
| | | | llvm-svn: 257957
* OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedefDavid Blaikie2016-01-156-72/+72
| | | | llvm-svn: 257956
* Add OpenMP dist_schedule clause to distribute directive and related ↵Carlo Bertolli2016-01-151-2/+13
| | | | | | regression tests. llvm-svn: 257917
* [OPENMP] Fix for declarative/standalone directives use.Alexey Bataev2016-01-132-21/+36
| | | | | | Fixes processing of declarative directives and standalone executable directives. Declarative directives should not be allowed as an immediate statements and standalone executable directives are allowed to be used in case-stmt constructs. llvm-svn: 257586
* Improve AST dumping:Richard Smith2016-01-123-0/+18
| | | | | | | | 1) When dumping a declaration that declares a name for a type, also dump the named type. 2) Add a #pragma clang __debug dump X, that dumps the lookup results for X in the current context. llvm-svn: 257529
* Properly track the end location of an exception specification.Aaron Ballman2016-01-121-1/+2
| | | | | | Patch by Adrian Zgorzałek llvm-svn: 257521
* [OpenCL] Pipe type supportXiuli Pan2016-01-091-0/+36
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* [OpenCL] Disallow taking an address of a function.Anastasia Stulova2016-01-051-1/+16
| | | | | | | | | | | | An undecorated function designator implies taking the address of a function, which is illegal in OpenCL. Implementing a check for this earlier to allow the error to be reported even in the presence of other more obvious errors. Patch by Neil Hickey! http://reviews.llvm.org/D15691 llvm-svn: 256838
* Remove an unused parameterDavid Majnemer2016-01-051-3/+2
| | | | | | No functionality change is intended llvm-svn: 256797
* Silence enumeral and non-enumeral type in conditional expression warning; NFC.Aaron Ballman2015-12-281-1/+1
| | | | llvm-svn: 256501
* [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.Alexey Bataev2015-12-281-10/+47
| | | | | | | | | OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size]) Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’. OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size]) Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’. llvm-svn: 256487
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-271-1/+1
| | | | llvm-svn: 256478
* Revert r256399 "[Sema] ArrayRef-ize ActOnBaseSpecifiers. NFC"Craig Topper2015-12-251-1/+1
| | | | | | It broke lldb build. llvm-svn: 256403
* [Sema] ArrayRef-ize ActOnTemplateParameterList. NFCCraig Topper2015-12-243-10/+8
| | | | llvm-svn: 256400
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-241-1/+1
| | | | llvm-svn: 256399
* [Sema] ArrayRef-ize BuildObjCDictionaryLiteral. NFCCraig Topper2015-12-241-1/+1
| | | | llvm-svn: 256398
* [Sema] ArrayRef-ize ParseObjCStringLiteral and ↵Craig Topper2015-12-241-8/+4
| | | | | | CodeCompleteObjCProtocolReferences. NFC llvm-svn: 256397
* Some minor correction based on David Blaikie post-commit code review for ↵Ekaterina Romanova2015-12-241-1/+1
| | | | | | r255281. llvm-svn: 256396
* Fix crash-on-invalid if a :: is followed by two or more open parentheses ↵Richard Smith2015-12-191-0/+9
| | | | | | (and then something else). llvm-svn: 256080
* [OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' ↵Alexey Bataev2015-12-181-5/+30
| | | | | | | | directive. OpenMP 4.5 adds 'depend(source)' clause for 'ordered' directive to support cross-iteration dependence. Patch adds parsing and semantic analysis for this construct. llvm-svn: 255986
* [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() isAkira Hatanaka2015-12-161-1/+1
| | | | | | | | | | | | | | called on an empty list. This commit makes Parser::parseObjCTypeParamListOrProtocolRefs return nullptr if it sees an invalid type parameter (e.g., __kindof) in the type parameter list. rdar://problem/23068920 Differential Revision: http://reviews.llvm.org/D15463 llvm-svn: 255754
* [Microsoft][C++] Clang doesn't support a use of "this" pointer inside inline asmMichael Zuckerman2015-12-151-11/+16
| | | | | | | | | | | | | | | | | | | | | Clang doesn’t support a use of “this” pointer inside inline asm. When I tried to compile a class or a struct (see example) with an inline asm that contains "this" pointer. Clang returns with an error. This patch fixes that. error: expected unqualified-id For example: ''' struct A { void f() { __asm mov eax, this // error: expected unqualified-id } }; ''' Differential Revision: http://reviews.llvm.org/D15115 llvm-svn: 255645
* [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.Alexey Bataev2015-12-151-2/+6
| | | | | | OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause. llvm-svn: 255625
* Add parse and sema of OpenMP distribute directive with all clauses except ↵Carlo Bertolli2015-12-141-2/+5
| | | | | | dist_schedule llvm-svn: 255498
* Objective-C properties: merge attributes when redeclaring 'readonly' as ↵Douglas Gregor2015-12-101-5/+1
| | | | | | | | | | | | | | 'readwrite' in an extension. r251874 stopped back-patching the AST when an Objective-C 'readonly' property is redeclared in a class extension as 'readwrite'. However, it did not properly handle merging of Objective-C property attributes (e.g., getter name, ownership, atomicity) to the redeclaration, leading to bad metadata. Merge (and check!) those property attributes so we get the right metadata and reasonable ASTs. Fixes rdar://problem/23823989. llvm-svn: 255309
OpenPOWER on IntegriCloud