RangeConstraintManager.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. //== RangeConstraintManager.cpp - Manage range constraints.------*- C++ -*--==//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines RangeConstraintManager, a class that tracks simple
  11. // equality and inequality constraints on symbolic values of ProgramState.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #include "SimpleConstraintManager.h"
  15. #include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
  16. #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
  17. #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
  18. #include "llvm/Support/Debug.h"
  19. #include "llvm/ADT/FoldingSet.h"
  20. #include "llvm/ADT/ImmutableSet.h"
  21. #include "llvm/Support/raw_ostream.h"
  22. using namespace clang;
  23. using namespace ento;
  24. namespace { class ConstraintRange {}; }
  25. static int ConstraintRangeIndex = 0;
  26. /// A Range represents the closed range [from, to]. The caller must
  27. /// guarantee that from <= to. Note that Range is immutable, so as not
  28. /// to subvert RangeSet's immutability.
  29. namespace {
  30. class Range : public std::pair<const llvm::APSInt*,
  31. const llvm::APSInt*> {
  32. public:
  33. Range(const llvm::APSInt &from, const llvm::APSInt &to)
  34. : std::pair<const llvm::APSInt*, const llvm::APSInt*>(&from, &to) {
  35. assert(from <= to);
  36. }
  37. bool Includes(const llvm::APSInt &v) const {
  38. return *first <= v && v <= *second;
  39. }
  40. const llvm::APSInt &From() const {
  41. return *first;
  42. }
  43. const llvm::APSInt &To() const {
  44. return *second;
  45. }
  46. const llvm::APSInt *getConcreteValue() const {
  47. return &From() == &To() ? &From() : NULL;
  48. }
  49. void Profile(llvm::FoldingSetNodeID &ID) const {
  50. ID.AddPointer(&From());
  51. ID.AddPointer(&To());
  52. }
  53. };
  54. class RangeTrait : public llvm::ImutContainerInfo<Range> {
  55. public:
  56. // When comparing if one Range is less than another, we should compare
  57. // the actual APSInt values instead of their pointers. This keeps the order
  58. // consistent (instead of comparing by pointer values) and can potentially
  59. // be used to speed up some of the operations in RangeSet.
  60. static inline bool isLess(key_type_ref lhs, key_type_ref rhs) {
  61. return *lhs.first < *rhs.first || (!(*rhs.first < *lhs.first) &&
  62. *lhs.second < *rhs.second);
  63. }
  64. };
  65. /// RangeSet contains a set of ranges. If the set is empty, then
  66. /// there the value of a symbol is overly constrained and there are no
  67. /// possible values for that symbol.
  68. class RangeSet {
  69. typedef llvm::ImmutableSet<Range, RangeTrait> PrimRangeSet;
  70. PrimRangeSet ranges; // no need to make const, since it is an
  71. // ImmutableSet - this allows default operator=
  72. // to work.
  73. public:
  74. typedef PrimRangeSet::Factory Factory;
  75. typedef PrimRangeSet::iterator iterator;
  76. RangeSet(PrimRangeSet RS) : ranges(RS) {}
  77. iterator begin() const { return ranges.begin(); }
  78. iterator end() const { return ranges.end(); }
  79. bool isEmpty() const { return ranges.isEmpty(); }
  80. /// Construct a new RangeSet representing '{ [from, to] }'.
  81. RangeSet(Factory &F, const llvm::APSInt &from, const llvm::APSInt &to)
  82. : ranges(F.add(F.getEmptySet(), Range(from, to))) {}
  83. /// Profile - Generates a hash profile of this RangeSet for use
  84. /// by FoldingSet.
  85. void Profile(llvm::FoldingSetNodeID &ID) const { ranges.Profile(ID); }
  86. /// getConcreteValue - If a symbol is contrained to equal a specific integer
  87. /// constant then this method returns that value. Otherwise, it returns
  88. /// NULL.
  89. const llvm::APSInt* getConcreteValue() const {
  90. return ranges.isSingleton() ? ranges.begin()->getConcreteValue() : 0;
  91. }
  92. private:
  93. void IntersectInRange(BasicValueFactory &BV, Factory &F,
  94. const llvm::APSInt &Lower,
  95. const llvm::APSInt &Upper,
  96. PrimRangeSet &newRanges,
  97. PrimRangeSet::iterator &i,
  98. PrimRangeSet::iterator &e) const {
  99. // There are six cases for each range R in the set:
  100. // 1. R is entirely before the intersection range.
  101. // 2. R is entirely after the intersection range.
  102. // 3. R contains the entire intersection range.
  103. // 4. R starts before the intersection range and ends in the middle.
  104. // 5. R starts in the middle of the intersection range and ends after it.
  105. // 6. R is entirely contained in the intersection range.
  106. // These correspond to each of the conditions below.
  107. for (/* i = begin(), e = end() */; i != e; ++i) {
  108. if (i->To() < Lower) {
  109. continue;
  110. }
  111. if (i->From() > Upper) {
  112. break;
  113. }
  114. if (i->Includes(Lower)) {
  115. if (i->Includes(Upper)) {
  116. newRanges = F.add(newRanges, Range(BV.getValue(Lower),
  117. BV.getValue(Upper)));
  118. break;
  119. } else
  120. newRanges = F.add(newRanges, Range(BV.getValue(Lower), i->To()));
  121. } else {
  122. if (i->Includes(Upper)) {
  123. newRanges = F.add(newRanges, Range(i->From(), BV.getValue(Upper)));
  124. break;
  125. } else
  126. newRanges = F.add(newRanges, *i);
  127. }
  128. }
  129. }
  130. const llvm::APSInt &getMinValue() const {
  131. assert(!isEmpty());
  132. return ranges.begin()->From();
  133. }
  134. bool pin(llvm::APSInt &Lower, llvm::APSInt &Upper) const {
  135. // This function has nine cases, the cartesian product of range-testing
  136. // both the upper and lower bounds against the symbol's type.
  137. // Each case requires a different pinning operation.
  138. // The function returns false if the described range is entirely outside
  139. // the range of values for the associated symbol.
  140. APSIntType Type(getMinValue());
  141. APSIntType::RangeTestResultKind LowerTest = Type.testInRange(Lower);
  142. APSIntType::RangeTestResultKind UpperTest = Type.testInRange(Upper);
  143. switch (LowerTest) {
  144. case APSIntType::RTR_Below:
  145. switch (UpperTest) {
  146. case APSIntType::RTR_Below:
  147. // The entire range is outside the symbol's set of possible values.
  148. // If this is a conventionally-ordered range, the state is infeasible.
  149. if (Lower < Upper)
  150. return false;
  151. // However, if the range wraps around, it spans all possible values.
  152. Lower = Type.getMinValue();
  153. Upper = Type.getMaxValue();
  154. break;
  155. case APSIntType::RTR_Within:
  156. // The range starts below what's possible but ends within it. Pin.
  157. Lower = Type.getMinValue();
  158. Type.apply(Upper);
  159. break;
  160. case APSIntType::RTR_Above:
  161. // The range spans all possible values for the symbol. Pin.
  162. Lower = Type.getMinValue();
  163. Upper = Type.getMaxValue();
  164. break;
  165. }
  166. break;
  167. case APSIntType::RTR_Within:
  168. switch (UpperTest) {
  169. case APSIntType::RTR_Below:
  170. // The range wraps around, but all lower values are not possible.
  171. Type.apply(Lower);
  172. Upper = Type.getMaxValue();
  173. break;
  174. case APSIntType::RTR_Within:
  175. // The range may or may not wrap around, but both limits are valid.
  176. Type.apply(Lower);
  177. Type.apply(Upper);
  178. break;
  179. case APSIntType::RTR_Above:
  180. // The range starts within what's possible but ends above it. Pin.
  181. Type.apply(Lower);
  182. Upper = Type.getMaxValue();
  183. break;
  184. }
  185. break;
  186. case APSIntType::RTR_Above:
  187. switch (UpperTest) {
  188. case APSIntType::RTR_Below:
  189. // The range wraps but is outside the symbol's set of possible values.
  190. return false;
  191. case APSIntType::RTR_Within:
  192. // The range starts above what's possible but ends within it (wrap).
  193. Lower = Type.getMinValue();
  194. Type.apply(Upper);
  195. break;
  196. case APSIntType::RTR_Above:
  197. // The entire range is outside the symbol's set of possible values.
  198. // If this is a conventionally-ordered range, the state is infeasible.
  199. if (Lower < Upper)
  200. return false;
  201. // However, if the range wraps around, it spans all possible values.
  202. Lower = Type.getMinValue();
  203. Upper = Type.getMaxValue();
  204. break;
  205. }
  206. break;
  207. }
  208. return true;
  209. }
  210. public:
  211. // Returns a set containing the values in the receiving set, intersected with
  212. // the closed range [Lower, Upper]. Unlike the Range type, this range uses
  213. // modular arithmetic, corresponding to the common treatment of C integer
  214. // overflow. Thus, if the Lower bound is greater than the Upper bound, the
  215. // range is taken to wrap around. This is equivalent to taking the
  216. // intersection with the two ranges [Min, Upper] and [Lower, Max],
  217. // or, alternatively, /removing/ all integers between Upper and Lower.
  218. RangeSet Intersect(BasicValueFactory &BV, Factory &F,
  219. llvm::APSInt Lower, llvm::APSInt Upper) const {
  220. if (!pin(Lower, Upper))
  221. return F.getEmptySet();
  222. PrimRangeSet newRanges = F.getEmptySet();
  223. PrimRangeSet::iterator i = begin(), e = end();
  224. if (Lower <= Upper)
  225. IntersectInRange(BV, F, Lower, Upper, newRanges, i, e);
  226. else {
  227. // The order of the next two statements is important!
  228. // IntersectInRange() does not reset the iteration state for i and e.
  229. // Therefore, the lower range most be handled first.
  230. IntersectInRange(BV, F, BV.getMinValue(Upper), Upper, newRanges, i, e);
  231. IntersectInRange(BV, F, Lower, BV.getMaxValue(Lower), newRanges, i, e);
  232. }
  233. return newRanges;
  234. }
  235. void print(raw_ostream &os) const {
  236. bool isFirst = true;
  237. os << "{ ";
  238. for (iterator i = begin(), e = end(); i != e; ++i) {
  239. if (isFirst)
  240. isFirst = false;
  241. else
  242. os << ", ";
  243. os << '[' << i->From().toString(10) << ", " << i->To().toString(10)
  244. << ']';
  245. }
  246. os << " }";
  247. }
  248. bool operator==(const RangeSet &other) const {
  249. return ranges == other.ranges;
  250. }
  251. };
  252. } // end anonymous namespace
  253. typedef llvm::ImmutableMap<SymbolRef,RangeSet> ConstraintRangeTy;
  254. namespace clang {
  255. namespace ento {
  256. template<>
  257. struct ProgramStateTrait<ConstraintRange>
  258. : public ProgramStatePartialTrait<ConstraintRangeTy> {
  259. static inline void *GDMIndex() { return &ConstraintRangeIndex; }
  260. };
  261. }
  262. }
  263. namespace {
  264. class RangeConstraintManager : public SimpleConstraintManager{
  265. RangeSet GetRange(ProgramStateRef state, SymbolRef sym);
  266. public:
  267. RangeConstraintManager(SubEngine &subengine, BasicValueFactory &BVF)
  268. : SimpleConstraintManager(subengine, BVF) {}
  269. ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym,
  270. const llvm::APSInt& Int,
  271. const llvm::APSInt& Adjustment);
  272. ProgramStateRef assumeSymEQ(ProgramStateRef state, SymbolRef sym,
  273. const llvm::APSInt& Int,
  274. const llvm::APSInt& Adjustment);
  275. ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym,
  276. const llvm::APSInt& Int,
  277. const llvm::APSInt& Adjustment);
  278. ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym,
  279. const llvm::APSInt& Int,
  280. const llvm::APSInt& Adjustment);
  281. ProgramStateRef assumeSymGE(ProgramStateRef state, SymbolRef sym,
  282. const llvm::APSInt& Int,
  283. const llvm::APSInt& Adjustment);
  284. ProgramStateRef assumeSymLE(ProgramStateRef state, SymbolRef sym,
  285. const llvm::APSInt& Int,
  286. const llvm::APSInt& Adjustment);
  287. const llvm::APSInt* getSymVal(ProgramStateRef St, SymbolRef sym) const;
  288. // FIXME: Refactor into SimpleConstraintManager?
  289. bool isEqual(ProgramStateRef St, SymbolRef sym, const llvm::APSInt& V) const {
  290. const llvm::APSInt *i = getSymVal(St, sym);
  291. return i ? *i == V : false;
  292. }
  293. ProgramStateRef removeDeadBindings(ProgramStateRef St, SymbolReaper& SymReaper);
  294. void print(ProgramStateRef St, raw_ostream &Out,
  295. const char* nl, const char *sep);
  296. private:
  297. RangeSet::Factory F;
  298. };
  299. } // end anonymous namespace
  300. ConstraintManager *
  301. ento::CreateRangeConstraintManager(ProgramStateManager &StMgr, SubEngine &Eng) {
  302. return new RangeConstraintManager(Eng, StMgr.getBasicVals());
  303. }
  304. const llvm::APSInt* RangeConstraintManager::getSymVal(ProgramStateRef St,
  305. SymbolRef sym) const {
  306. const ConstraintRangeTy::data_type *T = St->get<ConstraintRange>(sym);
  307. return T ? T->getConcreteValue() : NULL;
  308. }
  309. /// Scan all symbols referenced by the constraints. If the symbol is not alive
  310. /// as marked in LSymbols, mark it as dead in DSymbols.
  311. ProgramStateRef
  312. RangeConstraintManager::removeDeadBindings(ProgramStateRef state,
  313. SymbolReaper& SymReaper) {
  314. ConstraintRangeTy CR = state->get<ConstraintRange>();
  315. ConstraintRangeTy::Factory& CRFactory = state->get_context<ConstraintRange>();
  316. for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) {
  317. SymbolRef sym = I.getKey();
  318. if (SymReaper.maybeDead(sym))
  319. CR = CRFactory.remove(CR, sym);
  320. }
  321. return state->set<ConstraintRange>(CR);
  322. }
  323. RangeSet
  324. RangeConstraintManager::GetRange(ProgramStateRef state, SymbolRef sym) {
  325. if (ConstraintRangeTy::data_type* V = state->get<ConstraintRange>(sym))
  326. return *V;
  327. // Lazily generate a new RangeSet representing all possible values for the
  328. // given symbol type.
  329. BasicValueFactory &BV = getBasicVals();
  330. QualType T = sym->getType(BV.getContext());
  331. return RangeSet(F, BV.getMinValue(T), BV.getMaxValue(T));
  332. }
  333. //===------------------------------------------------------------------------===
  334. // assumeSymX methods: public interface for RangeConstraintManager.
  335. //===------------------------------------------------------------------------===/
  336. // The syntax for ranges below is mathematical, using [x, y] for closed ranges
  337. // and (x, y) for open ranges. These ranges are modular, corresponding with
  338. // a common treatment of C integer overflow. This means that these methods
  339. // do not have to worry about overflow; RangeSet::Intersect can handle such a
  340. // "wraparound" range.
  341. // As an example, the range [UINT_MAX-1, 3) contains five values: UINT_MAX-1,
  342. // UINT_MAX, 0, 1, and 2.
  343. ProgramStateRef
  344. RangeConstraintManager::assumeSymNE(ProgramStateRef St, SymbolRef Sym,
  345. const llvm::APSInt &Int,
  346. const llvm::APSInt &Adjustment) {
  347. // Before we do any real work, see if the value can even show up.
  348. APSIntType AdjustmentType(Adjustment);
  349. if (AdjustmentType.testInRange(Int) != APSIntType::RTR_Within)
  350. return St;
  351. llvm::APSInt Lower = AdjustmentType.convert(Int) - Adjustment;
  352. llvm::APSInt Upper = Lower;
  353. --Lower;
  354. ++Upper;
  355. // [Int-Adjustment+1, Int-Adjustment-1]
  356. // Notice that the lower bound is greater than the upper bound.
  357. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, Upper, Lower);
  358. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  359. }
  360. ProgramStateRef
  361. RangeConstraintManager::assumeSymEQ(ProgramStateRef St, SymbolRef Sym,
  362. const llvm::APSInt &Int,
  363. const llvm::APSInt &Adjustment) {
  364. // Before we do any real work, see if the value can even show up.
  365. APSIntType AdjustmentType(Adjustment);
  366. if (AdjustmentType.testInRange(Int) != APSIntType::RTR_Within)
  367. return NULL;
  368. // [Int-Adjustment, Int-Adjustment]
  369. llvm::APSInt AdjInt = AdjustmentType.convert(Int) - Adjustment;
  370. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, AdjInt, AdjInt);
  371. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  372. }
  373. ProgramStateRef
  374. RangeConstraintManager::assumeSymLT(ProgramStateRef St, SymbolRef Sym,
  375. const llvm::APSInt &Int,
  376. const llvm::APSInt &Adjustment) {
  377. // Before we do any real work, see if the value can even show up.
  378. APSIntType AdjustmentType(Adjustment);
  379. switch (AdjustmentType.testInRange(Int)) {
  380. case APSIntType::RTR_Below:
  381. return NULL;
  382. case APSIntType::RTR_Within:
  383. break;
  384. case APSIntType::RTR_Above:
  385. return St;
  386. }
  387. // Special case for Int == Min. This is always false.
  388. llvm::APSInt ComparisonVal = AdjustmentType.convert(Int);
  389. llvm::APSInt Min = AdjustmentType.getMinValue();
  390. if (ComparisonVal == Min)
  391. return NULL;
  392. llvm::APSInt Lower = Min-Adjustment;
  393. llvm::APSInt Upper = ComparisonVal-Adjustment;
  394. --Upper;
  395. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, Lower, Upper);
  396. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  397. }
  398. ProgramStateRef
  399. RangeConstraintManager::assumeSymGT(ProgramStateRef St, SymbolRef Sym,
  400. const llvm::APSInt &Int,
  401. const llvm::APSInt &Adjustment) {
  402. // Before we do any real work, see if the value can even show up.
  403. APSIntType AdjustmentType(Adjustment);
  404. switch (AdjustmentType.testInRange(Int)) {
  405. case APSIntType::RTR_Below:
  406. return St;
  407. case APSIntType::RTR_Within:
  408. break;
  409. case APSIntType::RTR_Above:
  410. return NULL;
  411. }
  412. // Special case for Int == Max. This is always false.
  413. llvm::APSInt ComparisonVal = AdjustmentType.convert(Int);
  414. llvm::APSInt Max = AdjustmentType.getMaxValue();
  415. if (ComparisonVal == Max)
  416. return NULL;
  417. llvm::APSInt Lower = ComparisonVal-Adjustment;
  418. llvm::APSInt Upper = Max-Adjustment;
  419. ++Lower;
  420. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, Lower, Upper);
  421. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  422. }
  423. ProgramStateRef
  424. RangeConstraintManager::assumeSymGE(ProgramStateRef St, SymbolRef Sym,
  425. const llvm::APSInt &Int,
  426. const llvm::APSInt &Adjustment) {
  427. // Before we do any real work, see if the value can even show up.
  428. APSIntType AdjustmentType(Adjustment);
  429. switch (AdjustmentType.testInRange(Int)) {
  430. case APSIntType::RTR_Below:
  431. return St;
  432. case APSIntType::RTR_Within:
  433. break;
  434. case APSIntType::RTR_Above:
  435. return NULL;
  436. }
  437. // Special case for Int == Min. This is always feasible.
  438. llvm::APSInt ComparisonVal = AdjustmentType.convert(Int);
  439. llvm::APSInt Min = AdjustmentType.getMinValue();
  440. if (ComparisonVal == Min)
  441. return St;
  442. llvm::APSInt Max = AdjustmentType.getMaxValue();
  443. llvm::APSInt Lower = ComparisonVal-Adjustment;
  444. llvm::APSInt Upper = Max-Adjustment;
  445. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, Lower, Upper);
  446. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  447. }
  448. ProgramStateRef
  449. RangeConstraintManager::assumeSymLE(ProgramStateRef St, SymbolRef Sym,
  450. const llvm::APSInt &Int,
  451. const llvm::APSInt &Adjustment) {
  452. // Before we do any real work, see if the value can even show up.
  453. APSIntType AdjustmentType(Adjustment);
  454. switch (AdjustmentType.testInRange(Int)) {
  455. case APSIntType::RTR_Below:
  456. return NULL;
  457. case APSIntType::RTR_Within:
  458. break;
  459. case APSIntType::RTR_Above:
  460. return St;
  461. }
  462. // Special case for Int == Max. This is always feasible.
  463. llvm::APSInt ComparisonVal = AdjustmentType.convert(Int);
  464. llvm::APSInt Max = AdjustmentType.getMaxValue();
  465. if (ComparisonVal == Max)
  466. return St;
  467. llvm::APSInt Min = AdjustmentType.getMinValue();
  468. llvm::APSInt Lower = Min-Adjustment;
  469. llvm::APSInt Upper = ComparisonVal-Adjustment;
  470. RangeSet New = GetRange(St, Sym).Intersect(getBasicVals(), F, Lower, Upper);
  471. return New.isEmpty() ? NULL : St->set<ConstraintRange>(Sym, New);
  472. }
  473. //===------------------------------------------------------------------------===
  474. // Pretty-printing.
  475. //===------------------------------------------------------------------------===/
  476. void RangeConstraintManager::print(ProgramStateRef St, raw_ostream &Out,
  477. const char* nl, const char *sep) {
  478. ConstraintRangeTy Ranges = St->get<ConstraintRange>();
  479. if (Ranges.isEmpty()) {
  480. Out << nl << sep << "Ranges are empty." << nl;
  481. return;
  482. }
  483. Out << nl << sep << "Ranges of symbol values:";
  484. for (ConstraintRangeTy::iterator I=Ranges.begin(), E=Ranges.end(); I!=E; ++I){
  485. Out << nl << ' ' << I.getKey() << " : ";
  486. I.getData().print(Out);
  487. }
  488. Out << nl;
  489. }