summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/JumpDiagnostics.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* In Microsoft mode, warn if an indirect goto jump over a variable initialization.Francois Pichet2011-09-161-2/+3
| | | | | | Also add a test case for the non Microsoft case because such test didn't exist. llvm-svn: 139971
* In Microsoft mode, downgrade "goto into protected scope" from error to ↵Francois Pichet2011-09-131-18/+40
| | | | | | | | warning if we are jumping over a variable initialization via a goto. This fixes a few errors when parsing MFC code with clang. llvm-svn: 139595
* Update comment because JumpDiagnostics.cpp is not just about VLA scope.Francois Pichet2011-09-091-2/+2
| | | | llvm-svn: 139364
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-9/+9
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* objc-arc: Diagnose when captured variable in block literalsFariborz Jahanian2011-07-111-13/+74
| | | | | | | | require destruction and there is possibility of that without construction. Thanks Johnm for review and suggestions offline. // rdar://9535237. llvm-svn: 134906
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-2/+2
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Automatic Reference Counting.John McCall2011-06-151-56/+88
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Properly implement C++0x [stmt.dcl]p3, which requires a scope to beDouglas Gregor2011-06-151-0/+3
| | | | | | | protected in the case where a variable is being initialized by a trivial default constructor but has a non-trivial destructor. llvm-svn: 133037
* Clean up a C++0x/C++03 conditional check.Douglas Gregor2011-05-271-5/+4
| | | | llvm-svn: 132229
* Clean up my changes to jump-diagnostic handling for local variables ofDouglas Gregor2011-05-271-26/+24
| | | | | | | | class type (or array thereof), eliminating some redundant checks (thanks Eli!) and adding some tests where the behavior differs in C++98/03 vs. C++0x. llvm-svn: 132218
* Update the jump-scope checker for local variables with initializers,Douglas Gregor2011-05-271-10/+41
| | | | | | | | so that it looks at the initializer of a local variable of class type (or array thereof) to determine whether it's just an implicit invocation of the trivial default constructor. Fixes PR10034. llvm-svn: 132191
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-0/+5
| | | | llvm-svn: 129567
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-21/+21
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* Give some convenient idiomatic accessors to Stmt::child_range andJohn McCall2011-02-131-2/+1
| | | | | | | Stmt::const_child_range, then make a bunch of places use them instead of the individual iterator accessors. llvm-svn: 125450
* Implement an indirect-goto optimization for goto *&&lbl and respect thisJohn McCall2010-10-281-1/+20
| | | | | | | | | | | | | | in the scope checker. With that done, turn an indirect goto into a protected scope into a hard error; otherwise IR generation has to start worrying about declarations not dominating their scopes, as exemplified in PR8473. If this really affects anyone, I can probably adjust this to only hard-error on possible indirect gotos into VLA scopes rather than arbitrary scopes. But we'll see how people cope with the aggressive change on the marginal feature. llvm-svn: 117539
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* Remove Sema.h's dependency on DeclCXX.h.John McCall2010-08-251-0/+1
| | | | llvm-svn: 112032
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
* Labels (and case statement) don't create independent scope parents for theJohn McCall2010-08-021-16/+18
| | | | | | | | purposes of the jump checker. Also extend Ted's iteration fix to labels. Fixes PR7789. llvm-svn: 110082
* Fix another case (this time in JumpScopeChecker) where walking deeply nested ↵Ted Kremenek2010-08-021-1/+11
| | | | | | CaseStmts can blow out the stack. Fixes <rdar://problem/8125165>. llvm-svn: 110071
* Be a bit more careful with undefined CXXRecordDecls. FixesDouglas Gregor2010-07-011-5/+7
| | | | | | rdar://problem/8124080 and PR7118. llvm-svn: 107358
* Alter the internal representation of the condition variable inDouglas Gregor2010-06-211-20/+38
| | | | | | | | | | | | | | | | if/while/switch/for statements to ensure that walking the children of these statements actually works. Previously, we stored the condition variable as a VarDecl. However, StmtIterator isn't able to walk from a VarDecl to a set of statements, and would (in some circumstances) walk beyond the end of the list of statements, cause Bad Behavior. In this change, we've gone back to representing the condition variables as DeclStmts. While not as memory-efficient as VarDecls, it greatly simplifies iteration over the children. Fixes the remainder of <rdar://problem/8104754>. llvm-svn: 106504
* Improve commentary on the indirect-goto jump scope checker and extractJohn McCall2010-05-121-69/+76
| | | | | | a convenience routine to find the innermost common ancestor of two scopes. llvm-svn: 103565
* When checking scopes for indirect goto, be more permissive (but still safe)John McCall2010-05-121-70/+249
| | | | | | | | | | | | | | | | | | | | | | | | | about the permitted scopes. Specifically: 1) Permit labels and gotos to appear after a prologue of variable initializations. 2) Permit indirect gotos to jump out of scopes that don't require cleanup. 3) Diagnose possible attempts to indirect-jump out of scopes that do require cleanup. This requires a substantial reinvention of the algorithm for checking indirect goto. The current algorithm is Omega(M*N), with M = the number of unique scopes being jumped from and N = the number of unique scopes being jumped to, with an additional factor that is probably (worst-case) linear in the depth of scopes. Thus the entire thing is likely cubic given some truly bizarre ill-formed code; on well-formed code the additional factor collapses to an amortized constant (when amortized over the entire function) and so the algorithm is quadratic. Even this requires every label to appear in its own scope, which would be very unusual for indirect-goto code (and extremely unlikely for well-formed code); it is far more likely that all labels will be in the same scope and so the algorithm becomes linear. For such a marginal feature, I am fairly happy with this result. (this is using JumpDiagnostic's definition of scope, where successive variables in a block appear in their own scope) llvm-svn: 103536
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-2/+2
| | | | | | | | | | statements. Instead of the @try having a single @catch, where all of the @catch's were chained (using an O(n^2) algorithm nonetheless), @try just holds an array of its @catch blocks. The resulting AST is slightly more compact (not important) and better represents the actual language semantics (good). llvm-svn: 102221
* Make a note for the C++0x future, when we'll have to revisit the ↵Douglas Gregor2010-03-081-0/+2
| | | | | | jump-diagnostics handling for variables without initializers llvm-svn: 97929
* Implement jump checking for initialized c++ variables, implementingChris Lattner2010-03-011-6/+8
| | | | | | | | | | | | | | | | | | a fixme and PR6451. Only perform jump checking if the containing function has no errors, and add the infrastructure needed to do this. On the testcase in the PR, we produce: t.cc:6:3: error: illegal goto into protected scope goto later; ^ t.cc:7:5: note: jump bypasses variable initialization X x; ^ llvm-svn: 97497
* Silence some warnings produced by Clang, and add a missing headerDouglas Gregor2009-11-171-1/+1
| | | | llvm-svn: 89051
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-30/+30
| | | | llvm-svn: 81346
* enhance the goto checker to reject jumps across __block variable definitions.Chris Lattner2009-07-191-0/+2
| | | | llvm-svn: 76376
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-3/+3
| | | | | | | | | The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. llvm-svn: 74501
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-3/+3
| | | | llvm-svn: 73702
* Improve validation of C++ exception handling: diagnose throwing incomplete ↵Sebastian Redl2009-04-271-2/+22
| | | | | | types and jumps into protected try-catch scopes. llvm-svn: 70242
* split ObjC and C++ Statements out into their own headers.Chris Lattner2009-04-261-0/+1
| | | | llvm-svn: 70105
* add support for goto checking and @synchronized blocks,Chris Lattner2009-04-211-0/+16
| | | | | | rdar://6810106 llvm-svn: 69667
* move jump scope checking and related code out into its own file, SemaDecl.cpp isChris Lattner2009-04-191-0/+290
already too large. llvm-svn: 69505
OpenPOWER on IntegriCloud