summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/JumpDiagnostics.cpp
Commit message (Collapse)AuthorAgeFilesLines
* ms-inline-asm: Scope inline asm labels to functionsEhsan Akhgari2014-09-221-4/+18
| | | | | | | | | | | | | | | | Summary: This fixes PR20023. In order to implement this scoping rule, we piggy back on the existing LabelDecl machinery, by creating LabelDecl's that will carry the "internal" name of the inline assembly label, which we will rewrite the asm label to. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4589 llvm-svn: 218230
* PR20356: Fix all Sema warnings with mismatched ext_/warn_ versusRichard Smith2014-07-191-2/+2
| | | | | | | | ExtWarn/Warnings. Mostly the name of the warning was changed to match the semantics, but in the PR20356 cases, the warning was about valid code, so the diagnostic was changed from ExtWarn to Warning instead. llvm-svn: 213443
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-1/+1
| | | | llvm-svn: 209613
* Add support for partial jump scope checkingAlp Toker2014-05-091-11/+22
| | | | | | | | | | This lets us diagnose and perform more complete semantic analysis when faced with errors in the function body or declaration. By recovering here we provide more consistent diagnostics, particularly during interactive editing. llvm-svn: 208394
* [C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with ↵Aaron Ballman2014-03-141-3/+2
| | | | | | iterator_range captures(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203958
* [C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-141-3/+2
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203947
* Rename language option MicrosoftMode to MSVCCompatAlp Toker2014-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
* PR18217: Rewrite JumpDiagnostics' handling of temporaries, to correctly handleRichard Smith2013-12-121-64/+54
| | | | | | | | | declarations that might lifetime-extend multiple temporaries. In passing, fix a crasher (PR18217) if an initializer was dependent and exactly the wrong shape, and remove a bogus function (Expr::findMaterializedTemporary) now its last use is gone. llvm-svn: 197103
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Fix a couple of bugs where jump diagnostics would not notice that a variableRichard Smith2013-06-031-6/+6
| | | | | | has an initializer. llvm-svn: 183092
* Fix handling of pointers-to-members and comma expressions whenRichard Smith2013-06-031-2/+7
| | | | | | lifetime-extending temporaries in reference bindings. llvm-svn: 183089
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-1/+1
| | | | llvm-svn: 171367
* Fix for PR12222.Erik Verbruggen2012-12-251-2/+8
| | | | | | | | Changed getLocStart() and getLocEnd() to be required for Stmts, and make getSourceRange() optional. The default implementation for getSourceRange() is build the range by calling getLocStart() and getLocEnd(). llvm-svn: 171067
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | 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
* Correctly reject gotos in function-level try blocks. PR14225.Eli Friedman2012-10-311-24/+23
| | | | llvm-svn: 167184
* Fix invalid jump scopes again. This time without trying to find out if anRafael Espindola2012-10-281-35/+45
| | | | | | incomplete type has a destructor or not. llvm-svn: 166895
* Revert 166876 while I debug a bootstrap problem.Rafael Espindola2012-10-271-45/+35
| | | | llvm-svn: 166878
* Reapply 166855 with an early exit on null QualTypes.Rafael Espindola2012-10-271-35/+45
| | | | llvm-svn: 166876
* Revert r166855. I can reproduce the bootstrap failure and have a testcaseRafael Espindola2012-10-271-41/+35
| | | | | | to reduce. llvm-svn: 166863
* Fix cases where we were not producing an error when a computed goto couldRafael Espindola2012-10-271-35/+41
| | | | | | | jump over destructor calls. Fixes pr13812. llvm-svn: 166855
* During jump-scope checking, build an ExprWithCleanups immediatelyJohn McCall2012-09-251-3/+8
| | | | | | | | | | | | into the enclosing scope; this is a more accurate model but is (I believe) unnecessary in my test case due to other flaws. However, one of those flaws is now intentional: blocks which appear in return statements can be trivially observed to not extend in lifetime past the return, and so we can allow a jump past them. Do the necessary magic in IR-generation to make this work. llvm-svn: 164589
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-4/+4
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* ArrayRef-icize the function arguments.Bill Wendling2012-02-221-3/+2
| | | | llvm-svn: 151151
* Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-PODRichard Smith2011-10-201-35/+84
| | | | | | | | but trivially constructible and destructible variables in C++11 mode. Also incidentally improve the precision of the wording for jump diagnostics in C++98 mode. llvm-svn: 142619
* Move the "jump bypasses variable initialization" error -> warning downgrade ↵Francois Pichet2011-09-181-1/+1
| | | | | | from -fms-extensions to -fms-compatibility. llvm-svn: 140008
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-1/+1
| | | | | | | | 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
* 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
OpenPOWER on IntegriCloud