GTIRB  v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
IR.hpp
Go to the documentation of this file.
1 //===- IR.hpp ---------------------------------------------------*- C++ -*-===//
2 //
3 // Copyright (C) 2021 GrammaTech, Inc.
4 //
5 // This code is licensed under the MIT license. See the LICENSE file in the
6 // project root for license terms.
7 //
8 // This project is sponsored by the Office of Naval Research, One Liberty
9 // Center, 875 N. Randolph Street, Arlington, VA 22203 under contract #
10 // N68335-17-C-0700. The content of the information does not necessarily
11 // reflect the position or policy of the Government and no official
12 // endorsement should be inferred.
13 //
14 //===----------------------------------------------------------------------===//
15 #ifndef GTIRB_IR_H
16 #define GTIRB_IR_H
17 
18 #include <gtirb/Addr.hpp>
19 #include <gtirb/AuxData.hpp>
21 #include <gtirb/CFG.hpp>
22 #include <gtirb/ErrorOr.hpp>
23 #include <gtirb/Module.hpp>
24 #include <gtirb/Node.hpp>
25 #include <gtirb/Observer.hpp>
26 #include <gtirb/Utility.hpp>
27 #include <gtirb/version.h>
28 #include <boost/iterator/indirect_iterator.hpp>
29 #include <boost/multi_index_container.hpp>
30 #include <boost/range/iterator_range.hpp>
31 #include <map>
32 #include <string>
33 #include <vector>
34 
37 
38 namespace gtirb {
39 namespace proto {
40 class IR;
41 }
75 
77  IR(Context& C);
78  IR(Context& C, const UUID& U);
79 
80  static IR* Create(Context& C, const UUID& U) { return C.Create<IR>(C, U); }
81 
82  struct by_name {};
83  struct by_pointer {};
84 
85  using ModuleSet = boost::multi_index::multi_index_container<
86  Module*, boost::multi_index::indexed_by<
87  boost::multi_index::ordered_non_unique<
88  boost::multi_index::tag<by_name>,
89  boost::multi_index::const_mem_fun<
90  Module, const std::string&, &Module::getName>>,
91  boost::multi_index::hashed_unique<
92  boost::multi_index::tag<by_pointer>,
93  boost::multi_index::identity<Module*>>>>;
94 
95  class ModuleObserverImpl;
96 
97 public:
103  static IR* Create(Context& C) { return C.Create<IR>(C); }
104 
108  const CFG& getCFG() const { return Cfg; }
109 
114  CFG& getCFG() { return Cfg; }
115 
122  using module_iterator = boost::indirect_iterator<ModuleSet::iterator>;
127  using const_module_iterator =
128  boost::indirect_iterator<ModuleSet::const_iterator, const Module>;
129 
131  module_iterator modules_begin() { return Modules.begin(); }
133  module_iterator modules_end() { return Modules.end(); }
135  const_module_iterator modules_begin() const { return Modules.begin(); }
138  const_module_iterator modules_end() const { return Modules.end(); }
139 
144  using module_range = boost::iterator_range<module_iterator>;
149  using const_module_range = boost::iterator_range<const_module_iterator>;
150 
153  return boost::make_iterator_range(modules_begin(), modules_end());
154  }
157  return boost::make_iterator_range(modules_begin(), modules_end());
158  }
159 
164  using module_name_iterator =
165  boost::indirect_iterator<ModuleSet::index<by_name>::type::iterator>;
170  using module_name_range = boost::iterator_range<module_name_iterator>;
176  boost::indirect_iterator<ModuleSet::index<by_name>::type::const_iterator,
177  const Module>;
183  boost::iterator_range<const_module_name_iterator>;
184 
192  bool removeModule(Module* M) {
193  auto& Index = Modules.get<by_pointer>();
194  if (auto Iter = Index.find(M); Iter != Index.end()) {
195  MO->removeProxyBlocks(M, M->proxy_blocks());
196  MO->removeCodeBlocks(M, M->code_blocks());
197  Index.erase(Iter);
198  M->setParent(nullptr, nullptr);
199  return true;
200  }
201  return false;
202  }
203 
208  if (M->getIR()) {
209  M->getIR()->removeModule(M);
210  }
211 
212  MO->addProxyBlocks(M, M->proxy_blocks());
213  MO->addCodeBlocks(M, M->code_blocks());
214  Modules.emplace(M);
215  M->setParent(this, MO.get());
216  return M;
217  }
218 
222  // FIXME: this API may wind up getting removed because we perhaps want to
223  // support creating a Module that is not hooked up to any IR object and then
224  // set the parent on the module later. Personally, I think that is a
225  // dangerous design choice, but we can argue the merits of both approaches in
226  // a code review.
227  template <typename... Args> Module* addModule(Context& C, Args... A) {
228  return addModule(Module::Create(C, A...));
229  }
230 
237  module_name_range findModules(const std::string& N) {
238  auto Found = Modules.get<by_name>().equal_range(N);
239  return boost::make_iterator_range(Found.first, Found.second);
240  }
241 
248  const_module_name_range findModules(const std::string& N) const {
249  auto Found = Modules.get<by_name>().equal_range(N);
250  return boost::make_iterator_range(Found.first, Found.second);
251  }
252 
254  // (end Module-Related Public Types and Functions)
255 
261  void save(std::ostream& Out) const;
262 
268  void saveJSON(std::ostream& Out) const;
269 
273  enum class load_error {
274  IncorrectVersion = 1,
275  CorruptFile,
276  CorruptModule,
277  CorruptSection,
278  CorruptByteInterval,
279  CorruptCFG,
280  BadUUID,
281  MissingUUID,
282  NotGTIRB,
283  };
284 
291  static ErrorOr<IR*> load(Context& C, std::istream& In);
292 
299  static ErrorOr<IR*> loadJSON(Context& C, std::istream& In);
300 
303 
305  using proxy_block_iterator = MergeSortedIterator<Module::proxy_block_iterator,
306  ArbitraryLess<ProxyBlock>>;
308  using proxy_block_range = boost::iterator_range<proxy_block_iterator>;
311  MergeSortedIterator<Module::const_proxy_block_iterator,
312  ArbitraryLess<ProxyBlock>>;
315  boost::iterator_range<const_proxy_block_iterator>;
316 
319  return proxy_block_iterator(
320  boost::make_transform_iterator(this->modules_begin(),
321  NodeToProxyBlockRange<Module>()),
322  boost::make_transform_iterator(this->modules_end(),
323  NodeToProxyBlockRange<Module>()));
324  }
325 
329 
332  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
333  }
334 
338  boost::make_transform_iterator(this->modules_begin(),
339  NodeToProxyBlockRange<const Module>()),
340  boost::make_transform_iterator(this->modules_end(),
341  NodeToProxyBlockRange<const Module>()));
342  }
343 
348  }
349 
352  return boost::make_iterator_range(proxy_blocks_begin(), proxy_blocks_end());
353  }
355  // (end ProxyBlock-Related Public Types and Functions)
356 
359 
363  using symbol_iterator =
364  MergeSortedIterator<Module::symbol_iterator, ArbitraryLess<Symbol>>;
368  using symbol_range = boost::iterator_range<symbol_iterator>;
372  using const_symbol_iterator =
373  MergeSortedIterator<Module::const_symbol_iterator, ArbitraryLess<Symbol>>;
377  using const_symbol_range = boost::iterator_range<const_symbol_iterator>;
378 
381  return symbol_iterator(
382  boost::make_transform_iterator(this->modules_begin(),
383  NodeToSymbolRange<Module>()),
384  boost::make_transform_iterator(this->modules_end(),
385  NodeToSymbolRange<Module>()));
386  }
387 
390 
393  return boost::make_iterator_range(symbols_begin(), symbols_end());
394  }
395 
398  return const_symbol_iterator(
399  boost::make_transform_iterator(this->modules_begin(),
400  NodeToSymbolRange<const Module>()),
401  boost::make_transform_iterator(this->modules_end(),
402  NodeToSymbolRange<const Module>()));
403  }
404 
407 
410  return boost::make_iterator_range(symbols_begin(), symbols_end());
411  }
413  // (end Symbol-Related Public Types and Functions)
414 
417 
419  using section_iterator =
420  MergeSortedIterator<Module::section_iterator, AddressLess>;
422  using section_range = boost::iterator_range<section_iterator>;
424  using section_subrange = boost::iterator_range<
425  MergeSortedIterator<Module::section_subrange::iterator, AddressLess>>;
427  using const_section_iterator =
428  MergeSortedIterator<Module::const_section_iterator, AddressLess>;
430  using const_section_range = boost::iterator_range<const_section_iterator>;
432  using const_section_subrange = boost::iterator_range<MergeSortedIterator<
433  Module::const_section_subrange::iterator, AddressLess>>;
435  using section_name_iterator =
436  MergeSortedIterator<Module::section_name_iterator, AddressLess>;
438  using section_name_range = boost::iterator_range<section_name_iterator>;
441  MergeSortedIterator<Module::const_section_name_iterator, AddressLess>;
444  boost::iterator_range<const_section_name_iterator>;
445 
448  return section_iterator(
449  boost::make_transform_iterator(this->modules_begin(),
450  NodeToSectionRange<Module>()),
451  boost::make_transform_iterator(this->modules_end(),
452  NodeToSectionRange<Module>()));
453  }
454 
457 
460  return boost::make_iterator_range(sections_begin(), sections_end());
461  }
462 
465  return const_section_iterator(
466  boost::make_transform_iterator(this->modules_begin(),
467  NodeToSectionRange<const Module>()),
468  boost::make_transform_iterator(this->modules_end(),
469  NodeToSectionRange<const Module>()));
470  }
471 
474  return const_section_iterator();
475  }
476 
479  return boost::make_iterator_range(sections_begin(), sections_end());
480  }
481 
488  return section_subrange(
489  section_subrange::iterator(
490  boost::make_transform_iterator(this->modules_begin(),
491  FindSectionsIn<Module>(A)),
492  boost::make_transform_iterator(this->modules_end(),
493  FindSectionsIn<Module>(A))),
494  section_subrange::iterator());
495  }
496 
503  return const_section_subrange(
504  const_section_subrange::iterator(
505  boost::make_transform_iterator(this->modules_begin(),
506  FindSectionsIn<const Module>(A)),
507  boost::make_transform_iterator(this->modules_end(),
508  FindSectionsIn<const Module>(A))),
509  const_section_subrange::iterator());
510  }
511 
518  return section_range(
519  section_range::iterator(
520  boost::make_transform_iterator(this->modules_begin(),
521  FindSectionsAt<Module>(A)),
522  boost::make_transform_iterator(this->modules_end(),
523  FindSectionsAt<Module>(A))),
524  section_range::iterator());
525  }
526 
534  return section_range(
535  section_range::iterator(
536  boost::make_transform_iterator(
537  this->modules_begin(), FindSectionsBetween<Module>(Low, High)),
538  boost::make_transform_iterator(
539  this->modules_end(), FindSectionsBetween<Module>(Low, High))),
540  section_range::iterator());
541  }
542 
549  return const_section_range(
550  const_section_range::iterator(
551  boost::make_transform_iterator(this->modules_begin(),
552  FindSectionsAt<const Module>(A)),
553  boost::make_transform_iterator(this->modules_end(),
554  FindSectionsAt<const Module>(A))),
555  const_section_range::iterator());
556  }
557 
565  return const_section_range(
566  const_section_range::iterator(
567  boost::make_transform_iterator(
568  this->modules_begin(),
569  FindSectionsBetween<const Module>(Low, High)),
570  boost::make_transform_iterator(
571  this->modules_end(),
572  FindSectionsBetween<const Module>(Low, High))),
573  const_section_range::iterator());
574  }
580  section_name_range findSections(const std::string& X) {
581  return section_name_range(
582  section_name_range::iterator(
583  boost::make_transform_iterator(this->modules_begin(),
584  FindSections<Module>(X)),
585  boost::make_transform_iterator(this->modules_end(),
586  FindSections<Module>(X))),
587  section_name_range::iterator());
588  }
589 
595  const_section_name_range findSections(const std::string& X) const {
597  const_section_name_range::iterator(
598  boost::make_transform_iterator(this->modules_begin(),
599  FindSections<const Module>(X)),
600  boost::make_transform_iterator(this->modules_end(),
601  FindSections<const Module>(X))),
602  const_section_name_range::iterator());
603  }
605  // (end Section-Related Public Types and Functions)
606 
609 
611  using byte_interval_iterator =
612  MergeSortedIterator<Module::byte_interval_iterator, AddressLess>;
614  using byte_interval_range = boost::iterator_range<byte_interval_iterator>;
616  using byte_interval_subrange = boost::iterator_range<MergeSortedIterator<
617  Module::byte_interval_subrange::iterator, AddressLess>>;
620  MergeSortedIterator<Module::const_byte_interval_iterator, AddressLess>;
623  boost::iterator_range<const_byte_interval_iterator>;
626  boost::iterator_range<MergeSortedIterator<
627  Module::const_byte_interval_subrange::iterator, AddressLess>>;
628 
631  return byte_interval_iterator(
632  boost::make_transform_iterator(this->modules_begin(),
633  NodeToByteIntervalRange<Module>()),
634  boost::make_transform_iterator(this->modules_end(),
635  NodeToByteIntervalRange<Module>()));
636  }
637 
641  return byte_interval_iterator();
642  }
643 
646  return boost::make_iterator_range(byte_intervals_begin(),
647  byte_intervals_end());
648  }
649 
653  boost::make_transform_iterator(this->modules_begin(),
654  NodeToByteIntervalRange<const Module>()),
655  boost::make_transform_iterator(
656  this->modules_end(), NodeToByteIntervalRange<const Module>()));
657  }
658 
663  }
664 
667  return boost::make_iterator_range(byte_intervals_begin(),
668  byte_intervals_end());
669  }
670 
679  return byte_interval_subrange(
680  byte_interval_subrange::iterator(
681  boost::make_transform_iterator(this->modules_begin(),
682  FindByteIntervalsIn<Module>(A)),
683  boost::make_transform_iterator(this->modules_end(),
684  FindByteIntervalsIn<Module>(A))),
685  byte_interval_subrange::iterator());
686  }
687 
697  const_byte_interval_subrange::iterator(
698  boost::make_transform_iterator(
699  this->modules_begin(), FindByteIntervalsIn<const Module>(A)),
700  boost::make_transform_iterator(
701  this->modules_end(), FindByteIntervalsIn<const Module>(A))),
702  const_byte_interval_subrange::iterator());
703  }
704 
711  return byte_interval_range(
712  byte_interval_range::iterator(
713  boost::make_transform_iterator(this->modules_begin(),
714  FindByteIntervalsAt<Module>(A)),
715  boost::make_transform_iterator(this->modules_end(),
716  FindByteIntervalsAt<Module>(A))),
717  byte_interval_range::iterator());
718  }
719 
728  return byte_interval_range(
729  byte_interval_range::iterator(
730  boost::make_transform_iterator(
731  this->modules_begin(),
732  FindByteIntervalsBetween<Module>(Low, High)),
733  boost::make_transform_iterator(
734  this->modules_end(),
735  FindByteIntervalsBetween<Module>(Low, High))),
736  byte_interval_range::iterator());
737  }
738 
746  const_byte_interval_range::iterator(
747  boost::make_transform_iterator(
748  this->modules_begin(), FindByteIntervalsAt<const Module>(A)),
749  boost::make_transform_iterator(
750  this->modules_end(), FindByteIntervalsAt<const Module>(A))),
751  const_byte_interval_range::iterator());
752  }
753 
763  const_byte_interval_range::iterator(
764  boost::make_transform_iterator(
765  this->modules_begin(),
766  FindByteIntervalsBetween<const Module>(Low, High)),
767  boost::make_transform_iterator(
768  this->modules_end(),
769  FindByteIntervalsBetween<const Module>(Low, High))),
770  const_byte_interval_range::iterator());
771  }
773  // (end group of ByteInterval-related types and functions)
774 
777 
782  using block_iterator =
783  MergeSortedIterator<Module::block_iterator, BlockAddressLess>;
788  using block_range = boost::iterator_range<block_iterator>;
793  using block_subrange = boost::iterator_range<
794  MergeSortedIterator<Module::block_subrange::iterator, BlockAddressLess>>;
799  using const_block_iterator =
800  MergeSortedIterator<Module::const_block_iterator, BlockAddressLess>;
805  using const_block_range = boost::iterator_range<const_block_iterator>;
810  using const_block_subrange = boost::iterator_range<MergeSortedIterator<
811  Module::const_block_subrange::iterator, BlockAddressLess>>;
812 
815  return block_iterator(
816  boost::make_transform_iterator(this->modules_begin(),
817  NodeToBlockRange<Module>()),
818  boost::make_transform_iterator(this->modules_end(),
819  NodeToBlockRange<Module>()));
820  }
821 
824 
827  return boost::make_iterator_range(blocks_begin(), blocks_end());
828  }
829 
832  return const_block_iterator(
833  boost::make_transform_iterator(this->modules_begin(),
834  NodeToBlockRange<const Module>()),
835  boost::make_transform_iterator(this->modules_end(),
836  NodeToBlockRange<const Module>()));
837  }
838 
841 
844  return boost::make_iterator_range(blocks_begin(), blocks_end());
845  }
846 
855  return block_subrange(
856  block_subrange::iterator(
857  boost::make_transform_iterator(this->modules_begin(),
858  FindBlocksIn<Module>(A)),
859  boost::make_transform_iterator(this->modules_end(),
860  FindBlocksIn<Module>(A))),
861  block_subrange::iterator());
862  }
863 
872  return const_block_subrange(
873  const_block_subrange::iterator(
874  boost::make_transform_iterator(this->modules_begin(),
875  FindBlocksIn<const Module>(A)),
876  boost::make_transform_iterator(this->modules_end(),
877  FindBlocksIn<const Module>(A))),
878  const_block_subrange::iterator());
879  }
880 
888  return block_range(block_range::iterator(
889  boost::make_transform_iterator(
890  this->modules_begin(), FindBlocksAt<Module>(A)),
891  boost::make_transform_iterator(
892  this->modules_end(), FindBlocksAt<Module>(A))),
893  block_range::iterator());
894  }
895 
904  return block_range(
905  block_range::iterator(
906  boost::make_transform_iterator(
907  this->modules_begin(), FindBlocksBetween<Module>(Low, High)),
908  boost::make_transform_iterator(
909  this->modules_end(), FindBlocksBetween<Module>(Low, High))),
910  block_range::iterator());
911  }
912 
920  return const_block_range(
921  const_block_range::iterator(
922  boost::make_transform_iterator(this->modules_begin(),
923  FindBlocksAt<const Module>(A)),
924  boost::make_transform_iterator(this->modules_end(),
925  FindBlocksAt<const Module>(A))),
926  const_block_range::iterator());
927  }
928 
937  return const_block_range(
938  const_block_range::iterator(
939  boost::make_transform_iterator(
940  this->modules_begin(),
941  FindBlocksBetween<const Module>(Low, High)),
942  boost::make_transform_iterator(
943  this->modules_end(),
944  FindBlocksBetween<const Module>(Low, High))),
945  const_block_range::iterator());
946  }
948  // (end group of Block-related types and functions)
949 
952 
957  using code_block_iterator =
958  MergeSortedIterator<Module::code_block_iterator, AddressLess>;
963  using code_block_range = boost::iterator_range<code_block_iterator>;
969  using code_block_subrange = boost::iterator_range<
970  MergeSortedIterator<Module::code_block_subrange::iterator, AddressLess>>;
976  MergeSortedIterator<Module::const_code_block_iterator, AddressLess>;
981  using const_code_block_range =
982  boost::iterator_range<const_code_block_iterator>;
987  using const_code_block_subrange = boost::iterator_range<MergeSortedIterator<
988  Module::const_code_block_subrange::iterator, AddressLess>>;
989 
992  return code_block_iterator(
993  boost::make_transform_iterator(this->modules_begin(),
994  NodeToCodeBlockRange<Module>()),
995  boost::make_transform_iterator(this->modules_end(),
996  NodeToCodeBlockRange<Module>()));
997  }
998 
1002 
1005  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1006  }
1007 
1011  boost::make_transform_iterator(this->modules_begin(),
1012  NodeToCodeBlockRange<const Module>()),
1013  boost::make_transform_iterator(this->modules_end(),
1014  NodeToCodeBlockRange<const Module>()));
1015  }
1016 
1020  return const_code_block_iterator();
1021  }
1022 
1025  return boost::make_iterator_range(code_blocks_begin(), code_blocks_end());
1026  }
1027 
1035  return code_block_subrange(
1036  code_block_subrange::iterator(
1037  boost::make_transform_iterator(this->modules_begin(),
1038  FindCodeBlocksIn<Module>(A)),
1039  boost::make_transform_iterator(this->modules_end(),
1040  FindCodeBlocksIn<Module>(A))),
1041  code_block_subrange::iterator());
1042  }
1043 
1052  const_code_block_subrange::iterator(
1053  boost::make_transform_iterator(this->modules_begin(),
1054  FindCodeBlocksIn<const Module>(A)),
1055  boost::make_transform_iterator(this->modules_end(),
1056  FindCodeBlocksIn<const Module>(A))),
1057  const_code_block_subrange::iterator());
1058  }
1059 
1066  return code_block_range(
1067  code_block_range::iterator(
1068  boost::make_transform_iterator(this->modules_begin(),
1069  FindCodeBlocksAt<Module>(A)),
1070  boost::make_transform_iterator(this->modules_end(),
1071  FindCodeBlocksAt<Module>(A))),
1072  code_block_range::iterator());
1073  }
1074 
1082  return code_block_range(
1083  code_block_range::iterator(
1084  boost::make_transform_iterator(
1085  this->modules_begin(),
1086  FindCodeBlocksBetween<Module>(Low, High)),
1087  boost::make_transform_iterator(
1088  this->modules_end(), FindCodeBlocksBetween<Module>(Low, High))),
1089  code_block_range::iterator());
1090  }
1091 
1098  return const_code_block_range(
1099  const_code_block_range::iterator(
1100  boost::make_transform_iterator(this->modules_begin(),
1101  FindCodeBlocksAt<const Module>(A)),
1102  boost::make_transform_iterator(this->modules_end(),
1103  FindCodeBlocksAt<const Module>(A))),
1104  const_code_block_range::iterator());
1105  }
1106 
1114  return const_code_block_range(
1115  const_code_block_range::iterator(
1116  boost::make_transform_iterator(
1117  this->modules_begin(),
1118  FindCodeBlocksBetween<const Module>(Low, High)),
1119  boost::make_transform_iterator(
1120  this->modules_end(),
1121  FindCodeBlocksBetween<const Module>(Low, High))),
1122  const_code_block_range::iterator());
1123  }
1125  // (end group of CodeBlock-related types and functions)
1126 
1129 
1134  using data_block_iterator =
1135  MergeSortedIterator<Module::data_block_iterator, AddressLess>;
1140  using data_block_range = boost::iterator_range<data_block_iterator>;
1146  using data_block_subrange = boost::iterator_range<
1147  MergeSortedIterator<Module::data_block_subrange::iterator, AddressLess>>;
1153  MergeSortedIterator<Module::const_data_block_iterator, AddressLess>;
1157  using const_data_block_range =
1158  boost::iterator_range<const_data_block_iterator>;
1164  using const_data_block_subrange = boost::iterator_range<MergeSortedIterator<
1165  Module::const_data_block_subrange::iterator, AddressLess>>;
1166 
1169  return data_block_iterator(
1170  boost::make_transform_iterator(this->modules_begin(),
1171  NodeToDataBlockRange<Module>()),
1172  boost::make_transform_iterator(this->modules_end(),
1173  NodeToDataBlockRange<Module>()));
1174  }
1175 
1179 
1182  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1183  }
1184 
1188  boost::make_transform_iterator(this->modules_begin(),
1189  NodeToDataBlockRange<const Module>()),
1190  boost::make_transform_iterator(this->modules_end(),
1191  NodeToDataBlockRange<const Module>()));
1192  }
1193 
1197  return const_data_block_iterator();
1198  }
1199 
1202  return boost::make_iterator_range(data_blocks_begin(), data_blocks_end());
1203  }
1204 
1212  return data_block_subrange(
1213  data_block_subrange::iterator(
1214  boost::make_transform_iterator(this->modules_begin(),
1215  FindDataBlocksIn<Module>(A)),
1216  boost::make_transform_iterator(this->modules_end(),
1217  FindDataBlocksIn<Module>(A))),
1218  data_block_subrange::iterator());
1219  }
1220 
1229  const_data_block_subrange::iterator(
1230  boost::make_transform_iterator(this->modules_begin(),
1231  FindDataBlocksIn<const Module>(A)),
1232  boost::make_transform_iterator(this->modules_end(),
1233  FindDataBlocksIn<const Module>(A))),
1234  const_data_block_subrange::iterator());
1235  }
1236 
1243  return data_block_range(
1244  data_block_range::iterator(
1245  boost::make_transform_iterator(this->modules_begin(),
1246  FindDataBlocksAt<Module>(A)),
1247  boost::make_transform_iterator(this->modules_end(),
1248  FindDataBlocksAt<Module>(A))),
1249  data_block_range::iterator());
1250  }
1251 
1259  return data_block_range(
1260  data_block_range::iterator(
1261  boost::make_transform_iterator(
1262  this->modules_begin(),
1263  FindDataBlocksBetween<Module>(Low, High)),
1264  boost::make_transform_iterator(
1265  this->modules_end(), FindDataBlocksBetween<Module>(Low, High))),
1266  data_block_range::iterator());
1267  }
1268 
1275  return const_data_block_range(
1276  const_data_block_range::iterator(
1277  boost::make_transform_iterator(this->modules_begin(),
1278  FindDataBlocksAt<const Module>(A)),
1279  boost::make_transform_iterator(this->modules_end(),
1280  FindDataBlocksAt<const Module>(A))),
1281  const_data_block_range::iterator());
1282  }
1283 
1291  return const_data_block_range(
1292  const_data_block_range::iterator(
1293  boost::make_transform_iterator(
1294  this->modules_begin(),
1295  FindDataBlocksBetween<const Module>(Low, High)),
1296  boost::make_transform_iterator(
1297  this->modules_end(),
1298  FindDataBlocksBetween<const Module>(Low, High))),
1299  const_data_block_range::iterator());
1300  }
1302  // (end group of DataBlock-related types and functions)
1303 
1306 
1310  using symbolic_expression_iterator =
1311  MergeSortedIterator<Module::symbolic_expression_iterator,
1317  boost::iterator_range<symbolic_expression_iterator>;
1321  using const_symbolic_expression_iterator = MergeSortedIterator<
1328  boost::iterator_range<const_symbolic_expression_iterator>;
1329 
1333  boost::make_transform_iterator(this->modules_begin(),
1334  NodeToSymbolicExpressionRange<Module>()),
1335  boost::make_transform_iterator(
1336  this->modules_end(), NodeToSymbolicExpressionRange<Module>()));
1337  }
1338 
1343  }
1344 
1347  return boost::make_iterator_range(symbolic_expressions_begin(),
1348  symbolic_expressions_end());
1349  }
1350 
1354  boost::make_transform_iterator(
1355  this->modules_begin(),
1356  NodeToSymbolicExpressionRange<const Module>()),
1357  boost::make_transform_iterator(
1358  this->modules_end(),
1359  NodeToSymbolicExpressionRange<const Module>()));
1360  }
1361 
1366  }
1367 
1370  return boost::make_iterator_range(symbolic_expressions_begin(),
1371  symbolic_expressions_end());
1372  }
1373 
1382  symbolic_expression_range::iterator(
1383  boost::make_transform_iterator(this->modules_begin(),
1384  FindSymExprsAt<Module>(A)),
1385  boost::make_transform_iterator(this->modules_end(),
1386  FindSymExprsAt<Module>(A))),
1387  symbolic_expression_range::iterator());
1388  }
1389 
1400  symbolic_expression_range::iterator(
1401  boost::make_transform_iterator(
1402  this->modules_begin(), FindSymExprsBetween<Module>(Low, High)),
1403  boost::make_transform_iterator(
1404  this->modules_end(), FindSymExprsBetween<Module>(Low, High))),
1405  symbolic_expression_range::iterator());
1406  }
1407 
1416  const_symbolic_expression_range::iterator(
1417  boost::make_transform_iterator(this->modules_begin(),
1418  FindSymExprsAt<const Module>(A)),
1419  boost::make_transform_iterator(this->modules_end(),
1420  FindSymExprsAt<const Module>(A))),
1421  const_symbolic_expression_range::iterator());
1422  }
1423 
1433  Addr High) const {
1435  const_symbolic_expression_range::iterator(
1436  boost::make_transform_iterator(
1437  this->modules_begin(),
1438  FindSymExprsBetween<const Module>(Low, High)),
1439  boost::make_transform_iterator(
1440  this->modules_end(),
1441  FindSymExprsBetween<const Module>(Low, High))),
1442  const_symbolic_expression_range::iterator());
1443  }
1445  // (end group of SymbolicExpression-related types and functions)
1446 
1448  static bool classof(const Node* N) { return N->getKind() == Kind::IR; }
1450 
1455  uint32_t getVersion() const { return Version; }
1456 
1463  void setVersion(uint32_t V) { Version = V; }
1464 
1465 private:
1468  using MessageType = proto::IR;
1469 
1475  void toProtobuf(MessageType* Message) const;
1476 
1483  static ErrorOr<IR*> fromProtobuf(Context& C, const MessageType& Message);
1485 
1486  ModuleSet Modules;
1487  uint32_t Version{GTIRB_PROTOBUF_VERSION};
1488  CFG Cfg;
1489 
1490  std::unique_ptr<ModuleObserver> MO;
1491 
1492  friend class Context; // Allow Context to construct new IRs.
1493 };
1494 
1497 GTIRB_EXPORT_API const std::error_category& loadErrorCategory();
1498 
1502 inline std::error_code make_error_code(gtirb::IR::load_error e) {
1503  return std::error_code(static_cast<int>(e), loadErrorCategory());
1504 }
1505 
1506 } // namespace gtirb
1507 
1508 namespace std {
1509 template <>
1510 struct is_error_code_enum<gtirb::IR::load_error> : std::true_type {};
1511 } // namespace std
1512 
1513 #endif // GTIRB_IR_H
gtirb::IR::const_section_range
boost::iterator_range< const_section_iterator > const_section_range
Range of Section objects.
Definition: IR.hpp:430
gtirb::IR::addModule
Module * addModule(Module *M)
Move a Module object to be located in this IR.
Definition: IR.hpp:207
gtirb::IR::data_blocks_end
const_data_block_iterator data_blocks_end() const
Return an iterator to the element following the last DataBlock.
Definition: IR.hpp:1196
gtirb::IR::symbolic_expressions_end
symbolic_expression_iterator symbolic_expressions_end()
Return an iterator to the element following the last SymbolicExpression.
Definition: IR.hpp:1341
gtirb::Module::getName
const std::string & getName() const
Get the module name.
Definition: Module.hpp:672
gtirb::IR::const_symbol_range
boost::iterator_range< const_symbol_iterator > const_symbol_range
Range of Symbol objects.
Definition: IR.hpp:377
gtirb::IR::const_symbolic_expression_range
boost::iterator_range< const_symbolic_expression_iterator > const_symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: IR.hpp:1328
gtirb::IR::byte_intervals_begin
byte_interval_iterator byte_intervals_begin()
Return an iterator to the first ByteInterval.
Definition: IR.hpp:630
gtirb::IR::const_code_block_iterator
MergeSortedIterator< Module::const_code_block_iterator, AddressLess > const_code_block_iterator
Iterator over CodeBlock objects.
Definition: IR.hpp:976
gtirb::Module::const_proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::const_iterator, const ProxyBlock > const_proxy_block_iterator
Constant iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:289
gtirb::IR::findDataBlocksOn
const_data_block_subrange findDataBlocksOn(Addr A) const
Find all the data blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1227
gtirb::IR::findBlocksAt
const_block_range findBlocksAt(Addr A) const
Find all the blocks that start at an address.
Definition: IR.hpp:919
gtirb::Context::Create
NodeTy * Create(Args &&... TheArgs)
Create an object of type T.
Definition: Context.hpp:126
gtirb::IR::symbolic_expressions_end
const_symbolic_expression_iterator symbolic_expressions_end() const
Return an iterator to the element following the last SymbolicExpression.
Definition: IR.hpp:1364
gtirb::IR::findBlocksOn
const_block_subrange findBlocksOn(Addr A) const
Find all the blocks that have bytes that lie within the address specified.
Definition: IR.hpp:871
gtirb::IR::modules
module_range modules()
Returns a range of the Modules.
Definition: IR.hpp:152
gtirb::Node
Represents the base of the Node class hierarchy.
Definition: Node.hpp:39
gtirb::IR::const_code_block_range
boost::iterator_range< const_code_block_iterator > const_code_block_range
Range of CodeBlock objects.
Definition: IR.hpp:982
gtirb::IR::const_section_subrange
boost::iterator_range< MergeSortedIterator< Module::const_section_subrange::iterator, AddressLess > > const_section_subrange
Sub-range of Section objects overlapping an address.
Definition: IR.hpp:433
gtirb::IR::modules_begin
const_module_iterator modules_begin() const
Returns a constant iterator to the first Module.
Definition: IR.hpp:135
gtirb::IR::sections_end
const_section_iterator sections_end() const
Return an iterator to the element following the last Section.
Definition: IR.hpp:473
gtirb::IR::sections_begin
const_section_iterator sections_begin() const
Return an iterator to the first Section.
Definition: IR.hpp:464
gtirb::Module::symbolic_expression_iterator
MergeSortedIterator< Section::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Module.hpp:1615
gtirb::IR::data_blocks
data_block_range data_blocks()
Return a range of all the DataBlock objects.
Definition: IR.hpp:1181
gtirb::IR::data_block_iterator
MergeSortedIterator< Module::data_block_iterator, AddressLess > data_block_iterator
Iterator over DataBlock objects.
Definition: IR.hpp:1135
CFG.hpp
Types and operations for interprocedural control flow graphs (CFGs).
ErrorOr.hpp
gtirb::IR::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr Low, Addr High) const
Find all the intervals that start between a range of addresses.
Definition: IR.hpp:761
gtirb::IR::getCFG
const CFG & getCFG() const
Get the associated Control Flow Graph (CFG).
Definition: IR.hpp:108
gtirb::UUID
boost::uuids::uuid UUID
Represents a universally unique identifier used to identify Node objects across serialization boundar...
Definition: Context.hpp:36
gtirb::IR::block_subrange
boost::iterator_range< MergeSortedIterator< Module::block_subrange::iterator, BlockAddressLess > > block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: IR.hpp:794
gtirb::IR::findModules
const_module_name_range findModules(const std::string &N) const
Find modules by name.
Definition: IR.hpp:248
gtirb::Addr
A special class to store an Effective Address.
Definition: Addr.hpp:37
gtirb::const_block_iterator
cfg_node_cast_iter< const CodeBlock > const_block_iterator
Constant iterator over blocks (Block).
Definition: CFG.hpp:198
gtirb::IR::findSections
const_section_name_range findSections(const std::string &X) const
Find all the sections containing a name.
Definition: IR.hpp:595
gtirb::IR::findByteIntervalsOn
const_byte_interval_subrange findByteIntervalsOn(Addr A) const
Find all the intervals that have bytes that lie within the address specified.
Definition: IR.hpp:695
gtirb::IR::const_data_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_data_block_subrange::iterator, AddressLess > > const_data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:1165
gtirb::IR::code_blocks_end
code_block_iterator code_blocks_end()
Return an iterator to the element following the last CodeBlock.
Definition: IR.hpp:1001
gtirb::IR::byte_intervals_begin
const_byte_interval_iterator byte_intervals_begin() const
Return an iterator to the first ByteInterval.
Definition: IR.hpp:651
gtirb::IR::symbols
symbol_range symbols()
Return a range of the Symbol objects.
Definition: IR.hpp:392
gtirb::IR::const_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_block_subrange::iterator, BlockAddressLess > > const_block_subrange
Sub-range of blocks overlapping an address or range of addreses.
Definition: IR.hpp:811
gtirb::IR::symbolic_expression_iterator
MergeSortedIterator< Module::symbolic_expression_iterator, ByteInterval::SymbolicExpressionElement::AddressLess > symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: IR.hpp:1312
gtirb::Context
The context under which GTIRB operations occur.
Definition: Context.hpp:63
gtirb::IR::code_blocks_end
const_code_block_iterator code_blocks_end() const
Return an iterator to the element following the last CodeBlock.
Definition: IR.hpp:1019
gtirb::IR::findCodeBlocksOn
code_block_subrange findCodeBlocksOn(Addr A)
Find all the code blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1034
Node.hpp
Class gtirb::Node.
gtirb::IR::code_blocks_begin
const_code_block_iterator code_blocks_begin() const
Return an iterator to the first CodeBlock.
Definition: IR.hpp:1009
gtirb::IR::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr A)
Find all the code blocks that start at an address.
Definition: IR.hpp:1065
gtirb::IR::const_module_iterator
boost::indirect_iterator< ModuleSet::const_iterator, const Module > const_module_iterator
Constant iterator over Modules.
Definition: IR.hpp:128
gtirb::IR::removeModule
bool removeModule(Module *M)
Remove a Module object located in this IR.
Definition: IR.hpp:192
gtirb::IR::section_subrange
boost::iterator_range< MergeSortedIterator< Module::section_subrange::iterator, AddressLess > > section_subrange
Sub-range of Section objects overlapping an address.
Definition: IR.hpp:425
gtirb::IR::modules_end
const_module_iterator modules_end() const
Returns a constant iterator to the element following the last Module.
Definition: IR.hpp:138
gtirb::IR::symbolic_expression_range
boost::iterator_range< symbolic_expression_iterator > symbolic_expression_range
Range of SymbolicExpressionElement objects.
Definition: IR.hpp:1317
gtirb::IR::symbolic_expressions_begin
const_symbolic_expression_iterator symbolic_expressions_begin() const
Return an iterator to the first SymbolicExpression.
Definition: IR.hpp:1352
gtirb::IR::sections
section_range sections()
Return a range of all the Section objects.
Definition: IR.hpp:459
gtirb::IR::byte_intervals
const_byte_interval_range byte_intervals() const
Return a range of all the ByteInterval objects.
Definition: IR.hpp:666
gtirb::IR::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr A)
Find all the intervals that start at an address.
Definition: IR.hpp:710
gtirb::IR::proxy_blocks_end
const_proxy_block_iterator proxy_blocks_end() const
Return an iterator to the element following the last ProxyBlock.
Definition: IR.hpp:346
gtirb::IR::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High) const
Find all the symbolic expressions that start between a range of addresses.
Definition: IR.hpp:1432
gtirb::IR::block_range
boost::iterator_range< block_iterator > block_range
Range of blocks.
Definition: IR.hpp:788
gtirb::IR::findSectionsOn
section_subrange findSectionsOn(Addr A)
Find a Section containing an address.
Definition: IR.hpp:487
gtirb::IR::data_blocks
const_data_block_range data_blocks() const
Return a range of all the DataBlock objects.
Definition: IR.hpp:1201
gtirb::IR::symbols_end
symbol_iterator symbols_end()
Return an iterator to the element following the last Symbol.
Definition: IR.hpp:389
gtirb::IR::code_blocks_begin
code_block_iterator code_blocks_begin()
Return an iterator to the first CodeBlock.
Definition: IR.hpp:991
version.h
Holds the version macros. Read from version.txt.
gtirb::IR::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr A) const
Find all the code blocks that start at an address.
Definition: IR.hpp:1097
gtirb::IR::byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Module::byte_interval_subrange::iterator, AddressLess > > byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: IR.hpp:617
gtirb::IR::blocks_end
block_iterator blocks_end()
Return an iterator to the element following the last block.
Definition: IR.hpp:823
gtirb::IR::setVersion
void setVersion(uint32_t V)
Set the version of the Protobuf used when creating this IR.
Definition: IR.hpp:1463
gtirb::IR::blocks_begin
block_iterator blocks_begin()
Return an iterator to the first block.
Definition: IR.hpp:814
gtirb::IR::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of all the ProxyBlock objects.
Definition: IR.hpp:331
gtirb::Module::const_symbolic_expression_iterator
MergeSortedIterator< Section::const_symbolic_expression_iterator, ByteInterval::ConstSymbolicExpressionElement::AddressLess > const_symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: Module.hpp:1626
gtirb::IR::const_block_range
boost::iterator_range< const_block_iterator > const_block_range
Range of blocks.
Definition: IR.hpp:805
gtirb::IR::const_section_name_iterator
MergeSortedIterator< Module::const_section_name_iterator, AddressLess > const_section_name_iterator
Iterator over Section objects.
Definition: IR.hpp:441
gtirb::IR::code_block_subrange
boost::iterator_range< MergeSortedIterator< Module::code_block_subrange::iterator, AddressLess > > code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:970
gtirb::IR::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr A) const
Find all the data blocks that start at an address.
Definition: IR.hpp:1274
GTIRB_EXPORT_API
#define GTIRB_EXPORT_API
This macro controls the visibility of exported symbols (i.e. classes) in shared libraries....
Definition: Export.hpp:52
gtirb::IR::const_module_range
boost::iterator_range< const_module_iterator > const_module_range
Constant range of Modules.
Definition: IR.hpp:149
gtirb::IR::const_byte_interval_range
boost::iterator_range< const_byte_interval_iterator > const_byte_interval_range
Const range of ByteInterval objects.
Definition: IR.hpp:623
gtirb::IR::findCodeBlocksOn
const_code_block_subrange findCodeBlocksOn(Addr A) const
Find all the code blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1050
gtirb::IR::symbolic_expressions
symbolic_expression_range symbolic_expressions()
Return a range of all the SymbolicExpression objects.
Definition: IR.hpp:1346
gtirb::IR::getCFG
CFG & getCFG()
Get a const reference to the associated Control Flow Graph (CFG).
Definition: IR.hpp:114
gtirb
Main namespace for the GTIRB API.
Definition: Addr.hpp:28
gtirb::IR::findByteIntervalsOn
byte_interval_subrange findByteIntervalsOn(Addr A)
Find all the intervals that have bytes that lie within the address specified.
Definition: IR.hpp:678
gtirb::IR::findModules
module_name_range findModules(const std::string &N)
Find modules by name.
Definition: IR.hpp:237
gtirb::IR::const_proxy_block_iterator
MergeSortedIterator< Module::const_proxy_block_iterator, ArbitraryLess< ProxyBlock > > const_proxy_block_iterator
Iterator over ProxyBlock objects.
Definition: IR.hpp:312
gtirb::loadErrorCategory
const GTIRB_EXPORT_API std::error_category & loadErrorCategory()
The error category used to represent load failures.
gtirb::Module::proxy_blocks
proxy_block_range proxy_blocks()
Return a range of the proxy_blocks (ProxyBlock).
Definition: Module.hpp:312
gtirb::IR::findDataBlocksAt
const_data_block_range findDataBlocksAt(Addr Low, Addr High) const
Find all the data blocks that start between a range of addresses.
Definition: IR.hpp:1290
gtirb::IR::sections_begin
section_iterator sections_begin()
Return an iterator to the first Section.
Definition: IR.hpp:447
gtirb::block_iterator
cfg_node_cast_iter< CodeBlock > block_iterator
Iterator over blocks (Block).
Definition: CFG.hpp:194
gtirb::IR::modules_begin
module_iterator modules_begin()
Returns an iterator to the first Module.
Definition: IR.hpp:131
gtirb::IR::section_name_range
boost::iterator_range< section_name_iterator > section_name_range
Range of Section objects.
Definition: IR.hpp:438
gtirb::IR::code_block_range
boost::iterator_range< code_block_iterator > code_block_range
Range of CodeBlock objects.
Definition: IR.hpp:963
gtirb::IR::blocks_end
const_block_iterator blocks_end() const
Return an iterator to the element following the last block.
Definition: IR.hpp:840
gtirb::IR::sections
const_section_range sections() const
Return a range of all the Section objects.
Definition: IR.hpp:478
gtirb::IR::data_block_subrange
boost::iterator_range< MergeSortedIterator< Module::data_block_subrange::iterator, AddressLess > > data_block_subrange
Sub-range of DataBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:1147
gtirb::IR
A complete internal representation consisting of Modules (Module).
Definition: IR.hpp:76
gtirb::IR::findSectionsAt
section_range findSectionsAt(Addr Low, Addr High)
Find all the sections that start between a range of addresses.
Definition: IR.hpp:533
gtirb::IR::Create
static IR * Create(Context &C)
Create an IR object in its default state.
Definition: IR.hpp:103
gtirb::IR::const_module_name_range
boost::iterator_range< const_module_name_iterator > const_module_name_range
Constant range of modules Modules.
Definition: IR.hpp:183
gtirb::IR::symbolic_expressions_begin
symbolic_expression_iterator symbolic_expressions_begin()
Return an iterator to the first SymbolicExpression.
Definition: IR.hpp:1331
gtirb::IR::proxy_blocks
const_proxy_block_range proxy_blocks() const
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:351
gtirb::IR::findDataBlocksOn
data_block_subrange findDataBlocksOn(Addr A)
Find all the data blocks that have bytes that lie within the address specified.
Definition: IR.hpp:1211
gtirb::ByteInterval::SymbolicExpressionElementBase::AddressLess
A comparison function object to order symbolic expression elements by the address in which they occur...
Definition: ByteInterval.hpp:1138
gtirb::IR::const_data_block_range
boost::iterator_range< const_data_block_iterator > const_data_block_range
Range of DataBlock objects.
Definition: IR.hpp:1158
gtirb::Module::proxy_block_iterator
boost::indirect_iterator< ProxyBlockSet::iterator > proxy_block_iterator
Iterator over proxy_blocks (ProxyBlock).
Definition: Module.hpp:284
gtirb::IR::symbol_range
boost::iterator_range< symbol_iterator > symbol_range
Range of Symbol objects.
Definition: IR.hpp:368
gtirb::IR::byte_interval_iterator
MergeSortedIterator< Module::byte_interval_iterator, AddressLess > byte_interval_iterator
Iterator over ByteInterval objects.
Definition: IR.hpp:612
gtirb::IR::const_section_iterator
MergeSortedIterator< Module::const_section_iterator, AddressLess > const_section_iterator
Iterator over Section objects.
Definition: IR.hpp:428
gtirb::IR::findSectionsAt
const_section_range findSectionsAt(Addr A) const
Find all the sections that start at an address.
Definition: IR.hpp:548
gtirb::IR::module_range
boost::iterator_range< module_iterator > module_range
Range of Modules.
Definition: IR.hpp:144
gtirb::Module::getIR
const IR * getIR() const
Get the IR this module belongs to.
Definition: Module.hpp:180
gtirb::IR::const_byte_interval_subrange
boost::iterator_range< MergeSortedIterator< Module::const_byte_interval_subrange::iterator, AddressLess > > const_byte_interval_subrange
Sub-range of ByteInterval objects overlapping addresses.
Definition: IR.hpp:627
gtirb::IR::proxy_blocks_end
proxy_block_iterator proxy_blocks_end()
Return an iterator to the element following the last ProxyBlock.
Definition: IR.hpp:328
gtirb::IR::data_block_range
boost::iterator_range< data_block_iterator > data_block_range
Range of DataBlock objects.
Definition: IR.hpp:1140
gtirb::IR::findSymbolicExpressionsAt
const_symbolic_expression_range findSymbolicExpressionsAt(Addr A) const
Find all the symbolic expressions that start at an address.
Definition: IR.hpp:1414
gtirb::IR::const_symbolic_expression_iterator
MergeSortedIterator< Module::const_symbolic_expression_iterator, ByteInterval::ConstSymbolicExpressionElement::AddressLess > const_symbolic_expression_iterator
Iterator over SymbolicExpressionElement objects.
Definition: IR.hpp:1323
AuxDataContainer.hpp
Class gtirb::AuxDataContainer.
gtirb::IR::findBlocksAt
block_range findBlocksAt(Addr A)
Find all the blocks that start at an address.
Definition: IR.hpp:887
gtirb::IR::blocks
const_block_range blocks() const
Return a range of all the blocks.
Definition: IR.hpp:843
gtirb::IR::section_iterator
MergeSortedIterator< Module::section_iterator, AddressLess > section_iterator
Iterator over Section objects.
Definition: IR.hpp:420
gtirb::IR::proxy_blocks_begin
proxy_block_iterator proxy_blocks_begin()
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:318
gtirb::IR::findBlocksOn
block_subrange findBlocksOn(Addr A)
Find all the blocks that have bytes that lie within the address specified.
Definition: IR.hpp:854
gtirb::IR::getVersion
uint32_t getVersion() const
Get the version of the Protobuf used when creating this IR.
Definition: IR.hpp:1455
gtirb::IR::modules
const_module_range modules() const
Returns a constant range of the Modules.
Definition: IR.hpp:156
gtirb::IR::findBlocksAt
block_range findBlocksAt(Addr Low, Addr High)
Find all the blocks that start between a range of addresses.
Definition: IR.hpp:903
gtirb::IR::const_byte_interval_iterator
MergeSortedIterator< Module::const_byte_interval_iterator, AddressLess > const_byte_interval_iterator
Const iterator over ByteInterval objects.
Definition: IR.hpp:620
gtirb::IR::const_module_name_iterator
boost::indirect_iterator< ModuleSet::index< by_name >::type::const_iterator, const Module > const_module_name_iterator
Constant iterator over modules Modules.
Definition: IR.hpp:177
gtirb::IR::findSectionsAt
section_range findSectionsAt(Addr A)
Find all the sections that start at an address.
Definition: IR.hpp:517
gtirb::IR::symbols
const_symbol_range symbols() const
Return a range of the Symbol objects.
Definition: IR.hpp:409
gtirb::IR::blocks_begin
const_block_iterator blocks_begin() const
Return an iterator to the first block.
Definition: IR.hpp:831
gtirb::IR::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr A)
Find all the symbolic expressions that start at an address.
Definition: IR.hpp:1380
gtirb::IR::load_error
load_error
Specifies various failure modes when loading an IR.
Definition: IR.hpp:273
gtirb::IR::findBlocksAt
const_block_range findBlocksAt(Addr Low, Addr High) const
Find all the blocks that start between a range of addresses.
Definition: IR.hpp:936
gtirb::IR::findCodeBlocksAt
const_code_block_range findCodeBlocksAt(Addr Low, Addr High) const
Find all the code blocks that start between a range of addresses.
Definition: IR.hpp:1113
gtirb::IR::symbols_end
const_symbol_iterator symbols_end() const
Return an iterator to the element following the last Symbol.
Definition: IR.hpp:406
gtirb::IR::const_symbol_iterator
MergeSortedIterator< Module::const_symbol_iterator, ArbitraryLess< Symbol > > const_symbol_iterator
Iterator over Symbol objects.
Definition: IR.hpp:373
gtirb::AuxDataContainer
Contains the AuxData Tables and serves as a base class.
Definition: AuxDataContainer.hpp:56
std
Definition: Addr.hpp:359
gtirb::IR::findCodeBlocksAt
code_block_range findCodeBlocksAt(Addr Low, Addr High)
Find all the code blocks that start between a range of addresses.
Definition: IR.hpp:1081
gtirb::IR::const_code_block_subrange
boost::iterator_range< MergeSortedIterator< Module::const_code_block_subrange::iterator, AddressLess > > const_code_block_subrange
Sub-range of CodeBlock objects overlapping an address or range of addreses.
Definition: IR.hpp:988
gtirb::IR::proxy_block_range
boost::iterator_range< proxy_block_iterator > proxy_block_range
Range over ProxyBlock objects.
Definition: IR.hpp:308
gtirb::IR::const_data_block_iterator
MergeSortedIterator< Module::const_data_block_iterator, AddressLess > const_data_block_iterator
Iterator over DataBlock objects.
Definition: IR.hpp:1153
gtirb::Module
Represents a single binary (library or executable).
Definition: Module.hpp:107
gtirb::IR::findByteIntervalsAt
const_byte_interval_range findByteIntervalsAt(Addr A) const
Find all the intervals that start at an address.
Definition: IR.hpp:744
gtirb::IR::const_block_iterator
MergeSortedIterator< Module::const_block_iterator, BlockAddressLess > const_block_iterator
Iterator over blocks.
Definition: IR.hpp:800
gtirb::IR::data_blocks_begin
data_block_iterator data_blocks_begin()
Return an iterator to the first DataBlock.
Definition: IR.hpp:1168
GTIRB_PROTOBUF_VERSION
#define GTIRB_PROTOBUF_VERSION
Definition: version.h:46
gtirb::IR::findSections
section_name_range findSections(const std::string &X)
Find all the sections containing a name.
Definition: IR.hpp:580
gtirb::IR::modules_end
module_iterator modules_end()
Returns an iterator to the element following the last Module.
Definition: IR.hpp:133
gtirb::Module::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: Module.hpp:1306
Observer.hpp
gtirb::IR::code_blocks
const_code_block_range code_blocks() const
Return a range of all the CodeBlock objects.
Definition: IR.hpp:1024
gtirb::IR::addModule
Module * addModule(Context &C, Args... A)
Creates a new Module in this IR.
Definition: IR.hpp:227
gtirb::make_error_code
std::error_code make_error_code(gtirb::IR::load_error e)
Makes an std::error_code object from an IR::load_error object.
Definition: IR.hpp:1502
gtirb::IR::findSectionsAt
const_section_range findSectionsAt(Addr Low, Addr High) const
Find all the sections that start between a range of addresses.
Definition: IR.hpp:564
gtirb::IR::byte_intervals_end
byte_interval_iterator byte_intervals_end()
Return an iterator to the element following the last ByteInterval.
Definition: IR.hpp:640
gtirb::IR::section_range
boost::iterator_range< section_iterator > section_range
Range of Section objects.
Definition: IR.hpp:422
Module.hpp
Class gtirb::Module and related functions and types.
gtirb::IR::proxy_blocks_begin
const_proxy_block_iterator proxy_blocks_begin() const
Return an iterator to the first ProxyBlock.
Definition: IR.hpp:336
gtirb::IR::module_iterator
boost::indirect_iterator< ModuleSet::iterator > module_iterator
Definition: IR.hpp:122
gtirb::IR::symbol_iterator
MergeSortedIterator< Module::symbol_iterator, ArbitraryLess< Symbol > > symbol_iterator
Iterator over Symbol objects.
Definition: IR.hpp:364
gtirb::IR::findSymbolicExpressionsAt
symbolic_expression_range findSymbolicExpressionsAt(Addr Low, Addr High)
Find all the symbolic expressions that start between a range of addresses.
Definition: IR.hpp:1398
gtirb::IR::section_name_iterator
MergeSortedIterator< Module::section_name_iterator, AddressLess > section_name_iterator
Iterator over Section objects.
Definition: IR.hpp:436
AuxData.hpp
Types and operations for auxiliary data.
gtirb::IR::byte_interval_range
boost::iterator_range< byte_interval_iterator > byte_interval_range
Range of ByteInterval objects.
Definition: IR.hpp:614
gtirb::IR::findDataBlocksAt
data_block_range findDataBlocksAt(Addr Low, Addr High)
Find all the data blocks that start between a range of addresses.
Definition: IR.hpp:1258
gtirb::IR::findByteIntervalsAt
byte_interval_range findByteIntervalsAt(Addr Low, Addr High)
Find all the intervals that start between a range of addresses.
Definition: IR.hpp:727
gtirb::IR::const_proxy_block_range
boost::iterator_range< const_proxy_block_iterator > const_proxy_block_range
Range over ProxyBlock objects.
Definition: IR.hpp:315
gtirb::IR::data_blocks_end
data_block_iterator data_blocks_end()
Return an iterator to the element following the last DataBlock.
Definition: IR.hpp:1178
Addr.hpp
Class gtirb::Addr and related functions.
gtirb::IR::module_name_range
boost::iterator_range< module_name_iterator > module_name_range
Range of modules Modules.
Definition: IR.hpp:170
gtirb::IR::symbols_begin
symbol_iterator symbols_begin()
Return an iterator to the first Symbol.
Definition: IR.hpp:380
gtirb::IR::const_section_name_range
boost::iterator_range< const_section_name_iterator > const_section_name_range
Range of Section objects.
Definition: IR.hpp:444
gtirb::IR::symbols_begin
const_symbol_iterator symbols_begin() const
Return an iterator to the first Symbol.
Definition: IR.hpp:397
gtirb::ErrorOr
Definition: ByteInterval.hpp:62
gtirb::IR::byte_intervals_end
const_byte_interval_iterator byte_intervals_end() const
Return an iterator to the element following the last ByteInterval.
Definition: IR.hpp:661
gtirb::IR::code_block_iterator
MergeSortedIterator< Module::code_block_iterator, AddressLess > code_block_iterator
Iterator over CodeBlock objects.
Definition: IR.hpp:958
gtirb::CFG
CfgBuilder< boost::listS, boost::listS, boost::bidirectionalS >::type CFG
Interprocedural control flow graph, with vertices of type Block.
Definition: CFG.hpp:105
gtirb::IR::blocks
block_range blocks()
Return a range of all the blocks.
Definition: IR.hpp:826
gtirb::IR::findSectionsOn
const_section_subrange findSectionsOn(Addr A) const
Find a Section containing an address.
Definition: IR.hpp:502
gtirb::IR::data_blocks_begin
const_data_block_iterator data_blocks_begin() const
Return an iterator to the first DataBlock.
Definition: IR.hpp:1186
Utility.hpp
gtirb::IR::code_blocks
code_block_range code_blocks()
Return a range of all the CodeBlock objects.
Definition: IR.hpp:1004
gtirb::IR::sections_end
section_iterator sections_end()
Return an iterator to the element following the last Section.
Definition: IR.hpp:456
gtirb::IR::proxy_block_iterator
MergeSortedIterator< Module::proxy_block_iterator, ArbitraryLess< ProxyBlock > > proxy_block_iterator
Iterator over ProxyBlock objects.
Definition: IR.hpp:306
gtirb::IR::findDataBlocksAt
data_block_range findDataBlocksAt(Addr A)
Find all the data blocks that start at an address.
Definition: IR.hpp:1242
gtirb::IR::byte_intervals
byte_interval_range byte_intervals()
Return a range of all the ByteInterval objects.
Definition: IR.hpp:645
gtirb::IR::block_iterator
MergeSortedIterator< Module::block_iterator, BlockAddressLess > block_iterator
Iterator over blocks.
Definition: IR.hpp:783
gtirb::IR::symbolic_expressions
const_symbolic_expression_range symbolic_expressions() const
Return a range of all the SymbolicExpression objects.
Definition: IR.hpp:1369