summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix <rdar://problem/6451399> problems with labels and blocks.Steve Naroff2009-02-281-6/+18
| | | | | | | | | - Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with. - Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr(). - Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope. - Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions). llvm-svn: 65694
* Match gcc and always perform array/function conversion for asm input exprs. ↵Anders Carlsson2009-02-221-2/+2
| | | | | | Fixes PR3641. llvm-svn: 65256
* Several related changes: Chris Lattner2009-02-141-16/+8
| | | | | | | | | | | | | | | 1) implement parser and sema support for reading and verifying attribute(warnunusedresult). 2) rename hasLocalSideEffect to isUnusedResultAWarning, inverting the sense of its result. 3) extend isUnusedResultAWarning to directly return the loc and range info that should be reported to the user. Make it substantially more precise in some cases than what was previously reported. 4) teach isUnusedResultAWarning about CallExpr to decls that are pure/const/warnunusedresult, fixing a fixme. 5) change warn_attribute_wrong_decl_type to not pass in english strings, instead, pass in integers and use %select. llvm-svn: 64543
* Remove DeclGroupOwningRef, since we intend for declarations to be ownedDouglas Gregor2009-02-131-2/+2
| | | | | | | | | | | | | | | by DeclContexts (always) rather than by statements. DeclContext currently goes out of its way to avoid destroying any Decls that might be owned by a DeclGroupOwningRef. However, in an error-recovery situation, a failure in a declaration statement can cause all of the decls in a DeclGroupOwningRef to be destroyed after they've already be added into the DeclContext. Hence, DeclContext is left with already-destroyed declarations, and bad things happen. This problem was causing failures that showed up as assertions on x86 Linux in test/Parser/objc-forcollection-neg-2.m. llvm-svn: 64474
* Sema::ActOnObjCAtThrowStmt(): return from recently added errors. Thanks Chris!Steve Naroff2009-02-121-3/+3
| | | | llvm-svn: 64389
* Turn warning into error. Minor incompatibility with GCC (for scalar types, ↵Steve Naroff2009-02-121-4/+2
| | | | | | GCC only produces a warning). llvm-svn: 64375
* Fix <rdar://problem/6243503> [sema] @throw; accepted outside catch block.Steve Naroff2009-02-111-2/+9
| | | | llvm-svn: 64318
* Fix <rdar://problem/6206858> [sema] type check @throw statements.Steve Naroff2009-02-111-3/+16
| | | | | | Added a FIXME to handle 'rethrow' check. llvm-svn: 64308
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-38/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Add support for blocks with explicit return types.Mike Stump2009-02-041-15/+16
| | | | llvm-svn: 63784
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+0
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* If an input constraint refers to an output constraint, it should have the ↵Anders Carlsson2009-01-271-1/+7
| | | | | | same constraint info as the output constraint. Fixes PR3417 llvm-svn: 63127
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Fix an inline asm sema bug that I introduced.Anders Carlsson2009-01-211-2/+2
| | | | llvm-svn: 62666
* Improvements to Sema of asm statements. Fixes <rdar://problem/6156893>Anders Carlsson2009-01-201-7/+16
| | | | llvm-svn: 62609
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-6/+6
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* Convert ObjC statement actions to smart pointers.Sebastian Redl2009-01-181-30/+28
| | | | llvm-svn: 62465
* Convert asm statement action to smart pointers.Sebastian Redl2009-01-181-65/+61
| | | | llvm-svn: 62464
* Convert more statement actions to smart pointers.Sebastian Redl2009-01-181-51/+48
| | | | llvm-svn: 62463
* Change TargetInfo::validateInputConstraint to take begin/end name iterators ↵Anders Carlsson2009-01-171-1/+2
| | | | | | instead of the number of outputs. No functionality change. llvm-svn: 62433
* Convert some more statement actions to smart pointers.Sebastian Redl2009-01-161-51/+67
| | | | | | Fix a type error; parser wanted to pass the third part of a for-statement as a statement; should be expression. llvm-svn: 62380
* Convert some more actions to smart pointers.Sebastian Redl2009-01-111-44/+49
| | | | | | | No performance regression in my basic test. Also fixed a type error in ActOnFinishSwitchStmt's arguments (body is a stmt). llvm-svn: 62032
* Perform default function/array conversion for input arguments to inline asm ↵Anders Carlsson2008-12-311-0/+3
| | | | | | statements if the input expr can be a memory operand llvm-svn: 61515
* Convert a two more statement actions to smart pointers.Sebastian Redl2008-12-281-22/+27
| | | | llvm-svn: 61456
* Full AST support and better Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+28
| | | | llvm-svn: 61346
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+10
| | | | llvm-svn: 61337
* Convert a few Stmt actions to smart pointers.Sebastian Redl2008-12-211-22/+23
| | | | llvm-svn: 61309
* This is valid in C++.Chris Lattner2008-12-181-4/+8
| | | | | | void foo() { return foo(); } llvm-svn: 61188
* Merge function-return.c into function.cChris Lattner2008-12-181-7/+8
| | | | | | | Fix PR2790 by making a warning an EXTWARN instead of EXTENSION. Add a new EXTENSION warning for "return (some void expression);" llvm-svn: 61187
* Introduce basic support for dependent types, type-dependentDouglas Gregor2008-12-051-14/+16
| | | | | | | | | | | | expressions, and value-dependent expressions. This permits us to parse some template definitions. This is not a complete solution; we're missing type- and value-dependent computations for most of the expression types, and we're missing checks for dependent types and type-dependent expressions throughout Sema. llvm-svn: 60615
* change getCurFunctionDecl to skip through Block contexts to findChris Lattner2008-12-041-3/+6
| | | | | | | | the containing block. Introduce a new getCurFunctionOrMethodDecl method to check to see if we're in a function or objc method. Minor cleanups to other related places. This fixes rdar://6405429. llvm-svn: 60564
* Use VerifyIntegerConstantExpression for case values.Anders Carlsson2008-12-011-19/+4
| | | | llvm-svn: 60317
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-8/+8
| | | | | | | | instead of converting them to strings first. This also fixes a bunch of minor inconsistencies in the diagnostics emitted by clang and adds a bunch of FIXME's to DiagnosticKinds.def. llvm-svn: 59948
* Make all the 'redefinition' diagnostics more consistent, and make the Chris Lattner2008-11-231-4/+4
| | | | | | "previously defined here" diagnostics all notes. llvm-svn: 59920
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-7/+7
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* Case values must be evaluatedAnders Carlsson2008-11-221-2/+5
| | | | llvm-svn: 59884
* Use Expr::Evaluate for case statements. Fixes PR2525Anders Carlsson2008-11-221-4/+13
| | | | llvm-svn: 59881
* remove the last old-fashioned Diag method. Transition complete!Chris Lattner2008-11-201-7/+9
| | | | llvm-svn: 59714
* remove another old-school Diag method.Chris Lattner2008-11-201-16/+16
| | | | llvm-svn: 59712
* stop calling II::getName() unnecesarily in semaChris Lattner2008-11-191-18/+22
| | | | llvm-svn: 59609
* remove one more old-style Diag method.Chris Lattner2008-11-191-24/+24
| | | | llvm-svn: 59589
* Switch several more Sema Diag methods over. This simplifies theChris Lattner2008-11-191-8/+8
| | | | | | | | __builtin_prefetch code to only emit one diagnostic per builtin_prefetch. While this has nothing to do with the rest of the patch, the code seemed like overkill when I was updating it. llvm-svn: 59588
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-5/+6
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ↵Ted Kremenek2008-10-071-1/+22
| | | | | | | | ScopedDecl*. This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*. llvm-svn: 57275
* When processing Objective-C foreach statements, first check to see if the ↵Ted Kremenek2008-10-061-4/+6
| | | | | | statement has a DeclStmt with a single Decl. Afterwards, use DeclStmt::getSolitaryDecl() to access that Decl (thus avoiding an assertion being triggered). These changes remove an unneeded use of ScopedDecl::getNextDeclarator() and DeclStmt::getDecl(). llvm-svn: 57207
* Use the DeclStmt::decl_iterator to get the first decl in a DeclStmt instead ↵Ted Kremenek2008-10-061-1/+1
| | | | | | of using DeclStmt::getDecl(). llvm-svn: 57196
* Fix <rdar://problem/6243788> clang: Incorrect return statement for Blocks?Steve Naroff2008-09-241-1/+3
| | | | llvm-svn: 56590
* Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on ↵Steve Naroff2008-09-161-2/+3
| | | | | | | | | the return type. Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts. Added some more test cases... llvm-svn: 56254
* Do implicit conversion to bool for the condition in a do-while statement.Argyrios Kyrtzidis2008-09-111-1/+4
| | | | llvm-svn: 56096
* Implement Sema support for the 'condition' part of C++ selection-statements ↵Argyrios Kyrtzidis2008-09-101-16/+49
| | | | | | and iteration-statements (if/switch/while/for). llvm-svn: 56044
OpenPOWER on IntegriCloud