Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 5540eb1

Browse files
committed
Disable variable PrettyPrint #if CINDEX_VERSION >= 47 and allow trunk libclang in tests
1 parent ff4ff86 commit 5540eb1

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/indexer.cc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,13 @@ struct IndexParam {
309309
print_policy = clang_getCursorPrintingPolicy(cursor);
310310
clang_PrintingPolicy_setProperty(print_policy,
311311
CXPrintingPolicy_TerseOutput, 1);
312+
clang_PrintingPolicy_setProperty(print_policy,
313+
CXPrintingPolicy_FullyQualifiedName, 1);
312314
clang_PrintingPolicy_setProperty(print_policy,
313315
CXPrintingPolicy_SuppressInitializers, 1);
314316
print_policy_more = clang_getCursorPrintingPolicy(cursor);
317+
clang_PrintingPolicy_setProperty(print_policy_more,
318+
CXPrintingPolicy_FullyQualifiedName, 1);
315319
clang_PrintingPolicy_setProperty(print_policy_more,
316320
CXPrintingPolicy_TerseOutput, 1);
317321
}
@@ -566,8 +570,9 @@ void SetVarDetail(IndexVar* var,
566570
def.comments = cursor.get_comments();
567571
def.storage = GetStorageClass(clang_Cursor_getStorageClass(cursor.cx_cursor));
568572

573+
// TODO how to make PrettyPrint'ed variable name qualified?
569574
std::string qualified_name =
570-
#if CINDEX_HAVE_PRETTY
575+
#if 0 && CINDEX_HAVE_PRETTY
571576
cursor.get_kind() != CXCursor_EnumConstantDecl
572577
? param->PrettyPrintCursor(cursor.cx_cursor)
573578
:
@@ -587,9 +592,8 @@ void SetVarDetail(IndexVar* var,
587592
def.detailed_name = std::move(qualified_name);
588593
def.hover = hover;
589594
} else {
590-
#if CINDEX_HAVE_PRETTY
591-
def.detailed_name = param->PrettyPrintCursor(cursor.cx_cursor, false);
592-
def.hover = std::move(qualified_name);
595+
#if 0 && CINDEX_HAVE_PRETTY
596+
//def.detailed_name = param->PrettyPrintCursor(cursor.cx_cursor, false);
593597
#else
594598
ConcatTypeAndName(type_name, qualified_name);
595599
def.detailed_name = type_name;
@@ -1349,7 +1353,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor,
13491353
SetUse(db, &ref_index->def.spell, ref_cursor.get_spelling_range(), parent, Role::Definition);
13501354
SetUse(db, &ref_index->def.extent, ref_cursor.get_extent(), parent, Role::None);
13511355
#if CINDEX_HAVE_PRETTY
1352-
ref_index->def.detailed_name = param->PrettyPrintCursor(cursor.cx_cursor);
1356+
ref_index->def.detailed_name = param->PrettyPrintCursor(ref_cursor.cx_cursor);
13531357
#else
13541358
ref_index->def.detailed_name = ref_cursor.get_spelling();
13551359
#endif
@@ -1377,7 +1381,7 @@ ClangCursor::VisitResult TemplateVisitor(ClangCursor cursor,
13771381
SetUse(db, &ref_index->def.spell, ref_cursor.get_spelling_range(), parent, Role::Definition);
13781382
SetUse(db, &ref_index->def.extent, ref_cursor.get_extent(), parent, Role::None);
13791383
#if CINDEX_HAVE_PRETTY
1380-
ref_index->def.detailed_name = param->PrettyPrintCursor(cursor.cx_cursor);
1384+
ref_index->def.detailed_name = param->PrettyPrintCursor(ref_cursor.cx_cursor);
13811385
#else
13821386
ref_index->def.detailed_name = ref_cursor.get_spelling();
13831387
#endif

src/test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ bool RunIndexTests(const std::string& filter_path, bool enable_update) {
150150
// Index tests change based on the version of clang used.
151151
static constexpr const char* kRequiredClangVersion =
152152
"clang version 5.0.1 (tags/RELEASE_501/final)";
153-
if (GetClangVersion() != kRequiredClangVersion) {
153+
if (GetClangVersion() != kRequiredClangVersion &&
154+
GetClangVersion().find("trunk") == std::string::npos) {
154155
std::cerr << "Index tests must be run using clang version \""
155156
<< kRequiredClangVersion << "\" (cquery is running with \""
156157
<< GetClangVersion() << "\")" << std::endl;

0 commit comments

Comments
 (0)