summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-271-7/+4
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* [coroutines] Initial stub Sema functionality for handling coroutine await / ↵Richard Smith2015-10-221-3/+4
| | | | | | yield / return. llvm-svn: 250993
* [coroutines] Add parsing support for co_await expression, co_yield expression,Richard Smith2015-10-221-3/+29
| | | | | | co_await modifier on range-based for loop, co_return statement. llvm-svn: 250985
* [Modules] More descriptive diagnostics for misplaced import directiveSerge Pavlov2015-09-191-1/+2
| | | | | | | | | | If an import directive was put into wrong context, the error message was obscure, complaining on misbalanced braces. To get more descriptive messages, annotation tokens related to modules are processed where they must not be seen. Differential Revision: http://reviews.llvm.org/D11844 llvm-svn: 248085
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-10/+7
| | | | | | is(). llvm-svn: 240008
* [OPENMP] Allow to use global variables as lcv in loop-based directives.Alexey Bataev2015-04-301-0/+6
| | | | | | | For proper codegen we need to capture variable in the OpenMP region. In loop-based directives loop control variables are private by default and they must be captured in this region. There was a problem with capturing of globals, used as lcv, as they was not marked as private by default. Differential Revision: http://reviews.llvm.org/D9336 llvm-svn: 236201
* Correct typos in SEH filter expressionsReid Kleckner2015-04-021-1/+1
| | | | | | Otherwise we assert due to uncorrected delayed typos. llvm-svn: 233980
* MS ABI: Implement the MSVC 2015 scheme for scope disambiguationDavid Majnemer2015-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider C++ that looks like: inline int &f(bool b) { if (b) { static int i; return i; } static int i; return i; } Both 'i' variables must have distinct (and stable) names for linkage purposes. The MSVC 2013 ABI would number the variables using a count of the number of scopes that have been created. However, the final 'i' returns to a scope that has already been created leading to a mangling collision. MSVC 2015 fixes this by giving the second 'i' the name it would have if it were declared before the 'if'. However, this results in ABI breakage because the mangled name, in cases where there was no ambiguity, would now be different. We implement the new behavior and only enable it if we are targeting the MSVC 2015 ABI, otherwise the old behavior will be used. This fixes PR18131. llvm-svn: 232766
* Fix a theoretical bug when ParseCompoundStatement() returns StmtError.Nico Weber2015-03-091-1/+3
| | | | | | | | ParseCompoundStatement() currently never returns StmtError, but if it did, Sema would keep the __finally scope on its stack indefinitely. Explicitly add an error callback that clears it. llvm-svn: 231625
* Warn when jumping out of a __finally block via continue, break, return, __leave.Nico Weber2015-03-091-2/+5
| | | | | | | | | | | | | | | Since continue, break, return are much more common than __finally, this tries to keep the work for continue, break, return O(1). Sema keeps a stack of active __finally scopes (to do this, ActOnSEHFinally() is split into ActOnStartSEHFinally() and ActOnFinishSEHFinally()), and the various jump statements then check if the current __finally scope (if present) is deeper than then destination scope of the jump. The same warning for goto statements is still missing. This is the moral equivalent of MSVC's C4532. llvm-svn: 231623
* Don't crash on missing '{' after __except or __finally, PR22687.Nico Weber2015-02-251-2/+8
| | | | | | Also add some general test/Parser coverage for SEH blocks. llvm-svn: 230449
* Fold ParseSEHTryBlockCommon() into its only caller. No behavior change.Nico Weber2015-02-251-7/+4
| | | | | | | ParseCXXTryBlockCommon() makes sense because it has two callers due to function try blocks. There are no SEH function try blocks. llvm-svn: 230426
* Initial support for Win64 SEH IR emissionReid Kleckner2015-01-221-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lowering looks a lot like normal EH lowering, with the exception that the exceptions are caught by executing filter expression code instead of matching typeinfo globals. The filter expressions are outlined into functions which are used in landingpad clauses where typeinfo would normally go. Major aspects that still need work: - Non-call exceptions in __try bodies won't work yet. The plan is to outline the __try block in the frontend to keep things simple. - Filter expressions cannot use local variables until capturing is implemented. - __finally blocks will not run after exceptions. Fixing this requires work in the LLVM SEH preparation pass. The IR lowering looks like this: // C code: bool safe_div(int n, int d, int *r) { __try { *r = normal_div(n, d); } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) { return false; } return true; } ; LLVM IR: define i32 @filter(i8* %e, i8* %fp) { %ehptrs = bitcast i8* %e to i32** %ehrec = load i32** %ehptrs %code = load i32* %ehrec %matches = icmp eq i32 %code, i32 u0xC0000094 %matches.i32 = zext i1 %matches to i32 ret i32 %matches.i32 } define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) { %rr = invoke i32 @normal_div(i32 %n, i32 %d) to label %normal unwind to label %lpad normal: store i32 %rr, i32* %r ret i1 1 lpad: %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*) %ehptr = extractvalue {i8*, i32} %ehvals, i32 0 %sel = extractvalue {i8*, i32} %ehvals, i32 1 %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*)) %matches = icmp eq i32 %sel, %filter_sel br i1 %matches, label %eh.except, label %eh.resume eh.except: ret i1 false eh.resume: resume } Reviewers: rjmccall, rsmith, majnemer Differential Revision: http://reviews.llvm.org/D5607 llvm-svn: 226760
* Fix indentation. No behavior change.Nico Weber2015-01-041-1/+1
| | | | llvm-svn: 225129
* Removing an outdated FIXME; try block attributes are parsed with the rest of ↵Aaron Ballman2014-12-201-1/+0
| | | | | | the statement attributes (as per the standard), and function-try-blocks may not have attributes. NFC. llvm-svn: 224662
* [c++1z] Remove terse range-based for loops; they've been removed fromRichard Smith2014-11-271-3/+1
| | | | | | consideration for C++17 for now. Update C++ status page to match. llvm-svn: 222865
* Wire up delayed typo correction to DiagnoseEmptyLookup and set upKaelyn Takata2014-11-201-1/+6
| | | | | | | | | Sema::ActOnIdExpression to use the new functionality. Among other things, this allows recovery in several cases where it wasn't possible before (e.g. correcting a mistyped static_cast<>). llvm-svn: 222464
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-3/+3
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* Remove unused StmtVector& parameters from declaration parsing functions.Rafael Espindola2014-10-221-5/+3
| | | | | | Patch by Eelis van der Weegen! llvm-svn: 220387
* C++1y is now C++14!Aaron Ballman2014-08-191-1/+1
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-311-3/+4
| | | | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Resubmit with changes to try to fix the build-bot issue. Reviewed by Aaron Ballman llvm-svn: 214432
* Revert r214333, "Add a state variable to the loop hint attribute."NAKAMURA Takumi2014-07-311-4/+3
| | | | | | It brought undefined behavior. llvm-svn: 214376
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-301-3/+4
| | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Reviewed by Aaron Ballman llvm-svn: 214333
* Revert r213437Warren Hunt2014-07-251-40/+8
| | | | | | | We no longer plan to use __except_hander3 and rather use custom personality functions per __try block. llvm-svn: 213971
* Add support for '#pragma unroll'.Mark Heffernan2014-07-211-7/+5
| | | | llvm-svn: 213574
* [MS-ABI] Assign SEH handler indices to __try blocksWarren Hunt2014-07-191-8/+40
| | | | | | | | | Assigns indices to try blocks. These indices will used in constructing tables that the mscrt function __except_handler3 reads during SEH. Testing will occur once we actually emit the tables, in a subsequent patch. llvm-svn: 213437
* [OPENMP] Initial parsing and sema analysis for 'taskwait' directive.Alexey Bataev2014-07-181-5/+0
| | | | llvm-svn: 213363
* [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
OpenPOWER on IntegriCloud