[PATCH] D132763: [clang][dataflow] Use `StringMap` for storing analysis states at annotated points instead of `vector<pair<string, StateT>>`.

weiyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 04:55:36 PDT 2022


wyt added inline comments.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:363-365
+        std::sort(AnnotationStatesAsVector.begin(),
+                  AnnotationStatesAsVector.end(),
+                  [](auto a, auto b) { return a.first < b.first; });
----------------
gribozavr2 wrote:
> Please use llvm::sort. You also don't need to specify the comparator, the default comparator for strings is exactly the same.
> 
> 
Used llvm::sort.

The default comparator for pairs also tries to compare the second field which is undefined for DataflowAnalysisState. And considering that annotations are unique here, it should be sufficient to just compare the strings here - hence the specified comparator that just checks the first of the pair.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132763



More information about the cfe-commits mailing list