[PATCH] D42335: [ASTImporter] Supporting CXXOperatorCallExpr, SizeOfPackExpr, DependentTemplateSpecializationType, DependentSizedArray, CXXTypeidExpr importing.
Aleksei Sidorin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 24 05:44:46 PST 2018
a.sidorin added inline comments.
================
Comment at: lib/AST/ASTImporter.cpp:6207
+ TypeSourceInfo *TSI = Importer.Import(E->getTypeOperandSourceInfo());
+ if (!TSI && E->getTypeOperandSourceInfo())
+ return nullptr;
----------------
As I see from usage of `getTypeOperandSourceInfo()`, it cannot return nullptr. `getExprOperand()` is used unchecked sometimes too, but not everywhere.
================
Comment at: unittests/AST/ASTImporterTest.cpp:653
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionDecl(hasDescendant(cxxTypeidExpr())));
+}
----------------
This will find only the first `typeid()`. How about something like this:
```
void declToImport() {"
" int x;"
" auto a = typeid(int), b = typeid(x);"
"}",
Lang_CXX, "", Lang_CXX, Verifier,
functionDecl(has(varDecl(hasName("a"), hasInitializer(cxxTypeidExpr())),
has(varDecl(hasName("b"), hasInitializer(cxxTypeidExpr())));
```
?
https://reviews.llvm.org/D42335
More information about the cfe-commits
mailing list