This is an archive of the discontinued LLVM Phabricator instance.

Update .clang-tidy to drop static -> anonymous namespace warnings
ClosedPublic

Authored by bondhugula on Apr 23 2023, 5:38 AM.

Details

Summary

This gets rid of numerous clang-tidy warnings in editor environments
along:

... declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]

The MLIR style has been to use 'static' for free-standing functions and
this appears in line with https://llvm.org/docs/CodingStandards.html#namespace-indentation

In any case, these warnings completely pollute/mess up in-editor
diagnostics (for eg. vim with YCM would show all these clang-tidy
warnings making real ones nearly invisible).

Diff Detail

Event Timeline

bondhugula created this revision.Apr 23 2023, 5:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2023, 5:38 AM
bondhugula requested review of this revision.Apr 23 2023, 5:38 AM

Fix spacing.

ftynse accepted this revision.Apr 23 2023, 5:39 AM
ftynse added a subscriber: ftynse.

Thanks, these are quite annoying!

This revision is now accepted and ready to land.Apr 23 2023, 5:39 AM

Fix syntax.

Seems like it could one at the top-level? Actually not even clear why clang-tidy has this warning enabled in the LLVM config?

mehdi_amini added a comment.EditedApr 23 2023, 1:04 PM

Seems like not unusual that we hit this kind of issues: https://reviews.llvm.org/D131414 ; please move it on level above :)

+1, I don't know why anyone would prefer anon namespaces to static where static works.

bondhugula closed this revision.May 26 2023, 8:22 PM

I thought I had committed this, but it looks like I missed it, and someone added this to LLVM's .clang-tidy in the meanwhile (on May 2)! Closing.