[PATCH] D38943: [ASTImporter] import SubStmt of CaseStmt

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 01:27:04 PDT 2018


martong added inline comments.


================
Comment at: cfe/trunk/unittests/AST/ASTImporterTest.cpp:100
 
+  // This traverses the AST to catch certain bugs like poorly or not
+  // implemented subtrees.
----------------
r.stahl wrote:
> a.sidorin wrote:
> > I just saw this change and I cannot find the reason, why do we need to print the imported declaration after we have printed the entire translation unit? Is there some special case?
> Sorry for the late reply.
> 
> The particular bug here would only be detected when dumping, but not when printing. The output of printing was just not listing the missing AST nodes, but dumping crashed and therefore failed the test as expected.
> 
> I'm not familiar with the inner workings of print and dump, so I cannot explain why that is.
I have a rough guess that this might be because the code buffer that is used in `vfs::InMemoryFileSystem` has a reference to the actual code string. That actual code string is a string literal in most of the cases which should be in the data segment, but there is no guarantee for that. E.g. some optimizing compilers might put it onto the stack.
We experienced a similar issue during building a test Fixture (https://reviews.llvm.org/D43967).

What I suggest is to build the `ASTTests` target with asan and ubsan enabled (set LLVM_USE_SANITIZER for cmake) and trigger the dump which caused the bug.


Repository:
  rL LLVM

https://reviews.llvm.org/D38943





More information about the cfe-commits mailing list