Merge "versioner: Port to clang-r344140"

This commit is contained in:
Logan Chien 2018-11-07 22:02:50 +00:00 committed by Gerrit Code Review
commit 77a5f95405
4 changed files with 12 additions and 12 deletions

View file

@ -29,7 +29,6 @@
#include <clang/AST/ASTConsumer.h>
#include <clang/Basic/Diagnostic.h>
#include <clang/Basic/TargetInfo.h>
#include <clang/Basic/VirtualFileSystem.h>
#include <clang/Driver/Compilation.h>
#include <clang/Driver/Driver.h>
#include <clang/Frontend/CompilerInstance.h>
@ -42,6 +41,7 @@
#include <llvm/ADT/IntrusiveRefCntPtr.h>
#include <llvm/ADT/SmallVector.h>
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/VirtualFileSystem.h>
#include "Arch.h"
#include "DeclarationDatabase.h"
@ -93,7 +93,7 @@ static IntrusiveRefCntPtr<DiagnosticsEngine> constructDiags() {
// Run it once to generate flags for each target, and memoize the results.
static std::unordered_map<CompilationType, std::vector<std::string>> cc1_flags;
static const char* filename_placeholder = "__VERSIONER_PLACEHOLDER__";
static void generateTargetCC1Flags(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> vfs,
static void generateTargetCC1Flags(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
CompilationType type,
const std::vector<std::string>& include_dirs) {
std::vector<std::string> cmd = { "versioner" };
@ -207,7 +207,7 @@ static std::vector<const char*> getCC1Command(CompilationType type, const std::s
return result;
}
void initializeTargetCC1FlagCache(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> vfs,
void initializeTargetCC1FlagCache(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
const std::set<CompilationType>& types,
const std::unordered_map<Arch, CompilationRequirements>& reqs) {
if (!cc1_flags.empty()) {
@ -242,7 +242,7 @@ void initializeTargetCC1FlagCache(llvm::IntrusiveRefCntPtr<clang::vfs::FileSyste
}
}
void compileHeader(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> vfs,
void compileHeader(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
HeaderDatabase* header_database, CompilationType type,
const std::string& filename) {
auto diags = constructDiags();

View file

@ -31,10 +31,10 @@ struct CompilationRequirements {
std::vector<std::string> dependencies;
};
void initializeTargetCC1FlagCache(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> vfs,
void initializeTargetCC1FlagCache(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
const std::set<CompilationType>& types,
const std::unordered_map<Arch, CompilationRequirements>& reqs);
void compileHeader(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> vfs,
void compileHeader(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
HeaderDatabase* header_database, CompilationType type,
const std::string& filename);

View file

@ -25,14 +25,14 @@
#include <string>
#include <android-base/unique_fd.h>
#include <clang/Basic/VirtualFileSystem.h>
#include <llvm/ADT/IntrusiveRefCntPtr.h>
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/Support/VirtualFileSystem.h>
#include "Utils.h"
using android::base::unique_fd;
using namespace clang::vfs;
using namespace llvm::vfs;
static void addDirectoryToVFS(InMemoryFileSystem* vfs, const std::string& path) {
char* paths[] = { const_cast<char*>(path.c_str()), nullptr };

View file

@ -20,8 +20,8 @@
#include <string>
#include <llvm/ADT/IntrusiveRefCntPtr.h>
#include <clang/Basic/VirtualFileSystem.h>
#include <llvm/Support/VirtualFileSystem.h>
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> createCommonVFS(const std::string& header_dir,
const std::string& dependency_dir,
bool add_versioning_header);
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> createCommonVFS(const std::string& header_dir,
const std::string& dependency_dir,
bool add_versioning_header);