[PATCH] D81916: [analyzer] Fix StdLibraryFunctionsChecker crash on macOS

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 06:04:10 PDT 2020


martong added a comment.

In D81916#2095106 <https://reviews.llvm.org/D81916#2095106>, @NoQ wrote:

> Thanks!
>
> @martong, thoughts on this? :)
>
> Also i guess in this test we're unable to obtain the value for `EOF`, what would be a good fixme-test to demonstrate that?


I accept this as a very quick fix, but this seems to be an error rather in ASTReader and ASTWriter. And this could affect other modules related logic in macOS, not just the CSA. I wouldn't be surprised if LLDB develeopers were the next to struggle with the same ASTReader/Writer issue.



================
Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:131
   const Token &T = FilteredTokens.back();
-  if (!T.isLiteral())
+  if (!T.isLiteral() || !T.getLiteralData())
     return llvm::None;
----------------
Could you please add a FIXME above the line with the real reasons: "EOF macro token coming from a PCH file on macOS while marked as literal,
doesn't contain any literal data."


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81916





More information about the cfe-commits mailing list