This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Use number of unwrapped lines for short namespace
ClosedPublic

Authored by krasimir on Mar 2 2017, 1:43 AM.

Details

Summary

This patch makes the namespace comment fixer use the number of unwrapped lines
that a namespace spans to detect it that namespace is short, thus not needing
end comments to be added.
This is needed to ensure clang-format is idempotent. Previously, a short namespace
was detected by the original source code lines. This has the effect of requiring two
runs for this example:

namespace { class A; }

after first run:

namespace {
class A;
}

after second run:

namespace {
class A;
} // namespace

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Mar 2 2017, 1:43 AM
krasimir added a subscriber: cfe-commits.
djasper accepted this revision.Mar 2 2017, 1:50 AM

Please include the reasoning in the patch description, i.e. that otherwise clang-format might need to runs to add all the namespace comments.

This revision is now accepted and ready to land.Mar 2 2017, 1:50 AM
krasimir edited the summary of this revision. (Show Details)Mar 2 2017, 2:04 AM
This revision was automatically updated to reflect the committed changes.