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 17536 - clang-format incorrectly formats long comments with preprocessor
Summary: clang-format incorrectly formats long comments with preprocessor
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Alexander Kornienko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 09:04 PDT by Michail Pishchagin
Modified: 2013-11-12 11:54 PST (History)
3 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 Michail Pishchagin 2013-10-10 09:04:22 PDT
I'm on Clang r192347.

mblsha@siruba-retina ~> cat clang-format-test.cc 
#ifdef ZOMFG //Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
int a;
#endif
 
mblsha@siruba-retina ~> ~/src/clang-llvm/build-release/bin/clang-format --style=Chromium clang-format-test.cc 
#ifdef ZOMFG  // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed          \
              // do eiusmod tempor incididunt ut labore et dolore magna \
              // aliqua.
int a;
#endif

If '\' are required for preprocessor lines, then they're not correctly aligned.
Comment 1 Michail Pishchagin 2013-10-10 09:05:21 PDT
And the first '\' breaks the 80-column limit.
Comment 2 Alexander Kornienko 2013-11-12 11:54:33 PST
Fixed in r194491.