do not strip any clang args for the time being

This commit is contained in:
Jacob Dufault 2017-03-10 18:23:57 -08:00
parent 68d9002ecd
commit 38fb4a4f1d
3 changed files with 18 additions and 19 deletions

View File

@ -1,7 +1,6 @@
#if false
#pragma once
#ifndef DIAGNOSTIC_H_
#define DIAGNOSTIC_H_
#include <string>
#include <vector>
#include <clang-c/Index.h>
@ -10,16 +9,16 @@
namespace clang {
class Diagnostic {
public:
friend class TranslationUnit;
Diagnostic(CXTranslationUnit& cx_tu, CXDiagnostic& cx_diagnostic);
public:
class FixIt {
public:
FixIt(const std::string &source, const std::pair<clang::Offset, clang::Offset> &offsets) :
source(source), offsets(offsets) {}
std::string source;
std::pair<clang::Offset, clang::Offset> offsets;
};
//class FixIt {
//public:
// FixIt(const std::string &source, const std::pair<clang::Offset, clang::Offset> &offsets) :
// source(source), offsets(offsets) {}
// std::string source;
// std::pair<clang::Offset, clang::Offset> offsets;
//};
static const std::string get_severity_spelling(unsigned severity);
@ -32,6 +31,4 @@ public:
};
}
#endif // DIAGNOSTIC_H_
#endif

View File

@ -7,11 +7,12 @@
namespace clang {
/*
TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
const std::vector<std::string> &command_line_args,
const std::string &buffer, unsigned flags) {
std::vector<const char*> args;
for (auto &a : command_line_args) {
for (auto& a : command_line_args) {
args.push_back(a.c_str());
}
@ -24,6 +25,7 @@ TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
index.cx_index, file_path.c_str(), args.data(), args.size(), files, 1, flags, &cx_tu);
assert(!error_code);
}
*/
TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
const std::vector<std::string> &command_line_args, unsigned flags) {
@ -31,7 +33,7 @@ TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
// TODO: only push defines for the time being. Might need to pass more flags.
std::vector<const char*> args;
for (const std::string& a : command_line_args) {
if (a.size() >= 2 && a[0] == '-' && a[1] == 'D')
//if (a.size() >= 2 && a[0] == '-' && a[1] == 'D')
args.push_back(a.c_str());
}

View File

@ -14,11 +14,11 @@
namespace clang {
class TranslationUnit {
public:
TranslationUnit(Index &index,
const std::string &file_path,
const std::vector<std::string> &command_line_args,
const std::string &buffer,
unsigned flags=DefaultFlags());
//TranslationUnit(Index &index,
// const std::string &file_path,
// const std::vector<std::string> &command_line_args,
// const std::string &buffer,
// unsigned flags=DefaultFlags());
TranslationUnit(Index &index,
const std::string &file_path,
const std::vector<std::string> &command_line_args,