[clang] e791535 - [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (#65645)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 02:25:45 PDT 2023


Author: Kinuko Yasuda
Date: 2023-09-12T11:25:40+02:00
New Revision: e791535b1333898abef0d30cbccce8c788006414

URL: https://github.com/llvm/llvm-project/commit/e791535b1333898abef0d30cbccce8c788006414
DIFF: https://github.com/llvm/llvm-project/commit/e791535b1333898abef0d30cbccce8c788006414.diff

LOG: [clang][dataflow] Remove RecordValue.getLog() usage in HTMLLogger (#65645)

We can dump the same information from RecordStorageLocation.

Tested the behavior before and after patch, that generates the field
values in the HTML
in both cases (and also made sure that removing the relevant code makes
the field values
in the HTML go away)

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
index b1bfe10db202435..a5f64021eb6ba4b 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
@@ -95,6 +95,7 @@ class ModelDumper {
 
     switch (V.getKind()) {
     case Value::Kind::Integer:
+    case Value::Kind::Record:
     case Value::Kind::TopBool:
     case Value::Kind::AtomicBool:
     case Value::Kind::FormulaBool:
@@ -103,14 +104,6 @@ class ModelDumper {
       JOS.attributeObject(
           "pointee", [&] { dump(cast<PointerValue>(V).getPointeeLoc()); });
       break;
-    case Value::Kind::Record:
-      for (const auto &Child : cast<RecordValue>(V).getLoc().children())
-        JOS.attributeObject("f:" + Child.first->getNameAsString(), [&] {
-          if (Child.second)
-            if (Value *Val = Env.getValue(*Child.second))
-              dump(*Val);
-        });
-      break;
     }
 
     for (const auto& Prop : V.properties())
@@ -136,6 +129,15 @@ class ModelDumper {
     JOS.attribute("type", L.getType().getAsString());
     if (auto *V = Env.getValue(L))
       dump(*V);
+
+    if (auto *RLoc = dyn_cast<RecordStorageLocation>(&L)) {
+      for (const auto &Child : RLoc->children())
+        JOS.attributeObject("f:" + Child.first->getNameAsString(), [&] {
+          if (Child.second)
+            if (Value *Val = Env.getValue(*Child.second))
+              dump(*Val);
+        });
+    }
   }
 
   llvm::DenseSet<const void*> Visited;


        


More information about the cfe-commits mailing list