[ASTImporter] Add test for C++ casts and fix broken const_cast importing.
Summary:
The ASTImporter does currently not handle const_casts. This patch adds the
missing const_cast importer code and the test case that discovered this.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D50932
llvm-svn: 340182
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index c1136c9..8a8b321 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -6897,6 +6897,10 @@
return CXXReinterpretCastExpr::Create(
Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath,
ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
+ } else if (isa<CXXConstCastExpr>(E)) {
+ return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp,
+ ToWritten, ToOperatorLoc, ToRParenLoc,
+ ToAngleBrackets);
} else {
return nullptr;
}