19
19
#define LLVM_CLANG_EXTRACTAPI_API_H
20
20
21
21
#include " clang/AST/Availability.h"
22
- #include " clang/AST/Decl.h"
23
22
#include " clang/AST/DeclBase.h"
24
- #include " clang/AST/DeclObjC.h"
25
23
#include " clang/AST/RawCommentList.h"
26
24
#include " clang/Basic/SourceLocation.h"
27
- #include " clang/Basic/Specifiers.h"
28
25
#include " clang/ExtractAPI/DeclarationFragments.h"
29
- #include " llvm/ADT/ArrayRef.h"
30
- #include " llvm/ADT/MapVector.h"
31
- #include " llvm/ADT/StringRef.h"
26
+ #include " llvm/ADT/SmallPtrSet.h"
32
27
#include " llvm/Support/Allocator.h"
33
28
#include " llvm/Support/Casting.h"
34
- #include " llvm/Support/Compiler.h"
35
- #include " llvm/Support/ErrorHandling.h"
36
- #include " llvm/Support/raw_ostream.h"
37
29
#include " llvm/TargetParser/Triple.h"
38
30
#include < cstddef>
39
31
#include < iterator>
@@ -328,6 +320,8 @@ class RecordContext {
328
320
// / chain.
329
321
void stealRecordChain (RecordContext &Other);
330
322
323
+ void removeFromRecordChain (APIRecord *Record);
324
+
331
325
APIRecord::RecordKind getKind () const { return Kind; }
332
326
333
327
struct record_iterator {
@@ -1426,10 +1420,14 @@ class APISet {
1426
1420
typename std::enable_if_t <std::is_base_of_v<APIRecord, RecordTy>, RecordTy> *
1427
1421
createRecord (StringRef USR, StringRef Name, CtorArgsContTy &&...CtorArgs);
1428
1422
1429
- ArrayRef< const APIRecord *> getTopLevelRecords () const {
1430
- return TopLevelRecords;
1423
+ auto getTopLevelRecords () const {
1424
+ return llvm::iterator_range< decltype ( TopLevelRecords)::iterator>(TopLevelRecords) ;
1431
1425
}
1432
1426
1427
+ void removeRecord (StringRef USR);
1428
+
1429
+ void removeRecord (APIRecord *Record);
1430
+
1433
1431
APISet (const llvm::Triple &Target, Language Lang,
1434
1432
const std::string &ProductName)
1435
1433
: Target(Target), Lang(Lang), ProductName(ProductName) {}
@@ -1456,7 +1454,7 @@ class APISet {
1456
1454
// lives in the BumpPtrAllocator.
1457
1455
using APIRecordStoredPtr = std::unique_ptr<APIRecord, APIRecordDeleter>;
1458
1456
llvm::DenseMap<StringRef, APIRecordStoredPtr> USRBasedLookupTable;
1459
- std::vector <const APIRecord *> TopLevelRecords;
1457
+ llvm::SmallPtrSet <const APIRecord *, 32 > TopLevelRecords;
1460
1458
1461
1459
public:
1462
1460
const std::string ProductName;
@@ -1482,7 +1480,7 @@ APISet::createRecord(StringRef USR, StringRef Name,
1482
1480
dyn_cast_if_present<RecordContext>(Record->Parent .Record ))
1483
1481
ParentContext->addToRecordChain (Record);
1484
1482
else
1485
- TopLevelRecords.push_back (Record);
1483
+ TopLevelRecords.insert (Record);
1486
1484
} else {
1487
1485
Record = dyn_cast<RecordTy>(Result.first ->second .get ());
1488
1486
}
0 commit comments