mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 17:11:59 +00:00
Add --log-file-append
This commit is contained in:
parent
6b167e7773
commit
a1210db985
@ -2002,11 +2002,9 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
case CXIdxEntity_CXXStaticVariable:
|
case CXIdxEntity_CXXStaticVariable:
|
||||||
case CXIdxEntity_Variable:
|
case CXIdxEntity_Variable:
|
||||||
case CXIdxEntity_Field: {
|
case CXIdxEntity_Field: {
|
||||||
ClangCursor ref_cursor(ref->cursor);
|
Range loc = cursor.get_spell();
|
||||||
Range loc = ref_cursor.get_spell();
|
CheckTypeDependentMemberRefExpr(&loc, cursor, param, db);
|
||||||
CheckTypeDependentMemberRefExpr(&loc, ref_cursor, param, db);
|
|
||||||
|
|
||||||
ClangCursor referenced = ref->referencedEntity->cursor;
|
|
||||||
referenced = referenced.template_specialization_to_template_definition();
|
referenced = referenced.template_specialization_to_template_definition();
|
||||||
|
|
||||||
IndexVarId var_id = db->ToVarId(referenced.get_usr_hash());
|
IndexVarId var_id = db->ToVarId(referenced.get_usr_hash());
|
||||||
@ -2054,8 +2052,7 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// TODO: search full history?
|
// TODO: search full history?
|
||||||
ClangCursor ref_cursor(ref->cursor);
|
Range loc = cursor.get_spell();
|
||||||
Range loc = ref_cursor.get_spell();
|
|
||||||
|
|
||||||
IndexFuncId called_id = db->ToFuncId(HashUsr(ref->referencedEntity->USR));
|
IndexFuncId called_id = db->ToFuncId(HashUsr(ref->referencedEntity->USR));
|
||||||
IndexFunc* called = db->Resolve(called_id);
|
IndexFunc* called = db->Resolve(called_id);
|
||||||
@ -2083,9 +2080,9 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
// Type-dependent member access expressions do not have useful spelling
|
// Type-dependent member access expressions do not have useful spelling
|
||||||
// ranges. See the comment above for the CXIdxEntity_Field case.
|
// ranges. See the comment above for the CXIdxEntity_Field case.
|
||||||
if (is_implicit)
|
if (is_implicit)
|
||||||
loc = ref_cursor.get_extent();
|
loc = cursor.get_extent();
|
||||||
else
|
else
|
||||||
CheckTypeDependentMemberRefExpr(&loc, ref_cursor, param, db);
|
CheckTypeDependentMemberRefExpr(&loc, cursor, param, db);
|
||||||
|
|
||||||
OnIndexReference_Function(
|
OnIndexReference_Function(
|
||||||
db, loc, ref->container->cursor, called_id,
|
db, loc, ref->container->cursor, called_id,
|
||||||
@ -2149,25 +2146,9 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
case CXIdxEntity_Union:
|
case CXIdxEntity_Union:
|
||||||
case CXIdxEntity_Struct:
|
case CXIdxEntity_Struct:
|
||||||
case CXIdxEntity_CXXClass: {
|
case CXIdxEntity_CXXClass: {
|
||||||
ClangCursor ref_cursor = ref->referencedEntity->cursor;
|
referenced = referenced.template_specialization_to_template_definition();
|
||||||
ref_cursor = ref_cursor.template_specialization_to_template_definition();
|
|
||||||
IndexType* ref_type =
|
IndexType* ref_type =
|
||||||
db->Resolve(db->ToTypeId(ref_cursor.get_usr_hash()));
|
db->Resolve(db->ToTypeId(referenced.get_usr_hash()));
|
||||||
|
|
||||||
// The following will generate two TypeRefs to Foo, both located at the
|
|
||||||
// same spot (line 3, column 3). One of the parents will be set to
|
|
||||||
// CXIdxEntity_Variable, the other will be CXIdxEntity_Function. There
|
|
||||||
// does not appear to be a good way to disambiguate these references, as
|
|
||||||
// using parent type alone breaks other indexing tasks.
|
|
||||||
//
|
|
||||||
// To work around this, we check to see if the usage location has been
|
|
||||||
// inserted into all_uses previously.
|
|
||||||
//
|
|
||||||
// struct Foo {};
|
|
||||||
// void Make() {
|
|
||||||
// Foo f;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
if (!ref->parentEntity || IsDeclContext(ref->parentEntity->kind))
|
if (!ref->parentEntity || IsDeclContext(ref->parentEntity->kind))
|
||||||
AddUseSpell(db, ref_type->declarations, ref->cursor);
|
AddUseSpell(db, ref_type->declarations, ref->cursor);
|
||||||
else
|
else
|
||||||
|
@ -94,6 +94,7 @@ Other command line options:
|
|||||||
--record <path>
|
--record <path>
|
||||||
Writes stdin to <path>.in and stdout to <path>.out
|
Writes stdin to <path>.in and stdout to <path>.out
|
||||||
--log-file <path> Logging file for diagnostics
|
--log-file <path> Logging file for diagnostics
|
||||||
|
--log-file-append <path> Like --log-file, but appending
|
||||||
--log-all-to-stderr Write all log messages to STDERR.
|
--log-all-to-stderr Write all log messages to STDERR.
|
||||||
--wait-for-input Wait for an '[Enter]' before exiting
|
--wait-for-input Wait for an '[Enter]' before exiting
|
||||||
--help Print this help information.
|
--help Print this help information.
|
||||||
@ -360,8 +361,8 @@ void LaunchStdoutThread(std::unordered_map<IpcId, Timer>* request_times,
|
|||||||
|
|
||||||
RecordOutput(message.content);
|
RecordOutput(message.content);
|
||||||
|
|
||||||
std::cout << message.content;
|
fwrite(message.content.c_str(), message.content.size(), 1, stdout);
|
||||||
std::cout.flush();
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -434,6 +435,10 @@ int main(int argc, char** argv) {
|
|||||||
loguru::add_file(options["--log-file"].c_str(), loguru::Truncate,
|
loguru::add_file(options["--log-file"].c_str(), loguru::Truncate,
|
||||||
loguru::Verbosity_MAX);
|
loguru::Verbosity_MAX);
|
||||||
}
|
}
|
||||||
|
if (HasOption(options, "--log-file-append")) {
|
||||||
|
loguru::add_file(options["--log-file-append"].c_str(), loguru::Append,
|
||||||
|
loguru::Verbosity_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
if (HasOption(options, "--record"))
|
if (HasOption(options, "--record"))
|
||||||
EnableRecording(options["--record"]);
|
EnableRecording(options["--record"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user