summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith2013-05-161-2/+2
| | | | | | | | | | | | | a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. llvm-svn: 181985
* C++1y: provide full 'auto' return type deduction for lambda expressions. ThisRichard Smith2013-05-121-5/+19
| | | | | | completes the implementation of N3638. llvm-svn: 181669
* C++1y auto return type: when a function contains no 'return' statements at all,Richard Smith2013-05-101-3/+1
| | | | | | | substitute 'void' into the return type rather than replacing it with 'void', so that we maintain the 'auto' type sugar. llvm-svn: 181584
* Implement most of N3638 (return type deduction for normal functions).Richard Smith2013-05-041-3/+88
| | | | | | | Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. llvm-svn: 181108
* Implement template support for CapturedStmtWei Pan2013-05-041-6/+9
| | | | | | | | - Sema tests added and CodeGen tests are pending Differential Revision: http://llvm-reviews.chandlerc.com/D728 llvm-svn: 181101
* Test commitWei Pan2013-05-031-1/+1
| | | | llvm-svn: 181057
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-031-5/+16
| | | | | | | | | | | Move the creation of CapturedStmt parameters out of CodeGen and into Sema, making it easier to customize the outlined function. The ImplicitParamDecls are stored in the CapturedDecl using an ASTContext-allocated array. Differential Revision: http://llvm-reviews.chandlerc.com/D722 llvm-svn: 181043
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-031-2/+2
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-1/+0
| | | | | | | | | | | | | | | | | | | | | 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
* When deducing an 'auto' type, don't modify the type-as-written.Richard Smith2013-04-301-16/+12
| | | | llvm-svn: 180808
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-4/+9
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* Small CapturedStmt improvementsBen Langmuir2013-04-291-1/+1
| | | | | | | | | | | | | Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 llvm-svn: 180710
* Test commitBen Langmuir2013-04-291-1/+1
| | | | llvm-svn: 180709
* Disable VLA diagnostic in C++1y mode, and add some tests.Richard Smith2013-04-201-0/+2
| | | | | | | | | | | | Still to do here: - we have a collection of syntactic accepts-invalids to diagnose - support non-PODs in VLAs, including dynamic initialization / destruction - runtime checks (and throw std::bad_array_length) for bad bound - support VLA capture by reference in lambdas - properly support VLAs in range-based for (don't recompute bound) llvm-svn: 179962
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+111
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* <rdar://problem/13540921> Fix a crasher when an Objective-C for-in loop gets ↵Douglas Gregor2013-04-081-8/+25
| | | | | | a non-variable iteration declaration. llvm-svn: 179053
* <rdar://problem/13540921> Cope with deduced 'auto' in a C++11 for-range loop ↵Douglas Gregor2013-04-081-0/+27
| | | | | | that is actually an Objective-C fast enumeration loop. llvm-svn: 179035
* Add 178663 back.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Fix a crash-on-valid where a block capture copy expression wasJohn McCall2013-03-221-0/+5
| | | | | | | | | | | | 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
* Add a clarifying note when a return statement is rejected becauseJohn McCall2013-03-191-20/+22
| | | | | | | | we expect a related result type. rdar://12493140 llvm-svn: 177378
* Silence a number of static analyzer warnings with assertions and such.Jordan Rose2013-03-051-0/+1
| | | | | | No functionality change. llvm-svn: 176469
* Warn on dropping the return value from a warn_unused_result function, even inMatt Beaumont-Gay2013-02-261-5/+17
| | | | | | macros. llvm-svn: 176114
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-1/+1
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* When a statement is dropped from the AST because it was invalid, make sureArgyrios Kyrtzidis2013-02-151-0/+7
| | | | | | | 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
* Patch to check for integer overflow. It has beenFariborz Jahanian2013-01-241-8/+7
| | | | | | commented on and approved by Richard Smith. llvm-svn: 173377
* Suppress all -Wunused-value warnings from macro body expansions.Matt Beaumont-Gay2013-01-171-2/+5
| | | | | | | | | | | | | | | | | | | This is inspired by a number of false positives in real code, including PR14968. I've added test cases reduced from these false positives to test/Sema/unused-expr.c, as well as corresponding test cases that pass the offending expressions as arguments to a no-op macro to ensure that we do warn there. This also removes my previous tweak from r166522/r166534, so that we warn on unused cast expressions in macro arguments. There were several test cases that were using -Wunused-value to test general diagnostic emission features; I changed those to use other warnings or warn on a macro argument expression. I stared at the test case for PR14399 for a while with Richard Smith and we believe the new test case exercises the same codepaths as before. llvm-svn: 172696
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-2/+1
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith2013-01-141-24/+42
| | | | | | | | 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
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-7/+7
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fix -Wunused-comparison for comparisons in arguments to function-like macros.Matt Beaumont-Gay2013-01-121-1/+1
| | | | | | | | | | | Previously, -Wunused-comparison ignored comparisons in both macro bodies and macro arguments, but we would still emit a -Wunused-value warning for either. Now we correctly emit -Wunused-comparison for expressions in macro arguments. Also, add isMacroBodyExpansion to SourceManager, to go along with isMacroArgExpansion. llvm-svn: 172279
* Provide a better warning when case value overflows.Fariborz Jahanian2013-01-101-2/+2
| | | | | | // rdar://11577384 llvm-svn: 172102
* Issue warning when case value is too large to fitFariborz Jahanian2013-01-091-1/+9
| | | | | | | | | in case condition type. // rdar://11577384. Test is conditionalized on x86_64-apple triple as I am not sure if the INT_MAX/LONG_MAX values in the test will pass this test for other hosts. llvm-svn: 172016
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-3/+3
| | | | llvm-svn: 171367
* ArrayRefize CXXTryStmt.Nico Weber2012-12-291-1/+1
| | | | llvm-svn: 171239
* ArrayRefize a CompoundStmt constructor.Nico Weber2012-12-291-3/+4
| | | | llvm-svn: 171238
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-6/+6
| | | | | | | | | | | | | 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
* Remove redundant (duplicated) check.Dmitri Gribenko2012-11-181-1/+1
| | | | llvm-svn: 168293
* Fixed LabelDecl source range.Abramo Bagnara2012-10-151-1/+3
| | | | llvm-svn: 165976
* If the range in a for range statement doesn't have a viable begin/end function,Richard Smith2012-09-201-27/+45
| | | | | | | | | | | | | 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
* Clarified diagnostics for range-based for loops with invalid rangesSam Panzer2012-09-061-0/+6
| | | | llvm-svn: 163350
* Revert r163083 per chandlerc's request.Joao Matos2012-09-041-6/+0
| | | | llvm-svn: 163149
* Implemented parsing and AST support for the MS __leave exception statement. ↵Joao Matos2012-09-021-0/+6
| | | | | | Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review. llvm-svn: 163083
* don't warn about unused values when the unused value is a statement ↵Chris Lattner2012-08-311-0/+7
| | | | | | expression expanded from a macro. This is of dubious utility in general, but is specifically a major issue for the linux kernel. This resolves PR13747. llvm-svn: 163034
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-3/+3
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-2/+2
| | | | | | | 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-112/+158
| | | | | | | | | | | | | 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
* [ms-inline asm] Extract AsmStmt handling into a separate file, so as to notChad Rosier2012-08-171-611/+0
| | | | | | pollute SemaStmt with extraneous asm handling logic. llvm-svn: 162132
* [ms-inline asm] Instantiate the MCStreamer as a NullStream. We're parsingChad Rosier2012-08-171-1/+1
| | | | | | instruction, not emitting them, so a NullStream is fine. llvm-svn: 162105
OpenPOWER on IntegriCloud