Skip to content

Commit 39dbfa7

Browse files
Revert "Only add targetFallback if target is not in defined in current product"
This was an accidental addition of a non-reviewed change. This reverts commit f63db91.
1 parent f63db91 commit 39dbfa7

File tree

11 files changed

+75
-80
lines changed

11 files changed

+75
-80
lines changed

clang/include/clang/ExtractAPI/API.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,6 @@ class APISet {
675675
const RecordMap<MacroDefinitionRecord> &getMacros() const { return Macros; }
676676
const RecordMap<TypedefRecord> &getTypedefs() const { return Typedefs; }
677677

678-
/// Get the APIRecord associated with the USR if it's defined in the
679-
/// current product.
680-
///
681-
/// \returns a APIRecord pointer to the stored symbol record if it exists.
682-
APIRecord *getSymbolForUSR(StringRef USR) const;
683-
684678
/// Generate and store the USR of declaration \p D.
685679
///
686680
/// Note: The USR string is stored in and owned by Allocator.

clang/lib/ExtractAPI/API.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -197,39 +197,6 @@ TypedefRecord *APISet::addTypedef(StringRef Name, StringRef USR,
197197
Comment, Declaration, SubHeading, UnderlyingType);
198198
}
199199

200-
template <class RecordMap>
201-
static APIRecord *getSymbolInRecordMapForUSR(StringRef USR,
202-
const RecordMap &Records) {
203-
auto It = Records.find(USR);
204-
return (It != Records.end() ? It->second.get() : nullptr);
205-
}
206-
207-
APIRecord *APISet::getSymbolForUSR(StringRef USR) const {
208-
if (USR.empty())
209-
return nullptr;
210-
if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCProtocols))
211-
return Record;
212-
if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCInterfaces))
213-
return Record;
214-
if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCCategories))
215-
return Record;
216-
if (auto *Record = getSymbolInRecordMapForUSR(USR, ObjCCategories))
217-
return Record;
218-
if (auto *Record = getSymbolInRecordMapForUSR(USR, Structs))
219-
return Record;
220-
if (auto *Record = getSymbolInRecordMapForUSR(USR, Enums))
221-
return Record;
222-
if (auto *Record = getSymbolInRecordMapForUSR(USR, Typedefs))
223-
return Record;
224-
if (auto *Record = getSymbolInRecordMapForUSR(USR, GlobalFunctions))
225-
return Record;
226-
if (auto *Record = getSymbolInRecordMapForUSR(USR, GlobalVariables))
227-
return Record;
228-
if (auto *Record = getSymbolInRecordMapForUSR(USR, Macros))
229-
return Record;
230-
return nullptr;
231-
}
232-
233200
StringRef APISet::recordUSR(const Decl *D) {
234201
SmallString<128> USR;
235202
index::generateUSRForDecl(D, USR);

clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,7 @@ void SymbolGraphSerializer::serializeRelationship(RelationshipKind Kind,
559559
Object Relationship;
560560
Relationship["source"] = Source.USR;
561561
Relationship["target"] = Target.USR;
562-
// Emit a fallback if the target is not a symbol that will be part of this
563-
// symbol graph.
564-
if (API.getSymbolForUSR(Target.USR) == nullptr)
565-
Relationship["targetFallback"] = Target.Name;
562+
Relationship["targetFallback"] = Target.Name;
566563
Relationship["kind"] = getRelationshipString(Kind);
567564

568565
Relationships.emplace_back(std::move(Relationship));

clang/test/ExtractAPI/anonymous_record_no_typedef.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,26 @@ struct Vehicle {
5656
{
5757
"kind": "memberOf",
5858
"source": "c:@S@Vehicle@E@input.h@64@Bicycle",
59-
"target": "c:@S@Vehicle@[email protected]@64"
59+
"target": "c:@S@Vehicle@[email protected]@64",
60+
"targetFallback": "Vehicle::enum (unnamed)"
6061
},
6162
{
6263
"kind": "memberOf",
6364
"source": "c:@S@Vehicle@E@input.h@64@Car",
64-
"target": "c:@S@Vehicle@E@input.h@64"
65+
"target": "c:@S@Vehicle@E@input.h@64",
66+
"targetFallback": "Vehicle::enum (unnamed)"
6567
},
6668
{
6769
"kind": "memberOf",
6870
"source": "c:@S@Vehicle@FI@type",
69-
"target": "c:@S@Vehicle"
71+
"target": "c:@S@Vehicle",
72+
"targetFallback": "Vehicle"
7073
},
7174
{
7275
"kind": "memberOf",
7376
"source": "c:@S@Vehicle@FI@information",
74-
"target": "c:@S@Vehicle"
77+
"target": "c:@S@Vehicle",
78+
"targetFallback": "Vehicle"
7579
}
7680
],
7781
"symbols": [

clang/test/ExtractAPI/enum.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,57 +65,68 @@ enum {
6565
{
6666
"kind": "memberOf",
6767
"source": "c:@E@Vehicle@Bicycle",
68-
"target": "c:@E@Vehicle"
68+
"target": "c:@E@Vehicle",
69+
"targetFallback": "Vehicle"
6970
},
7071
{
7172
"kind": "memberOf",
7273
"source": "c:@E@Vehicle@Car",
73-
"target": "c:@E@Vehicle"
74+
"target": "c:@E@Vehicle",
75+
"targetFallback": "Vehicle"
7476
},
7577
{
7678
"kind": "memberOf",
7779
"source": "c:@E@Vehicle@Train",
78-
"target": "c:@E@Vehicle"
80+
"target": "c:@E@Vehicle",
81+
"targetFallback": "Vehicle"
7982
},
8083
{
8184
"kind": "memberOf",
8285
"source": "c:@E@Vehicle@Ship",
83-
"target": "c:@E@Vehicle"
86+
"target": "c:@E@Vehicle",
87+
"targetFallback": "Vehicle"
8488
},
8589
{
8690
"kind": "memberOf",
8791
"source": "c:@E@Vehicle@Airplane",
88-
"target": "c:@E@Vehicle"
92+
"target": "c:@E@Vehicle",
93+
"targetFallback": "Vehicle"
8994
},
9095
{
9196
"kind": "memberOf",
9297
"source": "c:@E@Direction@North",
93-
"target": "c:@E@Direction"
98+
"target": "c:@E@Direction",
99+
"targetFallback": "Direction"
94100
},
95101
{
96102
"kind": "memberOf",
97103
"source": "c:@E@Direction@East",
98-
"target": "c:@E@Direction"
104+
"target": "c:@E@Direction",
105+
"targetFallback": "Direction"
99106
},
100107
{
101108
"kind": "memberOf",
102109
"source": "c:@E@Direction@South",
103-
"target": "c:@E@Direction"
110+
"target": "c:@E@Direction",
111+
"targetFallback": "Direction"
104112
},
105113
{
106114
"kind": "memberOf",
107115
"source": "c:@E@Direction@West",
108-
"target": "c:@E@Direction"
116+
"target": "c:@E@Direction",
117+
"targetFallback": "Direction"
109118
},
110119
{
111120
"kind": "memberOf",
112121
"source": "c:@Ea@Constant@Constant",
113-
"target": "c:@Ea@Constant"
122+
"target": "c:@Ea@Constant",
123+
"targetFallback": "enum (unnamed)"
114124
},
115125
{
116126
"kind": "memberOf",
117127
"source": "c:@Ea@OtherConstant@OtherConstant",
118-
"target": "c:@Ea@OtherConstant"
128+
"target": "c:@Ea@OtherConstant",
129+
"targetFallback": "enum (unnamed)"
119130
}
120131
],
121132
"symbols": [

clang/test/ExtractAPI/objc_category.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,20 @@ + (void)ClassMethod;
5454
{
5555
"kind": "memberOf",
5656
"source": "c:objc(cs)Interface(im)InstanceMethod",
57-
"target": "c:objc(cs)Interface"
57+
"target": "c:objc(cs)Interface",
58+
"targetFallback": "Interface"
5859
},
5960
{
6061
"kind": "memberOf",
6162
"source": "c:objc(cs)Interface(cm)ClassMethod",
62-
"target": "c:objc(cs)Interface"
63+
"target": "c:objc(cs)Interface",
64+
"targetFallback": "Interface"
6365
},
6466
{
6567
"kind": "memberOf",
6668
"source": "c:objc(cs)Interface(py)Property",
67-
"target": "c:objc(cs)Interface"
69+
"target": "c:objc(cs)Interface",
70+
"targetFallback": "Interface"
6871
},
6972
{
7073
"kind": "conformsTo",

clang/test/ExtractAPI/objc_interface.m

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,20 @@ - (char)getIvar;
5757
{
5858
"kind": "memberOf",
5959
"source": "c:objc(cs)Super(cm)getWithProperty:",
60-
"target": "c:objc(cs)Super"
60+
"target": "c:objc(cs)Super",
61+
"targetFallback": "Super"
6162
},
6263
{
6364
"kind": "memberOf",
6465
"source": "c:objc(cs)Super(im)setProperty:andOtherThing:",
65-
"target": "c:objc(cs)Super"
66+
"target": "c:objc(cs)Super",
67+
"targetFallback": "Super"
6668
},
6769
{
6870
"kind": "memberOf",
6971
"source": "c:objc(cs)Super(py)Property",
70-
"target": "c:objc(cs)Super"
72+
"target": "c:objc(cs)Super",
73+
"targetFallback": "Super"
7174
},
7275
{
7376
"kind": "conformsTo",
@@ -78,17 +81,20 @@ - (char)getIvar;
7881
{
7982
"kind": "memberOf",
8083
"source": "c:objc(cs)Derived@Ivar",
81-
"target": "c:objc(cs)Derived"
84+
"target": "c:objc(cs)Derived",
85+
"targetFallback": "Derived"
8286
},
8387
{
8488
"kind": "memberOf",
8589
"source": "c:objc(cs)Derived(im)getIvar",
86-
"target": "c:objc(cs)Derived"
90+
"target": "c:objc(cs)Derived",
91+
"targetFallback": "Derived"
8792
},
8893
{
8994
"kind": "inheritsFrom",
9095
"source": "c:objc(cs)Derived",
91-
"target": "c:objc(cs)Super"
96+
"target": "c:objc(cs)Super",
97+
"targetFallback": "Super"
9298
}
9399
],
94100
"symbols": [

clang/test/ExtractAPI/objc_property.m

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,37 +55,44 @@ @interface Interface (Category) <Protocol>
5555
{
5656
"kind": "memberOf",
5757
"source": "c:objc(cs)Interface(cpy)myInterfaceTypeProp",
58-
"target": "c:objc(cs)Interface"
58+
"target": "c:objc(cs)Interface",
59+
"targetFallback": "Interface"
5960
},
6061
{
6162
"kind": "memberOf",
6263
"source": "c:objc(cs)Interface(py)myInterfaceInstanceProp",
63-
"target": "c:objc(cs)Interface"
64+
"target": "c:objc(cs)Interface",
65+
"targetFallback": "Interface"
6466
},
6567
{
6668
"kind": "memberOf",
6769
"source": "c:objc(cs)Interface(cpy)myCategoryTypeProp",
68-
"target": "c:objc(cs)Interface"
70+
"target": "c:objc(cs)Interface",
71+
"targetFallback": "Interface"
6972
},
7073
{
7174
"kind": "memberOf",
7275
"source": "c:objc(cs)Interface(py)myCategoryInstanceProp",
73-
"target": "c:objc(cs)Interface"
76+
"target": "c:objc(cs)Interface",
77+
"targetFallback": "Interface"
7478
},
7579
{
7680
"kind": "conformsTo",
7781
"source": "c:objc(cs)Interface",
78-
"target": "c:objc(pl)Protocol"
82+
"target": "c:objc(pl)Protocol",
83+
"targetFallback": "Protocol"
7984
},
8085
{
8186
"kind": "memberOf",
8287
"source": "c:objc(pl)Protocol(cpy)myProtocolTypeProp",
83-
"target": "c:objc(pl)Protocol"
88+
"target": "c:objc(pl)Protocol",
89+
"targetFallback": "Protocol"
8490
},
8591
{
8692
"kind": "memberOf",
8793
"source": "c:objc(pl)Protocol(py)myProtocolInstanceProp",
88-
"target": "c:objc(pl)Protocol"
94+
"target": "c:objc(pl)Protocol",
95+
"targetFallback": "Protocol"
8996
}
9097
],
9198
"symbols": [

clang/test/ExtractAPI/objc_protocol.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ @protocol AnotherProtocol <Protocol>
4949
{
5050
"kind": "conformsTo",
5151
"source": "c:objc(pl)AnotherProtocol",
52-
"target": "c:objc(pl)Protocol"
52+
"target": "c:objc(pl)Protocol",
53+
"targetFallback": "Protocol"
5354
}
5455
],
5556
"symbols": [

clang/test/ExtractAPI/struct.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,26 @@ struct Color {
5252
{
5353
"kind": "memberOf",
5454
"source": "c:@S@Color@FI@Red",
55-
"target": "c:@S@Color"
55+
"target": "c:@S@Color",
56+
"targetFallback": "Color"
5657
},
5758
{
5859
"kind": "memberOf",
5960
"source": "c:@S@Color@FI@Green",
60-
"target": "c:@S@Color"
61+
"target": "c:@S@Color",
62+
"targetFallback": "Color"
6163
},
6264
{
6365
"kind": "memberOf",
6466
"source": "c:@S@Color@FI@Blue",
65-
"target": "c:@S@Color"
67+
"target": "c:@S@Color",
68+
"targetFallback": "Color"
6669
},
6770
{
6871
"kind": "memberOf",
6972
"source": "c:@S@Color@FI@Alpha",
70-
"target": "c:@S@Color"
73+
"target": "c:@S@Color",
74+
"targetFallback": "Color"
7175
}
7276
],
7377
"symbols": [

clang/test/ExtractAPI/underscored.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ typedef _HiddenTypedef ExposedTypedefToHidden;
6565
{
6666
"kind": "memberOf",
6767
"source": "c:@S@ExposedRecord@FI@a",
68-
"target": "c:@S@ExposedRecord"
68+
"target": "c:@S@ExposedRecord",
69+
"targetFallback": "ExposedRecord"
6970
}
7071
],
7172
"symbols": [

0 commit comments

Comments
 (0)