This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] update documentation
ClosedPublic

Authored by mrexodia on Apr 1 2017, 4:53 PM.

Details

Summary
  • Added example code for BreakStringLiterals;

Diff Detail

Event Timeline

mrexodia created this revision.Apr 1 2017, 4:53 PM
mrexodia updated this revision to Diff 93763.Apr 1 2017, 4:56 PM
mrexodia added reviewers: djasper, klimek.
djasper edited edge metadata.Apr 1 2017, 11:36 PM

This file is auto-generated from include/clang/format/Format.h. Changes need to be made there and then this files needs to be regenerated with docs/tools/dump_format_style.py. Sorry, we probably need to make that more obvious.

mrexodia updated this revision to Diff 93818.Apr 2 2017, 4:58 PM

This file is auto-generated from include/clang/format/Format.h. Changes need to be made there and then this files needs to be regenerated with docs/tools/dump_format_style.py. Sorry, we probably need to make that more obvious.

Alright, I moved my changes to the source code.

MyDeveloperDay added a project: Restricted Project.Oct 6 2019, 12:12 PM
MyDeveloperDay requested changes to this revision.Oct 6 2019, 12:36 PM
MyDeveloperDay added a subscriber: MyDeveloperDay.

@mrexodia, Thank you for this patch, I'm sorry you've had no response, I'm trying to go through some of the old reviews.

This revision needs rebasing, at least some of the changes have been already made, and I'm not sure about the Mozilla Bracing Style is quite right, but your other examples will help to improve the documentation.

include/clang/Format/Format.h
447 ↗(On Diff #93818)

Are you sure this is correct? I tried a small example and didn't get this

This revision now requires changes to proceed.Oct 6 2019, 12:36 PM

If I'm not mistaken the documentation I updated was not for BS_Mozilla, but for BS_Stroustrup. It's been a very long time though so I absolutely don't remember unfortunately.

I tried that too

---
Language: Cpp
BreakBeforeBraces: Stroustrup
...

But I don't seem to get the style for that either, maybe I did something wrong?

try {
  foo();
}
catch () {
}
void foo() { bar(); }
class foo {
};
if (foo()) {
}
else {
}

Looking here https://en.wikipedia.org/wiki/Indentation_style#Variant:_Stroustrup I think the original document wasn't quite correct its the "cuddled" catch and else that the Stroustrup style doesn't have

i.e.

}
else {

rather than

} else {

Okay I remember what happened now. In the past Allman and Stroustroup had the same documentation (Allman being incorrect), so I updated the documentation for Allman, but by accident I updated the documentation for Stroustroup instead. Anyway I went over the changes and will upload a new diff with the ones that are still relevant today.

mrexodia updated this revision to Diff 223443.Oct 6 2019, 1:17 PM
mrexodia edited the summary of this revision. (Show Details)
mrexodia removed reviewers: klimek, djasper.
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2019, 1:17 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Oct 6 2019, 2:02 PM

When I land this change, I'll include the ClangFormatStyleOptions.rst to match (plus some minor NFC) in Format.h that are preventing dump_format_style.py from being rerun

in a later commit I'll try and bring the Format.h and ClangFormaatStyleOptions.rst back into line

This revision was automatically updated to reflect the committed changes.