mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[FIX][clang-extract-api] Fix scope naming violation
This commit is contained in:
parent
0a65112cf7
commit
fa331da8fb
@ -88,9 +88,9 @@ struct GlobalRecord : APIRecord {
|
||||
}
|
||||
};
|
||||
|
||||
class API {
|
||||
class APISet {
|
||||
public:
|
||||
API(const llvm::Triple &Target, const LangOptions &LangOpts)
|
||||
APISet(const llvm::Triple &Target, const LangOptions &LangOpts)
|
||||
: Target(Target), LangOpts(LangOpts) {}
|
||||
|
||||
const llvm::Triple &getTarget() const { return Target; }
|
||||
|
@ -30,7 +30,7 @@ struct SerializerOption {
|
||||
|
||||
class Serializer {
|
||||
public:
|
||||
Serializer(const API &API, SerializerOption Options = {})
|
||||
Serializer(const APISet &API, SerializerOption Options = {})
|
||||
: API(API), Options(Options) {}
|
||||
|
||||
Object serialize();
|
||||
@ -44,7 +44,7 @@ private:
|
||||
|
||||
bool shouldSkip(const APIRecord &Record) const;
|
||||
|
||||
const API &API;
|
||||
const APISet &API;
|
||||
SerializerOption Options;
|
||||
Array Symbols;
|
||||
Array Relationships;
|
||||
|
@ -23,11 +23,13 @@ namespace symbolgraph {
|
||||
|
||||
APIRecord::~APIRecord() {}
|
||||
|
||||
GlobalRecord *
|
||||
API::addGlobal(GVKind Kind, StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability, LinkageInfo Linkage,
|
||||
const DocComment &Comment, DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading, FunctionSignature Signature) {
|
||||
GlobalRecord *APISet::addGlobal(GVKind Kind, StringRef Name, StringRef USR,
|
||||
PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability,
|
||||
LinkageInfo Linkage, const DocComment &Comment,
|
||||
DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading,
|
||||
FunctionSignature Signature) {
|
||||
auto Result = Globals.insert({Name, nullptr});
|
||||
if (Result.second) {
|
||||
GlobalRecord *Record = new (Allocator)
|
||||
@ -38,32 +40,33 @@ API::addGlobal(GVKind Kind, StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
return Result.first->second;
|
||||
}
|
||||
|
||||
GlobalRecord *API::addGlobalVar(StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability,
|
||||
LinkageInfo Linkage, const DocComment &Comment,
|
||||
DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading) {
|
||||
GlobalRecord *
|
||||
APISet::addGlobalVar(StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability, LinkageInfo Linkage,
|
||||
const DocComment &Comment, DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading) {
|
||||
return addGlobal(GVKind::Variable, Name, USR, Loc, Availability, Linkage,
|
||||
Comment, Fragments, SubHeading, {});
|
||||
}
|
||||
|
||||
GlobalRecord *API::addFunction(StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability,
|
||||
LinkageInfo Linkage, const DocComment &Comment,
|
||||
DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading,
|
||||
FunctionSignature Signature) {
|
||||
GlobalRecord *
|
||||
APISet::addFunction(StringRef Name, StringRef USR, PresumedLoc Loc,
|
||||
const AvailabilityInfo &Availability, LinkageInfo Linkage,
|
||||
const DocComment &Comment, DeclarationFragments Fragments,
|
||||
DeclarationFragments SubHeading,
|
||||
FunctionSignature Signature) {
|
||||
return addGlobal(GVKind::Function, Name, USR, Loc, Availability, Linkage,
|
||||
Comment, Fragments, SubHeading, Signature);
|
||||
}
|
||||
|
||||
StringRef API::recordUSR(const Decl *D) {
|
||||
StringRef APISet::recordUSR(const Decl *D) {
|
||||
SmallString<128> USR;
|
||||
index::generateUSRForDecl(D, USR);
|
||||
return copyString(USR);
|
||||
}
|
||||
|
||||
StringRef API::copyString(StringRef String, llvm::BumpPtrAllocator &Allocator) {
|
||||
StringRef APISet::copyString(StringRef String,
|
||||
llvm::BumpPtrAllocator &Allocator) {
|
||||
if (String.empty())
|
||||
return {};
|
||||
|
||||
@ -75,7 +78,7 @@ StringRef API::copyString(StringRef String, llvm::BumpPtrAllocator &Allocator) {
|
||||
return StringRef(reinterpret_cast<const char *>(Ptr), String.size());
|
||||
}
|
||||
|
||||
StringRef API::copyString(StringRef String) {
|
||||
StringRef APISet::copyString(StringRef String) {
|
||||
return copyString(String, Allocator);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
: Context(Context),
|
||||
API(Context.getTargetInfo().getTriple(), Context.getLangOpts()) {}
|
||||
|
||||
const API &getAPI() const { return API; }
|
||||
const APISet &getAPI() const { return API; }
|
||||
|
||||
bool VisitVarDecl(const VarDecl *Decl) {
|
||||
// Skip function parameters.
|
||||
@ -165,7 +165,7 @@ private:
|
||||
}
|
||||
|
||||
ASTContext &Context;
|
||||
API API;
|
||||
APISet API;
|
||||
};
|
||||
|
||||
class ExtractAPIConsumer : public ASTConsumer {
|
||||
|
Loading…
x
Reference in New Issue
Block a user