summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* unique_ptrify ConsumedBlockInfo analysis to make it move assignableDavid Blaikie2015-08-141-72/+55
| | | | | | | | | ConsumedBlockInfo objects were move assigned, but only in a state where the dtor was a no-op anyway. Subtle and easily could've happened in ways that wouldn't've been safe - so this change makes it safe no matter what state the ConsumedBlockInfo object is in. llvm-svn: 244998
* Wdeprecated: Make BumpVectorContext movableDavid Blaikie2015-08-131-9/+7
| | | | | | | | | | | Turns out the one place that relied on the implicit copy ctor was safe because it created an object in a state where the dtor was a no-op, but that's more luck that good management. Sure up the API by defining move construction and using it, which implicitly disallows the unreliable copy operations. llvm-svn: 244968
* [modules] Fix thread safety analysis to cope with merging of FieldDecls ↵Richard Smith2015-08-121-1/+2
| | | | | | across modules. llvm-svn: 244714
* Use llvm::reverse to make a bunch of loops use foreach. NFC.Pete Cooper2015-07-301-3/+2
| | | | | | | | | | | | | | | | In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. llvm-svn: 243663
* Analysis: Fix example usage comment in CFG.cpp. NFCJonathan Roelofs2015-07-271-1/+1
| | | | | | Patch by Vedant Kumar! llvm-svn: 243275
* [AST] Remove StmtRange in favor of an iterator_range.Benjamin Kramer2015-07-181-1/+2
| | | | | | | | | StmtRange was just a convenient wrapper for two StmtIterators before we had real range support. This removes some of the implicit conversions StmtRange had leading to slightly more verbose code but also should make more obvious what's going on. No functional change intended. llvm-svn: 242615
* Rewrite users of Stmt::child_begin/end into for-range loops.Benjamin Kramer2015-07-031-5/+4
| | | | | | No functionality change intended. llvm-svn: 241355
* Switch users of the 'for (StmtRange range = stmt->children(); range; ↵Benjamin Kramer2015-07-024-15/+14
| | | | | | | | | ++range)‘ pattern to range for loops. The pattern was born out of the lack of range-based for loops in C++98 and is somewhat obscure. No functionality change intended. llvm-svn: 241300
* Parse 'technical term' format specifier.Ted Kremenek2015-07-021-0/+62
| | | | | | | | | | | | | | | | | | | | | | | Objective-C format strings now support modifier flags that can be attached to a '@' conversion. Currently the only one supported, as of iOS 9 and OS X 10.11, is the new "technical term", denoted by the flag "tt", for example: %[tt]@ instead of just: %@ The 'tt' stands for "technical term", which is used by the string-localization facilities on Darwin to add the appropriate spacing or quotation depending the language locale. Implements <rdar://problem/20374720>. llvm-svn: 241243
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-229-22/+19
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-229-19/+22
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Allow the cf_returns_[not_]retained attributes to appear on out-parameters.Douglas Gregor2015-06-191-1/+1
| | | | | | | | | | | | | | | | Includes a simple static analyzer check and not much else, but we'll also be able to take advantage of this in Swift. This feature can be tested for using __has_feature(cf_returns_on_parameters). This commit also contains two fixes: - Look through non-typedef sugar when deciding whether something is a CF type. - When (cf|ns)_returns(_not)?_retained is applied to invalid properties, refer to "property" instead of "method" in the error message. rdar://problem/18742441 llvm-svn: 240185
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | llvm-svn: 240110
* Append CXXDefaultInitExpr's wrapped expression to the CFG when visiting a ↵Enrico Pertoso2015-06-031-0/+13
| | | | | | | | | | | | | | | | | | | constructor initializer Summary: This patch is part of http://llvm-reviews.chandlerc.com/D2181. In-class initializers are appended to the CFG when CFGBuilder::addInitializer is called. Reviewers: jordan_rose, rsmith Reviewed By: jordan_rose Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D2370 llvm-svn: 238913
* Update -Winvalid-noreturn to handle destructors better.Richard Trieu2015-05-281-3/+2
| | | | | | | | | | When checking if a function is noreturn, consider a codepath to be noreturn if the path destroys a class and the class destructor, base class destructors, or member field destructors are marked noreturn. Differential Revision: http://reviews.llvm.org/D9454 llvm-svn: 238382
* Fix 'CFG graph' typo. NFCJonathan Roelofs2015-05-191-3/+3
| | | | | | Patch by Jon Eyolfson! llvm-svn: 237713
* Wrap to 80 columns. No behavior change.Nico Weber2015-05-181-1/+2
| | | | llvm-svn: 237549
* PR23334: Perform semantic checking of lambda capture initialization in the ↵Richard Smith2015-04-271-1/+1
| | | | | | | | | | | | | | | | | | right context. Previously we'd try to perform checks on the captures from the middle of parsing the lambda's body, at the point where we detected that a variable needed to be captured. This was wrong in a number of subtle ways. In PR23334, we couldn't correctly handle the list of potential odr-uses resulting from the capture, and our attempt to recover from that resulted in a use-after-free. We now defer building the initialization expression until we leave the lambda body and return to the enclosing context, where the initialization does the right thing. This patch only covers lambda-expressions, but we should apply the same change to blocks and captured statements too. llvm-svn: 235921
* Fix for PR20402 in -Wconsumed.DeLesley Hutchins2015-04-151-1/+1
| | | | | | | https://llvm.org/bugs/show_bug.cgi?id=20402 Patch by Chris Wailes. llvm-svn: 235051
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-3/+2
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Take the non-reference type when constructing a dummy expression.Richard Trieu2015-03-161-2/+2
| | | | | | Otherwise, Expr will assert during construction with a reference type. llvm-svn: 232425
* Make helper functions staticBenjamin Kramer2015-03-091-7/+6
| | | | | | NFC. llvm-svn: 231657
* Hide away implementation details of the ThreadSafetyAnalysis in anonymous ↵Benjamin Kramer2015-03-093-69/+41
| | | | | | | | namespaces NFC. llvm-svn: 231653
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-2/+2
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Add a format warning for "%p" with non-void* argsSeth Cantrell2015-03-041-37/+45
| | | | | | | | | | | | | | | | | | GCC -pedantic produces a format warning when the "%p" specifier is used with arguments that are not void*. It's useful for portability to be able to catch such warnings with clang as well. The warning is off by default in both gcc and with this patch. This patch enables it either when extensions are disabled with -pedantic, or with the specific flag -Wformat-pedantic. The C99 and C11 specs do appear to require arguments corresponding to 'p' specifiers to be void*: "If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined." [7.19.6.1 p9], and of the 'p' format specifier "The argument shall be a pointer to void." [7.19.6.1 p8] Both printf and scanf format checking are covered. llvm-svn: 231211
* Make -Wuninitialized warn on pointer-to-member and comma operators.Manuel Klimek2015-03-031-11/+44
| | | | | | | | | | | `isTrackedVar` has been updated to also track records. `DeclRefExpr`s appearing on the left side of a comma operator are ignored, while those appearing on the right side are classified as `Use`. Patch by Enrico Pertoso. llvm-svn: 231068
* Add support for analyzing FreeBSD kernel printf extensions.Dimitry Andric2015-02-192-5/+54
| | | | | | | | | | | | This adds a new __freebsd_kprintf__ format string type, which enables checking when used in __attribute__((format(...))) attributes. It can check the FreeBSD kernel specific %b, %D, %r and %y specifiers, using existing diagnostic messages. Also adds test cases for all these specifiers. Differential Revision: http://reviews.llvm.org/D7154 llvm-svn: 229921
* Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the ↵Aaron Ballman2015-02-151-1/+1
| | | | | | macro. NFC; Clang edition. llvm-svn: 229336
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-062-9/+6
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* Thread Safety Analysis: support adopting of locks, as implemented inDeLesley Hutchins2015-02-041-11/+24
| | | | | | | | std::lock_guard. If EXCLUSIVE_LOCKS_REQUIRED is placed on the constructor of a SCOPED_LOCKABLE class, then that constructor is assumed to adopt the lock; e.g. the lock must be held on construction, and will be released on destruction. llvm-svn: 228194
* Thread Safety Analysis: remove minor piece of unused code. No change inDeLesley Hutchins2015-02-041-4/+0
| | | | | | functionality. llvm-svn: 228176
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-031-23/+220
| | | | | | | | | | These checks detect potential deadlocks caused by inconsistent lock ordering. The checks are implemented under the -Wthread-safety-beta flag. This patch also replaces calls to getAttrs() with calls to attrs() throughout ThreadSafety.cpp, which fixes the earlier issue that cause assert failures. llvm-svn: 228051
* Revert "Thread Safety Analysis: add support for before/after annotations on ↵Reid Kleckner2015-02-031-216/+17
| | | | | | | | | mutexes." This reverts r227997, as well as r228009. It does not pass check-clang for me locally on Linux. llvm-svn: 228020
* thread safety: Add move ctor to BeforeInfo to fix MSVC buildReid Kleckner2015-02-031-0/+2
| | | | | | MSVC cannot infer move ctors yet. llvm-svn: 228009
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-031-17/+214
| | | | | | | These checks detect potential deadlocks caused by inconsistent lock ordering. The checks are implemented under the -Wthread-safety-beta flag. llvm-svn: 227997
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-144-5/+4
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFCAlexey Bataev2015-01-121-1/+1
| | | | llvm-svn: 225624
* [CallGraph] Make sure the edges are not missed due to re-declarationsAnna Zaks2014-12-171-8/+5
| | | | | | | | | | | | | | A patch by Daniel DeFreez! We were previously dropping edges on re-declarations. Store the canonical declarations in the graph to ensure that different references to the same function end up reflected with the same call graph node. (Note, this might lead to performance fluctuation because call graph is used to determine the function analysis order.) llvm-svn: 224398
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-161-1/+1
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* When checking for uninitialized values, do not confuse "std::move" with everyRichard Trieu2014-11-271-1/+2
| | | | | | other function named "move". llvm-svn: 222863
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-1/+1
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* Thread Safety Analysis: move warnings on range-based for loops out of betaDeLesley Hutchins2014-11-051-11/+9
| | | | | | and into -Wthread-safety. llvm-svn: 221410
* Remove unused member variable.Craig Topper2014-10-211-1/+0
| | | | llvm-svn: 220264
* [Analysis] Add missing newlines at end of file.Daniel Dunbar2014-10-091-1/+1
| | | | llvm-svn: 219439
* Reverting r214064 and r215650 while investigating a pesky performance regressionArtyom Skrobov2014-09-236-143/+134
| | | | llvm-svn: 218296
* Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, whichDeLesley Hutchins2014-09-181-16/+68
| | | | | | | | warns when a guarded variable is passed by reference as a function argument. This is released as a separate warning flag, because it could potentially break existing code that uses thread safety analysis. llvm-svn: 218087
* Fixing a -Woverflow warning from GCC by using a more natural datatype for ↵Aaron Ballman2014-09-121-2/+2
| | | | | | this operation. NFC. llvm-svn: 217670
* Fix a couple of -Wsign-compare warnings introduced in r217556Justin Bogner2014-09-111-3/+2
| | | | llvm-svn: 217569
* Thread Safety Analysis: major update to thread safety TIL.DeLesley Hutchins2014-09-102-99/+252
| | | | | | | | | | | | Numerous changes, including: * Changed the way variables and instructions are handled in basic blocks to be more efficient. * Eliminated SExprRef. * Simplified futures. * Fixed documentation. * Compute dominator and post dominator trees. llvm-svn: 217556
* Objective-C. Under a special flag, -Wcstring-format-directive,Fariborz Jahanian2014-09-091-9/+45
| | | | | | | | off by default, issue a warning if %s directive is used in certain CF/NS formatting APIs, to assist user in deprecating use of such %s in these APIs. rdar://18182443 llvm-svn: 217467
OpenPOWER on IntegriCloud