use early exits to reduce nesting.

llvm-svn: 61642
This commit is contained in:
Chris Lattner 2009-01-04 22:32:19 +00:00
parent 8a38aa83da
commit dfa1a45abd

View File

@ -784,7 +784,9 @@ void Parser::TryAnnotateTypeOrScopeToken() {
// FIXME: check for a template-id token here, and look it up if it
// names a type.
if (SS.isNotEmpty()) {
if (SS.isEmpty())
return;
// A C++ scope specifier that isn't followed by a typename.
// 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.
@ -800,19 +802,19 @@ void Parser::TryAnnotateTypeOrScopeToken() {
// annotation token.
PP.AnnotateCachedTokens(Tok);
}
}
/// TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only
/// annotates C++ scope specifiers.
void Parser::TryAnnotateCXXScopeToken() {
assert(getLang().CPlusPlus &&
"Call sites of this function should be guarded by checking for C++.");
"Call sites of this function should be guarded by checking for C++");
if (Tok.is(tok::annot_cxxscope))
return;
CXXScopeSpec SS;
if (MaybeParseCXXScopeSpecifier(SS)) {
if (!MaybeParseCXXScopeSpecifier(SS))
return;
// 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.
@ -828,4 +830,3 @@ void Parser::TryAnnotateCXXScopeToken() {
// annotation token.
PP.AnnotateCachedTokens(Tok);
}
}