summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Avoid the hard-coded limit on the number of typo corrections attempted.Kaelyn Uhrain2013-09-271-15/+29
| | | | | | | | | | | | | | | Move some tests from typo-correction.cpp to typo-correction-pt2.cpp because they were running afoul of the hard-coded limit of 20 typos corrected. Some of the tests after it were still working due to the limit not applying to cached corrections and in cases where a non-NULL MemberContext is passed in to Sema::CorrectTypo. Most of the moved tests still passed after being moved, but the test involving "data_struct" had only been passing because the test had exceeded that limit so a fix for it is also included (most of the changes to ParseStmt.cpp are shared with and originated from another typo correction impovement that was split into a separate commit). llvm-svn: 191544
* Add some missing ProhibitAttributes calls to some declaration-like #pragmas.Richard Smith2013-09-161-0/+2
| | | | llvm-svn: 190806
* Fix the MCTargetAsmParser API change.Joey Gouly2013-09-121-3/+3
| | | | llvm-svn: 190601
* const'ify Sema::ActOnCXXTryBlock byRobert Wilhelm2013-08-221-1/+1
| | | | | | | | changing Parameter from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188994
* Remove Extension warning for GNU local labels.Eli Friedman2013-08-201-1/+0
| | | | | | | | | We generally don't warn about extensions involving keywords reserved for the implementation, so we shouldn't warn here either: the standard doesn't require it, and it doesn't provide useful information to the user. llvm-svn: 188840
* const'ify Sema::ActOnCompoundStmt byRobert Wilhelm2013-08-191-4/+2
| | | | | | | | changing Parameter of Sema::ActOnCompoundStmt from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188705
* OpenMP: basic support for #pragma omp parallelAlexey Bataev2013-07-191-3/+2
| | | | llvm-svn: 186647
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-091-2/+2
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Update to pass in pointers intead of references.Bill Wendling2013-06-181-1/+1
| | | | llvm-svn: 184176
* Update for LLVM interface change in r181680.Rafael Espindola2013-05-131-1/+1
| | | | llvm-svn: 181681
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-2/+395
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Parser support for #pragma clang __debug capturedTareq A. Siraj2013-04-161-0/+3
| | | | | | | | | | | | | | | This patch implements parsing ‘#pragma clang __debug’ as a first step for implementing captured statements. Captured statements are a mechanism for doing outlining in the AST. see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. Currently returns StmtEmpty Author: Andy Zhang <andy.zhang@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D369 llvm-svn: 179614
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-281-0/+3
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-221-0/+5
| | | | llvm-svn: 177705
* Fix a crash-on-valid where a block capture copy expression wasJohn McCall2013-03-221-1/+1
| | | | | | | | | | | | picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. llvm-svn: 177692
* [libclang] Fix a crash with invalid code, while skip function bodies is enabled.Argyrios Kyrtzidis2013-02-221-1/+1
| | | | llvm-svn: 175860
* Process and handle attributes on conditions and for loop variables. Process andRichard Smith2013-02-201-3/+0
| | | | | | | diagnose attributes on alias declarations, using directives, and attribute declarations. llvm-svn: 175649
* When a statement is dropped from the AST because it was invalid, make sureArgyrios Kyrtzidis2013-02-151-5/+0
| | | | | | | we don't do the scope checks otherwise we are going to hit assertion checks since a label may not have been actually added. llvm-svn: 175281
* Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.Richard Smith2013-01-291-7/+12
| | | | llvm-svn: 173779
* [ms-inline asm] Remove the -fenable-experimental-ms-inline-asm flag. MS-styleChad Rosier2013-01-221-15/+0
| | | | | | inline assembly can be enable with -fasm-blocks or -fms-extensions alone. llvm-svn: 173186
* [ms-inline asm] Remove a warning about ms-style inline assembly not beingChad Rosier2013-01-221-3/+0
| | | | | | supported. llvm-svn: 173177
OpenPOWER on IntegriCloud