[PATCH] D101763: [analyzer][ctu] Avoid parsing invocation list again and again during on-demand parsing of CTU

Ella Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 03:51:23 PDT 2021


OikawaKirie updated this revision to Diff 343346.
OikawaKirie added a comment.

In D101763#2741536 <https://reviews.llvm.org/D101763#2741536>, @steakhal wrote:

> Overall, it looks promising. But I don't quite get this test.
> There is no invocation yaml in the temp directory. So, you are probably not testing the right thing.
> You wanted to test if the invocation yaml exists, and could be opened **but the parsing fails**.
> You should demonstrate that when a parsing error happens, the error code has recoded and it won't try to reparse the invocation yaml again and again.

The main idea of the test case is that the mocked `open` function will dump a log every time when the invocation list file is opened to be read. If a second open operation is detected in the log, it means the list is parsed again.

As the behavior of missing the invocation list file or failing to parse it are the same (both returns the error), the previous version checks whether function `open` will be called again after a file-not-found error.
In this update, I use an empty invocation list to really trigger an `invocation_list_empty` error and check whether the invocation list file will be read again via function `open`.
Compared with the previous version, opening the invocation list will not be manually failed, and a real parsing error is triggered instead.


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

https://reviews.llvm.org/D101763

Files:
  clang/include/clang/CrossTU/CrossTranslationUnit.h
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/test/Analysis/multiple-invocation-list-parsing.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101763.343346.patch
Type: text/x-patch
Size: 4585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210506/49281e71/attachment.bin>


More information about the cfe-commits mailing list