summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-03 17:33:04 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-03 17:33:04 +0000
commit9e42a952d79224ff98161e733bd82efbac55a7a3 (patch)
treeb0c7dd80a65928c6ccc6df5c300e3ad27393b0a3 /clang/lib/Parse/ParseObjc.cpp
parent02ab9a69b9ef64db10adfbae7fbde7c67753be44 (diff)
downloadbcm5719-llvm-9e42a952d79224ff98161e733bd82efbac55a7a3.tar.gz
bcm5719-llvm-9e42a952d79224ff98161e733bd82efbac55a7a3.zip
Use getSpelling to get original text of the
c++ operator token. (radar 8328250). llvm-svn: 112977
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp76
1 files changed, 21 insertions, 55 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 8d7d67ed8d4..e0f9e2907b5 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -553,60 +553,6 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl,
MatchRHSPunctuation(tok::r_paren, LHSLoc);
}
-static void ConvertCPlusPlusOperatorToken(Preprocessor &PP, Token &Tok) {
- if (!Tok.isCPlusPlusOpKeyword())
- return;
-
- switch (Tok.getKind()) {
- case tok::ampamp:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("and"));
- Tok.setKind(tok::identifier);
- return;
- case tok::ampequal:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("and_eq"));
- Tok.setKind(tok::identifier);
- return;
- case tok::amp:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("bitand"));
- Tok.setKind(tok::identifier);
- return;
- case tok::pipe:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("pipe"));
- Tok.setKind(tok::identifier);
- return;
- case tok::tilde:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("compl"));
- Tok.setKind(tok::identifier);
- return;
- case tok::exclaim:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("not"));
- Tok.setKind(tok::identifier);
- return;
- case tok::exclaimequal:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("not_eq"));
- Tok.setKind(tok::identifier);
- return;
- case tok::pipepipe:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("or"));
- Tok.setKind(tok::identifier);
- return;
- case tok::pipeequal:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("or_eq"));
- Tok.setKind(tok::identifier);
- return;
- case tok::caret:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("xor"));
- Tok.setKind(tok::identifier);
- return;
- case tok::caretequal:
- Tok.setIdentifierInfo(&PP.getIdentifierTable().get("xor_eq"));
- Tok.setKind(tok::identifier);
- return;
- default:
- return;
- }
-}
-
/// objc-method-proto:
/// objc-instance-method objc-method-decl objc-method-attributes[opt]
/// objc-class-method objc-method-decl objc-method-attributes[opt]
@@ -638,11 +584,31 @@ Decl *Parser::ParseObjCMethodPrototype(Decl *IDecl,
/// in out inout bycopy byref oneway int char float double void _Bool
///
IdentifierInfo *Parser::ParseObjCSelectorPiece(SourceLocation &SelectorLoc) {
- ConvertCPlusPlusOperatorToken(PP, Tok);
switch (Tok.getKind()) {
default:
return 0;
+ case tok::ampamp:
+ case tok::ampequal:
+ case tok::amp:
+ case tok::pipe:
+ case tok::tilde:
+ case tok::exclaim:
+ case tok::exclaimequal:
+ case tok::pipepipe:
+ case tok::pipeequal:
+ case tok::caret:
+ case tok::caretequal: {
+ llvm::StringRef ThisTok = PP.getSpelling(Tok);
+ if (isalpha(ThisTok[0])) {
+ IdentifierInfo *II = &PP.getIdentifierTable().get(ThisTok.data());
+ Tok.setKind(tok::identifier);
+ SelectorLoc = ConsumeToken();
+ return II;
+ }
+ return 0;
+ }
+
case tok::identifier:
case tok::kw_asm:
case tok::kw_auto:
OpenPOWER on IntegriCloud