|
5 | 5 | #include "klee/Expr/Path.h" |
6 | 6 | #include "klee/Module/LocationInfo.h" |
7 | 7 |
|
| 8 | +#include <cinttypes> |
8 | 9 | #include <cstdint> |
9 | 10 | #include <iostream> |
10 | 11 | #include <optional> |
@@ -33,41 +34,35 @@ struct CodeLocation { |
33 | 34 | private: |
34 | 35 | CodeLocation(const Path::PathIndex &pathIndex, const KValue *source, |
35 | 36 | const std::string &sourceFilename, uint64_t sourceCodeLine, |
36 | | - std::optional<uint64_t> sourceCodeColumn) |
37 | | - : pathIndex(pathIndex), source(source), |
38 | | - location( |
39 | | - LocationInfo{sourceFilename, sourceCodeLine, sourceCodeColumn}) {} |
| 37 | + std::optional<uint64_t> sourceCodeColumn); |
40 | 38 |
|
41 | 39 | CodeLocation(const CodeLocation &) = delete; |
42 | 40 | CodeLocation &operator=(const CodeLocation &) = delete; |
43 | 41 |
|
44 | 42 | public: |
45 | | - /// @brief: Factory method. Wraps constructed objects in the ref |
46 | | - /// to provide zero-cost copying of code locations. |
47 | | - /// @param sourceFilename |
48 | | - /// @param sourceCodeLine |
49 | | - /// @param sourceCodeColumn |
50 | | - /// @return |
51 | | - static ref<CodeLocation> |
52 | | - create(const Path::PathIndex &pathIndex, const KValue *source, |
53 | | - const std::string &sourceFilename, uint64_t sourceCodeLine, |
54 | | - std::optional<uint64_t> sourceCodeColumn = std::nullopt) { |
55 | | - return new CodeLocation(pathIndex, source, sourceFilename, sourceCodeLine, |
56 | | - sourceCodeColumn); |
57 | | - } |
| 43 | + /// @brief Factory method for `CodeLocation` enhanced with `PathIndex` |
| 44 | + /// in history. Wraps constructed objects in the ref to provide |
| 45 | + /// zero-cost copying of code locations. |
| 46 | + /// @param sourceFilename Name of source file to which location refers. |
| 47 | + /// @param sourceCodeLine Line in source to which location refers. |
| 48 | + /// @param sourceCodeColumn Column in source code to which location refers. |
| 49 | + /// @return `CodeLocation` representing the location in source code. |
| 50 | + static ref<CodeLocation> create(const Path::PathIndex &pathIndex, |
| 51 | + const KValue *source, |
| 52 | + const std::string &sourceFilename, |
| 53 | + uint64_t sourceCodeLine, |
| 54 | + std::optional<uint64_t> sourceCodeColumn); |
58 | 55 |
|
59 | | - /// @brief TODO: finish docs. |
60 | | - /// @param sourceFilename |
61 | | - /// @param sourceCodeLine |
62 | | - /// @param sourceCodeColumn |
63 | | - /// @return |
64 | | - static ref<CodeLocation> |
65 | | - create(const KValue *source, const std::string &sourceFilename, |
66 | | - uint64_t sourceCodeLine, |
67 | | - std::optional<uint64_t> sourceCodeColumn = std::nullopt) { |
68 | | - return new CodeLocation(Path::PathIndex{0, 0}, source, sourceFilename, |
69 | | - sourceCodeLine, sourceCodeColumn); |
70 | | - } |
| 56 | + /// @brief Factory method for `CodeLocation`. Wraps constructed |
| 57 | + /// objects in the ref to provide zero-cost copying of code locations. |
| 58 | + /// @param sourceFilename Name of source file to which location refers. |
| 59 | + /// @param sourceCodeLine Line in source to which location refers. |
| 60 | + /// @param sourceCodeColumn Column in source code to which location refers. |
| 61 | + /// @return `CodeLocation` representing the location in source code. |
| 62 | + static ref<CodeLocation> create(const KValue *source, |
| 63 | + const std::string &sourceFilename, |
| 64 | + uint64_t sourceCodeLine, |
| 65 | + std::optional<uint64_t> sourceCodeColumn); |
71 | 66 |
|
72 | 67 | /// @brief Converts code location info to SARIFs representation |
73 | 68 | /// of location. |
|
0 commit comments