[llvm-bugs] [Bug 38155] New: Missing includes inhibits getting correct inheritance information.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 12 14:50:41 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38155
Bug ID: 38155
Summary: Missing includes inhibits getting correct inheritance
information.
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: libclang
Assignee: unassignedclangbugs at nondot.org
Reporter: 6yearold at gmail.com
CC: klimek at google.com, llvm-bugs at lists.llvm.org
When running
# c-index-test -index-file test.cpp
on this file:
#include "missing1.h"
template<class T>
class A
{
T a;
};
//#include "missing2.h"
class B : public A<int>
{
};
I get the following output:
[startedTranslationUnit]
[enteredMainFile]: /home/arr/test.cpp
[ppIncludedFile]: (null) | name: "missing1.h" | hash loc: 1:1 | isImport: 0 |
isAngled: 0 | isModule: 0
[indexDeclaration]: kind: c++-class-template | name: A | USR: c:@ST>1#T at A |
lang: C++ | cursor: ClassDecl=A:4:7 (Definition) | loc: 4:7 |
semantic-container: [TU] | lexical-container: [TU] | isRedecl: 0 | isDef: 1 |
isContainer: 1 | isImplicit: 0
[indexDeclaration]: kind: field | name: a | USR: c:@ST>1#T at A@FI at a | lang: C++ |
cursor: FieldDecl=a:6:7 (Definition) | loc: 6:7 | semantic-container: [A:4:7] |
lexical-container: [A:4:7] | isRedecl: 0 | isDef: 1 | isContainer: 0 |
isImplicit: 0
[indexDeclaration]: kind: c++-class | name: B | USR: c:@S at B | lang: C++ |
cursor: ClassDecl=B:11:7 (Definition) | loc: 11:7 | semantic-container: [TU] |
lexical-container: [TU] | isRedecl: 0 | isDef: 1 | isContainer: 1 | isImplicit:
0
<base>: kind: c++-class-template | name: A | USR: c:@ST>1#T at A | lang: C++
| cursor: C++ base class specifier=A<int>:4:7 [access=public isVirtual=false] |
loc: 11:11
[indexEntityReference]: kind: c++-class-template | name: A | USR: c:@ST>1#T at A |
lang: C++ | cursor: TemplateRef=A:4:7 | loc: 11:18 | <parent>:: kind: c++-class
| name: B | USR: c:@S at B | lang: C++ | container: [B:11:7] | refkind: direct
[diagnostic]: /home/arr/test.cpp:1:10: fatal error: 'missing1.h' file not found
However, if I uncomment #include "missing2.h" line, the output changes to
[startedTranslationUnit]
[enteredMainFile]: /home/arr/test.cpp
[ppIncludedFile]: (null) | name: "missing1.h" | hash loc: 1:1 | isImport: 0 |
isAngled: 0 | isModule: 0
[ppIncludedFile]: (null) | name: "missing2.h" | hash loc: 9:1 | isImport: 0 |
isAngled: 0 | isModule: 0
[indexDeclaration]: kind: c++-class-template | name: A | USR: c:@ST>1#T at A |
lang: C++ | cursor: ClassDecl=A:4:7 (Definition) | loc: 4:7 |
semantic-container: [TU] | lexical-container: [TU] | isRedecl: 0 | isDef: 1 |
isContainer: 1 | isImplicit: 0
[indexDeclaration]: kind: field | name: a | USR: c:@ST>1#T at A@FI at a | lang: C++ |
cursor: FieldDecl=a:6:7 (Definition) | loc: 6:7 | semantic-container: [A:4:7] |
lexical-container: [A:4:7] | isRedecl: 0 | isDef: 1 | isContainer: 0 |
isImplicit: 0
[indexDeclaration]: kind: c++-class | name: B | USR: c:@S at B | lang: C++ |
cursor: ClassDecl=B:11:7 (Definition) | loc: 11:7 | semantic-container: [TU] |
lexical-container: [TU] | isRedecl: 0 | isDef: 1 | isContainer: 1 | isImplicit:
0
[diagnostic]: /home/arr/test.cpp:1:10: fatal error: 'missing1.h' file not found
The difference between outputs is
- <base>: kind: c++-class-template | name: A | USR: c:@ST>1#T at A | lang: C++
| cursor: C++ base class specifier=A<int>:4:7 [access=public isVirtual=false] |
loc: 11:11
-[indexEntityReference]: kind: c++-class-template | name: A | USR: c:@ST>1#T at A
| lang: C++ | cursor: TemplateRef=A:4:7 | loc: 11:18 | <parent>:: kind:
c++-class | name: B | USR: c:@S at B | lang: C++ | container: [B:11:7] | refkind:
direct
This prevents getting correct information about class B when using libclang
from KDevelop.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180712/726b49f2/attachment.html>
More information about the llvm-bugs
mailing list