Skip to content

Commit

Permalink
chore: add OptionalLocation
Browse files Browse the repository at this point in the history
fix #316
  • Loading branch information
sdkrystian committed Jun 17, 2023
1 parent ec7344e commit 23b8911
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions include/mrdox/Metadata/Source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define MRDOX_API_METADATA_SOURCE_HPP

#include <mrdox/Platform.hpp>
#include <mrdox/ADT/Optional.hpp>
#include <mrdox/Metadata/Info.hpp>
#include <optional>
#include <string>
#include <string_view>

Expand Down Expand Up @@ -49,6 +49,11 @@ struct Location
}
};

/** Like std::optional<SymbolID>
*/
using OptionalLocation = Optional<Location,
decltype([](const Location& loc) { return loc.Filename.empty(); })>;

/** Stores source information for a declaration.
*/
struct SourceInfo
Expand All @@ -60,7 +65,7 @@ struct SourceInfo
actually a definition (e.g. alias-declarations and
typedef declarations are never definition).
*/
std::optional<Location> DefLoc;
OptionalLocation DefLoc;

/** Locations where the entity was declared,
Expand Down
2 changes: 1 addition & 1 deletion source/AST/DecodeRecord.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ inline
Error
decodeRecord(
Record const& R,
std::optional<Location>& Field,
OptionalLocation& Field,
llvm::StringRef Blob)
{
if (R[0] > INT_MAX)
Expand Down

0 comments on commit 23b8911

Please sign in to comment.