本文整理汇总了C++中clang::ASTContext::getTranslationUnitDecl方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTContext::getTranslationUnitDecl方法的具体用法?C++ ASTContext::getTranslationUnitDecl怎么用?C++ ASTContext::getTranslationUnitDecl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clang::ASTContext
的用法示例。
在下文中一共展示了ASTContext::getTranslationUnitDecl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleTranslationUnit
virtual void HandleTranslationUnit(clang::ASTContext &ctx)
{
llvm::raw_ostream &out = llvm::errs();
clang::TranslationUnitDecl *translationUnit = ctx.getTranslationUnitDecl();
MyDeclVisitor(out, _astinfo).Visit(translationUnit);
}
示例2: checkAndAnalyze
void WebCLConsumer::checkAndAnalyze(clang::ASTContext &context)
{
clang::TranslationUnitDecl *decl = context.getTranslationUnitDecl();
for (Visitors::iterator i = visitors_.begin(); i != visitors_.end(); ++i) {
// There is no point to continue if an error has been reported.
if (!hasErrors(context)) {
WebCLVisitor *visitor = (*i);
visitor->TraverseDecl(decl);
}
}
}
示例3: HandleTranslationUnit
virtual void HandleTranslationUnit(clang::ASTContext& Ctx) override {
/* if (PP.getDiagnostics().hasErrorOccurred())
return;*/
ci.getPreprocessor().getDiagnostics().getClient();
BrowserASTVisitor v(annotator);
v.TraverseDecl(Ctx.getTranslationUnitDecl());
annotator.generate(ci.getSema(), WasInDatabase);
}
示例4: HandleTranslationUnit
void ReplaceArrayAccessWithIndex::HandleTranslationUnit(clang::ASTContext &Ctx)
{
TransAssert(Collector && "NULL Collector");
Collector->TraverseDecl(Ctx.getTranslationUnitDecl());
if (QueryInstanceOnly)
return;
if (TransformationCounter > ValidInstanceNum) {
TransError = TransMaxInstanceError;
return;
}
Ctx.getDiagnostics().setSuppressAllDiagnostics(false);
doRewrite();
if (Ctx.getDiagnostics().hasErrorOccurred() ||
Ctx.getDiagnostics().hasFatalErrorOccurred())
TransError = TransInternalError;
}
示例5: collect
RangeSet collect(clang::ASTContext &astContext, oclint::RuleBase *rule)
{
_rule = rule;
_sourceManager = &astContext.getSourceManager();
_range.clear();
clang::DeclContext *decl = astContext.getTranslationUnitDecl();
for (clang::DeclContext::decl_iterator declIt = decl->decls_begin(),
declEnd = decl->decls_end(); declIt != declEnd; ++declIt)
{
clang::SourceLocation startLocation = (*declIt)->getLocStart();
if (startLocation.isValid() &&
_sourceManager->getMainFileID() == _sourceManager->getFileID(startLocation))
{
(void) /* explicitly ignore the return of this function */
clang::RecursiveASTVisitor<DeclAnnotationRangeCollector>::TraverseDecl(*declIt);
}
}
return _range;
}
示例6: HandleTranslationUnit
virtual void HandleTranslationUnit(clang::ASTContext &Context)
{
Visitor.TraverseDecl(Context.getTranslationUnitDecl());
}
示例7: HandleTranslationUnit
void HandleTranslationUnit(clang::ASTContext& ctx) {
MyASTVisitor visitor(ctx.getSourceManager(), _db);
visitor.TraverseDecl(ctx.getTranslationUnitDecl());
}
示例8: HandleTranslationUnit
void ClangToSageTranslator::HandleTranslationUnit(clang::ASTContext & ast_context) {
Traverse(ast_context.getTranslationUnitDecl());
}
示例9: HandleTranslationUnit
/**
* Method called only when the entire file is parsed.
*/
void HandleTranslationUnit( clang::ASTContext & context ) override
{
// Recursively visit the AST.
myrecvisitor.TraverseDecl( context.getTranslationUnitDecl() );
}
示例10: HandleTranslationUnit
virtual void HandleTranslationUnit(clang::ASTContext &Context){
// Traversing the translation unit decl via a RecursiveASTVisitor
// will visit all nodes in the AST.
Visitor.TraverseDecl(Context.getTranslationUnitDecl());
}
示例11: HandleTranslationUnit
void MyConsumer::HandleTranslationUnit(clang::ASTContext &Context) {
visitor->manager = &Context.getSourceManager();
visitor->TraverseDecl(Context.getTranslationUnitDecl());
visitor->print_types();
}