1 //===--- IdentifierTable.cpp - Hash table for identifier lookup -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the IdentifierInfo, IdentifierVisitor, and
11 // IdentifierTable interfaces.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/Basic/CharInfo.h"
16 #include "clang/Basic/IdentifierTable.h"
17 #include "clang/Basic/LangOptions.h"
18 #include "clang/Basic/OperatorKinds.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/FoldingSet.h"
21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/Support/ErrorHandling.h"
23 #include "llvm/Support/raw_ostream.h"
24 #include <cstdio>
25 
26 using namespace clang;
27 
28 //===----------------------------------------------------------------------===//
29 // IdentifierInfo Implementation
30 //===----------------------------------------------------------------------===//
31 
32 IdentifierInfo::IdentifierInfo() {
33   TokenID = tok::identifier;
34   ObjCOrBuiltinID = 0;
35   HasMacro = false;
36   HadMacro = false;
37   IsExtension = false;
38   IsCXX11CompatKeyword = false;
39   IsPoisoned = false;
40   IsCPPOperatorKeyword = false;
41   NeedsHandleIdentifier = false;
42   IsFromAST = false;
43   ChangedAfterLoad = false;
44   RevertedTokenID = false;
45   OutOfDate = false;
46   IsModulesImport = false;
47   FETokenInfo = nullptr;
48   Entry = nullptr;
49 }
50 
51 //===----------------------------------------------------------------------===//
52 // IdentifierTable Implementation
53 //===----------------------------------------------------------------------===//
54 
55 IdentifierIterator::~IdentifierIterator() { }
56 
57 IdentifierInfoLookup::~IdentifierInfoLookup() {}
58 
59 namespace {
60   /// \brief A simple identifier lookup iterator that represents an
61   /// empty sequence of identifiers.
62   class EmptyLookupIterator : public IdentifierIterator
63   {
64   public:
65     StringRef Next() override { return StringRef(); }
66   };
67 }
68 
69 IdentifierIterator *IdentifierInfoLookup::getIdentifiers() {
70   return new EmptyLookupIterator();
71 }
72 
73 ExternalIdentifierLookup::~ExternalIdentifierLookup() {}
74 
75 IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
76                                  IdentifierInfoLookup* externalLookup)
77   : HashTable(8192), // Start with space for 8K identifiers.
78     ExternalLookup(externalLookup) {
79 
80   // Populate the identifier table with info about keywords for the current
81   // language.
82   AddKeywords(LangOpts);
83 
84 
85   // Add the '_experimental_modules_import' contextual keyword.
86   get("import").setModulesImport(true);
87 }
88 
89 //===----------------------------------------------------------------------===//
90 // Language Keyword Implementation
91 //===----------------------------------------------------------------------===//
92 
93 // Constants for TokenKinds.def
94 namespace {
95   enum {
96     KEYC99 = 0x1,
97     KEYCXX = 0x2,
98     KEYCXX11 = 0x4,
99     KEYGNU = 0x8,
100     KEYMS = 0x10,
101     BOOLSUPPORT = 0x20,
102     KEYALTIVEC = 0x40,
103     KEYNOCXX = 0x80,
104     KEYBORLAND = 0x100,
105     KEYOPENCL = 0x200,
106     KEYC11 = 0x400,
107     KEYARC = 0x800,
108     KEYNOMS = 0x01000,
109     WCHARSUPPORT = 0x02000,
110     HALFSUPPORT = 0x04000,
111     KEYALL = (0xffff & ~KEYNOMS) // Because KEYNOMS is used to exclude.
112   };
113 
114   /// \brief How a keyword is treated in the selected standard.
115   enum KeywordStatus {
116     KS_Disabled,    // Disabled
117     KS_Extension,   // Is an extension
118     KS_Enabled,     // Enabled
119     KS_Future       // Is a keyword in future standard
120   };
121 }
122 
123 /// \brief Translates flags as specified in TokenKinds.def into keyword status
124 /// in the given language standard.
125 static KeywordStatus GetKeywordStatus(const LangOptions &LangOpts,
126                                       unsigned Flags) {
127   if (Flags == KEYALL) return KS_Enabled;
128   if (LangOpts.CPlusPlus && (Flags & KEYCXX)) return KS_Enabled;
129   if (LangOpts.CPlusPlus11 && (Flags & KEYCXX11)) return KS_Enabled;
130   if (LangOpts.C99 && (Flags & KEYC99)) return KS_Enabled;
131   if (LangOpts.GNUKeywords && (Flags & KEYGNU)) return KS_Extension;
132   if (LangOpts.MicrosoftExt && (Flags & KEYMS)) return KS_Extension;
133   if (LangOpts.Borland && (Flags & KEYBORLAND)) return KS_Extension;
134   if (LangOpts.Bool && (Flags & BOOLSUPPORT)) return KS_Enabled;
135   if (LangOpts.Half && (Flags & HALFSUPPORT)) return KS_Enabled;
136   if (LangOpts.WChar && (Flags & WCHARSUPPORT)) return KS_Enabled;
137   if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) return KS_Enabled;
138   if (LangOpts.OpenCL && (Flags & KEYOPENCL)) return KS_Enabled;
139   if (!LangOpts.CPlusPlus && (Flags & KEYNOCXX)) return KS_Enabled;
140   if (LangOpts.C11 && (Flags & KEYC11)) return KS_Enabled;
141   // We treat bridge casts as objective-C keywords so we can warn on them
142   // in non-arc mode.
143   if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
144   if (LangOpts.CPlusPlus && (Flags & KEYCXX11)) return KS_Future;
145   return KS_Disabled;
146 }
147 
148 /// AddKeyword - This method is used to associate a token ID with specific
149 /// identifiers because they are language keywords.  This causes the lexer to
150 /// automatically map matching identifiers to specialized token codes.
151 static void AddKeyword(StringRef Keyword,
152                        tok::TokenKind TokenCode, unsigned Flags,
153                        const LangOptions &LangOpts, IdentifierTable &Table) {
154   KeywordStatus AddResult = GetKeywordStatus(LangOpts, Flags);
155 
156   // Don't add this keyword under MSVCCompat.
157   if (LangOpts.MSVCCompat && (Flags & KEYNOMS))
158      return;
159   // Don't add this keyword if disabled in this language.
160   if (AddResult == KS_Disabled) return;
161 
162   IdentifierInfo &Info =
163       Table.get(Keyword, AddResult == KS_Future ? tok::identifier : TokenCode);
164   Info.setIsExtensionToken(AddResult == KS_Extension);
165   Info.setIsCXX11CompatKeyword(AddResult == KS_Future);
166 }
167 
168 /// AddCXXOperatorKeyword - Register a C++ operator keyword alternative
169 /// representations.
170 static void AddCXXOperatorKeyword(StringRef Keyword,
171                                   tok::TokenKind TokenCode,
172                                   IdentifierTable &Table) {
173   IdentifierInfo &Info = Table.get(Keyword, TokenCode);
174   Info.setIsCPlusPlusOperatorKeyword();
175 }
176 
177 /// AddObjCKeyword - Register an Objective-C \@keyword like "class" "selector"
178 /// or "property".
179 static void AddObjCKeyword(StringRef Name,
180                            tok::ObjCKeywordKind ObjCID,
181                            IdentifierTable &Table) {
182   Table.get(Name).setObjCKeywordID(ObjCID);
183 }
184 
185 /// AddKeywords - Add all keywords to the symbol table.
186 ///
187 void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
188   // Add keywords and tokens for the current language.
189 #define KEYWORD(NAME, FLAGS) \
190   AddKeyword(StringRef(#NAME), tok::kw_ ## NAME,  \
191              FLAGS, LangOpts, *this);
192 #define ALIAS(NAME, TOK, FLAGS) \
193   AddKeyword(StringRef(NAME), tok::kw_ ## TOK,  \
194              FLAGS, LangOpts, *this);
195 #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \
196   if (LangOpts.CXXOperatorNames)          \
197     AddCXXOperatorKeyword(StringRef(#NAME), tok::ALIAS, *this);
198 #define OBJC1_AT_KEYWORD(NAME) \
199   if (LangOpts.ObjC1)          \
200     AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this);
201 #define OBJC2_AT_KEYWORD(NAME) \
202   if (LangOpts.ObjC2)          \
203     AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this);
204 #define TESTING_KEYWORD(NAME, FLAGS)
205 #include "clang/Basic/TokenKinds.def"
206 
207   if (LangOpts.ParseUnknownAnytype)
208     AddKeyword("__unknown_anytype", tok::kw___unknown_anytype, KEYALL,
209                LangOpts, *this);
210 }
211 
212 tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
213   // We use a perfect hash function here involving the length of the keyword,
214   // the first and third character.  For preprocessor ID's there are no
215   // collisions (if there were, the switch below would complain about duplicate
216   // case values).  Note that this depends on 'if' being null terminated.
217 
218 #define HASH(LEN, FIRST, THIRD) \
219   (LEN << 5) + (((FIRST-'a') + (THIRD-'a')) & 31)
220 #define CASE(LEN, FIRST, THIRD, NAME) \
221   case HASH(LEN, FIRST, THIRD): \
222     return memcmp(Name, #NAME, LEN) ? tok::pp_not_keyword : tok::pp_ ## NAME
223 
224   unsigned Len = getLength();
225   if (Len < 2) return tok::pp_not_keyword;
226   const char *Name = getNameStart();
227   switch (HASH(Len, Name[0], Name[2])) {
228   default: return tok::pp_not_keyword;
229   CASE( 2, 'i', '\0', if);
230   CASE( 4, 'e', 'i', elif);
231   CASE( 4, 'e', 's', else);
232   CASE( 4, 'l', 'n', line);
233   CASE( 4, 's', 'c', sccs);
234   CASE( 5, 'e', 'd', endif);
235   CASE( 5, 'e', 'r', error);
236   CASE( 5, 'i', 'e', ident);
237   CASE( 5, 'i', 'd', ifdef);
238   CASE( 5, 'u', 'd', undef);
239 
240   CASE( 6, 'a', 's', assert);
241   CASE( 6, 'd', 'f', define);
242   CASE( 6, 'i', 'n', ifndef);
243   CASE( 6, 'i', 'p', import);
244   CASE( 6, 'p', 'a', pragma);
245 
246   CASE( 7, 'd', 'f', defined);
247   CASE( 7, 'i', 'c', include);
248   CASE( 7, 'w', 'r', warning);
249 
250   CASE( 8, 'u', 'a', unassert);
251   CASE(12, 'i', 'c', include_next);
252 
253   CASE(14, '_', 'p', __public_macro);
254 
255   CASE(15, '_', 'p', __private_macro);
256 
257   CASE(16, '_', 'i', __include_macros);
258 #undef CASE
259 #undef HASH
260   }
261 }
262 
263 //===----------------------------------------------------------------------===//
264 // Stats Implementation
265 //===----------------------------------------------------------------------===//
266 
267 /// PrintStats - Print statistics about how well the identifier table is doing
268 /// at hashing identifiers.
269 void IdentifierTable::PrintStats() const {
270   unsigned NumBuckets = HashTable.getNumBuckets();
271   unsigned NumIdentifiers = HashTable.getNumItems();
272   unsigned NumEmptyBuckets = NumBuckets-NumIdentifiers;
273   unsigned AverageIdentifierSize = 0;
274   unsigned MaxIdentifierLength = 0;
275 
276   // TODO: Figure out maximum times an identifier had to probe for -stats.
277   for (llvm::StringMap<IdentifierInfo*, llvm::BumpPtrAllocator>::const_iterator
278        I = HashTable.begin(), E = HashTable.end(); I != E; ++I) {
279     unsigned IdLen = I->getKeyLength();
280     AverageIdentifierSize += IdLen;
281     if (MaxIdentifierLength < IdLen)
282       MaxIdentifierLength = IdLen;
283   }
284 
285   fprintf(stderr, "\n*** Identifier Table Stats:\n");
286   fprintf(stderr, "# Identifiers:   %d\n", NumIdentifiers);
287   fprintf(stderr, "# Empty Buckets: %d\n", NumEmptyBuckets);
288   fprintf(stderr, "Hash density (#identifiers per bucket): %f\n",
289           NumIdentifiers/(double)NumBuckets);
290   fprintf(stderr, "Ave identifier length: %f\n",
291           (AverageIdentifierSize/(double)NumIdentifiers));
292   fprintf(stderr, "Max identifier length: %d\n", MaxIdentifierLength);
293 
294   // Compute statistics about the memory allocated for identifiers.
295   HashTable.getAllocator().PrintStats();
296 }
297 
298 //===----------------------------------------------------------------------===//
299 // SelectorTable Implementation
300 //===----------------------------------------------------------------------===//
301 
302 unsigned llvm::DenseMapInfo<clang::Selector>::getHashValue(clang::Selector S) {
303   return DenseMapInfo<void*>::getHashValue(S.getAsOpaquePtr());
304 }
305 
306 namespace clang {
307 /// MultiKeywordSelector - One of these variable length records is kept for each
308 /// selector containing more than one keyword. We use a folding set
309 /// to unique aggregate names (keyword selectors in ObjC parlance). Access to
310 /// this class is provided strictly through Selector.
311 class MultiKeywordSelector
312   : public DeclarationNameExtra, public llvm::FoldingSetNode {
313   MultiKeywordSelector(unsigned nKeys) {
314     ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
315   }
316 public:
317   // Constructor for keyword selectors.
318   MultiKeywordSelector(unsigned nKeys, IdentifierInfo **IIV) {
319     assert((nKeys > 1) && "not a multi-keyword selector");
320     ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
321 
322     // Fill in the trailing keyword array.
323     IdentifierInfo **KeyInfo = reinterpret_cast<IdentifierInfo **>(this+1);
324     for (unsigned i = 0; i != nKeys; ++i)
325       KeyInfo[i] = IIV[i];
326   }
327 
328   // getName - Derive the full selector name and return it.
329   std::string getName() const;
330 
331   unsigned getNumArgs() const { return ExtraKindOrNumArgs - NUM_EXTRA_KINDS; }
332 
333   typedef IdentifierInfo *const *keyword_iterator;
334   keyword_iterator keyword_begin() const {
335     return reinterpret_cast<keyword_iterator>(this+1);
336   }
337   keyword_iterator keyword_end() const {
338     return keyword_begin()+getNumArgs();
339   }
340   IdentifierInfo *getIdentifierInfoForSlot(unsigned i) const {
341     assert(i < getNumArgs() && "getIdentifierInfoForSlot(): illegal index");
342     return keyword_begin()[i];
343   }
344   static void Profile(llvm::FoldingSetNodeID &ID,
345                       keyword_iterator ArgTys, unsigned NumArgs) {
346     ID.AddInteger(NumArgs);
347     for (unsigned i = 0; i != NumArgs; ++i)
348       ID.AddPointer(ArgTys[i]);
349   }
350   void Profile(llvm::FoldingSetNodeID &ID) {
351     Profile(ID, keyword_begin(), getNumArgs());
352   }
353 };
354 } // end namespace clang.
355 
356 unsigned Selector::getNumArgs() const {
357   unsigned IIF = getIdentifierInfoFlag();
358   if (IIF <= ZeroArg)
359     return 0;
360   if (IIF == OneArg)
361     return 1;
362   // We point to a MultiKeywordSelector.
363   MultiKeywordSelector *SI = getMultiKeywordSelector();
364   return SI->getNumArgs();
365 }
366 
367 IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const {
368   if (getIdentifierInfoFlag() < MultiArg) {
369     assert(argIndex == 0 && "illegal keyword index");
370     return getAsIdentifierInfo();
371   }
372   // We point to a MultiKeywordSelector.
373   MultiKeywordSelector *SI = getMultiKeywordSelector();
374   return SI->getIdentifierInfoForSlot(argIndex);
375 }
376 
377 StringRef Selector::getNameForSlot(unsigned int argIndex) const {
378   IdentifierInfo *II = getIdentifierInfoForSlot(argIndex);
379   return II? II->getName() : StringRef();
380 }
381 
382 std::string MultiKeywordSelector::getName() const {
383   SmallString<256> Str;
384   llvm::raw_svector_ostream OS(Str);
385   for (keyword_iterator I = keyword_begin(), E = keyword_end(); I != E; ++I) {
386     if (*I)
387       OS << (*I)->getName();
388     OS << ':';
389   }
390 
391   return OS.str();
392 }
393 
394 std::string Selector::getAsString() const {
395   if (InfoPtr == 0)
396     return "<null selector>";
397 
398   if (getIdentifierInfoFlag() < MultiArg) {
399     IdentifierInfo *II = getAsIdentifierInfo();
400 
401     // If the number of arguments is 0 then II is guaranteed to not be null.
402     if (getNumArgs() == 0)
403       return II->getName();
404 
405     if (!II)
406       return ":";
407 
408     return II->getName().str() + ":";
409   }
410 
411   // We have a multiple keyword selector.
412   return getMultiKeywordSelector()->getName();
413 }
414 
415 void Selector::print(llvm::raw_ostream &OS) const {
416   OS << getAsString();
417 }
418 
419 /// Interpreting the given string using the normal CamelCase
420 /// conventions, determine whether the given string starts with the
421 /// given "word", which is assumed to end in a lowercase letter.
422 static bool startsWithWord(StringRef name, StringRef word) {
423   if (name.size() < word.size()) return false;
424   return ((name.size() == word.size() || !isLowercase(name[word.size()])) &&
425           name.startswith(word));
426 }
427 
428 ObjCMethodFamily Selector::getMethodFamilyImpl(Selector sel) {
429   IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
430   if (!first) return OMF_None;
431 
432   StringRef name = first->getName();
433   if (sel.isUnarySelector()) {
434     if (name == "autorelease") return OMF_autorelease;
435     if (name == "dealloc") return OMF_dealloc;
436     if (name == "finalize") return OMF_finalize;
437     if (name == "release") return OMF_release;
438     if (name == "retain") return OMF_retain;
439     if (name == "retainCount") return OMF_retainCount;
440     if (name == "self") return OMF_self;
441     if (name == "initialize") return OMF_initialize;
442   }
443 
444   if (name == "performSelector") return OMF_performSelector;
445 
446   // The other method families may begin with a prefix of underscores.
447   while (!name.empty() && name.front() == '_')
448     name = name.substr(1);
449 
450   if (name.empty()) return OMF_None;
451   switch (name.front()) {
452   case 'a':
453     if (startsWithWord(name, "alloc")) return OMF_alloc;
454     break;
455   case 'c':
456     if (startsWithWord(name, "copy")) return OMF_copy;
457     break;
458   case 'i':
459     if (startsWithWord(name, "init")) return OMF_init;
460     break;
461   case 'm':
462     if (startsWithWord(name, "mutableCopy")) return OMF_mutableCopy;
463     break;
464   case 'n':
465     if (startsWithWord(name, "new")) return OMF_new;
466     break;
467   default:
468     break;
469   }
470 
471   return OMF_None;
472 }
473 
474 ObjCInstanceTypeFamily Selector::getInstTypeMethodFamily(Selector sel) {
475   IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
476   if (!first) return OIT_None;
477 
478   StringRef name = first->getName();
479 
480   if (name.empty()) return OIT_None;
481   switch (name.front()) {
482     case 'a':
483       if (startsWithWord(name, "array")) return OIT_Array;
484       break;
485     case 'd':
486       if (startsWithWord(name, "default")) return OIT_ReturnsSelf;
487       if (startsWithWord(name, "dictionary")) return OIT_Dictionary;
488       break;
489     case 's':
490       if (startsWithWord(name, "shared")) return OIT_ReturnsSelf;
491       if (startsWithWord(name, "standard")) return OIT_Singleton;
492     case 'i':
493       if (startsWithWord(name, "init")) return OIT_Init;
494     default:
495       break;
496   }
497   return OIT_None;
498 }
499 
500 ObjCStringFormatFamily Selector::getStringFormatFamilyImpl(Selector sel) {
501   IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
502   if (!first) return SFF_None;
503 
504   StringRef name = first->getName();
505 
506   switch (name.front()) {
507     case 'a':
508       if (name == "appendFormat") return SFF_NSString;
509       break;
510 
511     case 'i':
512       if (name == "initWithFormat") return SFF_NSString;
513       break;
514 
515     case 'l':
516       if (name == "localizedStringWithFormat") return SFF_NSString;
517       break;
518 
519     case 's':
520       if (name == "stringByAppendingFormat" ||
521           name == "stringWithFormat") return SFF_NSString;
522       break;
523   }
524   return SFF_None;
525 }
526 
527 namespace {
528   struct SelectorTableImpl {
529     llvm::FoldingSet<MultiKeywordSelector> Table;
530     llvm::BumpPtrAllocator Allocator;
531   };
532 } // end anonymous namespace.
533 
534 static SelectorTableImpl &getSelectorTableImpl(void *P) {
535   return *static_cast<SelectorTableImpl*>(P);
536 }
537 
538 SmallString<64>
539 SelectorTable::constructSetterName(StringRef Name) {
540   SmallString<64> SetterName("set");
541   SetterName += Name;
542   SetterName[3] = toUppercase(SetterName[3]);
543   return SetterName;
544 }
545 
546 Selector
547 SelectorTable::constructSetterSelector(IdentifierTable &Idents,
548                                        SelectorTable &SelTable,
549                                        const IdentifierInfo *Name) {
550   IdentifierInfo *SetterName =
551     &Idents.get(constructSetterName(Name->getName()));
552   return SelTable.getUnarySelector(SetterName);
553 }
554 
555 size_t SelectorTable::getTotalMemory() const {
556   SelectorTableImpl &SelTabImpl = getSelectorTableImpl(Impl);
557   return SelTabImpl.Allocator.getTotalMemory();
558 }
559 
560 Selector SelectorTable::getSelector(unsigned nKeys, IdentifierInfo **IIV) {
561   if (nKeys < 2)
562     return Selector(IIV[0], nKeys);
563 
564   SelectorTableImpl &SelTabImpl = getSelectorTableImpl(Impl);
565 
566   // Unique selector, to guarantee there is one per name.
567   llvm::FoldingSetNodeID ID;
568   MultiKeywordSelector::Profile(ID, IIV, nKeys);
569 
570   void *InsertPos = nullptr;
571   if (MultiKeywordSelector *SI =
572         SelTabImpl.Table.FindNodeOrInsertPos(ID, InsertPos))
573     return Selector(SI);
574 
575   // MultiKeywordSelector objects are not allocated with new because they have a
576   // variable size array (for parameter types) at the end of them.
577   unsigned Size = sizeof(MultiKeywordSelector) + nKeys*sizeof(IdentifierInfo *);
578   MultiKeywordSelector *SI =
579     (MultiKeywordSelector*)SelTabImpl.Allocator.Allocate(Size,
580                                          llvm::alignOf<MultiKeywordSelector>());
581   new (SI) MultiKeywordSelector(nKeys, IIV);
582   SelTabImpl.Table.InsertNode(SI, InsertPos);
583   return Selector(SI);
584 }
585 
586 SelectorTable::SelectorTable() {
587   Impl = new SelectorTableImpl();
588 }
589 
590 SelectorTable::~SelectorTable() {
591   delete &getSelectorTableImpl(Impl);
592 }
593 
594 const char *clang::getOperatorSpelling(OverloadedOperatorKind Operator) {
595   switch (Operator) {
596   case OO_None:
597   case NUM_OVERLOADED_OPERATORS:
598     return nullptr;
599 
600 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
601   case OO_##Name: return Spelling;
602 #include "clang/Basic/OperatorKinds.def"
603   }
604 
605   llvm_unreachable("Invalid OverloadedOperatorKind!");
606 }
607