forked from OSchip/llvm-project
[index] Index system ImportDecls even when there is a DeclarationsOnly filter
Whether we call an ImportDecl a decl or a reference symbol role is somewhat academic, but in practice it's more like a declaration because it is interesting even to consumers who wouldn't care about references. Most importantly, we want to report the module dependencies of system modules even when we have declaration-only filtering. rdar://problem/27134855 llvm-svn: 275454
This commit is contained in:
parent
c837af306e
commit
6aed6b4f01
|
@ -83,14 +83,14 @@ bool IndexingContext::importedModule(const ImportDecl *ImportD) {
|
|||
if (SEntry.getFile().getFileCharacteristic() != SrcMgr::C_User) {
|
||||
switch (IndexOpts.SystemSymbolFilter) {
|
||||
case IndexingOptions::SystemSymbolFilterKind::None:
|
||||
case IndexingOptions::SystemSymbolFilterKind::DeclarationsOnly:
|
||||
return true;
|
||||
case IndexingOptions::SystemSymbolFilterKind::DeclarationsOnly:
|
||||
case IndexingOptions::SystemSymbolFilterKind::All:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SymbolRoleSet Roles = (unsigned)SymbolRole::Reference;
|
||||
SymbolRoleSet Roles = (unsigned)SymbolRole::Declaration;
|
||||
if (ImportD->isImplicit())
|
||||
Roles |= (unsigned)SymbolRole::Implicit;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// RUN: rm -rf %t.mcp
|
||||
// RUN: c-index-test core -print-source-symbols -- %s -I %S/Inputs/module -fmodules -fmodules-cache-path=%t.mcp | FileCheck %s
|
||||
|
||||
// CHECK: [[@LINE+1]]:9 | module/C | ModA | Ref |
|
||||
// CHECK: [[@LINE+1]]:9 | module/C | ModA | Decl |
|
||||
@import ModA;
|
||||
// CHECK: [[@LINE+1]]:1 | module/C | ModA | Ref,Impl |
|
||||
// CHECK: [[@LINE+1]]:1 | module/C | ModA | Decl,Impl |
|
||||
#include "ModA.h"
|
||||
|
||||
void foo() {
|
||||
// CHECK: [[@LINE+1]]:3 | function/C | ModA_func | c:@F@ModA_func | {{.*}} | Ref,Call,RelCall | rel: 1
|
||||
ModA_func();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ int glob;
|
|||
// RUN: rm -rf %t.cache
|
||||
// RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \
|
||||
// RUN: -Xclang -fdisable-module-hash | FileCheck %s
|
||||
// RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache.sys -fmodules -iframework %S/../Modules/Inputs \
|
||||
// RUN: -Xclang -fdisable-module-hash | FileCheck %s
|
||||
// RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -gmodules -F %S/../Modules/Inputs \
|
||||
// RUN: -Xclang -fdisable-module-hash | FileCheck %s
|
||||
|
||||
|
@ -18,6 +20,7 @@ int glob;
|
|||
// CHECK-NOT: [indexDeclaration]
|
||||
|
||||
// RUN: c-index-test -index-tu %t.cache/DependsOnModule.pcm | FileCheck %s -check-prefix=CHECK-DMOD
|
||||
// RUN: c-index-test -index-tu %t.cache.sys/DependsOnModule.pcm | FileCheck %s -check-prefix=CHECK-DMOD
|
||||
|
||||
// CHECK-DMOD: [startedTranslationUnit]
|
||||
// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_MODULE_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule
|
||||
|
@ -27,7 +30,8 @@ int glob;
|
|||
// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_H:.*/Modules/Inputs/DependsOnModule\.framework[/\\]Frameworks[/\\]SubFramework\.framework[/\\]Headers[/\\]SubFramework\.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.SubFramework
|
||||
// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_SUB_OTHER_H:.*/Modules/Inputs/DependsOnModule.framework[/\\]Frameworks/SubFramework\.framework/Headers/Other\.h]] | name: "SubFramework/Other.h" | hash loc: [[DMOD_SUB_H]]:1:1 | isImport: 0 | isAngled: 0 | isModule: 0 | module: DependsOnModule.SubFramework.Other
|
||||
// CHECK-DMOD-NEXT: [ppIncludedFile]: [[DMOD_PRIVATE_H:.*/Modules/Inputs/DependsOnModule.framework[/\\]PrivateHeaders[/\\]DependsOnModulePrivate.h]] | {{.*}} | hash loc: <invalid> | {{.*}} | module: DependsOnModule.Private.DependsOnModule
|
||||
// CHECK-DMOD-NEXT: [importedASTFile]: {{.*}}.cache{{[/\\]}}Module.pcm | loc: [[DMOD_MODULE_H]]:1:1 | name: "Module" | isImplicit: 1
|
||||
// CHECK-DMOD-NEXT: [importedASTFile]: {{.*}}.cache{{(.sys)?[/\\]}}Module.pcm | loc: [[DMOD_MODULE_H]]:1:1 | name: "Module" | isImplicit: 1
|
||||
//
|
||||
// CHECK-DMOD-NEXT: [indexDeclaration]: kind: variable | name: depends_on_module_other | {{.*}} | loc: [[DMOD_OTHER_H]]:1:5
|
||||
// CHECK-DMOD-NEXT: [indexDeclaration]: kind: variable | name: template | {{.*}} | loc: [[DMOD_NOT_CXX_H]]:1:12
|
||||
// CHECK-DMOD-NEXT: [indexDeclaration]: kind: variable | name: sub_framework | {{.*}} | loc: [[DMOD_SUB_H]]:2:8
|
||||
|
|
Loading…
Reference in New Issue