Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

modernize check for static declarations in C++ code #26594

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR26595
Status NEW
Importance P enhancement
Reported by Eugene Zelenko (eugene.zelenko@gmail.com)
Reported on 2016-02-12 13:10:54 -0800
Last modified on 2017-01-17 12:05:51 -0800
Version unspecified
Hardware All All
CC alexfh@google.com, djasper@google.com, klimek@google.com, malcolm.parsons@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

I think will be good idea to have C++ check which fill detect and fix static declarations in anonymous namespaces.

Quuxplusone commented 8 years ago

I think will be good idea to extend scope of the check to also move static declarations in C++ source files into anonymous namespaces.

Quuxplusone commented 8 years ago

First part is implemented in r265384.

Quuxplusone commented 7 years ago
(In reply to comment #1)
> I think will be good idea to extend scope of the check to also move static
> declarations in C++ source files into anonymous namespaces.

LLVM's coding standards say to do the opposite.

http://llvm.org/docs/CodingStandards.html#anonymous-namespaces

"make anonymous namespaces as small as possible, and only use them for class
declarations."
Quuxplusone commented 7 years ago
(In reply to comment #3)
> (In reply to comment #1)
> > I think will be good idea to extend scope of the check to also move static
> > declarations in C++ source files into anonymous namespaces.
>
> LLVM's coding standards say to do the opposite.
>
> http://llvm.org/docs/CodingStandards.html#anonymous-namespaces
>
> "make anonymous namespaces as small as possible, and only use them for class
> declarations."

See also bug 27267.