r336523 - [ASTImporter] import FunctionDecl end locations
Rafael Stahl via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 9 01:40:17 PDT 2018
Author: r.stahl
Date: Mon Jul 9 01:40:17 2018
New Revision: 336523
URL: http://llvm.org/viewvc/llvm-project?rev=336523&view=rev
Log:
[ASTImporter] import FunctionDecl end locations
Summary: On constructors that do not take the end source location, it was not imported. Fixes test from D47698 / rC336269.
Reviewers: martong, a.sidorin, balazske, xazax.hun, a_sidorin
Reviewed By: martong, a_sidorin
Subscribers: a_sidorin, rnkovacs, cfe-commits
Differential Revision: https://reviews.llvm.org/D48941
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=336523&r1=336522&r2=336523&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Jul 9 01:40:17 2018
@@ -2554,7 +2554,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl
D->isInlineSpecified(),
FromConversion->isExplicit(),
D->isConstexpr(),
- Importer.Import(D->getLocEnd()));
+ SourceLocation());
} else if (auto *Method = dyn_cast<CXXMethodDecl>(D)) {
ToFunction = CXXMethodDecl::Create(Importer.getToContext(),
cast<CXXRecordDecl>(DC),
@@ -2563,7 +2563,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl
Method->getStorageClass(),
Method->isInlineSpecified(),
D->isConstexpr(),
- Importer.Import(D->getLocEnd()));
+ SourceLocation());
} else {
ToFunction = FunctionDecl::Create(Importer.getToContext(), DC,
InnerLocStart,
@@ -2580,6 +2580,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl
ToFunction->setVirtualAsWritten(D->isVirtualAsWritten());
ToFunction->setTrivial(D->isTrivial());
ToFunction->setPure(D->isPure());
+ ToFunction->setRangeEnd(Importer.Import(D->getLocEnd()));
Importer.Imported(D, ToFunction);
// Set the parameters.
Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=336523&r1=336522&r2=336523&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Mon Jul 9 01:40:17 2018
@@ -1620,7 +1620,7 @@ TEST_P(ASTImporterTestBase, ImportSource
FromSM);
}
-TEST_P(ASTImporterTestBase, DISABLED_ImportNestedMacro) {
+TEST_P(ASTImporterTestBase, ImportNestedMacro) {
Decl *FromTU = getTuDecl(
R"(
#define FUNC_INT void declToImport
More information about the cfe-commits
mailing list