mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 08:48:12 +00:00
[Tooling/Inclusion] qualifed_name() => qualifiedName(), NFC
This commit is contained in:
parent
f42e1a7484
commit
d46d44e3c4
@ -75,11 +75,11 @@ public:
|
||||
named(llvm::StringRef Scope, llvm::StringRef Name, Lang Language = Lang::CXX);
|
||||
|
||||
friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Symbol &S) {
|
||||
return OS << S.qualified_name();
|
||||
return OS << S.qualifiedName();
|
||||
}
|
||||
llvm::StringRef scope() const;
|
||||
llvm::StringRef name() const;
|
||||
llvm::StringRef qualified_name() const;
|
||||
llvm::StringRef qualifiedName() const;
|
||||
// The preferred header for this symbol (e.g. the suggested insertion).
|
||||
Header header() const;
|
||||
// Some symbols may be provided by multiple headers.
|
||||
|
@ -32,6 +32,11 @@ struct SymbolHeaderMapping {
|
||||
const char *Data; // std::vector
|
||||
unsigned ScopeLen; // ~~~~~
|
||||
unsigned NameLen; // ~~~~~~
|
||||
StringRef scope() const { return StringRef(Data, ScopeLen); }
|
||||
StringRef name() const { return StringRef(Data + ScopeLen, NameLen); }
|
||||
StringRef qualifiedName() const {
|
||||
return StringRef(Data, ScopeLen + NameLen);
|
||||
}
|
||||
} *SymbolNames = nullptr;
|
||||
// Symbol name -> Symbol::ID, within a namespace.
|
||||
llvm::DenseMap<llvm::StringRef, NSSymbolMap *> *NamespaceSymbols = nullptr;
|
||||
@ -162,16 +167,13 @@ std::vector<Symbol> Symbol::all(Lang L) {
|
||||
return Result;
|
||||
}
|
||||
llvm::StringRef Symbol::scope() const {
|
||||
auto &S = getMappingPerLang(Language)->SymbolNames[ID];
|
||||
return StringRef(S.Data, S.ScopeLen);
|
||||
return getMappingPerLang(Language)->SymbolNames[ID].scope();
|
||||
}
|
||||
llvm::StringRef Symbol::name() const {
|
||||
auto &S = getMappingPerLang(Language)->SymbolNames[ID];
|
||||
return StringRef(S.Data + S.ScopeLen, S.NameLen);
|
||||
return getMappingPerLang(Language)->SymbolNames[ID].name();
|
||||
}
|
||||
llvm::StringRef Symbol::qualified_name() const {
|
||||
auto &S = getMappingPerLang(Language)->SymbolNames[ID];
|
||||
return StringRef(S.Data, S.ScopeLen + S.NameLen);
|
||||
llvm::StringRef Symbol::qualifiedName() const {
|
||||
return getMappingPerLang(Language)->SymbolNames[ID].qualifiedName();
|
||||
}
|
||||
std::optional<Symbol> Symbol::named(llvm::StringRef Scope, llvm::StringRef Name,
|
||||
Lang L) {
|
||||
|
@ -47,7 +47,7 @@ TEST(StdlibTest, All) {
|
||||
EXPECT_TRUE(Vector);
|
||||
EXPECT_EQ(Vector->scope(), "std::");
|
||||
EXPECT_EQ(Vector->name(), "vector");
|
||||
EXPECT_EQ(Vector->qualified_name(), "std::vector");
|
||||
EXPECT_EQ(Vector->qualifiedName(), "std::vector");
|
||||
EXPECT_EQ(llvm::to_string(*Vector), "std::vector");
|
||||
EXPECT_FALSE(stdlib::Symbol::named("std::", "dongle"));
|
||||
EXPECT_FALSE(stdlib::Symbol::named("clang::", "ASTContext"));
|
||||
|
Loading…
Reference in New Issue
Block a user