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

[clang-format] Different formatted output can be produced from varying whitespace #48235

Closed
PiJoules opened this issue Jan 26, 2021 · 4 comments
Labels
bugzilla Issues migrated from bugzilla clang-format

Comments

@PiJoules
Copy link
Contributor

Bugzilla Link 48891
Resolution FIXED
Resolved on Jan 29, 2021 21:57
Version trunk
OS All
Blocks #48246
CC @mkurdej,@mydeveloperday,@tstellar
Fixed by commit(s) e3713f1 0a32d93

Extended Description

As of https://reviews.llvm.org/D93839, clang-format can produce different formatted files depending on amount of whitespace. For example, given (A):

#include <stdint.h>
namespace fuzzing {}

clang-format with this patch would produced (B):

#include <stdint.h>
namespace fuzzing {
}

but given (C):

#include <stdint.h>
namespace fuzzing {


}

would be formatted to (D):

#include <stdint.h>
namespace fuzzing {

}

The invocation specifically is clang-format --style=google file. Prior to this patch, both inputs (A/C) would give the same output:

#include <stdint.h>
namespace fuzzing {}

This seems to be unintended behavior that should be fixed. This doesn't seem to occur if #include "stdint.h" is used.

@mkurdej
Copy link
Member

mkurdej commented Jan 27, 2021

@mkurdej
Copy link
Member

mkurdej commented Jan 28, 2021

Reopening until it gets merged into 12.x.

@tstellar
Copy link
Collaborator

Merged: 0a32d93

@tstellar
Copy link
Collaborator

mentioned in issue #48246

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-format
Projects
None yet
Development

No branches or pull requests

3 participants