summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix CFG crasher involving statement expressions reported in PR 6938.Ted Kremenek2010-04-291-2/+10
| | | | llvm-svn: 102576
* Use direct assignment instead of user defined conversion.Zhongxing Xu2010-04-141-3/+3
| | | | llvm-svn: 101236
* CFGBuilder: always add C++ member call expr as block-level expr.Zhongxing Xu2010-04-131-0/+13
| | | | llvm-svn: 101127
* Fix CFG bug where bases of member expressions were not always evaluated in a ↵Ted Kremenek2010-04-111-4/+24
| | | | | | lvalue context. Fixes <rdar://problem/7813989>. llvm-svn: 100966
* Fix bug in AddStmtChoice:asLValue() where 'AsLValueNotAlwaysAdd' would not ↵Ted Kremenek2010-04-111-1/+1
| | | | | | be treated as indicating an lvalue. llvm-svn: 100965
* Sort visitor methods. No functionality change.Ted Kremenek2010-04-111-5/+4
| | | | llvm-svn: 100964
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-1/+1
| | | | | | | | 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
* Fix '+=' accumulation error when parsing numeric amounts in a format string.Ted Kremenek2010-03-251-1/+1
| | | | llvm-svn: 99479
* Only perform CFG-based warnings on 'static inline' functions thatTed Kremenek2010-03-231-12/+16
| | | | | | | are called (transitively) by regular functions/blocks within a translation untion. llvm-svn: 99233
* Allow users to set CPPFLAGS and CXXFLAGS on the make command line.Jeffrey Yasskin2010-03-121-1/+1
| | | | | Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test) llvm-svn: 98399
* When computing in AnalysisContext the variables referencedTed Kremenek2010-03-101-6/+20
| | | | | | by a block, also look at the contained blocks. llvm-svn: 98111
* Simplify code a bit and remove unneeded semicolons.Benjamin Kramer2010-03-031-7/+4
| | | | llvm-svn: 97654
* Fix an algorithmic bug in LiveVariables pointed out by Zhongxing.Ted Kremenek2010-03-031-6/+9
| | | | | | | If an initializer in a DeclStmt references the declared variable, that extends the liveness of that variable. llvm-svn: 97624
* [CFG]Ted Kremenek2010-03-022-19/+23
| | | | | | | | | | | | | | | | | | | After discussion with Zhongxing, don't force the initializer of DeclStmts to be block-level expressions. This led to some interesting fallout: [UninitializedValues] Always visit the initializer of DeclStmts (do not assume they are block-level expressions). [BasicStore] With initializers of DeclStmts no longer block-level expressions, this causes self-referencing initializers (e.g. 'int x = x') to no longer cause the initialized variable to be live before the DeclStmt. While this is correct, it caused BasicStore::RemoveDeadBindings() to prune off the values of these variables from the initial store (where they are set to uninitialized). The fix is to back-port some (and only some) of the lazy-binding logic from RegionStore to BasicStore. Now the default values of local variables are determined lazily as opposed to explicitly initialized. llvm-svn: 97591
* Register all parameters even if they didn't occur in the function body.Zhongxing Xu2010-03-021-0/+6
| | | | | | | We may query their liveness because they are added to store when passing argument values. llvm-svn: 97562
* Allow a '0' precision in format strings (as the man page says it is okay).Ted Kremenek2010-03-011-10/+18
| | | | | | Fixes <rdar://problem/7700339>. llvm-svn: 97482
* For printf format string checking, add support for positional format strings.Ted Kremenek2010-02-271-15/+134
| | | | | | Along the way, coelesce some of the diagnostics. llvm-svn: 97297
* For printf format string checking, move the tracking of the data argument ↵Ted Kremenek2010-02-261-13/+21
| | | | | | | | | index out of Sema and into analyze_printf::ParseFormatString(). Also use a bitvector to determine what arguments have been covered (instead of just checking to see if the last argument consumed is the max argument). This is prep. for support positional arguments (an IEEE extension). llvm-svn: 97248
* Always add CallExpr as block-level expression. Inline-based interproceduralZhongxing Xu2010-02-241-1/+1
| | | | | | analysis needs this. llvm-svn: 97014
* Add support for '%C' and '%S' printf conversion specifiers.Ted Kremenek2010-02-241-22/+35
| | | | llvm-svn: 97005
* Move the rest of the unreachable code analysis from libSemaTed Kremenek2010-02-231-9/+235
| | | | | | to libAnalysis (with only the error reporting in libSema). llvm-svn: 96893
* Start moving some of the logic for the unreachable code analysis out of libSemaTed Kremenek2010-02-232-0/+53
| | | | | | and into libAnalysis. llvm-svn: 96872
* Revert "Simplify code: Succ is guaranteed to be not NULL.", which turns out toDaniel Dunbar2010-02-221-28/+28
| | | | | | not be guaranteed. llvm-svn: 96782
* Simplify code: Succ is guaranteed to be not NULL.Zhongxing Xu2010-02-221-28/+28
| | | | llvm-svn: 96772
* Add a utility method.Zhongxing Xu2010-02-171-0/+12
| | | | llvm-svn: 96471
* Refactor the logic for printf argument type-checking into ↵Ted Kremenek2010-02-161-32/+143
| | | | | | | | | | analyze_printf::ArgTypeResult. Implement printf argument type checking for '%s'. Fixes <rdar://problem/3065808>. llvm-svn: 96310
* Convert tabs to spaces.Ted Kremenek2010-02-091-5/+5
| | | | llvm-svn: 95621
* Teach RegionStore::InvalidateRegions() to also invalidate static variables ↵Ted Kremenek2010-02-061-2/+20
| | | | | | referenced by blocks. llvm-svn: 95459
* Move ParseFormatString() and FormatStringHandler back into the ↵Ted Kremenek2010-02-041-2/+4
| | | | | | analyze_printf namespace. llvm-svn: 95324
* Add format string type checking support for 'long double'.Ted Kremenek2010-02-011-1/+4
| | | | llvm-svn: 95026
* Recognize 'q' as a format length modifier (from BSD).Daniel Dunbar2010-01-301-0/+1
| | | | llvm-svn: 94894
* Add format string checking of 'double' arguments. Fixes ↵Ted Kremenek2010-01-301-0/+3
| | | | | | <rdar://problem/6931734>. llvm-svn: 94867
* Fix spacing.Ted Kremenek2010-01-291-1/+1
| | | | llvm-svn: 94852
* Per a suggestion from Cristian Draghici, add a method to FormatSpecifier ↵Ted Kremenek2010-01-291-0/+53
| | | | | | that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases. llvm-svn: 94851
* Enhancements to the alternate (WIP) format string checking:Ted Kremenek2010-01-291-2/+10
| | | | | | | | | | - Add ConversionSpecifier::consumesDataArgument() as a helper method to determine if a conversion specifier requires a matching argument. - Add support for glibc-specific '%m' conversion - Add an extra callback to HandleNull() for locations within the format specifier that have a null character llvm-svn: 94834
* Alternate format string checking: issue warnings for incomplete format ↵Ted Kremenek2010-01-291-13/+11
| | | | | | | | | | specifiers. In addition, move ParseFormatString() and FormatStringHandler() from the clang::analyze_printf to the clang namespace. Hopefully this will resolve some link errors on Linux. llvm-svn: 94794
* Alternate format string checking: issue a warning for invalid conversion ↵Ted Kremenek2010-01-291-13/+18
| | | | | | specifiers. llvm-svn: 94792
OpenPOWER on IntegriCloud