: PathDiagnosticPiece(Call), Caller(callerD),
Callee(0), callReturn(callReturnPos) {}
- PathDiagnosticCallPiece(PathPieces &oldPath)
- : PathDiagnosticPiece(Call), Caller(0), Callee(0), path(oldPath) {}
+ PathDiagnosticCallPiece(PathPieces &oldPath, const Decl *caller)
+ : PathDiagnosticPiece(Call), Caller(caller), Callee(0),
+ NoExit(true), path(oldPath) {}
const Decl *Caller;
const Decl *Callee;
+
+ // Flag signifying that this diagnostic has only call enter and no matching
+ // call exit.
+ bool NoExit;
+
public:
PathDiagnosticLocation callEnter;
PathDiagnosticLocation callEnterWithin;
const CallExit &CE,
const SourceManager &SM);
- static PathDiagnosticCallPiece *construct(PathPieces &pieces);
+ static PathDiagnosticCallPiece *construct(PathPieces &pieces,
+ const Decl *caller);
virtual void Profile(llvm::FoldingSetNodeID &ID) const;
assert(!PD.getActivePath().empty());
PathDiagnosticCallPiece *C =
dyn_cast<PathDiagnosticCallPiece>(PD.getActivePath().front());
- if (!C)
- C = PathDiagnosticCallPiece::construct(PD.getActivePath());
+ if (!C) {
+ const Decl *Caller = CE->getLocationContext()->getDecl();
+ C = PathDiagnosticCallPiece::construct(PD.getActivePath(), Caller);
+ }
C->setCallee(*CE, SMgr);
continue;
}
// a new PathDiagnosticCallPiece.
PathDiagnosticCallPiece *C =
dyn_cast<PathDiagnosticCallPiece>(PD.getActivePath().front());
- if (!C)
- C = PathDiagnosticCallPiece::construct(PD.getActivePath());
+ if (!C) {
+ const Decl * Caller = CE->getLocationContext()->getDecl();
+ C = PathDiagnosticCallPiece::construct(PD.getActivePath(), Caller);
+ }
C->setCallee(*CE, SM);
EB.addContext(CE->getCallExpr());
break;
}
PathDiagnosticCallPiece *
-PathDiagnosticCallPiece::construct(PathPieces &path) {
- PathDiagnosticCallPiece *C = new PathDiagnosticCallPiece(path);
+PathDiagnosticCallPiece::construct(PathPieces &path,
+ const Decl *caller) {
+ PathDiagnosticCallPiece *C = new PathDiagnosticCallPiece(path, caller);
path.clear();
path.push_front(C);
return C;
IntrusiveRefCntPtr<PathDiagnosticEventPiece>
PathDiagnosticCallPiece::getCallExitEvent() const {
- if (!Caller)
+ if (NoExit)
return 0;
SmallString<256> buf;
llvm::raw_svector_ostream Out(buf);
// CHECK: </dict>
// CHECK: <key>depth</key><integer>1</integer>
// CHECK: <key>extended_message</key>
-// CHECK: <string>Entered call
+// CHECK: <string>Entered call from 'test_has_bug'</string>
// CHECK: <key>message</key>
// CHECK: <string>Entered call
// CHECK: </dict>