Add tests for directive collections.
This commit is contained in:
@@ -80,6 +80,10 @@ public:
|
||||
return llvm::StringRef(srcMgr().getCharacterData(loc), getTokenLength(loc));
|
||||
}
|
||||
|
||||
auto getLocation(clang::SourceLocation loc) {
|
||||
return srcMgr().getPresumedLoc(loc);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<clang::ASTFrontendAction> action;
|
||||
std::unique_ptr<clang::CompilerInstance> instance;
|
||||
@@ -131,6 +135,8 @@ struct CompliationParams {
|
||||
/// Information about reuse PCM(name, path).
|
||||
llvm::SmallVector<std::pair<std::string, std::string>> pcms;
|
||||
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs = llvm::vfs::getRealFileSystem();
|
||||
|
||||
uint32_t line = 0, column = 0;
|
||||
|
||||
void addPCH(const PCHInfo& info) {
|
||||
|
||||
@@ -4,7 +4,16 @@
|
||||
|
||||
namespace clice {
|
||||
|
||||
struct Include {};
|
||||
struct Include {
|
||||
/// The path of the included file.
|
||||
llvm::StringRef path;
|
||||
|
||||
/// Location of the directive identifier.
|
||||
clang::SourceLocation loc;
|
||||
|
||||
/// Range of the filename.
|
||||
clang::SourceRange range;
|
||||
};
|
||||
|
||||
struct Condition {
|
||||
enum BranchKind : uint8_t {
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
namespace clice::support {
|
||||
|
||||
template <typename T>
|
||||
template <typename LHS, typename RHS = LHS>
|
||||
struct Equal {
|
||||
static bool equal(const T& lhs, const T& rhs) {
|
||||
static bool equal(const LHS& lhs, const RHS& rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool equal(const T& lhs, const T& rhs) {
|
||||
return Equal<T>::equal(lhs, rhs);
|
||||
template <typename LHS, typename RHS>
|
||||
bool equal(const LHS& lhs, const RHS& rhs) {
|
||||
return Equal<LHS, RHS>::equal(lhs, rhs);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -173,6 +173,13 @@ struct Serde<double> {
|
||||
}
|
||||
};
|
||||
|
||||
template <std::size_t N>
|
||||
struct Serde<char[N]> {
|
||||
static json::Value serialize(const char (&v)[N]) {
|
||||
return json::Value(llvm::StringRef(v, N));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Serde<llvm::StringRef> {
|
||||
using V = llvm::StringRef;
|
||||
|
||||
Reference in New Issue
Block a user