OSDN Git Service

Reland "[Remarks] Add a new Remark / RemarkParser abstraction"
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 19 Mar 2019 21:11:07 +0000 (21:11 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 19 Mar 2019 21:11:07 +0000 (21:11 +0000)
commitae5245f08c685d449550bd42bc6c943cabbd0632
tree7a08cfc5e21a8327edf722b3b9e60fd33d613943
parent6364ead02be1fb7fd0f6e080777bd3c1887bb00d
Reland "[Remarks] Add a new Remark / RemarkParser abstraction"

This adds a Remark class that allows us to share code when working with
remarks.

The C API has been updated to reflect this. Instead of the parser
generating C structs, it's now using a C++ object that is used through
opaque pointers in C. This gives us much more flexibility on what
changes we can make to the internal state of the object and interacts
much better with scenarios where the library is used through dlopen.

* C API updates:
  * move from C structs to opaque pointers and functions
  * the remark type is now an enum instead of a string
* unit tests updates:
  * use mostly the C++ API
  * keep one test for the C API
  * rename to YAMLRemarksParsingTest
* a typo was fixed: AnalysisFPCompute -> AnalysisFPCommute.
* a new error message was added: "expected a remark tag."
* llvm-opt-report has been updated to use the C++ parser instead of the
C API

Differential Revision: https://reviews.llvm.org/D59049

Original llvm-svn: 356491

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356519 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/llvm-c/Remarks.h
include/llvm/Remarks/Remark.h [new file with mode: 0644]
include/llvm/Remarks/RemarkParser.h [new file with mode: 0644]
lib/Remarks/CMakeLists.txt
lib/Remarks/Remark.cpp [new file with mode: 0644]
lib/Remarks/RemarkParser.cpp
lib/Remarks/RemarkParserImpl.h [new file with mode: 0644]
lib/Remarks/YAMLRemarkParser.cpp [new file with mode: 0644]
lib/Remarks/YAMLRemarkParser.h [new file with mode: 0644]
tools/llvm-opt-report/OptReport.cpp
tools/remarks-shlib/Remarks.exports
unittests/Remarks/CMakeLists.txt
unittests/Remarks/RemarksParsingTest.cpp [deleted file]
unittests/Remarks/YAMLRemarksParsingTest.cpp [new file with mode: 0644]