forked from qt-creator/qt-creator
Fix coding style for else statements
Change-Id: I1309db70e98d678e150388c76ce665e988fdf081 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
c67f7f6349
commit
ad9e7ccab6
@@ -129,9 +129,9 @@ public:
|
||||
virtual void visit(NamedType *type)
|
||||
{
|
||||
FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite);
|
||||
if (! ty->isUndefinedType())
|
||||
if (! ty->isUndefinedType()) {
|
||||
temps.append(ty);
|
||||
else {
|
||||
} else {
|
||||
const Name *name = rewrite->rewriteName(type->name());
|
||||
temps.append(control()->namedType(name));
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ private:
|
||||
if (! name)
|
||||
return name;
|
||||
|
||||
else if (const Identifier *nameId = name->asNameId()) {
|
||||
if (const Identifier *nameId = name->asNameId()) {
|
||||
const Identifier *id = control()->identifier(nameId->chars(), nameId->size());
|
||||
return id;
|
||||
|
||||
|
||||
@@ -263,19 +263,20 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor) const
|
||||
forever {
|
||||
const Token &tk = scanner[index - 1];
|
||||
|
||||
if (tk.is(T_EOF_SYMBOL))
|
||||
if (tk.is(T_EOF_SYMBOL)) {
|
||||
break;
|
||||
else if (tk.is(T_LPAREN))
|
||||
} else if (tk.is(T_LPAREN)) {
|
||||
return scanner.startPosition() + tk.begin();
|
||||
else if (tk.is(T_RPAREN)) {
|
||||
} else if (tk.is(T_RPAREN)) {
|
||||
int matchingBrace = scanner.startOfMatchingBrace(index);
|
||||
|
||||
if (matchingBrace == index) // If no matching brace found
|
||||
return -1;
|
||||
|
||||
index = matchingBrace;
|
||||
} else
|
||||
} else {
|
||||
--index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -57,7 +57,7 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa
|
||||
{
|
||||
if (! name)
|
||||
return;
|
||||
else if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
addNames(q->base(), names);
|
||||
addNames(q->name(), names, addAllNames);
|
||||
} else if (addAllNames || name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
|
||||
@@ -98,7 +98,7 @@ static inline bool compareName(const Name *name, const Name *other)
|
||||
if (name == other)
|
||||
return true;
|
||||
|
||||
else if (name && other) {
|
||||
if (name && other) {
|
||||
const Identifier *id = name->identifier();
|
||||
const Identifier *otherId = other->identifier();
|
||||
|
||||
@@ -599,10 +599,9 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
|
||||
if (name) {
|
||||
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
if (! q->base()) // e.g. ::std::string
|
||||
if (! q->base()) { // e.g. ::std::string
|
||||
result = globalNamespace()->find(q->name());
|
||||
|
||||
else if (ClassOrNamespace *binding = lookupType(q->base())) {
|
||||
} else if (ClassOrNamespace *binding = lookupType(q->base())) {
|
||||
result = binding->find(q->name());
|
||||
|
||||
QList<const Name *> fullName;
|
||||
@@ -864,7 +863,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
|
||||
if (ClassOrNamespace *e = nestedType(name, origin))
|
||||
return e;
|
||||
|
||||
else if (_templateId) {
|
||||
if (_templateId) {
|
||||
if (_usings.size() == 1) {
|
||||
ClassOrNamespace *delegate = _usings.first();
|
||||
|
||||
@@ -1265,8 +1264,7 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c
|
||||
if (Declaration *declaration = memberAsSymbol->asDeclaration()) {
|
||||
if (containsTemplateType(declaration))
|
||||
return true;
|
||||
}
|
||||
else if (Function *function = memberAsSymbol->asFunction()) {
|
||||
} else if (Function *function = memberAsSymbol->asFunction()) {
|
||||
if (containsTemplateType(function))
|
||||
return true;
|
||||
}
|
||||
@@ -1447,7 +1445,7 @@ void CreateBindings::process(Document::Ptr doc)
|
||||
if (! doc)
|
||||
return;
|
||||
|
||||
else if (Namespace *globalNamespace = doc->globalNamespace()) {
|
||||
if (Namespace *globalNamespace = doc->globalNamespace()) {
|
||||
if (! _processed.contains(globalNamespace)) {
|
||||
_processed.insert(globalNamespace);
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &tc) const
|
||||
if (current.is(T_EOF_SYMBOL))
|
||||
break;
|
||||
|
||||
else if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) {
|
||||
if (current.is(T_CLASS) || current.is(T_STRUCT) || current.is(T_UNION) || current.is(T_ENUM)) {
|
||||
// found a class key.
|
||||
QString str = QLatin1String("};");
|
||||
|
||||
|
||||
@@ -170,8 +170,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[2] == 'F') {
|
||||
} else if (s[2] == 'F') {
|
||||
if (s[3] == 'I') {
|
||||
if (s[4] == 'L') {
|
||||
if (s[5] == 'E') {
|
||||
@@ -183,8 +182,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[2] == 'L') {
|
||||
} else if (s[2] == 'L') {
|
||||
if (s[3] == 'I') {
|
||||
if (s[4] == 'N') {
|
||||
if (s[5] == 'E') {
|
||||
@@ -196,8 +194,7 @@ bool Environment::isBuiltinMacro(const ByteArrayRef &s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s[2] == 'T') {
|
||||
} else if (s[2] == 'T') {
|
||||
if (s[3] == 'I') {
|
||||
if (s[4] == 'M') {
|
||||
if (s[5] == 'E') {
|
||||
|
||||
@@ -576,16 +576,14 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
|
||||
if (n == 0) {
|
||||
item.setType(newType);
|
||||
item.setScope(typeItems[n].scope());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
LookupItem newItem(item);
|
||||
newItem.setType(newType);
|
||||
newItem.setScope(typeItems[n].scope());
|
||||
newCandidates.push_back(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
item.setType(item.declaration()->type());
|
||||
item.setScope(item.declaration()->enclosingScope());
|
||||
}
|
||||
|
||||
@@ -1862,12 +1862,11 @@ void Preprocessor::handleElseDirective(PPToken *tk, const PPToken £Token)
|
||||
else if (m_client && !wasSkipping && startSkipping)
|
||||
startSkippingBlocks(poundToken);
|
||||
}
|
||||
}
|
||||
#ifndef NO_DEBUG
|
||||
else {
|
||||
} else {
|
||||
std::cerr << "*** WARNING #else without #if" << std::endl;
|
||||
}
|
||||
#endif // NO_DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken £Token)
|
||||
@@ -1930,12 +1929,11 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk)
|
||||
startSkippingBlocks(*tk);
|
||||
|
||||
lex(tk); // consume the identifier
|
||||
}
|
||||
#ifndef NO_DEBUG
|
||||
else {
|
||||
} else {
|
||||
std::cerr << "*** WARNING #ifdef without identifier" << std::endl;
|
||||
}
|
||||
#endif // NO_DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
void Preprocessor::handleUndefDirective(PPToken *tk)
|
||||
@@ -1948,12 +1946,11 @@ void Preprocessor::handleUndefDirective(PPToken *tk)
|
||||
if (m_client && macro)
|
||||
m_client->macroAdded(*macro);
|
||||
lex(tk); // consume macro name
|
||||
}
|
||||
#ifndef NO_DEBUG
|
||||
else {
|
||||
} else {
|
||||
std::cerr << "*** WARNING #undef without identifier" << std::endl;
|
||||
}
|
||||
#endif // NO_DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
PPToken Preprocessor::generateToken(enum Kind kind,
|
||||
|
||||
@@ -259,13 +259,13 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
|
||||
lines = 0;
|
||||
|
||||
while (__first != __last) {
|
||||
if (!depth && (*__first == ')' || *__first == ','))
|
||||
if (!depth && (*__first == ')' || *__first == ',')) {
|
||||
break;
|
||||
else if (*__first == '(')
|
||||
} else if (*__first == '(') {
|
||||
++depth, ++__first;
|
||||
else if (*__first == ')')
|
||||
} else if (*__first == ')') {
|
||||
--depth, ++__first;
|
||||
else if (*__first == '\"') {
|
||||
} else if (*__first == '\"') {
|
||||
__first = skip_string_literal (__first, __last);
|
||||
lines += skip_string_literal.lines;
|
||||
} else if (*__first == '\'') {
|
||||
@@ -283,8 +283,9 @@ const char *pp_skip_argument::operator () (const char *__first, const char *__la
|
||||
} else if (*__first == '\n') {
|
||||
++__first;
|
||||
++lines;
|
||||
} else
|
||||
} else {
|
||||
++__first;
|
||||
}
|
||||
}
|
||||
|
||||
return __first;
|
||||
|
||||
Reference in New Issue
Block a user