diff options
author | Rafael Stahl <r.stahl@tum.de> | 2018-07-09 08:40:17 +0000 |
---|---|---|
committer | Rafael Stahl <r.stahl@tum.de> | 2018-07-09 08:40:17 +0000 |
commit | a0010472cac3f8e3d39ec081c421c866e5781738 (patch) | |
tree | f138bd897c937dccde36dc8e1ae959962f21655c | |
parent | 9e1e0c7b2ac47dc1d09bbbbd4f5717020cb8b3d4 (diff) | |
download | bcm5719-llvm-a0010472cac3f8e3d39ec081c421c866e5781738.tar.gz bcm5719-llvm-a0010472cac3f8e3d39ec081c421c866e5781738.zip |
[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
llvm-svn: 336523
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 5 | ||||
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 759f9da30bf..0e3756265e5 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2554,7 +2554,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { 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(FunctionDecl *D) { 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(FunctionDecl *D) { 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. diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 1f86b91a88d..34ed5b93a89 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -1620,7 +1620,7 @@ TEST_P(ASTImporterTestBase, ImportSourceLocs) { FromSM); } -TEST_P(ASTImporterTestBase, DISABLED_ImportNestedMacro) { +TEST_P(ASTImporterTestBase, ImportNestedMacro) { Decl *FromTU = getTuDecl( R"( #define FUNC_INT void declToImport |