summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/AnalysisBasedWarnings.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the ↵Ted Kremenek2011-02-231-3/+47
| | | | | | | | | | related code is reachable. This suppresses some diagnostics that occur in unreachable code (e.g., -Warray-bound). We only pay the cost of doing the reachability analysis when we issue one of these diagnostics. llvm-svn: 126290
* Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.Ted Kremenek2011-02-231-0/+1
| | | | llvm-svn: 126288
* Issue AnalysisBasedWarnings as part of calling ↵Ted Kremenek2011-02-231-23/+4
| | | | | | Sema::PopBlockOrFunctionScope(). No real functionality change. llvm-svn: 126287
* Don't suggest -Wuninitialized fixits for uninitialized enum types.Ted Kremenek2011-02-051-1/+3
| | | | llvm-svn: 124924
* Based on user feedback, swap -Wuninitialized diagnostics to have the warning ↵Ted Kremenek2011-02-021-32/+37
| | | | | | refer to the bad use, and the note to the variable declaration. llvm-svn: 124758
* Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code) ↵Ted Kremenek2011-02-011-1/+18
| | | | | | | | | | | | | that doesn't include implicit dtors. Implicit dtors confuse the ad hoc path-sensitivity of UninitializedValuesV2.cpp. This isn't the ideal solution, as it will directly impact compile time, but should significantly reduce the noise of -Wuninitialized on some code bases. This immediately "fixes" the false positive reported in PR 9063, although this isn't the right fix in the long run. llvm-svn: 124667
* Tweak -Wuninitialized fixit for '_Bool' types to be initialized to 0, and ↵Ted Kremenek2011-01-271-1/+1
| | | | | | C++ 'bool' types to false. llvm-svn: 124356
* Teach -Wuninitialized to suggest "= false" for initializing bool variables.Ted Kremenek2011-01-271-0/+3
| | | | llvm-svn: 124352
* Teach -Wreturn-type that destructors can appearTed Kremenek2011-01-261-11/+14
| | | | | | | | | after a 'return' in a CFGBlock. This accidentally was working before, but the false assumption that 'return' always appeared at the end of the block was uncovered by a recent change. llvm-svn: 124280
* Fix regression in -Wreturn-type caused by notTed Kremenek2011-01-251-12/+3
| | | | | | | | | | handling all CFGElement kinds. While writing the test case, it turned out that return-noreturn.cpp wasn't actually testing anything since it has the wrong -W flag. That uncovered another regression with the handling of destructors marked noreturn. WIP. llvm-svn: 124238
* Teach -Wuninitialized-experimental to also warnTed Kremenek2011-01-251-10/+17
| | | | | | about uninitialized variables captured by blocks. llvm-svn: 124213
* Provide -Wuninitialized-experimental fixitsTed Kremenek2011-01-211-3/+10
| | | | | | | for floats, and also check if 'nil' is declared when suggesting it for initializing ObjC pointers. llvm-svn: 124004
* Add basic fixits for -Wuninitialized-experimentalTed Kremenek2011-01-211-1/+20
| | | | | | | to suggest initializations for pointer and ObjC pointer types. llvm-svn: 123995
* Enhance -Wuninitialized-experimental diagnosticsTed Kremenek2011-01-211-3/+51
| | | | | | | | to issue the warning at an uninitialized variable's declaration, but to issue notes at possible uninitialized uses (which could be multiple). llvm-svn: 123994
* Teach UninitializedValuesV2 to implicitly reason about C++Ted Kremenek2011-01-181-7/+3
| | | | | | | | references by monitoring whether an access to a variable is solely to compute it's lvalue or to do an lvalue-to-rvalue conversion (i.e., a load). llvm-svn: 123777
* Handle base and member destructors in CheckFallThrough.Anders Carlsson2011-01-171-1/+10
| | | | llvm-svn: 123667
* Fix a bug where the -Wmissing-noreturn would always treat constructors with ↵Anders Carlsson2011-01-161-0/+6
| | | | | | base or member initializers as noreturn. llvm-svn: 123603
* Add initial prototype for implementation ofTed Kremenek2011-01-151-0/+30
| | | | | | -Wuninitialized based on CFG dataflow analysis. WIP. llvm-svn: 123512
* Remove a kludge from analysis based warnings that used to detectChandler Carruth2011-01-081-14/+2
| | | | | | | | | | | | | | | | temporaries with no-return destructors. The CFG now properly supports temporaries and implicit destructors which both makes this kludge no longer work, and conveniently removes the need for it. Turn on CFG handling of implicit destructors and initializers. Several ad-hoc benchmarks don't indicate any measurable performance impact from growing the CFG, and it fixes real correctness problems with warnings. As a result of turning on these CFG elements, we started to tickle an inf-loop in the unreachable code logic used for warnings. The fix is trivial. llvm-svn: 123056
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-9/+16
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patchZhongxing Xu2010-09-161-1/+5
| | | | | | and discussions with Ted and Jordy. llvm-svn: 114056
* Enhance -Wreturn-type to not warn when control-flow is most likely limited ↵Ted Kremenek2010-09-091-5/+9
| | | | | | | | by a switch statement explicitly covering all the cases for an enum value. llvm-svn: 113450
* 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
* Remove AnalysisBasedWarnings.h's dependency on Type.hJohn McCall2010-08-251-6/+21
| | | | llvm-svn: 112027
* Struggle mightily against header inclusion in Sema.h.John McCall2010-08-241-0/+1
| | | | llvm-svn: 111904
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-2/+2
| | | | llvm-svn: 110945
* Fix namespace polution.Dan Gohman2010-07-261-0/+4
| | | | llvm-svn: 109440
* Fix construction of AnalysisContext. Thanks Daniel.Zhongxing Xu2010-07-191-1/+1
| | | | llvm-svn: 108694
* Add a hack to silence warnings about failing to return from functions afterChandler Carruth2010-05-171-0/+13
| | | | | | a temporary with a noreturn destructor has been created. Fixes PR6884 for now. llvm-svn: 104000
* Don't emit any fallthrough / missing-noreturn warnings if we can'tJohn McCall2010-05-161-5/+11
| | | | | | compute a CFG for a function. llvm-svn: 103905
* Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when aTed Kremenek2010-04-301-2/+4
| | | | | | fatal error has occurred. llvm-svn: 102778
* An edge from a call expression to the exit block is only an abnormal edgeJohn McCall2010-04-301-1/+2
| | | | | | | | | | | if *none* of the successors of the call expression is the exit block. This matters when a call of bool type is the condition of (say) a while loop in a function with no statements after the loop. This *can* happen in C, but it's much more common in C++ because of overloaded operators. Suppresses some substantial number of spurious -Wmissing-noreturn warnings. llvm-svn: 102696
* If a non-noreturn virtual member function is guaranteed not to return,Douglas Gregor2010-04-161-5/+16
| | | | | | | do *not* suggest that the function could be attribute 'noreturn'; overridden functions may end up returning. llvm-svn: 101572
* Remove micro-optimization for not issueing CFG-based warnings for 'static ↵Ted Kremenek2010-04-081-59/+2
| | | | | | | | | | inline' functions unless they are used. I discussed this with Daniel Dunbar, and we agreed that this provides an inconsistent warnings experience for the user and that there were genuine cases where we wouldn't want to do this optimization. llvm-svn: 100800
* Removed unused object.Ted Kremenek2010-04-081-1/+0
| | | | llvm-svn: 100750
* Use SmallVector instead of an std::queue.Ted Kremenek2010-04-081-2/+1
| | | | llvm-svn: 100730
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-2/+2
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Be a bit more consistent in using operator->Rafael Espindola2010-03-291-1/+1
| | | | | | | This patch moves some methods from QualType to Type and changes the users to use -> instead of . llvm-svn: 99805
* For forward-declared static inline functions, delay CFG-based warnings until weTed Kremenek2010-03-231-7/+21
| | | | | | encounter a definition. llvm-svn: 99243
* Only perform CFG-based warnings on 'static inline' functions thatTed Kremenek2010-03-231-23/+69
| | | | | | | are called (transitively) by regular functions/blocks within a translation untion. llvm-svn: 99233
* Don't bother running the analysis for CFG-based warnings if theTed Kremenek2010-03-201-0/+7
| | | | | | declaration is in a system header. llvm-svn: 99087
* Refactor CFG-based warnings in Sema to be run by a worked object called ↵Ted Kremenek2010-03-201-0/+362
AnalysisBasedWarnings. This object controls when the warnings are executed, allowing the client code in Sema to selectively disable warnings as needed. Centralizing the logic for analysis-based warnings allows us to optimize when and how they are run. Along the way, remove the redundant logic for the 'check fall-through' warning for blocks; now the same logic is used for both blocks and functions. llvm-svn: 99085
OpenPOWER on IntegriCloud