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 26274 - google-readability-namespace-comments check does the wrong thing for macro id tokens on closing namespace
Summary: google-readability-namespace-comments check does the wrong thing for macro id...
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Alexander Kornienko
URL:
Keywords: beginner
Depends on:
Blocks:
 
Reported: 2016-01-23 11:27 PST by Nico Weber
Modified: 2019-12-06 01:12 PST (History)
6 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 Nico Weber 2016-01-23 11:27:25 PST
Consider:

#define MY_NAMESPACE foo

namespace MY_NAMESPACE {
}  // namespace MY_NAMESPACE

clang-tidy wants to change the last line to `}  // namespace foo`.  It shouldn't. (Fix: If the namespace name is a macro token, check if the macro name matches what's in the closing comment, and don't change that if so.)

https://codereview.chromium.org/1629693002/diff/1/base/containers/hash_tables.h
Comment 1 Marcin Twardak 2019-11-25 11:47:11 PST
It was fixed in commit:

4736d63f752f8d13f4c6a9afd558565c32119718

Review can be found here:

https://reviews.llvm.org/D69855

I will close this bug now.
Comment 2 Alexander Kornienko 2019-12-03 11:36:26 PST
Reverted 4736d63f752f8d13f4c6a9afd558565c32119718, because it introduces false positives. Sent out an alternative fix: https://reviews.llvm.org/D70974
Comment 3 Alexander Kornienko 2019-12-06 01:12:57 PST
The new fix has landed in commit fac4e3c5f8a018599cbd9363a735b1c13e8f8a05.