This is an archive of the discontinued LLVM Phabricator instance.

[Remark] Overload `<<` for Remark, RemarkType and RemarkLocation.
ClosedPublic

Authored by zjaffal on Jul 12 2023, 2:48 AM.

Details

Summary

Represent different remark concepts as strings by overloading the <<
operator.

Diff Detail

Event Timeline

zjaffal created this revision.Jul 12 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 2:48 AM
zjaffal requested review of this revision.Jul 12 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 2:48 AM
JDevlieghere added inline comments.Jul 12 2023, 5:39 PM
llvm/include/llvm/Remarks/Remark.h
38

Doesn't look like you need the grouping here. Similar comment below.

73–90

Given that there are all string literals, this function should return a StringRef and avoid the std::string allocation.

bulbazord added inline comments.
llvm/include/llvm/Remarks/Remark.h
73–90

+1

llvm/lib/Remarks/Remark.cpp
30–31

No need for the additional allocation, you can send StringRefs to raw_ostreams.

35
42–43
zjaffal updated this revision to Diff 539888.Jul 13 2023, 1:17 AM
  1. Change std::string references to StringRef
thegameg accepted this revision.Jul 17 2023, 3:16 AM
thegameg added inline comments.
llvm/lib/Remarks/Remark.cpp
30

I suggest Line and Column, the difference is not that big.

39

Name and Type? Remove Remark from the keys.

This revision is now accepted and ready to land.Jul 17 2023, 3:16 AM