LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 16157 - Globals now formatted surprsingly
Summary: Globals now formatted surprsingly
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-27 15:53 PDT by Tobias Grosser
Modified: 2013-06-28 12:29 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Grosser 2013-05-27 15:53:00 PDT
Hi,

clang-format now formats the following code differently:

This:

static cl::opt<bool>
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<bool>
    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
Comment 1 Reid Kleckner 2013-06-14 15:00:54 PDT
From my current change, clang-format is doing this too:

-  virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
-                                     ArgStringList &CmdArgs) const = 0;
-
+  virtual void
+      AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
+                            llvm::opt::ArgStringList &CmdArgs) const = 0;
+
Comment 2 Rafael Ávila de Espíndola 2013-06-27 16:10:23 PDT
I just hit this bug. We try to format:


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

as


static llvm::error_code
    createUniqueEntity(const llvm::Twine &Model, int &ResultFD,
                       llvm::SmallVectorImpl<char> &ResultPath,
                       bool MakeAbsolute, unsigned Mode, FSEntity Type);
Comment 3 Tobias Grosser 2013-06-28 12:29:28 PDT
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.