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;
|
||||
}
|
||||
|
||||
emitter_.AddTypeDeclarations(visitor_.collector_.GetTypeDeclarations());
|
||||
|
||||
for (clang::FunctionDecl* func : visitor_.functions_) {
|
||||
// TODO(cblichmann): Move below to emit all functions after traversing TUs.
|
||||
emitter_.AddTypeDeclarations(visitor_.collector().GetTypeDeclarations());
|
||||
for (clang::FunctionDecl* func : visitor_.functions()) {
|
||||
absl::Status status = emitter_.AddFunction(func);
|
||||
if (!status.ok()) {
|
||||
clang::SourceLocation loc =
|
||||
|
|
|
@ -64,13 +64,15 @@ class GeneratorASTVisitor
|
|||
bool VisitTypeDecl(clang::TypeDecl* decl);
|
||||
bool VisitFunctionDecl(clang::FunctionDecl* decl);
|
||||
|
||||
TypeCollector& collector() { return collector_; }
|
||||
|
||||
const std::vector<clang::FunctionDecl*>& functions() const {
|
||||
return functions_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class GeneratorASTConsumer;
|
||||
|
||||
TypeCollector collector_;
|
||||
|
||||
std::vector<clang::FunctionDecl*> functions_;
|
||||
|
||||
const GeneratorOptions& options_;
|
||||
};
|
||||
|
||||
|
@ -85,7 +87,6 @@ class GeneratorASTConsumer : public clang::ASTConsumer {
|
|||
|
||||
std::string in_file_;
|
||||
GeneratorASTVisitor visitor_;
|
||||
|
||||
Emitter& emitter_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user