[analyzer] Fix FieldRegion dumps.

The '->' thing has always been confusing; the actual operation '->'
translates to a pointer dereference together with adding a FieldRegion,
but FieldRegion on its own doesn't imply an additional pointer
dereference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375281 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp
index c7b280a..a10d7e6 100644
--- a/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -506,7 +506,7 @@
 }
 
 void FieldRegion::dumpToStream(raw_ostream &os) const {
-  os << superRegion << "->" << *getDecl();
+  os << superRegion << "." << *getDecl();
 }
 
 void ObjCIvarRegion::dumpToStream(raw_ostream &os) const {
diff --git a/test/Analysis/dump_egraph.cpp b/test/Analysis/dump_egraph.cpp
index a56f061..9b87d1a 100644
--- a/test/Analysis/dump_egraph.cpp
+++ b/test/Analysis/dump_egraph.cpp
@@ -20,7 +20,7 @@
 
 // CHECK: \"location_context\": \"#0 Call\", \"calling\": \"foo\", \"location\": null, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"stmt_id\": {{[0-9]+}}, \"kind\": \"construct into local variable\", \"argument_index\": null, \"pretty\": \"T t;\", \"value\": \"&t\"
 
-// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"location\": \{ \"line\": 16, \"column\": 5, \"file\": \"{{.*}}dump_egraph.cpp\" \}, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
+// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"location\": \{ \"line\": 16, \"column\": 5, \"file\": \"{{.*}}dump_egraph.cpp\" \}, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t.s\"
 
 // CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
 
diff --git a/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp b/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
index 472627e..96df69f 100644
--- a/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
+++ b/test/Analysis/exploded-graph-rewriter/initializers_under_construction.cpp
@@ -20,6 +20,6 @@
 void test() {
   // CHECK: (construct into member variable)
   // CHECK-SAME: <td align="left">a</td>
-  // CHECK-SAME: <td align="left">&amp;b-&gt;a</td>
+  // CHECK-SAME: <td align="left">&amp;b.a</td>
   B b;
 }
diff --git a/test/Analysis/expr-inspection.c b/test/Analysis/expr-inspection.c
index 6d9ea4b..7c5d9e5 100644
--- a/test/Analysis/expr-inspection.c
+++ b/test/Analysis/expr-inspection.c
@@ -5,6 +5,7 @@
 // Self-tests for the debug.ExprInspection checker.
 
 void clang_analyzer_dump(int x);
+void clang_analyzer_dump_pointer(int *p);
 void clang_analyzer_printState();
 void clang_analyzer_numTimesReached();
 
@@ -30,7 +31,7 @@
 // CHECK-NEXT:     ]}
 // CHECK-NEXT:   ]},
 // CHECK-NEXT:   "environment": { "pointer": "{{0x[0-9a-f]+}}", "items": [
-// CHECK-NEXT:     { "lctx_id": 1, "location_context": "#0 Call", "calling": "foo", "location": null, "items": [
+// CHECK-NEXT:     { "lctx_id": {{[0-9]+}}, "location_context": "#0 Call", "calling": "foo", "location": null, "items": [
 // CHECK-NEXT:       { "stmt_id": {{[0-9]+}}, "pretty": "clang_analyzer_printState", "value": "&code{clang_analyzer_printState}" }
 // CHECK-NEXT:     ]}
 // CHECK-NEXT:   ]},
@@ -43,3 +44,11 @@
 // CHECK-NEXT:   "checker_messages": null
 // CHECK-NEXT: }
 
+struct S {
+  int x, y;
+};
+
+void test_field_dumps(struct S s, struct S *p) {
+  clang_analyzer_dump_pointer(&s.x); // expected-warning{{&s.x}}
+  clang_analyzer_dump_pointer(&p->x); // expected-warning{{&SymRegion{reg_$0<struct S * p>}.x}}
+}