[PATCH] D16804: [analyzer] AnalysisConsumer: print fully-qualified function name while displaying progress

Aleksei Sidorin via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 05:21:34 PST 2016


a.sidorin created this revision.
a.sidorin added reviewers: xazax.hun, zaks.anna, dcoughlin.
a.sidorin added a subscriber: cfe-commits.

-analyzer-display progress option prints only function names which may be suspicious. This patch forces AnalysisConsumer to print fully-qualified function names.

http://reviews.llvm.org/D16804

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/analyze_display_progress.c
  test/Analysis/analyze_display_progress.cpp

Index: test/Analysis/analyze_display_progress.cpp
===================================================================
--- /dev/null
+++ test/Analysis/analyze_display_progress.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -analyze -analyzer-display-progress %s 2>&1 | FileCheck %s
+
+void f() {};
+void g() {};
+void h() {}
+
+struct SomeStruct {
+  void f() {}
+};
+
+struct SomeOtherStruct {
+  void f() {}
+};
+
+namespace ns {
+  struct SomeStruct {
+    void f() {}
+  };
+}
+
+// CHECK: analyze_display_progress.cpp f
+// CHECK: analyze_display_progress.cpp g
+// CHECK: analyze_display_progress.cpp h
+// CHECK: analyze_display_progress.cpp SomeStruct::f
+// CHECK: analyze_display_progress.cpp SomeOtherStruct::f
+// CHECK: analyze_display_progress.cpp ns::SomeStruct::f
Index: test/Analysis/analyze_display_progress.c
===================================================================
--- test/Analysis/analyze_display_progress.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// RUN: %clang_cc1 -analyze -analyzer-display-progress %s 2>&1 | FileCheck %s
-
-void f() {};
-void g() {};
-void h() {}
-
-// CHECK: analyze_display_progress.c f
-// CHECK: analyze_display_progress.c g
-// CHECK: analyze_display_progress.c h
\ No newline at end of file
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===================================================================
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -286,7 +286,7 @@
       llvm::errs() << ": " << Loc.getFilename();
       if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
         const NamedDecl *ND = cast<NamedDecl>(D);
-        llvm::errs() << ' ' << *ND << '\n';
+        llvm::errs() << ' ' << ND->getQualifiedNameAsString() << '\n';
       }
       else if (isa<BlockDecl>(D)) {
         llvm::errs() << ' ' << "block(line:" << Loc.getLine() << ",col:"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16804.46640.patch
Type: text/x-patch
Size: 1885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160202/782c3870/attachment.bin>


More information about the cfe-commits mailing list