[llvm-dev] TableGen !find operator

Paul C. Anagnostopoulos via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 23 11:01:56 PDT 2021


I've implemented the !find operator for TableGen.

    !find(source_string, target_string [, start-pos])

It returns the position of the target_string in the source_string. The 
question is: What should it return if the there is no match?

std::string::find() returns npos, which is ~size_t 
<https://llvm.org/doxygen/classsize__t.html>(0). TableGen's integers are 
signed. So it could return -1, or it could return the maximum positive 
signed integer. Or, it could break with tradition and return the length 
of the source_string. The easiest thing to test for is -1.

Opinions, please.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210423/8a90fb5b/attachment.html>


More information about the llvm-dev mailing list