mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 16:15:07 +00:00
.ccls: add %objective-c %objective-cpp
Also allow multiple directives on a line, e.g. %c %cpp -DFOO
This commit is contained in:
parent
c2cf488114
commit
2d00b62f63
@ -90,15 +90,24 @@ struct ProjectProcessor {
|
|||||||
args.reserve(entry.args.size() + g_config->clang.extraArgs.size() + 1);
|
args.reserve(entry.args.size() + g_config->clang.extraArgs.size() + 1);
|
||||||
const LanguageId lang = lookupExtension(entry.filename).first;
|
const LanguageId lang = lookupExtension(entry.filename).first;
|
||||||
for (const char *arg : entry.args) {
|
for (const char *arg : entry.args) {
|
||||||
if (strncmp(arg, "%c ", 3) == 0) {
|
StringRef A(arg);
|
||||||
if (lang == LanguageId::C)
|
if (A[0] == '%') {
|
||||||
args.push_back(arg + 3);
|
bool ok = false;
|
||||||
} else if (strncmp(arg, "%cpp ", 5) == 0) {
|
for (;;) {
|
||||||
if (lang == LanguageId::Cpp)
|
if (A.consume_front("%c "))
|
||||||
args.push_back(arg + 5);
|
ok |= lang == LanguageId::C;
|
||||||
} else if (strcmp(arg, "%clang") == 0) {
|
else if (A.consume_front("%cpp "))
|
||||||
args.push_back(lang == LanguageId::Cpp ? "clang++" : "clang");
|
ok |= lang == LanguageId::Cpp;
|
||||||
} else if (!excludeArgs.count(arg)) {
|
else if (A.consume_front("%objective-c "))
|
||||||
|
ok |= lang == LanguageId::ObjC;
|
||||||
|
else if (A.consume_front("%objective-cpp "))
|
||||||
|
ok |= lang == LanguageId::ObjCpp;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ok)
|
||||||
|
args.push_back(A.data());
|
||||||
|
} else if (!excludeArgs.count(A)) {
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user