From 8359f004e2f32ceb3f2f87272d933850757f8723 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Sat, 17 Jun 2023 10:04:45 -0400 Subject: [PATCH] chore: add OptionalLocation fix #316 --- include/mrdox/Metadata/Source.hpp | 9 +++++++-- source/AST/DecodeRecord.hpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/mrdox/Metadata/Source.hpp b/include/mrdox/Metadata/Source.hpp index e478cbcc3..cf65ed4f9 100644 --- a/include/mrdox/Metadata/Source.hpp +++ b/include/mrdox/Metadata/Source.hpp @@ -14,8 +14,8 @@ #define MRDOX_API_METADATA_SOURCE_HPP #include +#include #include -#include #include #include @@ -49,6 +49,11 @@ struct Location } }; +/** Like std::optional +*/ +using OptionalLocation = Optional; + /** Stores source information for a declaration. */ struct SourceInfo @@ -60,7 +65,7 @@ struct SourceInfo actually a definition (e.g. alias-declarations and typedef declarations are never definition). */ - std::optional DefLoc; + OptionalLocation DefLoc; /** Locations where the entity was declared, diff --git a/source/AST/DecodeRecord.hpp b/source/AST/DecodeRecord.hpp index 3f159f9b1..276a19dfc 100644 --- a/source/AST/DecodeRecord.hpp +++ b/source/AST/DecodeRecord.hpp @@ -117,7 +117,7 @@ inline Error decodeRecord( Record const& R, - std::optional& Field, + OptionalLocation& Field, llvm::StringRef Blob) { if (R[0] > INT_MAX)