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

View File

@ -7,11 +7,12 @@
namespace clang { namespace clang {
/*
TranslationUnit::TranslationUnit(Index &index, const std::string &file_path, TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
const std::vector<std::string> &command_line_args, const std::vector<std::string> &command_line_args,
const std::string &buffer, unsigned flags) { const std::string &buffer, unsigned flags) {
std::vector<const char*> args; std::vector<const char*> args;
for (auto &a : command_line_args) { for (auto& a : command_line_args) {
args.push_back(a.c_str()); 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); index.cx_index, file_path.c_str(), args.data(), args.size(), files, 1, flags, &cx_tu);
assert(!error_code); assert(!error_code);
} }
*/
TranslationUnit::TranslationUnit(Index &index, const std::string &file_path, TranslationUnit::TranslationUnit(Index &index, const std::string &file_path,
const std::vector<std::string> &command_line_args, unsigned flags) { 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. // TODO: only push defines for the time being. Might need to pass more flags.
std::vector<const char*> args; std::vector<const char*> args;
for (const std::string& a : command_line_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()); args.push_back(a.c_str());
} }

View File

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