Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C-based parsers,style: adjust placements of "{" after if #3706

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions parsers/c-based.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,8 @@ static bool findScopeHierarchy (vString *const string, const statementInfo *cons
{
if (s->declaration == DECL_PRIVATE ||
s->declaration == DECL_PROTECTED ||
s->declaration == DECL_PUBLIC) {
s->declaration == DECL_PUBLIC)
{
continue;
}

Expand Down Expand Up @@ -1757,11 +1758,13 @@ static void setAccess (statementInfo *const st, const accessType access)
st->member.access = access;
cppUngetc (c);
}
else if (c == ':') {
else if (c == ':')
{
reinitStatement (st, false);
st->member.accessDefault = access;
}
else {
else
{
cppUngetc (c);
}
}
Expand Down Expand Up @@ -2177,12 +2180,15 @@ static void analyzePostParens (statementInfo *const st, parenInfo *const info)
cppUngetc (c);
if (isOneOf (c, "{;,="))
;
else if (isInputLanguage (Lang_java)) {

if (!insideAnnotationBody(st)) {
else if (isInputLanguage (Lang_java))
{
if (!insideAnnotationBody(st))
{
skipJavaThrows (st);
}
} else {
}
else
{
if (! skipPostArgumentStuff (st, info))
{
verbose (
Expand All @@ -2201,19 +2207,27 @@ static bool languageSupportsGenerics (void)
static void processAngleBracket (void)
{
int c = cppGetc ();
if (c == '>') {
if (c == '>')
{
/* already found match for template */
} else if (languageSupportsGenerics () && c != '<' && c != '=') {
}
else if (languageSupportsGenerics () && c != '<' && c != '=')
{
/* this is a template */
cppUngetc (c);
skipToMatch ("<>");
} else if (c == '<') {
}
else if (c == '<')
{
/* skip "<<" or "<<=". */
c = cppGetc ();
if (c != '=') {
if (c != '=')
{
cppUngetc (c);
}
} else {
}
else
{
cppUngetc (c);
}
}
Expand Down Expand Up @@ -2650,7 +2664,8 @@ static void parseGeneralToken (statementInfo *const st, const int c)
{
parseAtMarkStyleAnnotation (st);
}
else if (c == STRING_SYMBOL) {
else if (c == STRING_SYMBOL)
{
setToken(st, TOKEN_NONE);
}
}
Expand Down Expand Up @@ -2830,7 +2845,8 @@ static int tagCheck (statementInfo *const st)
{
if (st->declaration == DECL_TEMPLATE)
corkIndex = qualifyBlockTag (st, prev2);
else if (st->declaration == DECL_FUNCTION_TEMPLATE) {
else if (st->declaration == DECL_FUNCTION_TEMPLATE)
{
corkIndex = qualifyFunctionTag (st, st->blockName);
}
else if (st->haveQualifyingName)
Expand Down Expand Up @@ -2875,8 +2891,8 @@ static int tagCheck (statementInfo *const st)
break;

case TOKEN_KEYWORD:

if (token->keyword == KEYWORD_DEFAULT && isType(prev, TOKEN_ARGS) && insideAnnotationBody(st)) {
if (token->keyword == KEYWORD_DEFAULT && isType(prev, TOKEN_ARGS) && insideAnnotationBody(st))
{
corkIndex = qualifyFunctionDeclTag(st, prev2);
}
break;
Expand Down