summaryrefslogtreecommitdiffstats
path: root/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Basic/IdentifierTable.cpp')
-rw-r--r--lib/Basic/IdentifierTable.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 43899f0..4869ae1 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ErrorHandling.h"
+#include <cctype>
#include <cstdio>
using namespace clang;
@@ -103,7 +104,8 @@ namespace {
KEYOPENCL = 0x200,
KEYC11 = 0x400,
KEYARC = 0x800,
- KEYALL = 0x0fff
+ KEYNOMS = 0x01000,
+ KEYALL = (0xffff & ~KEYNOMS) // Because KEYNOMS is used to exclude.
};
}
@@ -136,6 +138,9 @@ static void AddKeyword(StringRef Keyword,
else if (LangOpts.ObjC2 && (Flags & KEYARC)) AddResult = 2;
else if (LangOpts.CPlusPlus && (Flags & KEYCXX0X)) AddResult = 3;
+ // Don't add this keyword under MicrosoftMode.
+ if (LangOpts.MicrosoftMode && (Flags & KEYNOMS))
+ return;
// Don't add this keyword if disabled in this language.
if (AddResult == 0) return;
@@ -154,8 +159,8 @@ static void AddCXXOperatorKeyword(StringRef Keyword,
Info.setIsCPlusPlusOperatorKeyword();
}
-/// AddObjCKeyword - Register an Objective-C @keyword like "class" "selector" or
-/// "property".
+/// AddObjCKeyword - Register an Objective-C \@keyword like "class" "selector"
+/// or "property".
static void AddObjCKeyword(StringRef Name,
tok::ObjCKeywordKind ObjCID,
IdentifierTable &Table) {
@@ -335,22 +340,22 @@ public:
unsigned Selector::getNumArgs() const {
unsigned IIF = getIdentifierInfoFlag();
- if (IIF == ZeroArg)
+ if (IIF <= ZeroArg)
return 0;
if (IIF == OneArg)
return 1;
- // We point to a MultiKeywordSelector (pointer doesn't contain any flags).
- MultiKeywordSelector *SI = reinterpret_cast<MultiKeywordSelector *>(InfoPtr);
+ // We point to a MultiKeywordSelector.
+ MultiKeywordSelector *SI = getMultiKeywordSelector();
return SI->getNumArgs();
}
IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const {
- if (getIdentifierInfoFlag()) {
+ if (getIdentifierInfoFlag() < MultiArg) {
assert(argIndex == 0 && "illegal keyword index");
return getAsIdentifierInfo();
}
- // We point to a MultiKeywordSelector (pointer doesn't contain any flags).
- MultiKeywordSelector *SI = reinterpret_cast<MultiKeywordSelector *>(InfoPtr);
+ // We point to a MultiKeywordSelector.
+ MultiKeywordSelector *SI = getMultiKeywordSelector();
return SI->getIdentifierInfoForSlot(argIndex);
}
@@ -375,7 +380,7 @@ std::string Selector::getAsString() const {
if (InfoPtr == 0)
return "<null selector>";
- if (InfoPtr & ArgFlags) {
+ if (getIdentifierInfoFlag() < MultiArg) {
IdentifierInfo *II = getAsIdentifierInfo();
// If the number of arguments is 0 then II is guaranteed to not be null.
@@ -388,8 +393,8 @@ std::string Selector::getAsString() const {
return II->getName().str() + ":";
}
- // We have a multiple keyword selector (no embedded flags).
- return reinterpret_cast<MultiKeywordSelector *>(InfoPtr)->getName();
+ // We have a multiple keyword selector.
+ return getMultiKeywordSelector()->getName();
}
/// Interpreting the given string using the normal CamelCase
OpenPOWER on IntegriCloud