From: Anna Zaks Date: Tue, 13 Mar 2012 22:15:55 +0000 (+0000) Subject: [analyzer] Call enter/exit diagnostic should refer to caller/callee, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc544e3d52c43746b1b273f38ec7d65461f0064a;p=clang [analyzer] Call enter/exit diagnostic should refer to caller/callee, respectively. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152676 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 01b40b43ba..d09bb3280b 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -549,14 +549,12 @@ PathDiagnosticCallPiece::getCallEnterEvent() const { IntrusiveRefCntPtr PathDiagnosticCallPiece::getCallEnterWithinCallerEvent() const { - if (!Callee) - return 0; SmallString<256> buf; llvm::raw_svector_ostream Out(buf); - if (isa(Callee)) - Out << "Entered call to block"; - else if (const NamedDecl *ND = dyn_cast(Callee)) - Out << "Entered call to '" << *ND << "'"; + if (const NamedDecl *ND = dyn_cast_or_null(Caller)) + Out << "Entered call from '" << *ND << "'"; + else + Out << "Entered call"; StringRef msg = Out.str(); if (msg.empty()) return 0; @@ -569,8 +567,8 @@ PathDiagnosticCallPiece::getCallExitEvent() const { return 0; SmallString<256> buf; llvm::raw_svector_ostream Out(buf); - if (const NamedDecl *ND = dyn_cast_or_null(Caller)) - Out << "Returning to '" << *ND << "'"; + if (const NamedDecl *ND = dyn_cast_or_null(Callee)) + Out << "Returning from '" << *ND << "'"; else Out << "Returning to caller"; return new PathDiagnosticEventPiece(callReturn, Out.str()); diff --git a/test/Analysis/inline-plist.c b/test/Analysis/inline-plist.c index 08b2aedc67..15b2070f23 100644 --- a/test/Analysis/inline-plist.c +++ b/test/Analysis/inline-plist.c @@ -281,9 +281,9 @@ void test_has_bug() { // CHECK: // CHECK: depth1 // CHECK: extended_message -// CHECK: Entered call to 'has_bug' +// CHECK: Entered call // CHECK: message -// CHECK: Entered call to 'has_bug' +// CHECK: Entered call // CHECK: // CHECK: // CHECK: kindcontrol diff --git a/test/Analysis/inline-unique-reports.c b/test/Analysis/inline-unique-reports.c index 83df2d84de..b4f032d74e 100644 --- a/test/Analysis/inline-unique-reports.c +++ b/test/Analysis/inline-unique-reports.c @@ -97,9 +97,9 @@ void test_bug_2() { // CHECK: file0 // CHECK: // CHECK: extended_message -// CHECK: Entered call to 'bug' +// CHECK: Entered call // CHECK: message -// CHECK: Entered call to 'bug' +// CHECK: Entered call // CHECK: // CHECK: // CHECK: kindcontrol diff --git a/test/Analysis/malloc-plist.c b/test/Analysis/malloc-plist.c index 9d71d714fb..154d756040 100644 --- a/test/Analysis/malloc-plist.c +++ b/test/Analysis/malloc-plist.c @@ -821,9 +821,9 @@ void test_wrapper() { // CHECK: file0 // CHECK: // CHECK: extended_message -// CHECK: Entered call to 'wrapper' +// CHECK: Entered call from 'test_wrapper' // CHECK: message -// CHECK: Entered call to 'wrapper' +// CHECK: Entered call from 'test_wrapper' // CHECK: // CHECK: // CHECK: kindcontrol @@ -1075,9 +1075,9 @@ void test_wrapper() { // CHECK: // CHECK: // CHECK: extended_message -// CHECK: Returning to 'test_wrapper' +// CHECK: Returning from 'wrapper' // CHECK: message -// CHECK: Returning to 'test_wrapper' +// CHECK: Returning from 'wrapper' // CHECK: // CHECK: // CHECK: kindcontrol