mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-30 13:47:32 +00:00
969e7edd88
Summary: This introduces a new SourceMgr::FindLocForLineAndColumn method that uses the OffsetCache in SourceMgr::SrcBuffer to do do a constant time lookup for the line number (once the cache is populated). Use this method in MLIR's SourceMgrDiagnosticHandler::convertLocToSMLoc, replacing the O(n) scanning logic. This resolves a long standing TODO in MLIR, and makes one of my usecases go dramatically faster (which is currently producing many diagnostics in a 40MB SourceBuffer). NFC, this is just a performance speedup and cleanup. Reviewers: rriddle!, ftynse! Subscribers: hiraditya, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78868