r220411 - Correct importing of the type of a TemplateArgument
David Blaikie
dblaikie at gmail.com
Wed Oct 22 12:54:16 PDT 2014
Author: dblaikie
Date: Wed Oct 22 14:54:16 2014
New Revision: 220411
URL: http://llvm.org/viewvc/llvm-project?rev=220411&view=rev
Log:
Correct importing of the type of a TemplateArgument
It's not clear how this would be tested - I imagine we should have an
ASTImporter test that RAVs the new AST and checks that all the elements
in it are from this ASTContext and not the foreign one... but I know
little about the ASTImporter and how/where that testing might be done.
(post-commit review feedback from Richard Smith on r219900)
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=220411&r1=220410&r2=220411&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Oct 22 14:54:16 2014
@@ -2092,10 +2092,11 @@ ASTNodeImporter::ImportTemplateArgument(
}
case TemplateArgument::Declaration: {
- ValueDecl *FromD = From.getAsDecl();
- if (ValueDecl *To = cast_or_null<ValueDecl>(Importer.Import(FromD)))
- return TemplateArgument(To, From.getParamTypeForDecl());
- return TemplateArgument();
+ ValueDecl *To = cast_or_null<ValueDecl>(Importer.Import(From.getAsDecl()));
+ QualType ToType = Importer.Import(From.getParamTypeForDecl());
+ if (!To || ToType.isNull())
+ return TemplateArgument();
+ return TemplateArgument(To, ToType);
}
case TemplateArgument::NullPtr: {
More information about the cfe-commits
mailing list