summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Thread-safety analysis: eliminate false positives in case where the definitionDeLesley Hutchins2012-07-051-183/+188
| | | | | | | duplicates attributes on the declaration. Also eliminates a false negative in ReleasableMutexLock. Fixing this bug required some refactoring. llvm-svn: 159780
* Drop the ASTContext.h include from DeclFriend.h and DeclTemplate.h.Benjamin Kramer2012-07-041-0/+1
| | | | llvm-svn: 159723
* Drop the ASTContext.h include from Stmt.h and fix up transitive users.Benjamin Kramer2012-07-042-0/+2
| | | | | | | | | | | | | | This required moving the ctors for IntegerLiteral and FloatingLiteral out of line which shouldn't change anything as they are usually called through Create methods that are already out of line. ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector and make it independent from ASTContext.h Pass the StorageAllocator directly to AccessedEntity so it doesn't need to have a definition of ASTContext around. llvm-svn: 159718
* Thread safety analysis: improve handling of smart pointers.DeLesley Hutchins2012-07-031-0/+19
| | | | llvm-svn: 159679
* Thread Safety Analysis: handle expressions involving temporaries,DeLesley Hutchins2012-07-031-8/+14
| | | | | | e.g. ExprWithCleanups. llvm-svn: 159674
* -Wuninitialized: assume that an __attribute__((returns_twice)) function mightRichard Smith2012-07-021-0/+18
| | | | | | | initialize any variable. This is extremely conservative, but is sufficient for now. llvm-svn: 159620
* Thread safety analysis: fixed bug that occurs when very silly peopleDeLesley Hutchins2012-07-021-14/+33
| | | | | | | use scoped_lockable without putting unlock_function on the destructor. llvm-svn: 159609
* Thread safety analysis: fixed incorrect error message at the end of a ↵DeLesley Hutchins2012-07-021-6/+15
| | | | | | locks_required function. llvm-svn: 159607
* Thread safety analysis: don't warn in case of duplicate annotation.DeLesley Hutchins2012-07-021-8/+11
| | | | llvm-svn: 159606
* Thread Safety Analysis: turn off checking within trylock functions.DeLesley Hutchins2012-07-021-0/+6
| | | | llvm-svn: 159601
* Bail out the LiveVariables analysis when the CFG is very large, asTed Kremenek2012-07-021-0/+5
| | | | | | | | | we are encountering some scalability issues with memory usage. The appropriate long term fix is to make the analysis more scalable, but this will at least prevent the analyzer swapping when analyzing very large functions. llvm-svn: 159578
* Thread safety analysis: support release() function on scopedDeLesley Hutchins2012-06-281-20/+44
| | | | | | lockable objects. llvm-svn: 159387
* Thread safety analysis: implement lock_returned attribute.DeLesley Hutchins2012-06-251-46/+88
| | | | llvm-svn: 159152
* Thread safety analysis: fixes a bug in which locksets are not handledDeLesley Hutchins2012-06-221-44/+50
| | | | | | | | properly if there is a join point in the control flow graph that involves a trylock. Also changes the source locations of some warnings to be more consistent. llvm-svn: 159008
* Remove a goofy CMake hack and use the standard CMake facilities toChandler Carruth2012-06-211-4/+12
| | | | | | | | | express library-level dependencies within Clang. This is no more verbose really, and plays nicer with the rest of the CMake facilities. It should also have no change in functionality. llvm-svn: 158888
* -Wuninitialized bugfix: when entering the scope of a variable with noRichard Smith2012-06-161-0/+12
| | | | | | | initializer, it is uninitialized, even if we may be coming from somewhere where it was initialized. llvm-svn: 158611
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-062-2/+2
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Remove unused private member variables found by clang's new ↵Benjamin Kramer2012-06-061-4/+3
| | | | | | -Wunused-private-field. llvm-svn: 158086
* Zap the /Za compiler switch from MSVC projects, the option is considered ↵Francois Pichet2012-06-061-2/+2
| | | | | | | | harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed. Only 1 minor code change was necessary: can't use cdecl as variable name anymore. llvm-svn: 158063
* Make suggestions for mismatched enum arguments to printf/scanf.Jordan Rose2012-06-042-0/+9
| | | | llvm-svn: 157962
* Teach printf/scanf about enums with fixed underlying types.Jordan Rose2012-06-041-0/+6
| | | | llvm-svn: 157961
* static analyzer: add inlining support for directly called blocks.Ted Kremenek2012-06-011-14/+27
| | | | llvm-svn: 157833
* Suggest '%@' for Objective-C objects in ObjC format strings.Jordan Rose2012-05-301-1/+23
| | | | llvm-svn: 157716
* Split a chunk of -Wconditional-uninitialized warnings out into a separate flag,Richard Smith2012-05-251-6/+134
| | | | | | | | | | | -Wsometimes-uninitialized. This detects cases where an explicitly-written branch inevitably leads to an uninitialized variable use (so either the branch is dead code or there is an uninitialized use bug). This chunk of warnings tentatively lives within -Wuninitialized, in order to give it more visibility to existing Clang users. llvm-svn: 157458
* Some cleanups around the uninitialized variables warning, and a FIXME. No ↵Richard Smith2012-05-241-22/+18
| | | | | | functional change. llvm-svn: 157440
* Make -Wformat accept printf("%hhx", c); with -funsigned-charHans Wennborg2012-05-081-2/+1
| | | | | | | | | For "%hhx", printf expects an unsigned char. This makes Clang accept a 'char' argument for that also when using -funsigned-char. This fixes PR12761. llvm-svn: 156388
* Fix handling of wint_t - we can't assume wint_t is purely an integer ↵James Molloy2012-05-041-10/+10
| | | | | | | | | | | | promotion of wchar_t - they may differ in signedness. Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned. There'll be a followup commit to fix that. Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8 llvm-svn: 156165
* Add -Wimplicit-fallthrough warning flag, which warns on fallthrough betweenRichard Smith2012-05-031-3/+0
| | | | | | | | | | | | cases in switch statements. Also add a [[clang::fallthrough]] attribute, which can be used to suppress the warning in the case of intentional fallthrough. Patch by Alexander Kornienko! The handling of C++11 attribute namespaces in this patch is temporary, and will be replaced with a cleaner mechanism in a subsequent patch. llvm-svn: 156086
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-302-2/+2
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* PR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler likeRichard Smith2012-04-301-1/+2
| | | | | | | | | | | g++4.7, which reuses stack space allocated for temporaries. CFGElement::getAs returns a suitably-cast version of 'this'. Patch by Markus Trippelsdorf! No test: this code has the same observable behavior as the old code when built with most compilers, and the tests were already failing when built with a compiler for which this produced a broken binary. llvm-svn: 155803
* [analyzer] Remove references to idx::TranslationUnit. Index is dead, ↵Jordy Rose2012-04-281-8/+3
| | | | | | cross-TU inlining never panned out. llvm-svn: 155751
* [analyzer] Run remove dead bindings right before leaving a function.Anna Zaks2012-04-201-2/+4
| | | | | | | | | | | | | | | | | | | | | This is needed to ensure that we always report issues in the correct function. For example, leaks are identified when we call remove dead bindings. In order to make sure we report a callee's leak in the callee, we have to run the operation in the callee's context. This change required quite a bit of infrastructure work since: - We used to only run remove dead bindings before a given statement; here we need to run it after the last statement in the function. For this, we added additional Program Point and special mode in the SymbolReaper to remove all symbols in context lower than the current one. - The call exit operation turned into a sequence of nodes, which are now guarded by CallExitBegin and CallExitEnd nodes for clarity and convenience. (Sorry for the long diff.) llvm-svn: 155244
* Refactor the thread safety analysis so that it is easier to doDeLesley Hutchins2012-04-191-272/+318
| | | | | | path-sensitive analysis like handling of trylock expressions. llvm-svn: 155137
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. llvm-svn: 154886
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-1/+5
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* Remove the unused, unmaintained, incomplete 'Index' library.Douglas Gregor2012-04-131-1/+1
| | | | llvm-svn: 154672
* [analyzer] PCH deserialization optimization.Anna Zaks2012-04-121-61/+32
| | | | | | | | | | | | | | | | We should not deserialize unused declarations from the PCH file. Achieve this by storing the top level declarations during parsing (HandleTopLevelDecl ASTConsumer callback) and analyzing/building a call graph only for those. Tested the patch on a sample ObjC file that uses PCH. With the patch, the analyzes is 17.5% faster and clang consumes 40% less memory. Got about 10% overall build/analyzes time decrease on a large Objective C project. A bit of CallGraph refactoring/cleanup as well.. llvm-svn: 154625
* Include lambda capture init expressions in CFG.Ted Kremenek2012-04-121-1/+17
| | | | llvm-svn: 154611
* Fix CFGBuilder to not include the body of a LambdaExpr in the CFG of the ↵Ted Kremenek2012-04-121-3/+5
| | | | | | enclosing function. llvm-svn: 154607
* Do not crash in the callgraph construction when encountering deleted ↵Ted Kremenek2012-04-051-1/+2
| | | | | | function definitions. Fixes <rdar://problem/11178609>. llvm-svn: 154081
* clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the ↵NAKAMURA Takumi2012-03-251-7/+4
| | | | | | map. llvm-svn: 153407
* clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.NAKAMURA Takumi2012-03-251-2/+5
| | | | | | evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator. llvm-svn: 153406
* [CFG] Cache boolean evaluations of expressions to avoid multiple re-evaluationsArgyrios Kyrtzidis2012-03-231-7/+66
| | | | | | | | | | during construction of branches for chained logical operators. This makes -fsyntax-only for test/Sema/many-logical-ops.c about 32x times faster. With measuring SemaExpr.cpp I see differences below the noise level. llvm-svn: 153297
* Fix broken CFG when an initializer is a statement expression that starts ↵Ted Kremenek2012-03-221-5/+15
| | | | | | with a while loop (PR 12325). llvm-svn: 153242
* [analyzer] Malloc: Utter the name of the leaked variable.Anna Zaks2012-03-211-2/+0
| | | | | | | | | | | | | | | Specifically, we use the last store of the leaked symbol in the leak diagnostic. (No support for struct fields since the malloc checker doesn't track those yet.) + Infrastructure to track the regions used in store evaluations. This approach is more precise than iterating the store to obtain the region bound to the symbol, which is used in RetainCount checker. The region corresponds to what is uttered in the code in the last store and we do not rely on the store implementation to support this functionality. llvm-svn: 153212
* Fix crash when querying the CFG reported when using the thread safety analysisTed Kremenek2012-03-191-1/+1
| | | | | | | on code using multi-dimensional arrays. Fix by DeLesley Hutchins, and reported in PR 12271. llvm-svn: 153067
* Kill cocoa::deriveNamingConvention and cocoa::followsFundamentalRule. They ↵Jordy Rose2012-03-171-40/+0
| | | | | | | | are now just simple wrappers around method families, and method decls can cache method family lookups. Also, no one is using them right now. The one difference between ObjCMethodDecl::getMethodFamily and Selector::getMethodFamily is that the former will do some additional sanity checking, and since CoreFoundation types don't look like Objective-C objects, an otherwise interesting method will get a method family of OMF_None. Future clients that use method families should consider how they want to handle CF types. llvm-svn: 153000
* Support '%p' format specifier with block pointers.Ted Kremenek2012-03-151-1/+1
| | | | llvm-svn: 152839
* Fix dereference of end iterator. Spotted by ASan.Matt Beaumont-Gay2012-03-141-1/+3
| | | | llvm-svn: 152738
* [analyzer] Refactor CallGraph to use Recursive AST visitor whenAnna Zaks2012-03-131-36/+32
| | | | | | collecting function Decls. llvm-svn: 152651
OpenPOWER on IntegriCloud