refactor: diagnostic handling (#337)
This commit is contained in:
@@ -14,7 +14,7 @@ class FilteredASTVisitor : public clang::RecursiveASTVisitor<Derived> {
|
||||
public:
|
||||
using Base = clang::RecursiveASTVisitor<Derived>;
|
||||
|
||||
FilteredASTVisitor(CompilationUnit& unit, bool interested_only) :
|
||||
FilteredASTVisitor(CompilationUnitRef unit, bool interested_only) :
|
||||
unit(unit), interested_only(interested_only) {}
|
||||
|
||||
#define CHECK_DERIVED_IMPL(func) \
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
#undef CHECK_DERIVED_IMPL
|
||||
|
||||
protected:
|
||||
CompilationUnit& unit;
|
||||
CompilationUnitRef unit;
|
||||
bool interested_only;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace clice {
|
||||
|
||||
class CompilationUnit;
|
||||
class CompilationUnitRef;
|
||||
|
||||
/// A selection can partially or completely cover several AST nodes.
|
||||
/// The SelectionTree contains nodes that are covered, and their parents.
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/// - Func should return true on success (stop) and false on failure (continue)
|
||||
///
|
||||
/// Always yields at least one tree. If no tokens are touched, it is empty.
|
||||
static bool create_each(CompilationUnit& unit,
|
||||
static bool create_each(CompilationUnitRef unit,
|
||||
LocalSourceRange range,
|
||||
llvm::function_ref<bool(SelectionTree)> callback);
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
///
|
||||
/// Where ambiguous (range is empty and borders two tokens), prefer the token
|
||||
/// on the right.
|
||||
static SelectionTree create_right(CompilationUnit& unit, LocalSourceRange range);
|
||||
static SelectionTree create_right(CompilationUnitRef unit, LocalSourceRange range);
|
||||
|
||||
/// Copies are no good - contain pointers to other nodes.
|
||||
SelectionTree(const SelectionTree&) = delete;
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
private:
|
||||
// Creates a selection tree for the given range in the main file.
|
||||
// The range includes bytes [Start, End).
|
||||
SelectionTree(CompilationUnit& unit, LocalSourceRange range);
|
||||
SelectionTree(CompilationUnitRef unit, LocalSourceRange range);
|
||||
|
||||
// Stable-pointer storage, FIXME: use memory pool instead?
|
||||
std::deque<Node> nodes;
|
||||
|
||||
@@ -13,7 +13,7 @@ class SemanticVisitor : public FilteredASTVisitor<SemanticVisitor<Derived>> {
|
||||
public:
|
||||
using Base = FilteredASTVisitor<SemanticVisitor>;
|
||||
|
||||
SemanticVisitor(CompilationUnit& unit, bool interested_only) :
|
||||
SemanticVisitor(CompilationUnitRef unit, bool interested_only) :
|
||||
Base(unit, interested_only), unit(unit), resolver(unit.resolver()) {}
|
||||
|
||||
public:
|
||||
@@ -725,7 +725,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
CompilationUnit& unit;
|
||||
CompilationUnitRef unit;
|
||||
TemplateResolver& resolver;
|
||||
llvm::SmallVector<clang::Decl*> decls;
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@ struct Token {
|
||||
return is_at_start_of_line && kind == clang::tok::hash;
|
||||
}
|
||||
|
||||
/// The tokens after the include diretive are regarded as
|
||||
/// The tokens after the include directive are regarded as
|
||||
/// a whole token, whose kind is `header_name`. For example
|
||||
/// `<iostream>` and `"test.h"` are both header name.
|
||||
bool is_header_name() const {
|
||||
|
||||
Reference in New Issue
Block a user