mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Adjust order of GetPlatformClangArguments
This commit is contained in:
parent
89d45fb48a
commit
3a752a3c8f
@ -69,11 +69,7 @@ std::unique_ptr<ClangTranslationUnit> ClangTranslationUnit::Create(
|
||||
std::vector<CXUnsavedFile>& unsaved_files,
|
||||
unsigned flags) {
|
||||
std::vector<const char*> args;
|
||||
for (const std::string& a : arguments)
|
||||
args.push_back(a.c_str());
|
||||
|
||||
std::vector<std::string> platform_args = GetPlatformClangArguments();
|
||||
for (const auto& arg : platform_args)
|
||||
for (auto& arg : arguments)
|
||||
args.push_back(arg.c_str());
|
||||
|
||||
CXTranslationUnit cx_tu;
|
||||
|
@ -42,7 +42,7 @@ void CopyFileTo(const std::string& destination, const std::string& source);
|
||||
bool IsSymLink(const std::string& path);
|
||||
|
||||
// Returns any clang arguments that are specific to the current platform.
|
||||
std::vector<std::string> GetPlatformClangArguments();
|
||||
std::vector<const char*> GetPlatformClangArguments();
|
||||
|
||||
// Free any unused memory and return it to the system.
|
||||
void FreeUnusedMemory();
|
||||
|
@ -259,7 +259,7 @@ bool IsSymLink(const std::string& path) {
|
||||
return lstat(path.c_str(), &buf) == 0 && S_ISLNK(buf.st_mode);
|
||||
}
|
||||
|
||||
std::vector<std::string> GetPlatformClangArguments() {
|
||||
std::vector<const char*> GetPlatformClangArguments() {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -129,12 +129,13 @@ bool IsSymLink(const std::string& path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetPlatformClangArguments() {
|
||||
std::vector<const char*> GetPlatformClangArguments() {
|
||||
//
|
||||
// Found by executing
|
||||
//
|
||||
// $ clang++ -E -x c++ - -v
|
||||
//
|
||||
// https://clang.llvm.org/docs/MSVCCompatibility.html
|
||||
|
||||
// clang-format off
|
||||
return {
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
extern bool gTestOutputMode;
|
||||
|
||||
struct CompileCommandsEntry {
|
||||
std::string directory;
|
||||
std::string file;
|
||||
@ -193,6 +195,12 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
||||
if (!AnyStartsWith(args, "-working-directory"))
|
||||
result.args.emplace_back("-working-directory=" + entry.directory);
|
||||
|
||||
if (!gTestOutputMode) {
|
||||
std::vector<const char*> platform = GetPlatformClangArguments();
|
||||
for (auto arg: platform)
|
||||
result.args.push_back(arg);
|
||||
}
|
||||
|
||||
bool next_flag_is_path = false;
|
||||
bool add_next_flag_to_quote_dirs = false;
|
||||
bool add_next_flag_to_angle_dirs = false;
|
||||
|
@ -10,9 +10,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace {
|
||||
bool gTestOutputMode = false;
|
||||
} // namespace
|
||||
|
||||
//// Elementary types
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user