Skip to content

Commit 77729b0

Browse files
committed
chore: rename SymbolInfo to SourceInfo, move Location into Source.hpp
1 parent 711baf4 commit 77729b0

20 files changed

+103
-118
lines changed

include/mrdox/Metadata.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
#include <mrdox/Metadata/Info.hpp>
2424
#include <mrdox/Metadata/Interface.hpp>
2525
#include <mrdox/Metadata/Javadoc.hpp>
26-
#include <mrdox/Metadata/Location.hpp>
2726
#include <mrdox/Metadata/Namespace.hpp>
2827
#include <mrdox/Metadata/Overloads.hpp>
2928
#include <mrdox/Metadata/Record.hpp>
3029
#include <mrdox/Metadata/Specialization.hpp>
31-
#include <mrdox/Metadata/Symbol.hpp>
30+
#include <mrdox/Metadata/Source.hpp>
3231
#include <mrdox/Metadata/Symbols.hpp>
3332
#include <mrdox/Metadata/Template.hpp>
3433
#include <mrdox/Metadata/Type.hpp>

include/mrdox/Metadata/Enum.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/Metadata/Javadoc.hpp>
17-
#include <mrdox/Metadata/Symbol.hpp>
17+
#include <mrdox/Metadata/Source.hpp>
1818
#include <mrdox/Metadata/Type.hpp>
1919
#include <optional>
2020
#include <string>
@@ -63,7 +63,7 @@ struct EnumValueInfo
6363
// Info for types.
6464
struct EnumInfo
6565
: IsInfo<InfoKind::Enum>
66-
, SymbolInfo
66+
, SourceInfo
6767
{
6868
// Indicates whether this enum is scoped (e.g. enum class).
6969
bool Scoped = false;

include/mrdox/Metadata/Field.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <mrdox/Platform.hpp>
1717
#include <mrdox/Metadata/Info.hpp>
18-
#include <mrdox/Metadata/Symbol.hpp>
18+
#include <mrdox/Metadata/Source.hpp>
1919
#include <mrdox/Metadata/Type.hpp>
2020
#include <mrdox/ADT/BitField.hpp>
2121
#include <utility>
@@ -40,7 +40,7 @@ union FieldFlags
4040
*/
4141
struct FieldInfo
4242
: IsInfo<InfoKind::Field>
43-
, SymbolInfo
43+
, SourceInfo
4444
{
4545
/** Type of the field */
4646
TypeInfo Type;

include/mrdox/Metadata/Function.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <mrdox/Platform.hpp>
1717
#include <mrdox/ADT/BitField.hpp>
1818
#include <mrdox/Metadata/Field.hpp>
19-
#include <mrdox/Metadata/Symbol.hpp>
19+
#include <mrdox/Metadata/Source.hpp>
2020
#include <mrdox/Metadata/Symbols.hpp>
2121
#include <mrdox/Metadata/Template.hpp>
2222
#include <clang/AST/Attr.h>
@@ -176,7 +176,7 @@ struct Param
176176
// Info for functions.
177177
struct FunctionInfo
178178
: IsInfo<InfoKind::Function>
179-
, SymbolInfo
179+
, SourceInfo
180180
{
181181
friend class ASTVisitor;
182182

include/mrdox/Metadata/Location.hpp

Lines changed: 0 additions & 44 deletions
This file was deleted.

include/mrdox/Metadata/Record.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <mrdox/Metadata/Enum.hpp>
1818
#include <mrdox/Metadata/Field.hpp>
1919
#include <mrdox/Metadata/Function.hpp>
20-
#include <mrdox/Metadata/Symbol.hpp>
20+
#include <mrdox/Metadata/Source.hpp>
2121
#include <mrdox/Metadata/Symbols.hpp>
2222
#include <mrdox/Metadata/Template.hpp>
2323
#include <mrdox/Metadata/Typedef.hpp>
@@ -73,7 +73,7 @@ enum class RecordKeyKind
7373
*/
7474
struct RecordInfo
7575
: IsInfo<InfoKind::Record>
76-
, SymbolInfo
76+
, SourceInfo
7777
{
7878
friend class ASTVisitor;
7979

include/mrdox/Metadata/Symbol.hpp renamed to include/mrdox/Metadata/Source.hpp

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,48 @@
1010
// Official repository: https://github.com/cppalliance/mrdox
1111
//
1212

13-
#ifndef MRDOX_API_METADATA_SYMBOL_HPP
14-
#define MRDOX_API_METADATA_SYMBOL_HPP
13+
#ifndef MRDOX_API_METADATA_SOURCE_HPP
14+
#define MRDOX_API_METADATA_SOURCE_HPP
1515

1616
#include <mrdox/Platform.hpp>
1717
#include <mrdox/Metadata/Info.hpp>
18-
#include <mrdox/Metadata/Location.hpp>
1918
#include <optional>
19+
#include <string>
20+
#include <string_view>
2021

2122
namespace clang {
2223
namespace mrdox {
2324

24-
/** Base class for Info that have source locations.
25+
struct Location
26+
{
27+
/** Name of the file
28+
*/
29+
std::string Filename;
30+
31+
/** Line number within the file
32+
*/
33+
int LineNumber;
34+
35+
/** Whether the file is inside the source root directory
36+
*/
37+
bool IsFileInRootDir;
38+
39+
//--------------------------------------------
40+
41+
Location(
42+
int line = 0,
43+
std::string_view filename = "",
44+
bool in_root_dir = false)
45+
: Filename(filename)
46+
, LineNumber(line)
47+
, IsFileInRootDir(in_root_dir)
48+
{
49+
}
50+
};
51+
52+
/** Stores source information for a declaration.
2553
*/
26-
struct SymbolInfo
54+
struct SourceInfo
2755
{
2856
/** Location where the entity was defined
2957
@@ -41,7 +69,7 @@ struct SymbolInfo
4169
std::vector<Location> Loc;
4270

4371
protected:
44-
SymbolInfo() = default;
72+
SourceInfo() = default;
4573
};
4674

4775
} // mrdox

include/mrdox/Metadata/Typedef.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define MRDOX_API_METADATA_TYPEDEF_HPP
1515

1616
#include <mrdox/Platform.hpp>
17-
#include <mrdox/Metadata/Symbol.hpp>
17+
#include <mrdox/Metadata/Source.hpp>
1818
#include <mrdox/Metadata/Template.hpp>
1919
#include <mrdox/Metadata/Type.hpp>
2020
#include <memory>
@@ -25,7 +25,7 @@ namespace mrdox {
2525
// Info for typedef and using statements.
2626
struct TypedefInfo
2727
: IsInfo<InfoKind::Typedef>
28-
, SymbolInfo
28+
, SourceInfo
2929
{
3030
friend class ASTVisitor;
3131

include/mrdox/Metadata/Variable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <mrdox/Platform.hpp>
1616
#include <mrdox/ADT/BitField.hpp>
17-
#include <mrdox/Metadata/Symbol.hpp>
17+
#include <mrdox/Metadata/Source.hpp>
1818
#include <mrdox/Metadata/Template.hpp>
1919
#include <mrdox/Metadata/Type.hpp>
2020
#include <clang/Basic/Specifiers.h>
@@ -37,7 +37,7 @@ union VariableFlags0
3737
*/
3838
struct VariableInfo
3939
: IsInfo<InfoKind::Variable>
40-
, SymbolInfo
40+
, SourceInfo
4141
{
4242
friend class ASTVisitor;
4343

include/mrdox/MetadataFwd.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct RecordInfo;
4141
struct Param;
4242
struct SpecializationInfo;
4343
struct SpecializedMember;
44-
struct SymbolInfo;
44+
struct SourceInfo;
4545
struct TypeInfo;
4646
struct TypedefInfo;
4747
struct VariableInfo;

0 commit comments

Comments
 (0)