llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.65k stars 11.84k forks source link

Globals now formatted surprsingly #16532

Closed tobiasgrosser closed 11 years ago

tobiasgrosser commented 11 years ago
Bugzilla Link 16157
Resolution FIXED
Resolved on Jun 28, 2013 12:29
Version unspecified
OS Linux
CC @rnk

Extended Description

Hi,

clang-format now formats the following code differently:

This:

static cl::opt ValueDependences("polly-value-dependences", cl::desc("Use value instead of memory based dependences"), cl::Hidden, cl::init(true), cl::cat(PollyCategory));

became:

static cl::opt ValueDependences("polly-value-dependences", cl::desc("Use value instead of memory based dependences"), cl::Hidden, cl::init(true), cl::cat(PollyCategory));

I can see the reasoning behind this, but a quick grep 'grep -R cl::opt -A 2 lib/' does not show a single use of this in LLVM whereas the first one is very common. I believe this change should be disabled in the LLVM style

tobiasgrosser commented 11 years ago

In fact, this bug was fixed by Manuel a week ago:

commit 65972bc4e59c64ade6a5f2efffc0764144e809f5 Author: Manuel Klimek klimek@google.com Date: Fri Jun 21 17:25:42 2013 +0000

Add an option to not indent declarations when breaking after the type.

Make that option the default for LLVM style.

I get the right behavior with the latest version of clang. Rafael, if this does not work for you after updating clang, please reopen the bug.

llvmbot commented 11 years ago

I just hit this bug. We try to format:

static llvm::error_code createUniqueEntity(const llvm::Twine &Model, int &ResultFD, llvm::SmallVectorImpl &ResultPath, bool MakeAbsolute, unsigned Mode, FSEntity Type);

as

static llvm::error_code createUniqueEntity(const llvm::Twine &Model, int &ResultFD, llvm::SmallVectorImpl &ResultPath, bool MakeAbsolute, unsigned Mode, FSEntity Type);

rnk commented 11 years ago

From my current change, clang-format is doing this too: