comparison clang-tools-extra/clangd/Hover.h @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children 5f17cb93ff66
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
57 index::SymbolKind Kind = index::SymbolKind::Unknown; 57 index::SymbolKind Kind = index::SymbolKind::Unknown;
58 std::string Documentation; 58 std::string Documentation;
59 /// Source code containing the definition of the symbol. 59 /// Source code containing the definition of the symbol.
60 std::string Definition; 60 std::string Definition;
61 61
62 /// Access specifier for declarations inside class/struct/unions, empty for
63 /// others.
64 std::string AccessSpecifier;
62 /// Pretty-printed variable type. 65 /// Pretty-printed variable type.
63 /// Set only for variables. 66 /// Set only for variables.
64 llvm::Optional<std::string> Type; 67 llvm::Optional<std::string> Type;
65 /// Set for functions and lambdas. 68 /// Set for functions and lambdas.
66 llvm::Optional<std::string> ReturnType; 69 llvm::Optional<std::string> ReturnType;
72 llvm::Optional<std::string> Value; 75 llvm::Optional<std::string> Value;
73 /// Contains the byte-size of fields and types where it's interesting. 76 /// Contains the byte-size of fields and types where it's interesting.
74 llvm::Optional<uint64_t> Size; 77 llvm::Optional<uint64_t> Size;
75 /// Contains the offset of fields within the enclosing class. 78 /// Contains the offset of fields within the enclosing class.
76 llvm::Optional<uint64_t> Offset; 79 llvm::Optional<uint64_t> Offset;
80 // Set when symbol is inside function call. Contains information extracted
81 // from the callee definition about the argument this is passed as.
82 llvm::Optional<Param> CalleeArgInfo;
83 struct PassType {
84 // How the variable is passed to callee.
85 enum PassMode { Ref, ConstRef, Value };
86 PassMode PassBy = Ref;
87 // True if type conversion happened. This includes calls to implicit
88 // constructor, as well as built-in type conversions. Casting to base class
89 // is not considered conversion.
90 bool Converted = false;
91 };
92 // Set only if CalleeArgInfo is set.
93 llvm::Optional<PassType> CallPassType;
77 94
78 /// Produce a user-readable information. 95 /// Produce a user-readable information.
79 markup::Document present() const; 96 markup::Document present() const;
80 }; 97 };
98
99 inline bool operator==(const HoverInfo::PassType &LHS,
100 const HoverInfo::PassType &RHS) {
101 return std::tie(LHS.PassBy, LHS.Converted) ==
102 std::tie(RHS.PassBy, RHS.Converted);
103 }
81 104
82 // Try to infer structure of a documentation comment (e.g. line breaks). 105 // Try to infer structure of a documentation comment (e.g. line breaks).
83 // FIXME: move to another file so CodeComplete doesn't depend on Hover. 106 // FIXME: move to another file so CodeComplete doesn't depend on Hover.
84 void parseDocumentation(llvm::StringRef Input, markup::Document &Output); 107 void parseDocumentation(llvm::StringRef Input, markup::Document &Output);
85 108