Skip to content

Commit 7e522b2

Browse files
committed
Simplify LLVMRustModuleCost()
1 parent 493c29d commit 7e522b2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/rustllvm/RustWrapper.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -1428,11 +1428,6 @@ LLVMRustModuleBufferLen(const LLVMRustModuleBuffer *Buffer) {
14281428

14291429
extern "C" uint64_t
14301430
LLVMRustModuleCost(LLVMModuleRef M) {
1431-
Module &Mod = *unwrap(M);
1432-
uint64_t cost = 0;
1433-
for (auto &F : Mod.functions()) {
1434-
(void)F;
1435-
cost += 1;
1436-
}
1437-
return cost;
1431+
auto f = unwrap(M)->functions();
1432+
return std::distance(std::begin(f), std::end(f));
14381433
}

0 commit comments

Comments
 (0)