[PATCH] D140859: [clang][dataflow] Allow analyzing multiple functions in unit tests

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 3 03:58:33 PST 2023


ymandel accepted this revision.
ymandel added inline comments.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp:59
+    if (SM.isPointWithin(Loc, BoundingRange.getBegin(),
+                         BoundingRange.getEnd())) {
+      LineNumberToContent[SM.getPresumedLineNumber(Loc)] =
----------------
This seems subtly wrong if BoundingRange is a TokenRange. It might be ok, if a comment can't be part of a token (at least, as a prefix), but still seems conceptually wrong in that it's not quite doing what it appears. So, if token ranges are ok, I'd recommend at least explaining that in the comments.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:173
 llvm::DenseMap<unsigned, std::string>
-buildLineToAnnotationMapping(SourceManager &SM,
+buildLineToAnnotationMapping(SourceManager &SM, SourceRange BoundingRange,
                              llvm::Annotations AnnotatedCode);
----------------
please specify (in the comments) the intended interpretation of `SourceRange` -- CharRange or TokenRange -- or use `CharSourceRange`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140859



More information about the cfe-commits mailing list