Make the identifier table track objc keywords

llvm-svn: 39003
diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp
index fe4be518..1a87119 100644
--- a/clang/Lex/Preprocessor.cpp
+++ b/clang/Lex/Preprocessor.cpp
@@ -109,6 +109,14 @@
   PP.getIdentifierInfo(Name, Name+NameLen)->setPPKeywordID(PPID);
 }
 
+/// AddObjCKeyword - Register an Objective-C @keyword like "class" "selector" or 
+/// "property".
+static void AddObjCKeyword(tok::ObjCKeywordKind ObjCID, 
+                           const char *Name, unsigned NameLen,
+                           Preprocessor &PP) {
+  PP.getIdentifierInfo(Name, Name+NameLen)->setObjCKeywordID(ObjCID);
+}
+
 /// AddKeywords - Add all keywords to the symbol table.
 ///
 void Preprocessor::AddKeywords() {
@@ -135,6 +143,12 @@
   AddKeyword(NAME, tok::kw_ ## TOK, 0, 0, 0);
 #define PPKEYWORD(NAME) \
   AddPPKeyword(tok::pp_##NAME, #NAME, strlen(#NAME), *this);
+#define OBJC1_AT_KEYWORD(NAME) \
+  if (Features.ObjC1)          \
+    AddObjCKeyword(tok::objc_##NAME, #NAME, strlen(#NAME), *this);
+#define OBJC2_AT_KEYWORD(NAME) \
+  if (Features.ObjC2)          \
+    AddObjCKeyword(tok::objc_##NAME, #NAME, strlen(#NAME), *this);
 #include "clang/Basic/TokenKinds.def"
 }