[PATCH] D148757: [clang] Follow user-provided order for prefix map

Gulfem Savrun Yeniceri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 20:01:07 PDT 2023


gulfem added a comment.

I compared Clang and GCC behavior.
**1) Following user-specified prefix mapping order**
GCC uses a linked list to store the prefix mappings, so it applies the prefix mappings based on the user-provided order.
https://github.com/gcc-mirror/gcc/blob/master/gcc/file-prefix-map.cc#L27
Whereas, Clang currently uses an `std::map`, which does **NOT** follow user-provided order.  So, Clang and GCC behavior do not match on that.

**2) Applying multiple prefix mappings**
Both Clang and GCC apply the first matching prefix mapping, and does not apply the following prefix mappings. So, they are consistent in that.

https://github.com/gcc-mirror/gcc/blob/master/gcc/file-prefix-map.cc#L88
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CoverageMappingGen.cpp#L1653


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148757/new/

https://reviews.llvm.org/D148757



More information about the cfe-commits mailing list