summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith2013-01-141-4/+6
| | | | | | | | ActOnFinishFullExpr that some of its checks only apply to discarded-value expressions. This adds missing checks for unexpanded variadic template parameter packs to a handful of constructs. llvm-svn: 172485
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-6/+6
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-3/+3
| | | | llvm-svn: 171367
* Simplify. No functionality change.Nico Weber2012-12-301-7/+2
| | | | llvm-svn: 171268
* Add a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a bodyArgyrios Kyrtzidis2012-12-061-2/+2
| | | | | | that was skipped by the parser. llvm-svn: 169531
* [driver, ms-inline asm] MS-Style inline assembly is controlled by theChad Rosier2012-12-051-1/+1
| | | | | | | -fasm-blocks flag, not the -fms-extensions flag. rdar://12808010 llvm-svn: 169422
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* PR14381: Never skip constexpr function bodies when code-completing. We may needRichard Smith2012-11-191-2/+4
| | | | | | them in order to parse the rest of the file. llvm-svn: 168327
* Simplify function try/catch scope handling.David Blaikie2012-11-131-3/+3
| | | | | | Based on post-commit review feedback for r167766 by Richard Smith. llvm-svn: 167856
* Fix more try scoping bugs introduced by r167650.David Blaikie2012-11-121-1/+1
| | | | | | | Introduces more clear scoping flags & flag combinations which should hopefully be more understandable. llvm-svn: 167766
* PR14296: function parameter name collisions in function try/catchDavid Blaikie2012-11-101-6/+8
| | | | | | | | | | | | C++11 3.3.3/2 "A parameter name shall not be redeclared in the outermost block of the function definition nor in the outermost block of any handler associated with a function-try-block." It's not totally clear to me whether the "FIXME" case is covered by this, but Richard Smith thinks it probably should be. It's just a bit more involved to fix that case. llvm-svn: 167650
* Support interleaving of other pragmas with FP_CONTRACT at the beginning of aLang Hames2012-11-031-4/+45
| | | | | | compound statement. llvm-svn: 167363
* If skipping bodies is enabled outside code-completion, just skip the body ↵Argyrios Kyrtzidis2012-10-311-1/+7
| | | | | | | | directly without using tentative parsing. llvm-svn: 167142
* Removed an extra blank line.Mahesha S2012-10-271-1/+0
| | | | llvm-svn: 166867
* When used in a compound expression FP_CONTRACT should proceed all explicitLang Hames2012-10-211-3/+8
| | | | | | | declarations and statements. Emit an error if the FP_CONTRACT is used later in a compound statement. llvm-svn: 166383
* People put pragmas in crazy places; add more handling. PR14046.Eli Friedman2012-10-091-0/+20
| | | | | | | I think our general framework for parser pragmas needs a bit more work, but I'm not planning on working on it at the moment. llvm-svn: 165558
* Make sure we allow "#pragma options align=mac68k" in function-local ↵Eli Friedman2012-10-081-0/+5
| | | | | | contexts. <rdar://problem/12453134> llvm-svn: 165462
* Permanently end the whole "pragma got handled by the parser too early"Eli Friedman2012-10-041-0/+10
| | | | | | | mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. llvm-svn: 165195
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-0/+5
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* If the range in a for range statement doesn't have a viable begin/end function,Richard Smith2012-09-201-1/+2
| | | | | | | | | | | | | but can be dereferenced to form an expression which does have viable begin/end functions, then typo-correct the range, even if something else goes wrong with the statement (such as inaccessible begin/end or the wrong type of loop variable). In order to ensure we recover correctly and produce any followup diagnostics in this case, redo semantic analysis on the for-range statement outside of the diagnostic trap, after issuing the typo-correction. llvm-svn: 164323
* Revert r163083 per chandlerc's request.Joao Matos2012-09-041-16/+1
| | | | llvm-svn: 163149
* Implemented parsing and AST support for the MS __leave exception statement. ↵Joao Matos2012-09-021-1/+16
| | | | | | Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review. llvm-svn: 163083
* [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier2012-08-251-12/+10
| | | | | | No functional change intended. llvm-svn: 162632
* [ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a Chad Rosier2012-08-241-0/+18
| | | | | | | | | CodeGen option to a LangOpt option. In turn, hoist the guard into the parser so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic. This should restore the behavior of clang to that prior to r158325. <rdar://problem/12163681> llvm-svn: 162602
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-2/+2
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-6/+6
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-19/+19
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Better diagnostics for range-based for loops with bad range types.Sam Panzer2012-08-211-1/+1
| | | | | | | | | | | | | The old error message stating that 'begin' was an undeclared identifier is replaced with a new message explaining that the error is in the range expression, along with which of the begin() and end() functions was problematic if relevant. Additionally, if the range was a pointer type or defines operator*, attempt to dereference the range, and offer a FixIt if the modified range works. llvm-svn: 162248
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-181-81/+24
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* Removed unused LParenLoc parameter to ActOnCXXForRangeStmtSam Panzer2012-08-161-3/+2
| | | | llvm-svn: 162048
* [ms-inline asm] MSVC parses multiple __asm statements on a single line as oneChad Rosier2012-08-151-5/+0
| | | | | | | | | | | | statement. For example, if (x) __asm out dx, ax __asm out dx, ax results in a single inline asm statement (i.e., both "out dx, ax" statements are predicated on if(x)). llvm-svn: 161986
* [ms-inline asm] Add the left brace source location and improve the prettyChad Rosier2012-08-151-1/+2
| | | | | | printer. Patch by Enea Zaffanella <zaffanella@cs.unipr.it>. llvm-svn: 161958
* [ms-inline asm] Remove the last bits of LineEnds.Chad Rosier2012-08-141-5/+1
| | | | llvm-svn: 161904
* [ms-inline asm] Add a helpful assert.Chad Rosier2012-08-141-91/+85
| | | | llvm-svn: 161890
* [ms-inline asm] Refactor the logic to generate the AsmString into Sema. NoChad Rosier2012-08-081-59/+2
| | | | | | functional change intended. llvm-svn: 161518
* [ms-inline asm] Stmt destructors are never called, so allocate the AsmToks usingChad Rosier2012-08-071-1/+2
| | | | | | the ASTContext BumpPtr. Also use the preferred llvm::ArrayRef interface. llvm-svn: 161373
* [ms-inline asm] Pass Tokens to Sema and store them in the AST. No functionalChad Rosier2012-08-061-5/+2
| | | | | | change intended. No test case as there's no real way to test at this time. llvm-svn: 161342
* 80-column violations and whitespace.Chad Rosier2012-07-101-13/+15
| | | | llvm-svn: 160017
* objective-c: Refactor parse/sema portion ofFariborz Jahanian2012-07-031-8/+8
| | | | | | | objective-c's fast enumeration statement, for more work to come. llvm-svn: 159689
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-0/+11
| | | | | | | | | | | | | | | | | | attributes in more places where we didn't and catching a lot more issues. This implements nearly every aspect of C++11 attribute parsing, except for: - Attributes are permitted on explicit instantiations inside the declarator (but not preceding the decl-spec) - Attributes are permitted on friend declarations of functions. - Multiple instances of the same attribute in an attribute-list (e.g. [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming) are allowed. The first two are marked as expected-FIXME in the test file and the latter is probably a defect and is currently untested. Thanks to Richard Smith for providing the lion's share of the testcases. llvm-svn: 159072
* [ms-inline-asm] The __asm keyword is a statement separator, so multiple asmChad Rosier2012-06-121-0/+5
| | | | | | statements are allowed on the same line. llvm-svn: 158372
* [ms-inline-asm] Cleanup MS style inline assembly parsing.Chad Rosier2012-06-121-9/+46
| | | | | | | | | | Specifically, improve the handling of whitespace, stop saving tokens that are in comments and fix the case where we have a comment followed by a closing brace on the next line. Unfortunately, there's no easy way of testing this code. llvm-svn: 158367
* Etch out the code path for MS-style inline assembly.Chad Rosier2012-06-111-33/+52
| | | | llvm-svn: 158325
* Include the correct conversion context locations for condition expressions.David Blaikie2012-05-161-3/+3
| | | | | | | | | | | | | This improves the conversion diagnostics (by correctly pointing to the loop construct for conversions that may've been caused by the contextual conversion to bool caused by a condition expression) and also causes the NULL conversion warnings to be correctly suppressed when crossing a macro boundary in such a context. (previously, since the conversion context location was incorrect, the suppression could not be performed) Reported by Nico Weber as feedback to r156826. llvm-svn: 156901
* improve error recovery for extra ')'s after a if/switch/while condition. ↵Chris Lattner2012-04-281-0/+10
| | | | | | | | | | | | | | | | | | Before: t.c:3:9: error: expected expression if (x)) { ^ .. which isn't even true - a statement or expression is fine. After: t.c:3:9: error: extraneous ')' after condition, expected a statement if (x)) { ^ This is the second part of PR12595 llvm-svn: 155762
* switch some uses of ExpectAndConsume(tok::semi to use ExpectAndConsumeSemi. ↵Chris Lattner2012-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | This allows us to improve this diagnostic (telling us to insert another ")": t.c:2:19: error: expected ';' at end of declaration int x = 4+(5-12)); ^ ; to: t.c:2:19: error: extraneous ')' before ';' int x = 4+(5-12)); ^ ...telling us to remove the ")". This is PR12595. There are more uses of ExpectAndConsumeSemi that could be switched over, but I don't hit them on a daily basis :) llvm-svn: 155759
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-97/+84
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-121-14/+10
| | | | llvm-svn: 154584
* Disambiguation of '[[':Richard Smith2012-04-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. llvm-svn: 154369
* [parser] If there are unmatched braces in a function definition, try toArgyrios Kyrtzidis2012-03-241-5/+8
| | | | | | | | | recover by returning the statements that we parsed so far, instead of dropping the whole function body. rdar://10967343 llvm-svn: 153367
OpenPOWER on IntegriCloud