summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-19/+19
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-4/+2
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma ↵Eli Friedman2012-02-231-0/+8
| | | | | | | | pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>. (Hopefully, common usage of these pragmas isn't irregular enough to break our current handling. Doug has ideas for a more crazy approach if necessary.) llvm-svn: 151307
* Fix parsing and processing initializer lists in return statements and as ↵Sebastian Redl2012-02-221-3/+0
| | | | | | direct member initializers. llvm-svn: 151155
* Don't assume that a valid expression for the first part of a for-statementRichard Smith2012-02-211-2/+1
| | | | | | is non-null when diagnosing a broken attempt to write a for-range-statement. llvm-svn: 151081
* Reject continue/break statements within members of local functions nested withinRichard Smith2012-02-171-7/+14
| | | | | | | | | | | | | | | loop and switch statements, by teaching Scope that a function scope never has a continue/break parent for the purposes of control flow. Remove the hack in block and lambda expressions which worked around this by pretending that such expressions were continue/break scopes. Remove Scope::ControlParent, since it's unused. In passing, teach default statements to recover properly from a missing ';', and add a fixit for same to both default and case labels (the latter already recovered correctly). llvm-svn: 150776
* Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)Dmitri Gribenko2012-02-141-5/+15
| | | | | | | | | | | | | | * if, switch, range-based for: warn if semicolon is on the same line. * for, while: warn if semicolon is on the same line and either next statement is compound statement or next statement has more indentation. Replacing the semicolon with {} or moving the semicolon to the next line will always silence the warning. Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp. llvm-svn: 150515
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-1/+1
| | | | llvm-svn: 149127
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-3/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Add -Wdangling-else.Nico Weber2011-12-221-13/+25
| | | | | | | This works like described in http://drdobbs.com/blogs/cpp/231602010 Fixes http://llvm.org/PR11609 llvm-svn: 147202
* PR11297: Provide a better diagnostic for code which contains aRichard Smith2011-12-201-0/+8
| | | | | | | | reasonable-looking but ill-formed for-range statement of the form: for (expression : expression) llvm-svn: 147006
* Fix tentative parsing so it knows how to handle an ambiguous ↵Eli Friedman2011-12-201-1/+1
| | | | | | for-range-declaration. PR11601. llvm-svn: 146953
* Fix test regression introduced by r145656. When seeing a string literal ↵Ted Kremenek2011-12-021-1/+6
| | | | | | that isn't accepted by 'asm', skip to the enclosing ')'. llvm-svn: 145662
* Implement support for dependent Microsoft __if_exists/__if_not_existsDouglas Gregor2011-10-251-1/+10
| | | | | | | | | | statements. As noted in the documentation for the AST node, the semantics of __if_exists/__if_not_exists are somewhat different from the way Visual C++ implements them, because our parsed-template representation can't accommodate VC++ semantics without serious contortions. Hopefully this implementation is "good enough". llvm-svn: 142901
* Rework Microsoft __if_exists/__if_not_exists parsing and semanticDouglas Gregor2011-10-241-12/+31
| | | | | | | | | | | | | | | | | analysis to separate dependent names from non-dependent names. For dependent names, we'll behave differently from Visual C++: - For __if_exists/__if_not_exists at class scope, we'll just warn and then ignore them. - For __if_exists/__if_not_exists in statements, we'll treat the inner statement as a compound statement, which we only instantiate in templates where the dependent name (after instantiation) exists. This behavior is different from VC++, but it's as close as we can get without encroaching ridiculousness. The latter part (dependent statements) is not yet implemented. llvm-svn: 142864
* Treat the Microsoft/Borland keyword "__except" as a context-sensitiveDouglas Gregor2011-10-211-3/+7
| | | | | | | keyword, because both libstdc++ and libc++ use "__except" as an identifier. Fixes <rdar://problem/10322555>. llvm-svn: 142636
* Implement -Wc++98-compat warnings for the parser.Richard Smith2011-10-151-4/+6
| | | | llvm-svn: 142056
* Introduce BalancedDelimiterTracker, to better track open/closeDouglas Gregor2011-10-121-34/+48
| | | | | | | delimiter pairs and detect when we exceed the implementation limit for nesting depth, from Aaron Ballman! llvm-svn: 141782
* Fix "Uninitialized" warnings.NAKAMURA Takumi2011-10-081-2/+2
| | | | llvm-svn: 141487
* WhitespaceNAKAMURA Takumi2011-10-081-60/+60
| | | | llvm-svn: 141486
* Some fixes for MS-style asm parsing: specifically, add some error checking, ↵Eli Friedman2011-09-301-26/+105
| | | | | | and handle asm comments using semicolons correctly. (The comments are actually surprisingly tricky.) llvm-svn: 140837
* Changes to the name lookup have caused a regression in the digraph fix-it hint.Richard Trieu2011-09-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For instance: template <class T> void E() {}; class F {}; void test() { ::E<::F>(); E<::F>(); } Gives the following error messages: error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'? ::E<::F>(); ^~~ < :: error: expected expression E<::F>(); ^ error: expected ']' note: to match this '[' E<::F>(); This patch adds the digraph fix-it check right before the name lookup, moves the shared checking code to a new function, and adds new tests to catch future regressions. llvm-svn: 140039
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-2/+2
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Change references to StmtTy to Stmt and removed typedefs of StmtTy. Also ↵Richard Trieu2011-09-091-1/+1
| | | | | | removed typedef of AttrTy since it is not used. llvm-svn: 139349
* Change all references of type ExprTy to Expr and get rid of the typedefs.Richard Trieu2011-09-091-2/+2
| | | | llvm-svn: 139347
* When parsing a function-try-block that does not have aDouglas Gregor2011-09-071-1/+3
| | | | | | | | ctor-initializer, remember to call the Sema action to generate default ctor-initializers. What a delightful little miscompile. Fixes PR10578 / <rdar://problem/9877267>. llvm-svn: 139253
* PR10458: Finesse behaviour of C++0x features when in pre-0x mode. Accept ↵Richard Smith2011-09-041-0/+3
| | | | | | for-range and auto with an ExtWarn, and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a storage class. llvm-svn: 139102
* Support code-completion for C++ inline methods and ObjC buffering methods.Argyrios Kyrtzidis2011-09-041-9/+13
| | | | | | | | | | | | | | Previously we would cut off the source file buffer at the code-completion point; this impeded code-completion inside C++ inline methods and, recently, with buffering ObjC methods. Have the code-completion inserted into the source buffer so that it can be buffered along with a method body. When we actually hit the code-completion point the cut-off lexing or parsing. Fixes rdar://10056932&8319466 llvm-svn: 139086
* Don't try keeping a 'LeadingEmptyMacroLoc' in NullStmt. This failsArgyrios Kyrtzidis2011-09-011-4/+2
| | | | | | in the face of buffering C++/ObjC method bodies. llvm-svn: 138972
OpenPOWER on IntegriCloud