summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP] Initial parsing and sema analysis of 'taskyield' directive.Alexey Bataev2014-07-181-1/+1
| | | | llvm-svn: 213355
* Sema: Check that __leave is contained in a __try block.Nico Weber2014-07-061-1/+2
| | | | | | | | | Give scope a SEHTryScope bit, set that in ParseSEHTry(), and let Sema walk the scope chain to find the SEHTry parent on __leave statements. (They are rare enough that it seems better to do the walk instead of giving Scope a SEHTryParent pointer -- this is similar to AtCatchScope.) llvm-svn: 212422
* Add parser support for __leave (sema and onward still missing).Nico Weber2014-07-061-0/+15
| | | | llvm-svn: 212421
* Fix parsing nested __if_exists blocksReid Kleckner2014-06-251-6/+8
| | | | | | | | | | | 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. llvm-svn: 211654
* [c++1z] Implement N3994: a range-based for loop can declare a variable with ↵Richard Smith2014-06-191-0/+42
| | | | | | | | | | | | super-terse notation for (x : range) { ... } which is equivalent to for (auto &&x : range) { ... } llvm-svn: 211267
* MS static locals mangling: don't double-increment mangling number for switchesHans Wennborg2014-06-171-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D4165 llvm-svn: 211079
* Adds a Pragma spelling for attributes to tablegen and makes use of it for loopTyler Nowicki2014-06-131-2/+1
| | | | | | | | | hint attributes. Includes tests for pragma printing and for attribute order which is incorrectly reversed by ParsedAttributes. Reviewed by Aaron Ballman llvm-svn: 210925
* [C++11] Use 'nullptr'.Craig Topper2014-06-091-2/+2
| | | | llvm-svn: 210448
* Split out inline asm parsing into ParseStmtAsm.cppAlp Toker2014-06-081-728/+0
| | | | | | | | | This change isolates various llvm/MC headers from the rest of the parser and better aligns with the existing SemaStmtAsm.cpp. No change in functionality, code move only. llvm-svn: 210420
* Don't include llvm/MC/MCParser throughout all of SemaAlp Toker2014-06-081-1/+1
| | | | | | Requires LLVM r210417. llvm-svn: 210418
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-0/+37
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-32/+32
| | | | | | takeAs to getAs. llvm-svn: 209800
* Improved recovery of switch statementSerge Pavlov2014-05-211-27/+34
| | | | | | | | | Make better diagnostic produced by erroneous switch statement. It fixes PR19022. Differential Revision: http://reviews.llvm.org/D3137 llvm-svn: 209302
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-17/+18
| | | | llvm-svn: 209275
* Suggest fix-it ':' when '=' used in for-range-declarationIsmail Pazarbasi2014-05-081-5/+3
| | | | | | | | | | 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
* Rewrite NRVO determination. Track NRVO candidates on the parser Scope and ↵Nick Lewycky2014-05-031-1/+1
| | | | | | | | apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal. Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith. llvm-svn: 207890
* Fix another leak in ParseMicrosoftAsmStatement(), found by LSan.Nico Weber2014-04-231-2/+3
| | | | llvm-svn: 207040
* Fix a memory leak found by LSan.Nico Weber2014-04-231-3/+4
| | | | llvm-svn: 207013
* Update Target::createMCAsmParser calls for the LLVM interface change.Evgeniy Stepanov2014-04-231-1/+5
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 206970
* Improve error recovery around colon.Serge Pavlov2014-04-131-2/+3
| | | | | | | | | | 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
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 205810
* MS asm: Filter out fpsw clobbersReid Kleckner2014-03-271-0/+5
| | | | | | | | | | | | | | | | When parsing MS inline assembly, we note that fpsw is an implicit def of most x87 FP operations, and add it to the clobber list. However, we don't recognize fpsw as a gcc register name, and we assert. Clang always adds an fpsr clobber, which means the same thing to LLVM, so we can just use that. This test case was broken by my LLVM change r196939. Reviewers: echristo Differential Revision: http://llvm-reviews.chandlerc.com/D2993 llvm-svn: 204878
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-3/+3
| | | | | | class. llvm-svn: 203641
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-11/+11
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* [-cxx-abi microsoft] Implement local manglings accuratelyDavid Majnemer2014-03-051-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVC ABI appears to mangle the lexical scope into the names of statics. Specifically, a counter is incremented whenever a scope is entered where things can be declared in such a way that an ambiguity can arise. For example, a class scope inside of a class scope doesn't do anything interesting because the nested class cannot collide with another nested class. There are problems with this scheme: - It is unreliable. The counter is only incremented when a previously never encountered scope is entered. There are cases where this will cause ambiguity amongst declarations that have the same name where one was introduced in a deep scope while the other was introduced right after in the previous lexical scope. - It is wasteful. Statements like: {{{{{{{ static int foo = a; }}}}}}} will make the mangling of "foo" larger than it need be because the scope counter has been incremented many times. Because of these problems, and practical implementation concerns. We choose not to implement this scheme if the local static or local type isn't visible. The mangling of these declarations will look very similar but the numbering will make far more sense, this scheme is lifted from the Itanium ABI implementation. Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2953 llvm-svn: 202951
* Pass llvm::Triple objects by const reference.Benjamin Kramer2014-03-041-1/+1
| | | | | | Copying isn't cheap as it contains a std::string. llvm-svn: 202880
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-101-0/+8
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 201105
* Fix to PR8880 (clang dies processing a for loop)Serge Pavlov2014-01-231-6/+7
| | | | | | | | | | | | | | | | | | | | | | | 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
* TryConsume parser cleanupsAlp Toker2014-01-101-9/+7
| | | | | | Also move some comments into the block they were meant to describe. llvm-svn: 198935
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* ExpectAndConsume: Diagnose errors automaticallyAlp Toker2014-01-011-4/+4
| | | | | | | | | | | | | | 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. llvm-svn: 198270
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-36/+31
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 197972
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Fix error recovery in return statement.Serge Pavlov2013-12-041-2/+2
| | | | | | This patch fixes PR16989. llvm-svn: 196352
* Parse: Fix references to 'if' that meant 'for', 'do', and 'while'Justin Bogner2013-12-031-3/+3
| | | | llvm-svn: 196229
* MS inline asm: When LLVM called back to Clang to parse a name and do nameDmitri Gribenko2013-12-031-14/+17
| | | | | | | | lookup, if parsing failed, we did not restore the lexer state properly, and eventually crashed. This change ensures that we always consume all the tokens from the new token stream we started to parse the name from inline asm. llvm-svn: 196182
* Generate a marker token when entering or leaving a submodule when building aRichard Smith2013-11-231-2/+2
| | | | | | | | | module. Use the marker to diagnose cases where we try to transition between submodules when not at the top level (most likely because a closing brace was missing at the end of a header file, but is also possible if submodule headers attempt to do something fundamentally non-modular, like our .def files). llvm-svn: 195543
* Replaced bool parameters in SkipUntil function with single bit-based parameter.Alexey Bataev2013-11-181-21/+20
| | | | llvm-svn: 194994
* PR8455: Handle an attribute between a goto label and a variable declaration perRichard Smith2013-11-151-5/+34
| | | | | | | the GNU documentation: the attribute only appertains to the label if it is followed by a semicolon. Based on a patch by Aaron Ballman! llvm-svn: 194869
* Diagnose C++11 attributes before fp_contract pragmas.Richard Smith2013-11-151-0/+1
| | | | llvm-svn: 194850
* Avoid diagnosing twice on non-x86 targetsAlp Toker2013-10-301-8/+10
| | | | | | The PowerPC and ARM native builders spotted this. llvm-svn: 193688
* Recover instead of crashing on MS assembly when no target is loadedAlp Toker2013-10-301-6/+7
| | | | | | | It's possible to embed the frontend in applications that haven't initialized backend targets so we need to handle this condition gracefully. llvm-svn: 193685
* Fix a parser crash when there are #pragmas in a context which requires a singleRichard Smith2013-10-281-0/+15
| | | | | | statement (after a case label, if, etc). Patch by Olivier Goffart! llvm-svn: 193545
* Revert r193073 and the attempt to fix it in r193170.Chandler Carruth2013-10-221-26/+0
| | | | | | | | | | This patch wasn't reviewed, and isn't correctly preserving the behaviors relied upon by QT. I don't have a direct example of fallout, but it should go through the standard code review process. For example, it should never have removed the QT test case that was added when fixing those users. llvm-svn: 193174
* Reenable 'break' in 'for' specifier to allow compilation of QT macro 'foreach'Serge Pavlov2013-10-221-0/+4
| | | | | | | | This is a fix to PR17649, caused by fix in r193073. QT uses 'break' statement to implement their 'foreach' macro. To enable build of QT, this fix reenables break but only in 'for' statement specifier and only in the third expression. llvm-svn: 193170
* Fix to PR8880 (clang dies processing a for loop).Serge Pavlov2013-10-211-0/+22
| | | | | | | | | | | | | | | | 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; }); ) Such usage must be diagnosed as an error, GCC rejects it. To recognize this and similar patterns the flags BreakScope and ContinueScope are temporarily turned off while parsing condition expression. Differential Revision: http://llvm-reviews.chandlerc.com/D1762 llvm-svn: 193073
* Tidy up and improve error recovery for C++11 attributes in bad places. Based onRichard Smith2013-10-151-8/+7
| | | | | | a patch by Michael Han. llvm-svn: 192666
* Fix a typo suggestion regression introduced by r191544.Kaelyn Uhrain2013-10-011-1/+1
| | | | llvm-svn: 191798
* Don't suggest namespaces if the next token is a '.'Kaelyn Uhrain2013-09-271-0/+3
| | | | llvm-svn: 191589
* Don't give suggest things like function names on the left side of "=".Kaelyn Uhrain2013-09-271-0/+2
| | | | llvm-svn: 191545
OpenPOWER on IntegriCloud