[PATCH] D24029: Split ScarinessScore between its "storage" (POD), and an initializing object.

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 10:17:15 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280110: Split ScarinessScore between its "storage" (POD), and an initializing object. (authored by filcab).

Changed prior to commit:
  https://reviews.llvm.org/D24029?vs=69696&id=69719#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24029

Files:
  compiler-rt/trunk/lib/asan/asan_scariness_score.h

Index: compiler-rt/trunk/lib/asan/asan_scariness_score.h
===================================================================
--- compiler-rt/trunk/lib/asan/asan_scariness_score.h
+++ compiler-rt/trunk/lib/asan/asan_scariness_score.h
@@ -34,10 +34,10 @@
 #include "sanitizer_common/sanitizer_libc.h"
 
 namespace __asan {
-class ScarinessScore {
- public:
-  ScarinessScore() {
+struct ScarinessScoreBase {
+  void Clear() {
     descr[0] = 0;
+    score = 0;
   }
   void Scare(int add_to_score, const char *reason) {
     if (descr[0])
@@ -52,16 +52,23 @@
       Printf("SCARINESS: %d (%s)\n", score, descr);
   }
   static void PrintSimple(int score, const char *descr) {
-    ScarinessScore SS;
-    SS.Scare(score, descr);
-    SS.Print();
+    ScarinessScoreBase SSB;
+    SSB.Clear();
+    SSB.Scare(score, descr);
+    SSB.Print();
   }
 
  private:
-  int score = 0;
+  int score;
   char descr[1024];
 };
 
+struct ScarinessScore : ScarinessScoreBase {
+  ScarinessScore() {
+    Clear();
+  }
+};
+
 }  // namespace __asan
 
 #endif  // ASAN_SCARINESS_SCORE_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24029.69719.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160830/091758fa/attachment.bin>


More information about the llvm-commits mailing list