diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2013-09-03 17:00:57 +0000 | 
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2013-09-03 17:00:57 +0000 | 
| commit | d2f4079db995c9dce34db0347b16df8ace62cf37 (patch) | |
| tree | 87711f6c80a2132f91dc03f3c3a6b68328617f5e /clang/lib/StaticAnalyzer/Core | |
| parent | c74c4976499b6ae5ff758cf5189b7bd69ca1ddc3 (diff) | |
| download | bcm5719-llvm-d2f4079db995c9dce34db0347b16df8ace62cf37.tar.gz bcm5719-llvm-d2f4079db995c9dce34db0347b16df8ace62cf37.zip | |
Add an implicit dtor CFG node just before C++ 'delete' expressions.
This paves the way for adding support for modeling the destructor of a
region before it is deleted. The statement "delete <expr>" now generates
this series of CFG elements:
  1. <expr>
  2. [B1.1]->~Foo() (Implicit destructor)
  3. delete [B1.1]
Patch by Karthik Bhat!
llvm-svn: 189828
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 10 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 3 | 
2 files changed, 13 insertions, 0 deletions
| diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 79139df786e..16369f0a2b7 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -287,6 +287,7 @@ void ExprEngine::processCFGElement(const CFGElement E, ExplodedNode *Pred,        ProcessInitializer(E.castAs<CFGInitializer>().getInitializer(), Pred);        return;      case CFGElement::AutomaticObjectDtor: +    case CFGElement::DeleteDtor:      case CFGElement::BaseDtor:      case CFGElement::MemberDtor:      case CFGElement::TemporaryDtor: @@ -535,6 +536,9 @@ void ExprEngine::ProcessImplicitDtor(const CFGImplicitDtor D,    case CFGElement::TemporaryDtor:      ProcessTemporaryDtor(D.castAs<CFGTemporaryDtor>(), Pred, Dst);      break; +  case CFGElement::DeleteDtor: +    ProcessDeleteDtor(D.castAs<CFGDeleteDtor>(), Pred, Dst); +    break;    default:      llvm_unreachable("Unexpected dtor kind.");    } @@ -562,6 +566,12 @@ void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor Dtor,                       Pred, Dst);  } +void ExprEngine::ProcessDeleteDtor(const CFGDeleteDtor Dtor, +                                   ExplodedNode *Pred, +                                   ExplodedNodeSet &Dst) { +  //TODO: Handle DeleteDtor +} +  void ExprEngine::ProcessBaseDtor(const CFGBaseDtor D,                                   ExplodedNode *Pred, ExplodedNodeSet &Dst) {    const LocationContext *LCtx = Pred->getLocationContext(); diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 33c7a82d8ea..8099cd3b74a 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -559,6 +559,9 @@ getLocationForCaller(const StackFrameContext *SFC,      return PathDiagnosticLocation::createEnd(Dtor.getTriggerStmt(),                                               SM, CallerCtx);    } +  case CFGElement::DeleteDtor: { +    llvm_unreachable("not yet implemented!"); +  }    case CFGElement::BaseDtor:    case CFGElement::MemberDtor: {      const AnalysisDeclContext *CallerInfo = CallerCtx->getAnalysisDeclContext(); | 

