summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Added psuedo-constant analysis and integrated it into the false positive ↵Tom Care2010-08-183-0/+128
| | | | | | | | | | | | | reduction stage in IdempotentOperationChecker. - Renamed IdempotentOperationChecker::isConstant to isConstantOrPseudoConstant to better reflect the function - Changed IdempotentOperationChecker::PreVisitBinaryOperator to only run 'CanVary' once on undefined assumptions - Created new PsuedoConstantAnalysis class and added it to AnalysisContext - Changed IdempotentOperationChecker to exploit the new analysis - Updated tests with psuedo-constants - Added check to IdempotentOperationChecker to see if a Decl is const qualified llvm-svn: 111426
* Fix horrible CFG bug caused by a series of NullStmts appearing at the ↵Ted Kremenek2010-08-171-1/+4
| | | | | | | | beginning of a do...while loop. This would cause the body of the DoStmt to be disconnected from the preceding code. llvm-svn: 111283
* CFGBuilder: don't create the empty "loop back" block for DoStmts if the loop ↵Ted Kremenek2010-08-171-12/+16
| | | | | | edge can never be taken. llvm-svn: 111282
* Fix a bug where child statements could not be identified as being in a ↵Tom Care2010-08-111-1/+1
| | | | | | CFGBlock in CFGStmtMap::getBlock. llvm-svn: 110881
* Remove bonehead redeclaration.Ted Kremenek2010-08-051-1/+1
| | | | llvm-svn: 110288
* Fix CFGBuilder to not blow out the stack when processing deeply nested ↵Ted Kremenek2010-08-041-5/+32
| | | | | | CaseStmts. Fixes <rdar://problem/8268753>. llvm-svn: 110286
* Add CFGStmtMap, which defines a mapping from Stmt* to CFGBlock*. The ↵Ted Kremenek2010-08-042-0/+89
| | | | | | immediate intended use is in the unreachable code analysis. llvm-svn: 110230
* Add -cc1 option '-unoptimized-cfg' to toggle using a CFG (for static ↵Ted Kremenek2010-08-031-1/+4
| | | | | | analysis) that doesn't prune CFG edges. llvm-svn: 110087
* Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to ↵Ted Kremenek2010-08-022-21/+46
| | | | | | | | the original CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)'). llvm-svn: 110085
* Revert r109428 "Hoist argument type checking into CheckFormatHandler. This ↵Michael J. Spencer2010-07-272-9/+1
| | | | | | | | is prep for scanf format" Got errors about ASTContext being undefined with Visual Studio 2010. llvm-svn: 109491
* Fix namespace polution.Dan Gohman2010-07-262-1/+3
| | | | llvm-svn: 109440
* Hoist argument type checking into CheckFormatHandler. This is prep for ↵Ted Kremenek2010-07-262-1/+9
| | | | | | | | scanf format string argument type checking. llvm-svn: 109428
* Make a bunch of new data structures for the new analysisZhongxing Xu2010-07-221-1/+1
| | | | | | | engine of the new translation unit. State marshal is there but no real work is done. End nodes are passed back. llvm-svn: 109105
* Hookup checking for invalid length modifiers in scanf format strings.Ted Kremenek2010-07-201-21/+23
| | | | llvm-svn: 108907
* Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.Ted Kremenek2010-07-202-70/+75
| | | | llvm-svn: 108906
* Cleanup whitespace in switch statement. No functionality change.Ted Kremenek2010-07-201-6/+7
| | | | llvm-svn: 108905
* Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace andTed Kremenek2010-07-202-29/+32
| | | | | | | derived 'PrintfConversionSpecifier' from this class. We will do the same for 'ScanfConversionSpecifier'. llvm-svn: 108903
* Rename 'UnicodeStrArg' to 'SArg'.Ted Kremenek2010-07-201-3/+3
| | | | llvm-svn: 108901
* Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and ↵Ted Kremenek2010-07-202-7/+7
| | | | | | printf checking). llvm-svn: 108900
* Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking.Ted Kremenek2010-07-201-4/+4
| | | | llvm-svn: 108899
* Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous ↵Ted Kremenek2010-07-201-6/+6
| | | | | | enum for scanf checking. llvm-svn: 108898
* Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to matchTed Kremenek2010-07-201-4/+4
| | | | | | | analagous enum in analyze_scanf. This is prep for refactoring the logic for handling ConversionSpecifiers for both scanf and printf. llvm-svn: 108897
* Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes ↵Ted Kremenek2010-07-191-0/+4
| | | | | | <rdar://problem/8204052>. llvm-svn: 108742
* Reapply r108617.Zhongxing Xu2010-07-191-2/+3
| | | | llvm-svn: 108668
* BUILD_ARCHIVE is the default for libraries, no need to set it.Chris Lattner2010-07-181-1/+0
| | | | llvm-svn: 108633
* Revert r108617, it broke the build.Benjamin Kramer2010-07-171-3/+2
| | | | llvm-svn: 108621
* Prepare the analyzer for the callee in another translation unit:Zhongxing Xu2010-07-171-2/+3
| | | | | | | Let AnalysisContext contain a TranslationUnit. Let CallEnter refer to an AnalysisContext instead of a FunctionDecl. llvm-svn: 108617
* Hook up warning for an incomplete scanlist in scanf format strings.Ted Kremenek2010-07-161-2/+2
| | | | llvm-svn: 108542
* Add the main scanf-parsing logic that I meant to include in my previous commit.Ted Kremenek2010-07-161-0/+214
| | | | llvm-svn: 108502
* Add missing header file.Ted Kremenek2010-07-161-0/+71
| | | | llvm-svn: 108501
* Add most of the boilerplate support for scanf format string checking. This ↵Ted Kremenek2010-07-163-405/+425
| | | | | | | | | | | | | includes handling the parsing of scanf format strings and hooking the checking into Sema. Most of this checking logic piggybacks on what was already there for checking printf format strings, but the checking logic has been refactored to support both. What is left to be done is to support argument type checking in format strings and of course fix the usual tail of bugs that will follow. llvm-svn: 108500
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-1/+1
| | | | | | | | | types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. llvm-svn: 106595
* Printf format strings: Added some more tests and fixed some minor bugs.Tom Care2010-06-181-3/+4
| | | | | | | | | | | | | | - Precision toStrings shouldn't print a dot when they have no value. - Length of char length modifier is now returned correctly. - Added several fixit tests. Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now. M test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp llvm-svn: 106275
* Bug 7394 - Fixed toString representation of Precisions in format strings.Tom Care2010-06-171-0/+3
| | | | | | | M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp llvm-svn: 106245
* Bug 7377: Fixed several bad printf format string bugs.Tom Care2010-06-171-11/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added warning for undefined behavior when using field specifier - Added warning for undefined behavior when using length modifier - Fixed warnings for invalid flags - Added warning for ignored flags - Added fixits for the above warnings - Fixed accuracy of detecting several undefined behavior conditions - Receive normal warnings in addition to security warnings when using %n - Fix bug where '+' flag would remain on unsigned conversion suggestions Summary of changes: - Added expanded tests - Added/expanded warnings - Added position info to OptionalAmounts for fixits - Extracted optional flags to a wrapper class with position info for fixits - Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior - Fixed conversion specifier checking to conform to C99 standard - Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly. M test/Sema/format-strings.c M include/clang/Basic/DiagnosticSemaKinds.td M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp M lib/Sema/SemaChecking.cpp llvm-svn: 106233
* Update CMake build for new attribute changes.Alexis Hunt2010-06-171-1/+2
| | | | llvm-svn: 106188
* Extend format string type-checking to include '%p'. Fixes remaining cases ↵Ted Kremenek2010-06-161-76/+92
| | | | | | PR 4468. llvm-svn: 106151
* Small fixes regarding printf fix suggestions.Tom Care2010-06-111-0/+8
| | | | | | | | | | | | - Added some handling of flags that become invalid when changing the conversion specifier. - Changed fixit behavior to remove unnecessary length modifiers. - Separated some tests out and added some comments. modified: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings-fixit.c llvm-svn: 105807
* Fix a typo that breaks the GCC build. Turns out that Clang isn'tDouglas Gregor2010-06-091-1/+1
| | | | | | | diagnosing this code as an error when it should, so I've filed http://llvm.org/bugs/show_bug.cgi?id=7325. llvm-svn: 105683
* Added FixIt support to printf format string checking.Tom Care2010-06-091-33/+228
| | | | | | | | | | | | | | | | - Refactored LengthModifier to be a class. - Added toString methods in all member classes of FormatSpecifier. - FixIt suggestions keep user specified flags unless incorrect. Limitations: - The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation. A test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp M lib/Sema/SemaChecking.cpp llvm-svn: 105680
* Makefiles: Set Clang CPP compiler flags in a single location, instead of ↵Daniel Dunbar2010-06-081-2/+0
| | | | | | scattered throughout the project Makefiles. llvm-svn: 105638
* Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.Daniel Dunbar2010-06-081-2/+2
| | | | | | - This eliminates most dependencies on how Clang is installed relative to LLVM. llvm-svn: 105637
* Assignments to reference variables shouldn't kill the variable.Jordy Rose2010-06-041-9/+13
| | | | llvm-svn: 105452
* Make addStmt always add stmt. Delegate other cases to Visit() directly.Zhongxing Xu2010-06-031-6/+6
| | | | llvm-svn: 105384
* CFG: add all LHS of assingments as lvalue. This improves support for C++ ↵Zhongxing Xu2010-06-031-2/+15
| | | | | | reference. Patch by Jordy. llvm-svn: 105383
* Convert DeclNodes to use TableGen.Alexis Hunt2010-05-301-1/+1
| | | | | | | | The macros required for DeclNodes use have changed to match the use of StmtNodes. The FooFirst enumerator constants have been named firstFoo to match usage elsewhere. llvm-svn: 105165
* Fix crash in CFG construction for 'break' statements appearing in statement ↵Ted Kremenek2010-05-211-7/+8
| | | | | | | | expressions within the increment code of a for loop. llvm-svn: 104375
* Don't add a null successor to a CFGBlock when the contents of an ↵Ted Kremenek2010-05-131-2/+1
| | | | | | | | @synchronized statement is empty. Fixes <rdar://problem/7979430>. llvm-svn: 103717
* Unbreak CMake build.Douglas Gregor2010-05-051-1/+1
| | | | llvm-svn: 103077
* Add null check in CFGBuilder::VisitStmt() to make CFG constructionTed Kremenek2010-04-301-0/+4
| | | | | | more resilient to bad code. llvm-svn: 102793
OpenPOWER on IntegriCloud