History log of /llvm-project/clang/lib/Format/NamespaceEndCommentsFixer.cpp (Results 1 – 25 of 41)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3
# b2082a98 20-Mar-2024 Owen Pan <owenpiano@gmail.com>

Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"

This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See
github.com/llvm/llvm-project/commit/b92d6dd704d7#com

Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"

This reverts commit b92d6dd704d789240685a336ad8b25a9f381b4cc. See
github.com/llvm/llvm-project/commit/b92d6dd704d7#commitcomment-139992444

We should use a tool like Visual Studio to clean up the headers.

show more ...


Revision tags: llvmorg-18.1.2
# b92d6dd7 17-Mar-2024 Owen Pan <owenpiano@gmail.com>

[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# 151d0a4d 29-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Handle __attribute/__declspec/AttributeMacro consistently (#67518)


# f2c97ffe 26-Sep-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Fix a bug in NamespaceEndCommentsFixer (#67422)

Fixed #67407.


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 063c42e9 10-Aug-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Handle NamespaceMacro string arg for FixNamespaceComments

Fixes #63795.

Differential Revision: https://reviews.llvm.org/D157568


Revision tags: llvmorg-17.0.0-rc2
# 2b8542ce 06-Aug-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Correctly count annoated lines of a namespace body

Fixes #63882.

Differential Revision: https://reviews.llvm.org/D157244


Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init
# 2f6b2daf 23-Jul-2023 Owen Pan <owenpiano@gmail.com>

[clang-format] Insert namespace comments with leading spaces

Insert missing namespace comments with SpacesBeforeTrailingComments
leading spaces.

Fixes #64051.

Differential Revision: https://review

[clang-format] Insert namespace comments with leading spaces

Insert missing namespace comments with SpacesBeforeTrailingComments
leading spaces.

Fixes #64051.

Differential Revision: https://reviews.llvm.org/D156065

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# d54c4df3 09-Mar-2022 Zequan Wu <zequanwu@google.com>

[clang-format] Fix namespace format when the name is followed by a macro

Example:
```
$ cat a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}

$ clang-format a.cpp
na

[clang-format] Fix namespace format when the name is followed by a macro

Example:
```
$ cat a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}

$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeahAPI_AVAILABLE(macos(10.15))
```
After:
```
$ clang-format a.cpp
namespace my_namespace::yeah API_AVAILABLE(macos(10.15)) {
void test() {}
}// namespace my_namespace::yeah
```

Reviewed By: MyDeveloperDay, owenpan, curdeius

Differential Revision: https://reviews.llvm.org/D121269

show more ...


# be570576 03-Mar-2022 Zequan Wu <zequanwu@google.com>

[clang-format] fix namepsace format when the name is macro expansion

Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.

[clang-format] fix namepsace format when the name is macro expansion

Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.
- It fixed the namepsace end comments.

Differential Revision: https://reviews.llvm.org/D120931

show more ...


Revision tags: llvmorg-14.0.0-rc2
# 7d5062c6 12-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Remove unnecessary parentheses in return statements. NFC.


Revision tags: llvmorg-14.0.0-rc1
# d079995d 02-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Elide unnecessary braces. NFC.


Revision tags: llvmorg-15-init
# 545317cb 01-Feb-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use ranged for loops. NFC.


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 717cd16e 14-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Fix namespace end comments fixer with anonymous namespaces.

Previously, a strange trailing comment was produced:
```
namespace out { namespace {
}} // namespace out::
```
(mind the "o

[clang-format] Fix namespace end comments fixer with anonymous namespaces.

Previously, a strange trailing comment was produced:
```
namespace out { namespace {
}} // namespace out::
```
(mind the "out::").

Reviewed By: MyDeveloperDay, owenpan

Differential Revision: https://reviews.llvm.org/D117289

show more ...


Revision tags: llvmorg-13.0.1-rc2
# 359b4e6c 07-Jan-2022 Marek Kurdej <marek.kurdej+llvm.org@gmail.com>

[clang-format] Use prefix increment and decrement. NFC.


# 0542d152 26-Dec-2021 Kazu Hirata <kazu@google.com>

Remove redundant string initialization (NFC)

Identified with readability-redundant-string-init.


# 6482383e 14-Dec-2021 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] FixNamespaceComments does not understand namespace aliases

https://github.com/llvm/llvm-project/issues/35876

Ensure a namespace alias doesn't get incorrectly identifier as a namespac

[clang-format] FixNamespaceComments does not understand namespace aliases

https://github.com/llvm/llvm-project/issues/35876

Ensure a namespace alias doesn't get incorrectly identifier as a namespace

Reviewed By: HazardyKnusperkeks, curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D115647

Fixes: #35876

show more ...


Revision tags: llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3
# 6ca52815 01-Mar-2021 Krystian Kuzniarek <krystian.kuzniarek@gmail.com>

[clang-format][PR47290] Add ShortNamespaceLines format option

clang-format documentation states that having enabled
FixNamespaceComments one may expect below code:

c++
namespace a {
foo();
}

to be

[clang-format][PR47290] Add ShortNamespaceLines format option

clang-format documentation states that having enabled
FixNamespaceComments one may expect below code:

c++
namespace a {
foo();
}

to be turned into:

c++
namespace a {
foo();
} // namespace a

In reality, no "// namespace a" was added. The problem was too high
value of kShortNamespaceMaxLines, which is used while deciding whether
a namespace is long enough to be formatted.

As with 9163fe2, clang-format idempotence is preserved.

Differential Revision: https://reviews.llvm.org/D87587

show more ...


Revision tags: llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3
# 772eb24e 29-Jan-2021 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Add option to control the spaces in a line comment

Differential Revision: https://reviews.llvm.org/D92257


# 4ad41f1d 29-Jan-2021 Björn Schäpers <bjoern@hazardy.de>

Revert "[clang-format] Add option to control the spaces in a line comment"

This reverts commit 078f30e04d1fcb5a05d8e340f3178f3478075541.


Revision tags: llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1
# 078f30e0 26-Dec-2020 Björn Schäpers <bjoern@hazardy.de>

[clang-format] Add option to control the spaces in a line comment

Differential Revision: https://reviews.llvm.org/D92257


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2
# 50bdd607 30-May-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR46130] When editing a file with unbalance {} the namespace comment fixer can incorrectly comment the wrong closing brace

Summary:
https://bugs.llvm.org/show_bug.cgi?id=46130 from

[clang-format] [PR46130] When editing a file with unbalance {} the namespace comment fixer can incorrectly comment the wrong closing brace

Summary:
https://bugs.llvm.org/show_bug.cgi?id=46130 from Twitter https://twitter.com/ikautak/status/1265998988232159232

I have seen this myself many times.. if you have format on save and you work in an editor where you are constantly saving (:w muscle memory)

If you are in the middle of editing and somehow you've missed a { or } in your code, somewhere, often way below where you are at the bottom of your file the namespace comment fixer will have put the namespace on the previous closing brace.

This leads to you having to fix up the bottom of the file.

This revision prevents that happening by performing an initial pass of the tokens and simply counting the number of `{` and `}` and ensuring they balance.

If they don't balance we don't do any namespace fixing as it will likely be unstable and incorrect.

Reviewed By: curdeius

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D80830

show more ...


Revision tags: llvmorg-10.0.1-rc1
# e8ea35e6 15-May-2020 mydeveloperday <mydeveloperday@gmail.com>

[clang-format] [PR44345] Long namespace closing comment is duplicated endlessly

Summary:
https://bugs.llvm.org/show_bug.cgi?id=44345

When namespaces get long the namespace end comment wraps onto th

[clang-format] [PR44345] Long namespace closing comment is duplicated endlessly

Summary:
https://bugs.llvm.org/show_bug.cgi?id=44345

When namespaces get long the namespace end comment wraps onto the next line

```
namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
went::mad::now {
void foo();
void bar();
} // namespace
// would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
```

If clang-format it applied successively it will duplicate the end comment

```
namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
went::mad::now {
void foo();
void bar();
} // namespace
// would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
// would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
```

This revision checks to ensure the end comment is not on the next line before adding yet another comment

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79935

show more ...


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1
# b81cc603 19-Nov-2019 Thomas Preud'homme <thomasp@graphcore.ai>

[clang][NFC] Make various uses of Regex const

The const-correctness of match() was fixed in rL372764, which allows
uses of Regex objects to be const in cases they couldn't be before. This
patch tigh

[clang][NFC] Make various uses of Regex const

The const-correctness of match() was fixed in rL372764, which allows
uses of Regex objects to be const in cases they couldn't be before. This
patch tightens up the const-ness of Regex in various such cases.

Reviewers: thopre

Reviewed By: thopre

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68155

show more ...


Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1
# 37944130 23-Jul-2019 Nico Weber <nicolasweber@gmx.de>

clang-format: Fix namespace end comments for namespaces with attributes and macros.

Fixes PR39247.

While here, also make C++20 `namespace A::inline B::inline C` nested
inline namespaced definitions

clang-format: Fix namespace end comments for namespaces with attributes and macros.

Fixes PR39247.

While here, also make C++20 `namespace A::inline B::inline C` nested
inline namespaced definitions work.

Before:
#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
void f() {}
} // namespace DEPRECATE_WOOFwoof

namespace [[deprecated("meow")]] woof {
void f() {}
} // namespace [[deprecated("meow")]]woof

namespace woof::inline bark {
void f() {}
} // namespace woof::inlinebark

Now:
#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
void f() {}
} // namespace woof

namespace [[deprecated("meow")]] woof {
void f() {}
} // namespace woof

namespace woof::inline bark {
void f() {}
} // namespace woof::inline bark

(In addition to the fixed namespace end comments, also note the correct
indent of the namespace contents.)

Differential Revision: https://reviews.llvm.org/D65125

llvm-svn: 366831

show more ...


Revision tags: llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2
# e8a301f8 06-Jun-2019 Francois Ferrand <thetypz@gmail.com>

clang-format: better handle namespace macros

Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittes

clang-format: better handle namespace macros

Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittest-cpp's SUITE macro:

TESTSUITE(Foo) {
TEST(MyFirstTest) {
assert(0);
}
} // TESTSUITE(Foo)

This patch deals with this cases by introducing a new option to specify
lists of namespace macros. Internally, it re-uses the system already in
place for foreach and statement macros, to ensure there is no impact on
performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: acoomans, cfe-commits, klimek

Tags: #clang

Differential Revision: https://reviews.llvm.org/D37813

llvm-svn: 362740

show more ...


12