aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-11-26 21:41:52 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-11-26 21:41:52 +0000
commit4bdd91c09fd59e0c154d759288beff300e31e1d0 (patch)
tree16e340033e52e3cefffece5821a9caa8ee8c9b0e /lib/Parse/Parser.cpp
parent3bf4a79712fb30dc27692ef2d4214ee7fa6681be (diff)
Implement some suggestions by Daniel:
-Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier -Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier -Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index f00eaeb17b..ec07b42319 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -705,8 +705,8 @@ void Parser::TryAnnotateTypeOrScopeToken() {
return;
CXXScopeSpec SS;
- if (isTokenCXXScopeSpecifier())
- ParseCXXScopeSpecifier(SS);
+ if (getLang().CPlusPlus)
+ MaybeParseCXXScopeSpecifier(SS);
if (Tok.is(tok::identifier)) {
TypeTy *Ty = Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope, &SS);
@@ -746,13 +746,15 @@ void Parser::TryAnnotateTypeOrScopeToken() {
/// TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only
/// annotates C++ scope specifiers.
-void Parser::TryAnnotateScopeToken() {
+void Parser::TryAnnotateCXXScopeToken() {
+ assert(getLang().CPlusPlus &&
+ "Call sites of this function should be guarded by checking for C++.");
+
if (Tok.is(tok::annot_cxxscope))
return;
- if (isTokenCXXScopeSpecifier()) {
- CXXScopeSpec SS;
- ParseCXXScopeSpecifier(SS);
+ CXXScopeSpec SS;
+ if (MaybeParseCXXScopeSpecifier(SS)) {
// Push the current token back into the token stream (or revert it if it is
// cached) and use an annotation scope token for current token.