[PATCH] D59279: [Analyzer] Checker for non-determinism caused by iteration of unordered container of pointers

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 12:37:14 PDT 2019


mgrang added a comment.

I was trying to write another checker for hashing of pointers. Basically, I wanted to match all instances where the keys of std::map are pointers. Writing an AST matcher for std::map is straightforward. However, I am not sure how to check for pointer keys after matching std::map.

The following matches std::map<K, V>. But I need to match std::map<int *, V>. So I was thinking something on the lines of templateArgument(hasType(pointerType())).

  auto ContainersM = anyOf(
                       hasName("std::map"),
                       hasName("std::unordered_map")
                     );
  
  auto HashContainerM = varDecl(hasType(cxxRecordDecl(ContainersM)))


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

https://reviews.llvm.org/D59279





More information about the cfe-commits mailing list