diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-03-20 04:28:39 +0000 | 
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-20 04:28:39 +0000 | 
| commit | 4e3e0991e9fed709600b72f8f84bb6f1d89f3ead (patch) | |
| tree | 0c28d80abceb59066875e674c65d31f471facd60 | |
| parent | fe06df4bf30c826411594c664e64f849a0faef0b (diff) | |
| download | bcm5719-llvm-4e3e0991e9fed709600b72f8f84bb6f1d89f3ead.tar.gz bcm5719-llvm-4e3e0991e9fed709600b72f8f84bb6f1d89f3ead.zip | |
Revert r99024, "Augment path diagnostics to include displaying when a message
expression", statistical evidence indicates it has some kind of memory error.
llvm-svn: 99040
| -rw-r--r-- | clang/include/clang/Checker/BugReporter/BugReporter.h | 2 | ||||
| -rw-r--r-- | clang/lib/Checker/BugReporter.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Checker/BugReporterVisitors.cpp | 51 | 
3 files changed, 4 insertions, 51 deletions
| diff --git a/clang/include/clang/Checker/BugReporter/BugReporter.h b/clang/include/clang/Checker/BugReporter/BugReporter.h index da91e126f08..6c41668ccec 100644 --- a/clang/include/clang/Checker/BugReporter/BugReporter.h +++ b/clang/include/clang/Checker/BugReporter/BugReporter.h @@ -467,8 +467,6 @@ void registerTrackNullOrUndefValue(BugReporterContext& BRC, const void *stmt,  void registerFindLastStore(BugReporterContext& BRC, const void *memregion,                             const ExplodedNode *N); -void registerNilReceiverVisitor(BugReporterContext &BRC); -  } // end namespace clang::bugreporter diff --git a/clang/lib/Checker/BugReporter.cpp b/clang/lib/Checker/BugReporter.cpp index c7438447bbb..0cf593b2600 100644 --- a/clang/lib/Checker/BugReporter.cpp +++ b/clang/lib/Checker/BugReporter.cpp @@ -1613,9 +1613,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,    else      return; -  // Register node visitors.    R->registerInitialVisitors(PDB, N); -  bugreporter::registerNilReceiverVisitor(PDB);    switch (PDB.getGenerationScheme()) {      case PathDiagnosticClient::Extensive: diff --git a/clang/lib/Checker/BugReporterVisitors.cpp b/clang/lib/Checker/BugReporterVisitors.cpp index 6cf6d92efb8..6cf41b14dc5 100644 --- a/clang/lib/Checker/BugReporterVisitors.cpp +++ b/clang/lib/Checker/BugReporterVisitors.cpp @@ -103,6 +103,7 @@ public:        const ExplodedNode *Node = N, *Last = NULL;        for ( ; Node ; Last = Node, Node = Node->getFirstPred()) { +          if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {            if (const PostStmt *P = Node->getLocationAs<PostStmt>())              if (const DeclStmt *DS = P->getStmtAs<DeclStmt>()) @@ -247,6 +248,7 @@ public:      // Check if in the previous state it was feasible for this constraint      // to *not* be true.      if (PrevN->getState()->Assume(Constraint, !Assumption)) { +        isSatisfied = true;        // As a sanity check, make sure that the negation of the constraint @@ -257,8 +259,8 @@ public:        // We found the transition point for the constraint.  We now need to        // pretty-print the constraint. (work-in-progress) -      llvm::SmallString<256> sbuf; -      llvm::raw_svector_ostream os(sbuf); +      std::string sbuf; +      llvm::raw_string_ostream os(sbuf);        if (isa<Loc>(Constraint)) {          os << "Assuming pointer value is "; @@ -363,48 +365,3 @@ void clang::bugreporter::registerFindLastStore(BugReporterContext& BRC,    BRC.addVisitor(new FindLastStoreBRVisitor(V, R));  } - -namespace { -class NilReceiverVisitor : public BugReporterVisitor { -public: -  NilReceiverVisitor() {} - -  PathDiagnosticPiece* VisitNode(const ExplodedNode *N, -                                 const ExplodedNode *PrevN, -                                 BugReporterContext& BRC) { - -    const PostStmt *P = N->getLocationAs<PostStmt>(); -    if (!P) -      return 0; -    const ObjCMessageExpr *ME = P->getStmtAs<ObjCMessageExpr>(); -    if (!ME) -      return 0; -    const Expr *Receiver = ME->getReceiver(); -    if (!Receiver) -      return 0; -    const GRState *state = N->getState(); -    const SVal &V = state->getSVal(Receiver); -    const DefinedOrUnknownSVal *DV = dyn_cast<DefinedOrUnknownSVal>(&V); -    if (!DV) -      return 0; - -    state = state->Assume(*DV, true); -    if (state) -      return 0; - -    // The receiver was nil, and hence the method was skipped. -    // Register a BugReporterVisitor to issue a message telling us how -    // the receiver was null. -    bugreporter::registerTrackNullOrUndefValue(BRC, Receiver, N); - -    //Issue a message saying that the method was skipped. -    PathDiagnosticLocation L(Receiver, BRC.getSourceManager()); -    return new PathDiagnosticEventPiece(L, "No method actually called " -                                           "because the receiver is nil"); -  } -}; -} // end anonymous namespace - -void clang::bugreporter::registerNilReceiverVisitor(BugReporterContext &BRC) { -  BRC.addVisitor(new NilReceiverVisitor()); -} | 

