This commit is contained in:
Fangrui Song 2018-03-31 09:25:58 -07:00
parent e1398ff319
commit ce33cc86d4
48 changed files with 96 additions and 858 deletions

View File

@ -64,7 +64,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 18410644574635149442,
"usr": 10983126130596230582,
"detailed_name": "Foo f",
"short_name": "f",
"declarations": [],
@ -76,7 +76,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 11468802633764653592,
"usr": 17165811951126099095,
"detailed_name": "Foo *f2",
"short_name": "f2",
"hover": "Foo *f2 = new Foo()",

View File

@ -85,7 +85,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 9954632887635271906,
"usr": 1893354193220338759,
"detailed_name": "Foo f",
"short_name": "f",
"declarations": [],

View File

@ -63,7 +63,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 17348451315735351657,
"usr": 449111627548814328,
"detailed_name": "Type foo0",
"short_name": "foo0",
"declarations": [],
@ -75,7 +75,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 3757978174345638825,
"usr": 17097499197730163115,
"detailed_name": "Type foo1",
"short_name": "foo1",
"declarations": [],

View File

@ -137,7 +137,7 @@ OUTPUT: make_functions.cc
"skipped_by_preprocessor": [],
"types": [{
"id": 0,
"usr": 7902098450755788854,
"usr": 9281343527065946499,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -153,7 +153,7 @@ OUTPUT: make_functions.cc
"uses": ["4:1-4:2|-1|1|4"]
}, {
"id": 1,
"usr": 12533159752419999454,
"usr": 10771590811355716928,
"detailed_name": "Args",
"short_name": "Args",
"kind": 26,
@ -169,7 +169,7 @@ OUTPUT: make_functions.cc
"uses": ["4:15-4:19|-1|1|4"]
}, {
"id": 2,
"usr": 18441628706991062891,
"usr": 11897454629873246477,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -185,7 +185,7 @@ OUTPUT: make_functions.cc
"uses": ["9:1-9:2|-1|1|4"]
}, {
"id": 3,
"usr": 9441341235704820385,
"usr": 3337128087216004141,
"detailed_name": "Args",
"short_name": "Args",
"kind": 26,
@ -328,7 +328,7 @@ OUTPUT: make_functions.cc
}],
"vars": [{
"id": 0,
"usr": 15288691366352169805,
"usr": 8463700030555379526,
"detailed_name": "Args &&... args",
"short_name": "args",
"declarations": [],
@ -339,7 +339,7 @@ OUTPUT: make_functions.cc
"storage": 1
}, {
"id": 1,
"usr": 12338908251430965107,
"usr": 3908732770590594660,
"detailed_name": "Args... args",
"short_name": "args",
"declarations": [],

View File

@ -51,7 +51,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 10480417713467708012,
"usr": 14555488990109936920,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],
@ -63,7 +63,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 18099600680625658464,
"usr": 10963664335057337329,
"detailed_name": "int b",
"short_name": "b",
"declarations": [],

View File

@ -97,7 +97,7 @@ OUTPUT:
"uses": ["13:56-13:64|-1|1|4"]
}, {
"id": 5,
"usr": 780719166805015998,
"usr": 7916588271848318236,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -131,7 +131,7 @@ OUTPUT:
"funcs": [],
"vars": [{
"id": 0,
"usr": 3880651725784125791,
"usr": 12990052348105569112,
"detailed_name": "unsigned int T",
"short_name": "T",
"declarations": [],

View File

@ -32,7 +32,7 @@ OUTPUT:
"uses": []
}, {
"id": 1,
"usr": 1287417953265234030,
"usr": 14635009347499519042,
"detailed_name": "",
"short_name": "",
"kind": 0,
@ -62,7 +62,7 @@ OUTPUT:
"callees": ["9:14-9:15|1|3|32", "10:14-10:15|1|3|32", "11:14-11:15|1|3|32"]
}, {
"id": 1,
"usr": 1328781044864682611,
"usr": 17926497908620168464,
"detailed_name": "",
"short_name": "",
"kind": 0,
@ -76,7 +76,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 17270098654620601683,
"usr": 12666114896600231317,
"detailed_name": "int x",
"short_name": "x",
"declarations": [],
@ -88,7 +88,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 16806544259835773270,
"usr": 2981279427664991319,
"detailed_name": "lambda dosomething",
"short_name": "dosomething",
"declarations": [],
@ -100,7 +100,7 @@ OUTPUT:
"storage": 1
}, {
"id": 2,
"usr": 2034725908368218782,
"usr": 12879188959314906706,
"detailed_name": "int y",
"short_name": "y",
"declarations": [],

View File

@ -87,7 +87,7 @@ OUTPUT:
"storage": 0
}, {
"id": 2,
"usr": 14946041066794678724,
"usr": 2056319845419860263,
"detailed_name": "DISALLOW",
"short_name": "DISALLOW",
"hover": "#define DISALLOW(type) type(type&&) = delete;",

View File

@ -142,7 +142,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 107714981785063096,
"usr": 6030927277961448585,
"detailed_name": "int a",
"short_name": "a",
"hover": "int a = foo::bar::baz::qux",
@ -155,7 +155,7 @@ OUTPUT:
"storage": 1
}, {
"id": 2,
"usr": 1200087780658383286,
"usr": 7657277353101371136,
"detailed_name": "int b",
"short_name": "b",
"hover": "int b = fbz::qux",

View File

@ -105,7 +105,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 7976909968919750794,
"usr": 3649375698083002347,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],

View File

@ -177,7 +177,7 @@ OUTPUT: static_function_in_type.cc
}],
"vars": [{
"id": 0,
"usr": 9285345059965948351,
"usr": 13569879755236306838,
"detailed_name": "ns::Manager *m",
"short_name": "m",
"declarations": [],

View File

@ -12,7 +12,7 @@ OUTPUT:
"funcs": [],
"vars": [{
"id": 0,
"usr": 13076155634261037336,
"usr": 11674328179498211370,
"detailed_name": "FOO",
"short_name": "FOO",
"hover": "#define FOO",

View File

@ -83,7 +83,7 @@ OUTPUT:
"uses": ["10:26-10:32|-1|1|4", "13:13-13:19|-1|1|4", "14:14-14:20|-1|1|4"]
}, {
"id": 4,
"usr": 14511917000226829276,
"usr": 2205716167465743256,
"detailed_name": "",
"short_name": "",
"kind": 0,

View File

@ -81,7 +81,7 @@ OUTPUT:
"uses": ["7:1-7:9|-1|1|4"]
}, {
"id": 2,
"usr": 10862637711685426953,
"usr": 9673599782548740467,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -97,7 +97,7 @@ OUTPUT:
"uses": ["5:16-5:17|-1|1|4"]
}, {
"id": 3,
"usr": 756188769017350739,
"usr": 7143192229126273961,
"detailed_name": "Args",
"short_name": "Args",
"kind": 26,
@ -159,7 +159,7 @@ OUTPUT:
"uses": ["31:1-31:7|-1|1|4"]
}, {
"id": 7,
"usr": 3421332160420436276,
"usr": 8880262253425334092,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -239,7 +239,7 @@ OUTPUT:
"uses": []
}, {
"id": 12,
"usr": 2461355892344618654,
"usr": 14111105212951082474,
"detailed_name": "T",
"short_name": "T",
"kind": 26,
@ -409,7 +409,7 @@ OUTPUT:
"storage": 0
}, {
"id": 7,
"usr": 10307767688451422448,
"usr": 17826688417349629938,
"detailed_name": "T Value",
"short_name": "Value",
"declarations": [],

View File

@ -69,7 +69,7 @@ OUTPUT:
"uses": ["8:1-8:2|-1|1|4", "8:11-8:12|-1|1|4"]
}, {
"id": 2,
"usr": 8864163146308556810,
"usr": 11919899838872947844,
"detailed_name": "",
"short_name": "",
"kind": 0,

View File

@ -61,7 +61,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 13681544683892648258,
"usr": 16088407831770615719,
"detailed_name": "void (*)() x",
"short_name": "x",
"declarations": [],

View File

@ -64,7 +64,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 8436636043513449412,
"usr": 4636142131003982569,
"detailed_name": "void (Foo::*)() x",
"short_name": "x",
"declarations": [],

View File

@ -64,7 +64,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 3014406561587537195,
"usr": 14045150712868309451,
"detailed_name": "Foo *f",
"short_name": "f",
"hover": "Foo *f = nullptr",

View File

@ -63,7 +63,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 12410753116854389823,
"usr": 16229832321010999607,
"detailed_name": "Foo *f",
"short_name": "f",
"hover": "Foo *f = nullptr",

View File

@ -90,7 +90,7 @@ OUTPUT:
"storage": 3
}, {
"id": 2,
"usr": 2462000803278878465,
"usr": 3364438781074774169,
"detailed_name": "unique_ptr<S> *local",
"short_name": "local",
"declarations": [],

View File

@ -219,7 +219,7 @@ OUTPUT:
"storage": 2
}, {
"id": 1,
"usr": 11547294959889394856,
"usr": 500112618220246,
"detailed_name": "unique_ptr<unique_ptr<S1, S2>, S2> *local",
"short_name": "local",
"declarations": [],

View File

@ -60,7 +60,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 11033478034711123650,
"usr": 16374832544037266261,
"detailed_name": "ForwardType *a",
"short_name": "a",
"declarations": [],
@ -72,7 +72,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 8949902309768550158,
"usr": 2580122838476012357,
"detailed_name": "ImplementedType b",
"short_name": "b",
"declarations": [],

View File

@ -57,7 +57,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 2584795197111552890,
"usr": 13058491096576226774,
"detailed_name": "ForwardType *f",
"short_name": "f",
"declarations": [],
@ -69,7 +69,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 5136230284979460117,
"usr": 11055777568039014776,
"detailed_name": "ImplementedType a",
"short_name": "a",
"declarations": [],

View File

@ -49,7 +49,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 2161866804398917919,
"usr": 13823260660189154978,
"detailed_name": "Foo *f",
"short_name": "f",
"declarations": [],

View File

@ -46,7 +46,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 16414210592877294238,
"usr": 7997456978847868736,
"detailed_name": "Type &a0",
"short_name": "a0",
"declarations": [],
@ -58,7 +58,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 11558141642862804306,
"usr": 17228576662112939520,
"detailed_name": "const Type &a1",
"short_name": "a1",
"declarations": [],
@ -70,7 +70,7 @@ OUTPUT:
"storage": 1
}, {
"id": 2,
"usr": 1536316608590232194,
"usr": 15429032129697337561,
"detailed_name": "Type a2",
"short_name": "a2",
"declarations": [],
@ -82,7 +82,7 @@ OUTPUT:
"storage": 1
}, {
"id": 3,
"usr": 316760354845869406,
"usr": 6081981442495435784,
"detailed_name": "Type *a3",
"short_name": "a3",
"declarations": [],
@ -94,7 +94,7 @@ OUTPUT:
"storage": 1
}, {
"id": 4,
"usr": 12321730890779907974,
"usr": 5004072032239834773,
"detailed_name": "const Type *a4",
"short_name": "a4",
"declarations": [],
@ -106,7 +106,7 @@ OUTPUT:
"storage": 1
}, {
"id": 5,
"usr": 4771437488905761633,
"usr": 14939253431683105646,
"detailed_name": "const Type *const a5",
"short_name": "a5",
"hover": "const Type *const a5 = nullptr",

View File

@ -53,7 +53,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 14873619387499024780,
"usr": 16380484338511689669,
"detailed_name": "Foo f",
"short_name": "f",
"declarations": [],

View File

@ -125,7 +125,7 @@ OUTPUT:
"storage": 0
}, {
"id": 2,
"usr": 13284113377394221067,
"usr": 8039186520399841081,
"detailed_name": "int a",
"short_name": "a",
"hover": "int a = 5",

View File

@ -46,7 +46,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 3510529098767253033,
"usr": 9121974011454213596,
"detailed_name": "void (*)() x",
"short_name": "x",
"declarations": [],

View File

@ -127,7 +127,7 @@ OUTPUT:
"storage": 0
}, {
"id": 2,
"usr": 16303259148898744165,
"usr": 14669930844300034456,
"detailed_name": "Foo f",
"short_name": "f",
"declarations": [],

View File

@ -40,7 +40,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 8534460107894911680,
"usr": 14014650769929566957,
"detailed_name": "int x",
"short_name": "x",
"declarations": [],

View File

@ -45,7 +45,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 17941402366659878910,
"usr": 13311055950748663970,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],
@ -57,7 +57,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 11094102496276744608,
"usr": 14036425367303419504,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],

View File

@ -57,7 +57,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 8011559936501990179,
"usr": 6997229590862003559,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],

View File

@ -44,7 +44,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 9275666070987716270,
"usr": 10601729374837386290,
"detailed_name": "Foo *x",
"short_name": "x",
"declarations": [],
@ -56,7 +56,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 16202433437488621027,
"usr": 18422884837902130475,
"detailed_name": "Foo *y",
"short_name": "y",
"declarations": [],

View File

@ -42,7 +42,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 10782632605670042066,
"usr": 13198746475679542317,
"detailed_name": "Foo *a",
"short_name": "a",
"declarations": [],

View File

@ -40,7 +40,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 4580260577538694711,
"usr": 8730439006497971620,
"detailed_name": "Foo *p0",
"short_name": "p0",
"declarations": [],
@ -52,7 +52,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 12071725611268840435,
"usr": 2525014371090380500,
"detailed_name": "Foo *p1",
"short_name": "p1",
"declarations": [],

View File

@ -45,7 +45,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 3440226937504376525,
"usr": 1894874819807168345,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],
@ -57,7 +57,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 14700715011944976607,
"usr": 4508045017817092115,
"detailed_name": "int a",
"short_name": "a",
"declarations": [],

View File

@ -51,7 +51,7 @@ OUTPUT:
"storage": 1
}, {
"id": 1,
"usr": 2147918703972955240,
"usr": 11404600766177939811,
"detailed_name": "int p",
"short_name": "p",
"hover": "int p = 0",

View File

@ -64,7 +64,7 @@ OUTPUT:
}],
"vars": [{
"id": 0,
"usr": 7730100248624586522,
"usr": 6975456769752895964,
"detailed_name": "F a",
"short_name": "a",
"declarations": [],

View File

@ -525,11 +525,8 @@ void SetTypeName(IndexType* type,
// Investigate why clang_getCursorPrettyPrinted gives `struct A {}` `namespace
// ns {}` which are not qualified.
// type->def.detailed_name = param->PrettyPrintCursor(cursor.cx_cursor);
type->def.detailed_name =
std::tie(type->def.detailed_name, type->def.short_name_offset) =
param->ns.QualifiedName(container ? container : &parent, name);
auto idx = type->def.detailed_name.rfind(name);
assert(idx != std::string::npos);
type->def.short_name_offset = idx;
type->def.short_name_size = strlen(name);
}
@ -599,7 +596,7 @@ void SetVarDetail(IndexVar* var,
? param->PrettyPrintCursor(cursor.cx_cursor)
:
#endif
param->ns.QualifiedName(semanticContainer, short_name);
param->ns.QualifiedName(semanticContainer, short_name).first;
if (cursor.get_kind() == CXCursor_EnumConstantDecl && semanticContainer) {
CXType enum_type = clang_getCanonicalType(
@ -782,12 +779,6 @@ void Uniquify(std::vector<Use>& uses) {
uses.resize(n);
}
// FIXME Reference: set id in call sites and remove this
// void AddUse(std::vector<Use>& values, Range value) {
// values.push_back(
// Use(value, Id<void>(), SymbolKind::File, Role::Reference, {}));
//}
void AddUse(IndexFile* db,
std::vector<Use>& uses,
Range range,
@ -1422,10 +1413,11 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor,
} // namespace
std::string NamespaceHelper::QualifiedName(const CXIdxContainerInfo* container,
std::string_view unqualified_name) {
std::pair<std::string, int> NamespaceHelper::QualifiedName(
const CXIdxContainerInfo* container,
std::string_view unqualified_name) {
if (!container)
return std::string(unqualified_name);
return {std::string(unqualified_name), 0};
// Anonymous namespaces are not processed by indexDeclaration. We trace
// nested namespaces bottom-up through clang_getCursorSemanticParent until
// one that we know its qualified name. Then do another trace top-down and
@ -1455,8 +1447,9 @@ std::string NamespaceHelper::QualifiedName(const CXIdxContainerInfo* container,
qualifier += "::";
container_cursor_to_qualified_name[namespaces[i]] = qualifier;
}
// C++17 string::append
return qualifier + std::string(unqualified_name);
int pos = qualifier.size();
qualifier.append(unqualified_name);
return {qualifier, pos};
}
void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {

View File

@ -509,8 +509,8 @@ struct NamespaceHelper {
std::unordered_map<ClangCursor, std::string>
container_cursor_to_qualified_name;
std::string QualifiedName(const CXIdxContainerInfo* container,
std::string_view unqualified_name);
std::pair<std::string, int> QualifiedName(const CXIdxContainerInfo* container,
std::string_view unqualified_name);
};
// |import_file| is the cc file which is what gets passed to clang.

View File

@ -349,7 +349,3 @@ void EmitSemanticHighlighting(QueryDatabase* db,
out.params.symbols.push_back(entry.second);
QueueManager::WriteStdout(kMethodType_CclsPublishSemanticHighlighting, out);
}
bool ShouldIgnoreFileForIndexing(const std::string& path) {
return StartsWith(path, "git:");
}

View File

@ -153,5 +153,3 @@ void EmitSemanticHighlighting(QueryDatabase* db,
SemanticHighlightSymbolCache* semantic_cache,
WorkingFile* working_file,
QueryFile* file);
bool ShouldIgnoreFileForIndexing(const std::string& path);

View File

@ -40,8 +40,6 @@ struct Handler_TextDocumentDidOpen
const auto& params = request->params;
Timer time;
std::string path = params.textDocument.uri.GetPath();
if (ShouldIgnoreFileForIndexing(path))
return;
std::shared_ptr<ICacheManager> cache_manager = ICacheManager::Make(config);
WorkingFile* working_file = working_files->OnOpen(params.textDocument);

View File

@ -32,8 +32,6 @@ struct Handler_TextDocumentDidSave
void Run(In_TextDocumentDidSave* request) override {
std::string path = request->params.textDocument.uri.GetPath();
if (ShouldIgnoreFileForIndexing(path))
return;
// Send out an index request, and copy the current buffer state so we
// can update the cached index contents when the index is done.

View File

@ -69,7 +69,6 @@ struct ProjectConfig {
std::unordered_set<std::string> angle_dirs;
std::vector<std::string> extra_flags;
std::string project_dir;
std::string resource_dir;
ProjectMode mode = ProjectMode::CompileCommandsJson;
};
@ -273,7 +272,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
// Add -resource-dir so clang can correctly resolve system includes like
// <cstddef>
if (!AnyStartsWith(result.args, "-resource-dir"))
result.args.push_back("-resource-dir=" + config->resource_dir);
result.args.push_back("-resource-dir=" + init_opts->resourceDirectory);
// There could be a clang version mismatch between what the project uses and
// what ccls uses. Make sure we do not emit warnings for mismatched options.
@ -476,39 +475,16 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
// Computes a score based on how well |a| and |b| match. This is used for
// argument guessing.
int ComputeGuessScore(const std::string& a, const std::string& b) {
const int kMatchPrefixWeight = 100;
const int kMismatchDirectoryWeight = 100;
const int kMatchPostfixWeight = 1;
int score = 0;
size_t i = 0;
// Increase score based on matching prefix.
for (i = 0; i < a.size() && i < b.size(); ++i) {
if (a[i] != b[i])
break;
score += kMatchPrefixWeight;
}
// Reduce score based on mismatched directory distance.
for (size_t j = i; j < a.size(); ++j) {
if (a[j] == '/')
score -= kMismatchDirectoryWeight;
}
for (size_t j = i; j < b.size(); ++j) {
if (b[j] == '/')
score -= kMismatchDirectoryWeight;
}
// Increase score based on common ending. Don't increase as much as matching
// prefix or directory distance.
for (size_t offset = 1; offset <= a.size() && offset <= b.size(); ++offset) {
if (a[a.size() - offset] != b[b.size() - offset])
break;
score += kMatchPostfixWeight;
}
int ComputeGuessScore(std::string_view a, std::string_view b) {
// Increase score based on common prefix and suffix. Prefixes are prioritized.
if (a.size() < b.size())
std::swap(a, b);
size_t i = std::mismatch(a.begin(), a.end(), b.begin()).first - a.begin();
size_t j = std::mismatch(a.rbegin(), a.rend(), b.rbegin()).first - a.rbegin();
int score = 10 * i + j;
if (i + j < b.size())
score -= 100 * (std::count(a.begin() + i, a.end() - j, '/') +
std::count(b.begin() + i, b.end() - j, '/'));
return score;
}
@ -519,7 +495,6 @@ void Project::Load(Config* config, const std::string& root_directory) {
ProjectConfig project;
project.extra_flags = config->extraClangArguments;
project.project_dir = root_directory;
project.resource_dir = config->resourceDirectory;
entries = LoadCompilationEntriesFromDirectory(
config, &project, config->compilationDatabaseDirectory);
@ -647,7 +622,7 @@ TEST_SUITE("Project") {
Config config;
ProjectConfig project;
project.project_dir = "/w/c/s/";
project.resource_dir = "/w/resource_dir/";
config.resourceDirectory = "/w/resource_dir/";
CompileCommandsEntry entry;
entry.directory = directory;
@ -691,19 +666,6 @@ TEST_SUITE("Project") {
{"clang.exe", "-working-directory=/dir/",
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
"-fparse-all-comments"});
CheckFlags(
/* raw */ {"goma", "clang"},
/* expected */
{"clang", "-working-directory=/dir/", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option", "-fparse-all-comments"});
CheckFlags(
/* raw */ {"goma", "clang", "--foo"},
/* expected */
{"clang", "-working-directory=/dir/", "--foo",
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
"-fparse-all-comments"});
}
TEST_CASE("Windows path normalization") {
@ -756,678 +718,6 @@ TEST_SUITE("Project") {
"-fparse-all-comments"});
}
// Checks flag parsing for a random chromium file in comparison to what
// YouCompleteMe fetches.
TEST_CASE("ycm") {
CheckFlags(
"/w/c/s/out/Release", "../../ash/login/lock_screen_sanity_unittest.cc",
/* raw */
{
"/work/goma/gomacc",
"../../third_party/llvm-build/Release+Asserts/bin/clang++",
"-MMD",
"-MF",
"obj/ash/ash_unittests/lock_screen_sanity_unittest.o.d",
"-DV8_DEPRECATION_WARNINGS",
"-DDCHECK_ALWAYS_ON=1",
"-DUSE_UDEV",
"-DUSE_AURA=1",
"-DUSE_NSS_CERTS=1",
"-DUSE_OZONE=1",
"-DFULL_SAFE_BROWSING",
"-DSAFE_BROWSING_CSD",
"-DSAFE_BROWSING_DB_LOCAL",
"-DCHROMIUM_BUILD",
"-DFIELDTRIAL_TESTING_ENABLED",
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE_SOURCE",
"-D_LARGEFILE64_SOURCE",
"-DCR_CLANG_REVISION=\"313786-1\"",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
"-DCOMPONENT_BUILD",
"-DOS_CHROMEOS",
"-DNDEBUG",
"-DNVALGRIND",
"-DDYNAMIC_ANNOTATIONS_ENABLED=0",
"-DGL_GLEXT_PROTOTYPES",
"-DUSE_GLX",
"-DUSE_EGL",
"-DANGLE_ENABLE_RELEASE_ASSERTS",
"-DTOOLKIT_VIEWS=1",
"-DGTEST_API_=",
"-DGTEST_HAS_POSIX_RE=0",
"-DGTEST_LANG_CXX11=1",
"-DUNIT_TEST",
"-DUSING_V8_SHARED",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=uint16_t",
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
"-DHAVE_PTHREAD",
"-DPROTOBUF_USE_DLLS",
"-DBORINGSSL_SHARED_LIBRARY",
"-DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS",
"-DSK_HAS_PNG_LIBRARY",
"-DSK_HAS_WEBP_LIBRARY",
"-DSK_HAS_JPEG_LIBRARY",
"-DSKIA_DLL",
"-DGR_GL_IGNORE_ES3_MSAA=0",
"-DSK_SUPPORT_GPU=1",
"-DMESA_EGL_NO_X11_HEADERS",
"-I../..",
"-Igen",
"-I../../third_party/libwebp/src",
"-I../../third_party/khronos",
"-I../../gpu",
"-I../../third_party/googletest/src/googletest/include",
"-I../../third_party/WebKit",
"-Igen/third_party/WebKit",
"-I../../v8/include",
"-Igen/v8/include",
"-I../../third_party/icu/source/common",
"-I../../third_party/icu/source/i18n",
"-I../../third_party/protobuf/src",
"-Igen/protoc_out",
"-I../../third_party/protobuf/src",
"-I../../third_party/boringssl/src/include",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nss",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nspr",
"-I../../skia/config",
"-I../../skia/ext",
"-I../../third_party/skia/include/c",
"-I../../third_party/skia/include/config",
"-I../../third_party/skia/include/core",
"-I../../third_party/skia/include/effects",
"-I../../third_party/skia/include/encode",
"-I../../third_party/skia/include/gpu",
"-I../../third_party/skia/include/images",
"-I../../third_party/skia/include/lazy",
"-I../../third_party/skia/include/pathops",
"-I../../third_party/skia/include/pdf",
"-I../../third_party/skia/include/pipe",
"-I../../third_party/skia/include/ports",
"-I../../third_party/skia/include/utils",
"-I../../third_party/skia/third_party/vulkan",
"-I../../third_party/skia/include/codec",
"-I../../third_party/skia/src/gpu",
"-I../../third_party/skia/src/sksl",
"-I../../third_party/ced/src",
"-I../../third_party/mesa/src/include",
"-I../../third_party/libwebm/source",
"-Igen",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/"
"dbus-1.0",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/lib/"
"x86_64-linux-gnu/dbus-1.0/include",
"-I../../third_party/googletest/custom",
"-I../../third_party/googletest/src/googlemock/include",
"-fno-strict-aliasing",
"-Wno-builtin-macro-redefined",
"-D__DATE__=",
"-D__TIME__=",
"-D__TIMESTAMP__=",
"-funwind-tables",
"-fPIC",
"-pipe",
"-B../../third_party/binutils/Linux_x64/Release/bin",
"-pthread",
"-fcolor-diagnostics",
"-no-canonical-prefixes",
"-m64",
"-march=x86-64",
"-Wall",
"-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-c++11-narrowing",
"-Wno-covered-switch-default",
"-Wno-unneeded-internal-declaration",
"-Wno-inconsistent-missing-override",
"-Wno-undefined-var-template",
"-Wno-nonportable-include-path",
"-Wno-address-of-packed-member",
"-Wno-unused-lambda-capture",
"-Wno-user-defined-warnings",
"-Wno-enum-compare-switch",
"-Wno-tautological-unsigned-zero-compare",
"-Wno-null-pointer-arithmetic",
"-Wno-tautological-unsigned-enum-zero-compare",
"-O2",
"-fno-ident",
"-fdata-sections",
"-ffunction-sections",
"-fno-omit-frame-pointer",
"-g0",
"-fvisibility=hidden",
"-Xclang",
"-load",
"-Xclang",
"../../third_party/llvm-build/Release+Asserts/lib/"
"libFindBadConstructs.so",
"-Xclang",
"-add-plugin",
"-Xclang",
"find-bad-constructs",
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"check-auto-raw-pointer",
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"check-ipc",
"-Wheader-hygiene",
"-Wstring-conversion",
"-Wtautological-overlap-compare",
"-Wno-header-guard",
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem../../buildtools/third_party/libc++/trunk/include",
"-isystem../../buildtools/third_party/libc++abi/trunk/include",
"--sysroot=../../build/linux/debian_jessie_amd64-sysroot",
"-fno-exceptions",
"-fvisibility-inlines-hidden",
"-c",
"../../ash/login/ui/lock_screen_sanity_unittest.cc",
"-o",
"obj/ash/ash_unittests/lock_screen_sanity_unittest.o",
},
/* expected */
{"../../third_party/llvm-build/Release+Asserts/bin/clang++",
"-working-directory=/w/c/s/out/Release",
"-DV8_DEPRECATION_WARNINGS",
"-DDCHECK_ALWAYS_ON=1",
"-DUSE_UDEV",
"-DUSE_AURA=1",
"-DUSE_NSS_CERTS=1",
"-DUSE_OZONE=1",
"-DFULL_SAFE_BROWSING",
"-DSAFE_BROWSING_CSD",
"-DSAFE_BROWSING_DB_LOCAL",
"-DCHROMIUM_BUILD",
"-DFIELDTRIAL_TESTING_ENABLED",
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE_SOURCE",
"-D_LARGEFILE64_SOURCE",
"-DCR_CLANG_REVISION=\"313786-1\"",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
"-DCOMPONENT_BUILD",
"-DOS_CHROMEOS",
"-DNDEBUG",
"-DNVALGRIND",
"-DDYNAMIC_ANNOTATIONS_ENABLED=0",
"-DGL_GLEXT_PROTOTYPES",
"-DUSE_GLX",
"-DUSE_EGL",
"-DANGLE_ENABLE_RELEASE_ASSERTS",
"-DTOOLKIT_VIEWS=1",
"-DGTEST_API_=",
"-DGTEST_HAS_POSIX_RE=0",
"-DGTEST_LANG_CXX11=1",
"-DUNIT_TEST",
"-DUSING_V8_SHARED",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=uint16_t",
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
"-DHAVE_PTHREAD",
"-DPROTOBUF_USE_DLLS",
"-DBORINGSSL_SHARED_LIBRARY",
"-DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS",
"-DSK_HAS_PNG_LIBRARY",
"-DSK_HAS_WEBP_LIBRARY",
"-DSK_HAS_JPEG_LIBRARY",
"-DSKIA_DLL",
"-DGR_GL_IGNORE_ES3_MSAA=0",
"-DSK_SUPPORT_GPU=1",
"-DMESA_EGL_NO_X11_HEADERS",
"-I../..",
"-Igen",
"-I../../third_party/libwebp/src",
"-I../../third_party/khronos",
"-I../../gpu",
"-I../../third_party/googletest/src/googletest/"
"include",
"-I../../third_party/WebKit",
"-Igen/third_party/WebKit",
"-I../../v8/include",
"-Igen/v8/include",
"-I../../third_party/icu/source/common",
"-I../../third_party/icu/source/i18n",
"-I../../third_party/protobuf/src",
"-Igen/protoc_out",
"-I../../third_party/protobuf/src",
"-I../../third_party/boringssl/src/include",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/include/nss",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/include/nspr",
"-I../../skia/config",
"-I../../skia/ext",
"-I../../third_party/skia/include/c",
"-I../../third_party/skia/include/config",
"-I../../third_party/skia/include/core",
"-I../../third_party/skia/include/effects",
"-I../../third_party/skia/include/encode",
"-I../../third_party/skia/include/gpu",
"-I../../third_party/skia/include/images",
"-I../../third_party/skia/include/lazy",
"-I../../third_party/skia/include/pathops",
"-I../../third_party/skia/include/pdf",
"-I../../third_party/skia/include/pipe",
"-I../../third_party/skia/include/ports",
"-I../../third_party/skia/include/utils",
"-I../../third_party/skia/third_party/vulkan",
"-I../../third_party/skia/include/codec",
"-I../../third_party/skia/src/gpu",
"-I../../third_party/skia/src/sksl",
"-I../../third_party/ced/src",
"-I../../third_party/mesa/src/include",
"-I../../third_party/libwebm/source",
"-Igen",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/include/dbus-1.0",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/lib/x86_64-linux-gnu/dbus-1.0/include",
"-I../../third_party/googletest/custom",
"-I../../third_party/googletest/src/googlemock/"
"include",
"-fno-strict-aliasing",
"-Wno-builtin-macro-redefined",
"-D__DATE__=",
"-D__TIME__=",
"-D__TIMESTAMP__=",
"-funwind-tables",
"-fPIC",
"-pipe",
"-B../../third_party/binutils/Linux_x64/Release/bin",
"-pthread",
"-fcolor-diagnostics",
"-no-canonical-prefixes",
"-m64",
"-march=x86-64",
"-Wall",
"-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-c++11-narrowing",
"-Wno-covered-switch-default",
"-Wno-unneeded-internal-declaration",
"-Wno-inconsistent-missing-override",
"-Wno-undefined-var-template",
"-Wno-nonportable-include-path",
"-Wno-address-of-packed-member",
"-Wno-unused-lambda-capture",
"-Wno-user-defined-warnings",
"-Wno-enum-compare-switch",
"-Wno-tautological-unsigned-zero-compare",
"-Wno-null-pointer-arithmetic",
"-Wno-tautological-unsigned-enum-zero-compare",
"-O2",
"-fno-ident",
"-fdata-sections",
"-ffunction-sections",
"-fno-omit-frame-pointer",
"-g0",
"-fvisibility=hidden",
"-Wheader-hygiene",
"-Wstring-conversion",
"-Wtautological-overlap-compare",
"-Wno-header-guard",
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem../../buildtools/third_party/libc++/"
"trunk/"
"include",
"-isystem../../buildtools/third_party/libc++abi/"
"trunk/"
"include",
"--sysroot=&/w/c/s/out/Release/../../build/linux/"
"debian_jessie_amd64-sysroot",
"-fno-exceptions",
"-fvisibility-inlines-hidden",
"&/w/c/s/out/Release/../../ash/login/ui/"
"lock_screen_sanity_unittest.cc",
"-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option",
"-fparse-all-comments"});
}
// Checks flag parsing for an example chromium file.
TEST_CASE("chromium") {
CheckFlags(
"/w/c/s/out/Release", "../../apps/app_lifetime_monitor.cc",
/* raw */
{"/work/goma/gomacc",
"../../third_party/llvm-build/Release+Asserts/bin/clang++",
"-MMD",
"-MF",
"obj/apps/apps/app_lifetime_monitor.o.d",
"-DV8_DEPRECATION_WARNINGS",
"-DDCHECK_ALWAYS_ON=1",
"-DUSE_UDEV",
"-DUSE_ASH=1",
"-DUSE_AURA=1",
"-DUSE_NSS_CERTS=1",
"-DUSE_OZONE=1",
"-DDISABLE_NACL",
"-DFULL_SAFE_BROWSING",
"-DSAFE_BROWSING_CSD",
"-DSAFE_BROWSING_DB_LOCAL",
"-DCHROMIUM_BUILD",
"-DFIELDTRIAL_TESTING_ENABLED",
"-DCR_CLANG_REVISION=\"310694-1\"",
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE_SOURCE",
"-D_LARGEFILE64_SOURCE",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
"-DCOMPONENT_BUILD",
"-DOS_CHROMEOS",
"-DNDEBUG",
"-DNVALGRIND",
"-DDYNAMIC_ANNOTATIONS_ENABLED=0",
"-DGL_GLEXT_PROTOTYPES",
"-DUSE_GLX",
"-DUSE_EGL",
"-DANGLE_ENABLE_RELEASE_ASSERTS",
"-DTOOLKIT_VIEWS=1",
"-DV8_USE_EXTERNAL_STARTUP_DATA",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=uint16_t",
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
"-DHAVE_PTHREAD",
"-DPROTOBUF_USE_DLLS",
"-DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS",
"-DSK_HAS_PNG_LIBRARY",
"-DSK_HAS_WEBP_LIBRARY",
"-DSK_HAS_JPEG_LIBRARY",
"-DSKIA_DLL",
"-DGR_GL_IGNORE_ES3_MSAA=0",
"-DSK_SUPPORT_GPU=1",
"-DMESA_EGL_NO_X11_HEADERS",
"-DBORINGSSL_SHARED_LIBRARY",
"-DUSING_V8_SHARED",
"-I../..",
"-Igen",
"-I../../third_party/libwebp/src",
"-I../../third_party/khronos",
"-I../../gpu",
"-I../../third_party/ced/src",
"-I../../third_party/icu/source/common",
"-I../../third_party/icu/source/i18n",
"-I../../third_party/protobuf/src",
"-I../../skia/config",
"-I../../skia/ext",
"-I../../third_party/skia/include/c",
"-I../../third_party/skia/include/config",
"-I../../third_party/skia/include/core",
"-I../../third_party/skia/include/effects",
"-I../../third_party/skia/include/encode",
"-I../../third_party/skia/include/gpu",
"-I../../third_party/skia/include/images",
"-I../../third_party/skia/include/lazy",
"-I../../third_party/skia/include/pathops",
"-I../../third_party/skia/include/pdf",
"-I../../third_party/skia/include/pipe",
"-I../../third_party/skia/include/ports",
"-I../../third_party/skia/include/utils",
"-I../../third_party/skia/third_party/vulkan",
"-I../../third_party/skia/src/gpu",
"-I../../third_party/skia/src/sksl",
"-I../../third_party/mesa/src/include",
"-I../../third_party/libwebm/source",
"-I../../third_party/protobuf/src",
"-Igen/protoc_out",
"-I../../third_party/boringssl/src/include",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nss",
"-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nspr",
"-Igen",
"-I../../third_party/WebKit",
"-Igen/third_party/WebKit",
"-I../../v8/include",
"-Igen/v8/include",
"-Igen",
"-I../../third_party/flatbuffers/src/include",
"-Igen",
"-fno-strict-aliasing",
"-Wno-builtin-macro-redefined",
"-D__DATE__=",
"-D__TIME__=",
"-D__TIMESTAMP__=",
"-funwind-tables",
"-fPIC",
"-pipe",
"-B../../third_party/binutils/Linux_x64/Release/bin",
"-pthread",
"-fcolor-diagnostics",
"-m64",
"-march=x86-64",
"-Wall",
"-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-c++11-narrowing",
"-Wno-covered-switch-default",
"-Wno-unneeded-internal-declaration",
"-Wno-inconsistent-missing-override",
"-Wno-undefined-var-template",
"-Wno-nonportable-include-path",
"-Wno-address-of-packed-member",
"-Wno-unused-lambda-capture",
"-Wno-user-defined-warnings",
"-Wno-enum-compare-switch",
"-O2",
"-fno-ident",
"-fdata-sections",
"-ffunction-sections",
"-fno-omit-frame-pointer",
"-g0",
"-fvisibility=hidden",
"-Xclang",
"-load",
"-Xclang",
"../../third_party/llvm-build/Release+Asserts/lib/"
"libFindBadConstructs.so",
"-Xclang",
"-add-plugin",
"-Xclang",
"find-bad-constructs",
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"check-auto-raw-pointer",
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"check-ipc",
"-Wheader-hygiene",
"-Wstring-conversion",
"-Wtautological-overlap-compare",
"-Wexit-time-destructors",
"-Wno-header-guard",
"-Wno-exit-time-destructors",
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem../../buildtools/third_party/libc++/trunk/include",
"-isystem../../buildtools/third_party/libc++abi/trunk/include",
"--sysroot=../../build/linux/debian_jessie_amd64-sysroot",
"-fno-exceptions",
"-fvisibility-inlines-hidden",
"../../apps/app_lifetime_monitor.cc"},
/* expected */
{"../../third_party/llvm-build/Release+Asserts/bin/clang++",
"-working-directory=/w/c/s/out/Release",
"-DV8_DEPRECATION_WARNINGS",
"-DDCHECK_ALWAYS_ON=1",
"-DUSE_UDEV",
"-DUSE_ASH=1",
"-DUSE_AURA=1",
"-DUSE_NSS_CERTS=1",
"-DUSE_OZONE=1",
"-DDISABLE_NACL",
"-DFULL_SAFE_BROWSING",
"-DSAFE_BROWSING_CSD",
"-DSAFE_BROWSING_DB_LOCAL",
"-DCHROMIUM_BUILD",
"-DFIELDTRIAL_TESTING_ENABLED",
"-DCR_CLANG_REVISION=\"310694-1\"",
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE_SOURCE",
"-D_LARGEFILE64_SOURCE",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
"-DCOMPONENT_BUILD",
"-DOS_CHROMEOS",
"-DNDEBUG",
"-DNVALGRIND",
"-DDYNAMIC_ANNOTATIONS_ENABLED=0",
"-DGL_GLEXT_PROTOTYPES",
"-DUSE_GLX",
"-DUSE_EGL",
"-DANGLE_ENABLE_RELEASE_ASSERTS",
"-DTOOLKIT_VIEWS=1",
"-DV8_USE_EXTERNAL_STARTUP_DATA",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=uint16_t",
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
"-DHAVE_PTHREAD",
"-DPROTOBUF_USE_DLLS",
"-DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS",
"-DSK_HAS_PNG_LIBRARY",
"-DSK_HAS_WEBP_LIBRARY",
"-DSK_HAS_JPEG_LIBRARY",
"-DSKIA_DLL",
"-DGR_GL_IGNORE_ES3_MSAA=0",
"-DSK_SUPPORT_GPU=1",
"-DMESA_EGL_NO_X11_HEADERS",
"-DBORINGSSL_SHARED_LIBRARY",
"-DUSING_V8_SHARED",
"-I../..",
"-Igen",
"-I../../third_party/libwebp/src",
"-I../../third_party/khronos",
"-I../../gpu",
"-I../../third_party/ced/src",
"-I../../third_party/icu/source/common",
"-I../../third_party/icu/source/i18n",
"-I../../third_party/protobuf/src",
"-I../../skia/config",
"-I../../skia/ext",
"-I../../third_party/skia/include/c",
"-I../../third_party/skia/include/config",
"-I../../third_party/skia/include/core",
"-I../../third_party/skia/include/effects",
"-I../../third_party/skia/include/encode",
"-I../../third_party/skia/include/gpu",
"-I../../third_party/skia/include/images",
"-I../../third_party/skia/include/lazy",
"-I../../third_party/skia/include/pathops",
"-I../../third_party/skia/include/pdf",
"-I../../third_party/skia/include/pipe",
"-I../../third_party/skia/include/ports",
"-I../../third_party/skia/include/utils",
"-I../../third_party/skia/third_party/vulkan",
"-I../../third_party/skia/src/gpu",
"-I../../third_party/skia/src/sksl",
"-I../../third_party/mesa/src/include",
"-I../../third_party/libwebm/source",
"-I../../third_party/protobuf/src",
"-Igen/protoc_out",
"-I../../third_party/boringssl/src/include",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/include/nss",
"-I../../build/linux/debian_jessie_amd64-sysroot/"
"usr/include/nspr",
"-Igen",
"-I../../third_party/WebKit",
"-Igen/third_party/WebKit",
"-I../../v8/include",
"-Igen/v8/include",
"-Igen",
"-I../../third_party/flatbuffers/src/include",
"-Igen",
"-fno-strict-aliasing",
"-Wno-builtin-macro-redefined",
"-D__DATE__=",
"-D__TIME__=",
"-D__TIMESTAMP__=",
"-funwind-tables",
"-fPIC",
"-pipe",
"-B../../third_party/binutils/Linux_x64/Release/bin",
"-pthread",
"-fcolor-diagnostics",
"-m64",
"-march=x86-64",
"-Wall",
"-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-c++11-narrowing",
"-Wno-covered-switch-default",
"-Wno-unneeded-internal-declaration",
"-Wno-inconsistent-missing-override",
"-Wno-undefined-var-template",
"-Wno-nonportable-include-path",
"-Wno-address-of-packed-member",
"-Wno-unused-lambda-capture",
"-Wno-user-defined-warnings",
"-Wno-enum-compare-switch",
"-O2",
"-fno-ident",
"-fdata-sections",
"-ffunction-sections",
"-fno-omit-frame-pointer",
"-g0",
"-fvisibility=hidden",
"-Wheader-hygiene",
"-Wstring-conversion",
"-Wtautological-overlap-compare",
"-Wexit-time-destructors",
"-Wno-header-guard",
"-Wno-exit-time-destructors",
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem../../buildtools/third_party/libc++/"
"trunk/"
"include",
"-isystem../../buildtools/third_party/libc++abi/"
"trunk/"
"include",
"--sysroot=&/w/c/s/out/Release/../../build/linux/"
"debian_jessie_amd64-sysroot",
"-fno-exceptions",
"-fvisibility-inlines-hidden",
"&/w/c/s/out/Release/../../apps/app_lifetime_monitor.cc",
"-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option",
"-fparse-all-comments"});
}
TEST_CASE("Directory extraction") {
Config init_opts;
ProjectConfig config;

View File

@ -37,8 +37,7 @@ std::string ToString(const rapidjson::Document& document) {
buffer.Clear();
document.Accept(writer);
std::string output = buffer.GetString();
return UpdateToRnNewlines(output);
return buffer.GetString();
}
void ParseTestExpectation(

View File

@ -1,6 +1,6 @@
#include "type_printer.h"
#include <string>
#include "loguru.hpp"
#include <loguru.hpp>
namespace {
@ -38,7 +38,7 @@ std::string GetFunctionSignature(IndexFile* db,
NamespaceHelper* ns,
const CXIdxDeclInfo* decl) {
int num_args = clang_Cursor_getNumArguments(decl->cursor);
std::string function_name =
std::pair<std::string, int> function_name =
ns->QualifiedName(decl->semanticContainer, decl->entityInfo->name);
std::vector<std::pair<int, std::string>> args;
@ -76,7 +76,7 @@ std::string GetFunctionSignature(IndexFile* db,
// Second pass: insert argument names before each comma and closing paren.
int i = function_name_offset;
std::string type_desc_with_names(type_desc.begin(), type_desc.begin() + i);
type_desc_with_names.append(function_name);
type_desc_with_names.append(function_name.first);
for (auto& arg : args) {
if (arg.first < 0) {
LOG_S(ERROR)
@ -99,7 +99,7 @@ std::string GetFunctionSignature(IndexFile* db,
} else {
// type_desc is either a typedef, or some complicated type we cannot handle.
// Append the function_name in this case.
ConcatTypeAndName(type_desc, function_name);
ConcatTypeAndName(type_desc, function_name.first);
}
return type_desc;

View File

@ -430,40 +430,6 @@ std::string GetDefaultResourceDirectory() {
return NormalizePath(result);
}
std::string UpdateToRnNewlines(std::string output) {
size_t idx = 0;
while (true) {
idx = output.find('\n', idx);
// No more matches.
if (idx == std::string::npos)
break;
// Skip an existing "\r\n" match.
if (idx > 0 && output[idx - 1] == '\r') {
++idx;
continue;
}
// Replace "\n" with "\r|n".
output.replace(output.begin() + idx, output.begin() + idx + 1, "\r\n");
}
return output;
};
TEST_SUITE("Update \\n to \\r\\n") {
TEST_CASE("all") {
REQUIRE(UpdateToRnNewlines("\n") == "\r\n");
REQUIRE(UpdateToRnNewlines("\n\n") == "\r\n\r\n");
REQUIRE(UpdateToRnNewlines("\r\n\n") == "\r\n\r\n");
REQUIRE(UpdateToRnNewlines("\n\r\n") == "\r\n\r\n");
REQUIRE(UpdateToRnNewlines("\r\n\r\n") == "\r\n\r\n");
REQUIRE(UpdateToRnNewlines("f1\nfo2\nfoo3") == "f1\r\nfo2\r\nfoo3");
REQUIRE(UpdateToRnNewlines("f1\r\nfo2\r\nfoo3") == "f1\r\nfo2\r\nfoo3");
}
}
TEST_SUITE("StripFileType") {
TEST_CASE("all") {
REQUIRE(StripFileType("") == "");