[PATCH] [patch] Adding Consumed Analysis to Clang

Christian Wailes chriswailes at google.com
Mon Jul 29 18:20:24 PDT 2013


Hi dblaikie,

This patch adds the beginnings of an analysis that tracks the "consumed" state of objects (this was previously mentioned on the list as uniqueness analysis).

The analysis currently provides enough functionality to detect when a class like std::unique_ptr is dereferenced after it is created with a default constructor.  It can also track the state of an object across the branches of an if-statement if the statement contains a single test of a tracked variable.  Lastly, the state of a value that is passed as a RValue References to a function is correctly tracked.

Future work, to follow in the next couple of weeks, will include more precise handling of for- and while-loops, support for member functions that consume an object, and tracking of state across function boundaries.

http://llvm-reviews.chandlerc.com/D1233

Files:
  include/clang/Analysis/Analyses/Consumed.h
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AnalysisBasedWarnings.h
  lib/Analysis/CMakeLists.txt
  lib/Analysis/Consumed.cpp
  lib/Sema/AnalysisBasedWarnings.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaCXX/warn-consumed-analysis.cpp
  test/SemaCXX/warn-consumed-parsing.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1233.1.patch
Type: text/x-patch
Size: 40775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130729/d59c7b23/attachment.bin>


More information about the cfe-commits mailing list