[PATCH] D63640: [clang] Improve Serialization/Imporing of APValues

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 08:24:26 PDT 2019


martong added inline comments.


================
Comment at: clang/lib/AST/ASTImporter.cpp:8503
 
+llvm::Expected<APValue> ASTImporter::Import(const APValue &FromValue) {
+  APValue Result;
----------------
Tyker wrote:
> martong wrote:
> > Tyker wrote:
> > > martong wrote:
> > > > Looks okay, but could we have unit tests for this in ASTImporterTest.cpp?
> > > I tested importing using the same test file as serialization `clang/test/PCH/APValue.cpp` with `-ast-merge` which uses importing. this prevent duplicating the test code for importing and serializing. is the unit-test in ASTImporterTest.cpp necessary anyway ?
> > Okay, that's fine I missed that previously, so there is no need for the unit-tests in this case.
> > Though maybe the `-ast-merge` part of the test should reside in the  `clang/test/ASTMerge` directory, because that is where all the other `-ast-merge` tests are. 
> > I am not sure how to solve that nicely, because i see you use the same file for both the serialization and for the import.
> > Perhaps there should be a common header file which is included both in `test/PCH/APValue.cpp` and in `test/ASTMerge/apvalue/test.cpp`?
> > 
> > 
> we can have a common header,  but i don't know where to put it. having a in `PCH` that includes a header form `ASTMerge` seems weird and vice versa. 
Yes, that is indeed not so good.

The point is that, we should execute the APValue tests as well when we invoke `ninja check-clang-astmerge`. (Some people do not execute the whole `check-clang` verification when they change only the ASTImporter, this way the edit-test cycle can be faster)

Can we have a symbolic link from `test/PCH/APValue.cpp` to `test/ASTMerge/APValue.cpp`? Probably that would work on *nix, but not on Windows (https://stackoverflow.com/questions/5917249/git-symlinks-in-windows).
If the symlink is really not an option then I am just fine with a real copy of the file.
If we have a link or a copy then the tests will run twice, that seems ok for me, but may disturb other devs.
Actually, this is an inconvenient problem, perhaps someone had this before, so maybe a mail to cfe-dev could help us out.



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

https://reviews.llvm.org/D63640





More information about the cfe-commits mailing list