[PATCH] D62373: [ASTImporter] Store import errors for Decls

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 24 00:40:50 PDT 2019


balazske added inline comments.


================
Comment at: clang/lib/AST/ASTImporter.cpp:7851
+    if (!getImportDeclErrorIfAny(FromD)) {
+      // Error encountered for the first time.
+      // After takeError the error is not usable any more in ToDOrErr.
----------------
martong wrote:
> a_sidorin wrote:
> > Is it possible to get this error more than once?
> Yes, that can happen in cyclic imports like: ClassTemplateDecl -> TemplatedDecl -> ClassTemplateDecl.
I do not understand this completely, in this branch `setImportDeclError` is called so at next time we can not go into this branch again (for the same `FromD`). (We can get the error and not go into this branch more than once but get no error and go into the branch only once.)


================
Comment at: clang/unittests/AST/ASTImporterTest.cpp:4697
+                        DefaultTestValuesForRunOptions, );
+
 INSTANTIATE_TEST_CASE_P(ParameterizedTests, ASTImporterLookupTableTest,
----------------
a_sidorin wrote:
> #undef ERRONEOUSSTMT?
Maybe we should not use a macro for this, specially not define the macro inside the `struct` block. For the current tests it is sufficient to make a std::string that contains something like `void f() { asm(""); }`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62373





More information about the cfe-commits mailing list