Skip to content

Commit d5402a2

Browse files
committed
Revert "[Analyzer][solver] Add dump methods for (dis)equality classes."
This reverts commit 6f3b775. Test fails flakily, see comments on https://reviews.llvm.org/D103967 Also revert follow-up "[Analyzer] Attempt to fix windows bots test failure b/c of new-line" This reverts commit fe0e861.
1 parent 540b4a5 commit d5402a2

File tree

4 files changed

+0
-197
lines changed

4 files changed

+0
-197
lines changed

clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,6 @@ class EquivalenceClass : public llvm::FoldingSetNode {
592592
RangeSet::Factory &F,
593593
ProgramStateRef State);
594594

595-
void dumpToStream(ProgramStateRef State, raw_ostream &os) const;
596-
LLVM_DUMP_METHOD void dump(ProgramStateRef State) const {
597-
dumpToStream(State, llvm::errs());
598-
}
599-
600595
/// Check equivalence data for consistency.
601596
LLVM_NODISCARD LLVM_ATTRIBUTE_UNUSED static bool
602597
isClassDataConsistent(ProgramStateRef State);
@@ -1410,17 +1405,6 @@ class RangeConstraintManager : public RangedConstraintManager {
14101405

14111406
void printJson(raw_ostream &Out, ProgramStateRef State, const char *NL = "\n",
14121407
unsigned int Space = 0, bool IsDot = false) const override;
1413-
void printConstraints(raw_ostream &Out, ProgramStateRef State,
1414-
const char *NL = "\n", unsigned int Space = 0,
1415-
bool IsDot = false) const;
1416-
void printEquivalenceClasses(raw_ostream &Out, ProgramStateRef State,
1417-
const char *NL = "\n", unsigned int Space = 0,
1418-
bool IsDot = false) const;
1419-
void printEquivalenceClass(raw_ostream &Out, ProgramStateRef State,
1420-
EquivalenceClass Class) const;
1421-
void printDisequalities(raw_ostream &Out, ProgramStateRef State,
1422-
const char *NL = "\n", unsigned int Space = 0,
1423-
bool IsDot = false) const;
14241408

14251409
//===------------------------------------------------------------------===//
14261410
// Implementation for interface from RangedConstraintManager.
@@ -1644,15 +1628,6 @@ ConstraintMap ento::getConstraintMap(ProgramStateRef State) {
16441628
// EqualityClass implementation details
16451629
//===----------------------------------------------------------------------===//
16461630

1647-
LLVM_DUMP_METHOD void EquivalenceClass::dumpToStream(ProgramStateRef State,
1648-
raw_ostream &os) const {
1649-
SymbolSet ClassMembers = getClassMembers(State);
1650-
for (const SymbolRef &MemberSym : ClassMembers) {
1651-
MemberSym->dump();
1652-
os << "\n";
1653-
}
1654-
}
1655-
16561631
inline EquivalenceClass EquivalenceClass::find(ProgramStateRef State,
16571632
SymbolRef Sym) {
16581633
assert(State && "State should not be null");
@@ -2493,16 +2468,6 @@ ProgramStateRef RangeConstraintManager::assumeSymOutsideInclusiveRange(
24932468
void RangeConstraintManager::printJson(raw_ostream &Out, ProgramStateRef State,
24942469
const char *NL, unsigned int Space,
24952470
bool IsDot) const {
2496-
printConstraints(Out, State, NL, Space, IsDot);
2497-
printEquivalenceClasses(Out, State, NL, Space, IsDot);
2498-
printDisequalities(Out, State, NL, Space, IsDot);
2499-
}
2500-
2501-
void RangeConstraintManager::printConstraints(raw_ostream &Out,
2502-
ProgramStateRef State,
2503-
const char *NL,
2504-
unsigned int Space,
2505-
bool IsDot) const {
25062471
ConstraintRangeTy Constraints = State->get<ConstraintRange>();
25072472

25082473
Indent(Out, Space, IsDot) << "\"constraints\": ";
@@ -2536,106 +2501,3 @@ void RangeConstraintManager::printConstraints(raw_ostream &Out,
25362501
--Space;
25372502
Indent(Out, Space, IsDot) << "]," << NL;
25382503
}
2539-
2540-
void RangeConstraintManager::printEquivalenceClass(
2541-
raw_ostream &Out, ProgramStateRef State, EquivalenceClass Class) const {
2542-
bool FirstMember = true;
2543-
SymbolSet ClassMembers = Class.getClassMembers(State);
2544-
Out << "[ ";
2545-
for (SymbolRef ClassMember : ClassMembers) {
2546-
if (FirstMember)
2547-
FirstMember = false;
2548-
else
2549-
Out << ", ";
2550-
Out << "\"" << ClassMember << "\"";
2551-
}
2552-
Out << " ]";
2553-
}
2554-
2555-
void RangeConstraintManager::printEquivalenceClasses(raw_ostream &Out,
2556-
ProgramStateRef State,
2557-
const char *NL,
2558-
unsigned int Space,
2559-
bool IsDot) const {
2560-
ClassMembersTy Members = State->get<ClassMembers>();
2561-
2562-
Indent(Out, Space, IsDot) << "\"equivalence_classes\": ";
2563-
if (Members.isEmpty()) {
2564-
Out << "null," << NL;
2565-
return;
2566-
}
2567-
2568-
++Space;
2569-
Out << '[' << NL;
2570-
bool FirstClass = true;
2571-
for (std::pair<EquivalenceClass, SymbolSet> ClassToSymbolSet : Members) {
2572-
EquivalenceClass Class = ClassToSymbolSet.first;
2573-
2574-
if (FirstClass) {
2575-
FirstClass = false;
2576-
} else {
2577-
Out << ',';
2578-
Out << NL;
2579-
}
2580-
Indent(Out, Space, IsDot);
2581-
printEquivalenceClass(Out, State, Class);
2582-
}
2583-
Out << NL;
2584-
2585-
--Space;
2586-
Indent(Out, Space, IsDot) << "]," << NL;
2587-
}
2588-
2589-
void RangeConstraintManager::printDisequalities(raw_ostream &Out,
2590-
ProgramStateRef State,
2591-
const char *NL,
2592-
unsigned int Space,
2593-
bool IsDot) const {
2594-
DisequalityMapTy Disequalities = State->get<DisequalityMap>();
2595-
2596-
Indent(Out, Space, IsDot) << "\"disequality_info\": ";
2597-
if (Disequalities.isEmpty()) {
2598-
Out << "null," << NL;
2599-
return;
2600-
}
2601-
2602-
++Space;
2603-
Out << '[' << NL;
2604-
bool FirstClass = true;
2605-
for (std::pair<EquivalenceClass, ClassSet> ClassToDisEqSet : Disequalities) {
2606-
EquivalenceClass Class = ClassToDisEqSet.first;
2607-
if (FirstClass) {
2608-
FirstClass = false;
2609-
} else {
2610-
Out << ',';
2611-
Out << NL;
2612-
}
2613-
Indent(Out, Space, IsDot) << "{" << NL;
2614-
unsigned int DisEqSpace = Space + 1;
2615-
Indent(Out, DisEqSpace, IsDot) << "\"class\": ";
2616-
printEquivalenceClass(Out, State, Class);
2617-
ClassSet DisequalClasses = ClassToDisEqSet.second;
2618-
if (!DisequalClasses.isEmpty()) {
2619-
Out << "," << NL;
2620-
Indent(Out, DisEqSpace, IsDot) << "\"disequal_to\": [" << NL;
2621-
unsigned int DisEqClassSpace = DisEqSpace + 1;
2622-
Indent(Out, DisEqClassSpace, IsDot);
2623-
bool FirstDisEqClass = true;
2624-
for (EquivalenceClass DisEqClass : DisequalClasses) {
2625-
if (FirstDisEqClass) {
2626-
FirstDisEqClass = false;
2627-
} else {
2628-
Out << ',' << NL;
2629-
Indent(Out, DisEqClassSpace, IsDot);
2630-
}
2631-
printEquivalenceClass(Out, State, DisEqClass);
2632-
}
2633-
Out << "]" << NL;
2634-
}
2635-
Indent(Out, Space, IsDot) << "}";
2636-
}
2637-
Out << NL;
2638-
2639-
--Space;
2640-
Indent(Out, Space, IsDot) << "]," << NL;
2641-
}

clang/test/Analysis/expr-inspection-printState-diseq-info.c

Lines changed: 0 additions & 35 deletions
This file was deleted.

clang/test/Analysis/expr-inspection-printState-eq-classes.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

clang/test/Analysis/expr-inspection.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ void foo(int x) {
3838
// CHECK-NEXT: "constraints": [
3939
// CHECK-NEXT: { "symbol": "reg_$0<int x>", "range": "{ [-2147483648, 13] }" }
4040
// CHECK-NEXT: ],
41-
// CHECK-NEXT: "equivalence_classes": null,
42-
// CHECK-NEXT: "disequality_info": null,
4341
// CHECK-NEXT: "dynamic_types": null,
4442
// CHECK-NEXT: "dynamic_casts": null,
4543
// CHECK-NEXT: "constructing_objects": null,

0 commit comments

Comments
 (0)