mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
clang_generator: Access type collector/function via accessors
PiperOrigin-RevId: 490476261 Change-Id: Icbd51d3792c33dcfb185ec0514118a095135b3f6
This commit is contained in:
parent
13c5b564b6
commit
37ca6d0fc6
|
@ -90,9 +90,9 @@ void GeneratorASTConsumer::HandleTranslationUnit(clang::ASTContext& context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter_.AddTypeDeclarations(visitor_.collector_.GetTypeDeclarations());
|
// TODO(cblichmann): Move below to emit all functions after traversing TUs.
|
||||||
|
emitter_.AddTypeDeclarations(visitor_.collector().GetTypeDeclarations());
|
||||||
for (clang::FunctionDecl* func : visitor_.functions_) {
|
for (clang::FunctionDecl* func : visitor_.functions()) {
|
||||||
absl::Status status = emitter_.AddFunction(func);
|
absl::Status status = emitter_.AddFunction(func);
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
clang::SourceLocation loc =
|
clang::SourceLocation loc =
|
||||||
|
|
|
@ -64,13 +64,15 @@ class GeneratorASTVisitor
|
||||||
bool VisitTypeDecl(clang::TypeDecl* decl);
|
bool VisitTypeDecl(clang::TypeDecl* decl);
|
||||||
bool VisitFunctionDecl(clang::FunctionDecl* decl);
|
bool VisitFunctionDecl(clang::FunctionDecl* decl);
|
||||||
|
|
||||||
|
TypeCollector& collector() { return collector_; }
|
||||||
|
|
||||||
|
const std::vector<clang::FunctionDecl*>& functions() const {
|
||||||
|
return functions_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class GeneratorASTConsumer;
|
|
||||||
|
|
||||||
TypeCollector collector_;
|
TypeCollector collector_;
|
||||||
|
|
||||||
std::vector<clang::FunctionDecl*> functions_;
|
std::vector<clang::FunctionDecl*> functions_;
|
||||||
|
|
||||||
const GeneratorOptions& options_;
|
const GeneratorOptions& options_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,7 +87,6 @@ class GeneratorASTConsumer : public clang::ASTConsumer {
|
||||||
|
|
||||||
std::string in_file_;
|
std::string in_file_;
|
||||||
GeneratorASTVisitor visitor_;
|
GeneratorASTVisitor visitor_;
|
||||||
|
|
||||||
Emitter& emitter_;
|
Emitter& emitter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user