File tree Expand file tree Collapse file tree 6 files changed +495
-6
lines changed Expand file tree Collapse file tree 6 files changed +495
-6
lines changed Original file line number Diff line number Diff line change 10
10
#define LLVM_CLANG_APINOTES_APINOTESYAMLCOMPILER_H
11
11
12
12
#include " llvm/ADT/StringRef.h"
13
+ #include " llvm/Support/SourceMgr.h"
13
14
#include " llvm/Support/raw_ostream.h"
14
15
16
+ namespace clang {
17
+ class FileEntry ;
18
+ } // namespace clang
19
+
15
20
namespace clang {
16
21
namespace api_notes {
17
22
// / Parses the APINotes YAML content and writes the representation back to the
18
23
// / specified stream. This provides a means of testing the YAML processing of
19
24
// / the APINotes format.
20
25
bool parseAndDumpAPINotes (llvm::StringRef YI, llvm::raw_ostream &OS);
26
+
27
+ // / Converts API notes from YAML format to binary format.
28
+ bool compileAPINotes (llvm::StringRef YAMLInput, const FileEntry *SourceFile,
29
+ llvm::raw_ostream &OS,
30
+ llvm::SourceMgr::DiagHandlerTy DiagHandler = nullptr ,
31
+ void *DiagHandlerCtxt = nullptr );
21
32
} // namespace api_notes
22
33
} // namespace clang
23
34
Original file line number Diff line number Diff line change @@ -766,6 +766,7 @@ struct Context {
766
766
// / data they contain; it is up to the user to ensure that the data
767
767
// / referenced by the identifier list persists.
768
768
struct ObjCSelectorRef {
769
+ unsigned NumArgs;
769
770
llvm::ArrayRef<llvm::StringRef> Identifiers;
770
771
};
771
772
} // namespace api_notes
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ using EnumConstantDataLayout =
247
247
248
248
// / A stored Objective-C selector.
249
249
struct StoredObjCSelector {
250
- unsigned NumPieces ;
250
+ unsigned NumArgs ;
251
251
llvm::SmallVector<IdentifierID, 2 > Identifiers;
252
252
};
253
253
@@ -302,7 +302,7 @@ template <> struct DenseMapInfo<clang::api_notes::StoredObjCSelector> {
302
302
303
303
static unsigned
304
304
getHashValue (const clang::api_notes::StoredObjCSelector &Selector) {
305
- auto hash = llvm::hash_value (Selector.NumPieces );
305
+ auto hash = llvm::hash_value (Selector.NumArgs );
306
306
hash = hash_combine (hash, Selector.Identifiers .size ());
307
307
for (auto piece : Selector.Identifiers )
308
308
hash = hash_combine (hash, static_cast <unsigned >(piece));
@@ -313,7 +313,7 @@ template <> struct DenseMapInfo<clang::api_notes::StoredObjCSelector> {
313
313
314
314
static bool isEqual (const clang::api_notes::StoredObjCSelector &LHS,
315
315
const clang::api_notes::StoredObjCSelector &RHS) {
316
- return LHS.NumPieces == RHS.NumPieces && LHS.Identifiers == RHS.Identifiers ;
316
+ return LHS.NumArgs == RHS.NumArgs && LHS.Identifiers == RHS.Identifiers ;
317
317
}
318
318
};
319
319
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ class ObjCSelectorTableInfo {
421
421
422
422
static internal_key_type ReadKey (const uint8_t *Data, unsigned Length) {
423
423
internal_key_type Key;
424
- Key.NumPieces =
424
+ Key.NumArgs =
425
425
endian::readNext<uint16_t , llvm::endianness::little, unaligned>(Data);
426
426
unsigned NumIdents = (Length - sizeof (uint16_t )) / sizeof (uint32_t );
427
427
for (unsigned i = 0 ; i != NumIdents; ++i) {
@@ -741,6 +741,7 @@ APINotesReader::Implementation::getSelector(ObjCSelectorRef Selector) {
741
741
742
742
// Translate the identifiers.
743
743
StoredObjCSelector Key;
744
+ Key.NumArgs = Selector.NumArgs ;
744
745
for (auto Ident : Selector.Identifiers ) {
745
746
if (auto IdentID = getIdentifier (Ident)) {
746
747
Key.Identifiers .push_back (*IdentID);
Original file line number Diff line number Diff line change @@ -823,7 +823,7 @@ class ObjCSelectorTableInfo {
823
823
824
824
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
825
825
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
826
- writer.write <uint16_t >(Key.NumPieces );
826
+ writer.write <uint16_t >(Key.NumArgs );
827
827
for (auto Identifier : Key.Identifiers )
828
828
writer.write <uint32_t >(Identifier);
829
829
}
You can’t perform that action at this time.
0 commit comments