[PATCH] D146385: [clang][ExtractAPI] Complete declaration fragments for TagDecl types defined in a typedef
R4444 via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 19 10:52:24 PDT 2023
Ruturaj4 created this revision.
Ruturaj4 added a reviewer: dang.
Herald added a reviewer: ributzka.
Herald added a project: All.
Ruturaj4 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
enums and structs declared inside typedefs have incorrect declaration fragments, where the typedef keyword and other syntax is missing.
For the following struct:
typedef struct Test {
int hello;
} Test;
The produced declaration is:
"declarationFragments": [
{
"kind": "keyword",
"spelling": "struct"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "Test"
}
],
instead the declaration fragments should represent the following
typedef struct Test {
…
} Test;
This patch removes the condition in SymbolGraphSerializer.cpp file and completes declaration fragments
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146385
Files:
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
Index: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
===================================================================
--- clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -801,11 +801,7 @@
const TypedefRecord &Record) {
// Typedefs of anonymous types have their entries unified with the underlying
// type.
- bool ShouldDrop = Record.UnderlyingType.Name.empty();
- // enums declared with `NS_OPTION` have a named enum and a named typedef, with
- // the same name
- ShouldDrop |= (Record.UnderlyingType.Name == Record.Name);
- if (ShouldDrop)
+ if (Record.UnderlyingType.Name.empty())
return;
auto Typedef = serializeAPIRecord(Record);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146385.506407.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230319/1899bc44/attachment-0001.bin>
More information about the cfe-commits
mailing list