This is an archive of the discontinued LLVM Phabricator instance.

[LLVM] Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes
ClosedPublic

Authored by Eugene.Zelenko on Mar 24 2016, 5:49 PM.

Details

Summary

Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

I checked this patch on my own build on RHEL 6. Regressions were OK.

Diff Detail

Repository
rL LLVM

Event Timeline

Eugene.Zelenko retitled this revision from to [LLVM] Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes.
Eugene.Zelenko updated this object.
Eugene.Zelenko added reviewers: hans, aaron.ballman.
Eugene.Zelenko set the repository for this revision to rL LLVM.
Eugene.Zelenko added a subscriber: llvm-commits.
mehdi_amini accepted this revision.Mar 24 2016, 6:54 PM
mehdi_amini added a reviewer: mehdi_amini.

Assuming this does not break any build, LGTM.

include/llvm-c/lto.h
766 ↗(On Diff #51623)

clang-tidy does that? Sweet

include/llvm/ADT/Statistic.h
186 ↗(On Diff #51623)

Here it is // while the previous file was /* ... */, do you know why?

include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

why do we need cstring here? (You uploaded the patch without context, which makes it hard to figure here)

This revision is now accepted and ready to land.Mar 24 2016, 6:54 PM
Eugene.Zelenko added inline comments.Mar 24 2016, 6:59 PM
include/llvm-c/lto.h
766 ↗(On Diff #51623)

I did this manually. Probably Clang-tidy llvm-header-guard could do this.

include/llvm/ADT/Statistic.h
186 ↗(On Diff #51623)

Previous file was supposed to be used in C code. This is clearly C++ one.

include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

Because of strcpy().

mehdi_amini added inline comments.Mar 24 2016, 7:03 PM
include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

Note sure if it is legit to have this in a header. This header is included in many many places!

include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

But strcpy() is used in this header.

This is whole idea of Include What You Use: to make files dependencies self-containing, so there is no need to rely on other headers.

mehdi_amini added inline comments.Mar 25 2016, 11:23 AM
include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

I'm not sure you got my point: "having the function that is using strcpy() in this header is not a good idea". Small header is better for compile time, and complicated methods can be defined in implementation file (when not templated).

include/llvm/DebugInfo/PDB/PDBTypes.h
18 ↗(On Diff #51623)

Sorry for misunderstanding.

Will be good idea to address this question to original authors. Probably the wanted to use implicit inlining (depended on optimization level).

This revision was automatically updated to reflect the committed changes.