[clang] 3f4b70c - Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 26 13:43:35 PST 2019
Please include details about the reason for the revert (links to and quotes
from buildbots are helpful, etc) in the commit message - so others can
follow along more easily (if they're seeing a local regression, they might
be able to check if this revert is likely to address it - if they want to
pick up the patch/do some similar change at a later date, this might help
explain what was wrong with this approach & would need to be addressed
before making another attempt)
On Sat, Nov 30, 2019 at 8:53 AM via cfe-commits <cfe-commits at lists.llvm.org>
wrote:
>
> Author: Tyker
> Date: 2019-11-30T17:52:26+01:00
> New Revision: 3f4b70c79e686117c2754d2c0a5a44c8b6829e79
>
> URL:
> https://github.com/llvm/llvm-project/commit/3f4b70c79e686117c2754d2c0a5a44c8b6829e79
> DIFF:
> https://github.com/llvm/llvm-project/commit/3f4b70c79e686117c2754d2c0a5a44c8b6829e79.diff
>
> LOG: Revert "[clang][modules] Add support for merging lifetime-extended
> temporaries"
>
> This reverts commit 3c7f6b439699a9cbbc0ac8d288cc70aff357446b.
>
> Added:
>
>
> Modified:
> clang/include/clang/AST/DeclCXX.h
> clang/include/clang/AST/TextNodeDumper.h
> clang/include/clang/Serialization/ASTReader.h
> clang/lib/AST/TextNodeDumper.cpp
> clang/lib/Serialization/ASTReaderDecl.cpp
>
> Removed:
> clang/test/Modules/Inputs/merge-lifetime-extended-temporary/a.h
> clang/test/Modules/Inputs/merge-lifetime-extended-temporary/b.h
> clang/test/Modules/Inputs/merge-lifetime-extended-temporary/c.h
>
> clang/test/Modules/Inputs/merge-lifetime-extended-temporary/module.modulemap
> clang/test/Modules/merge-lifetime-extended-temporary.cpp
>
>
>
> ################################################################################
> diff --git a/clang/include/clang/AST/DeclCXX.h
> b/clang/include/clang/AST/DeclCXX.h
> index 0f2018fb9e8c..63d67bd3f55b 100644
> --- a/clang/include/clang/AST/DeclCXX.h
> +++ b/clang/include/clang/AST/DeclCXX.h
> @@ -3041,9 +3041,7 @@ class NamespaceAliasDecl : public NamedDecl,
>
> /// Implicit declaration of a temporary that was materialized by
> /// a MaterializeTemporaryExpr and lifetime-extended by a declaration
> -class LifetimeExtendedTemporaryDecl final
> - : public Decl,
> - public Mergeable<LifetimeExtendedTemporaryDecl> {
> +class LifetimeExtendedTemporaryDecl final : public Decl {
> friend class MaterializeTemporaryExpr;
> friend class ASTDeclReader;
>
>
> diff --git a/clang/include/clang/AST/TextNodeDumper.h
> b/clang/include/clang/AST/TextNodeDumper.h
> index d293ea190aa4..0ff5a614a864 100644
> --- a/clang/include/clang/AST/TextNodeDumper.h
> +++ b/clang/include/clang/AST/TextNodeDumper.h
> @@ -346,8 +346,6 @@ class TextNodeDumper
> void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
> void VisitBlockDecl(const BlockDecl *D);
> void VisitConceptDecl(const ConceptDecl *D);
> - void
> - VisitLifetimeExtendedTemporaryDecl(const LifetimeExtendedTemporaryDecl
> *D);
> };
>
> } // namespace clang
>
> diff --git a/clang/include/clang/Serialization/ASTReader.h
> b/clang/include/clang/Serialization/ASTReader.h
> index b6dae68b3413..f0b5e9933823 100644
> --- a/clang/include/clang/Serialization/ASTReader.h
> +++ b/clang/include/clang/Serialization/ASTReader.h
> @@ -551,14 +551,6 @@ class ASTReader
> llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
> AnonymousDeclarationsForMerging;
>
> - /// Key used to identify LifetimeExtendedTemporaryDecl for merging,
> - /// containing the lifetime-extending declaration and the mangling
> number.
> - using LETemporaryKey = std::pair<Decl *, unsigned>;
> -
> - /// Map of already deserialiazed temporaries.
> - llvm::DenseMap<LETemporaryKey, LifetimeExtendedTemporaryDecl *>
> - LETemporaryForMerging;
> -
> struct FileDeclsInfo {
> ModuleFile *Mod = nullptr;
> ArrayRef<serialization::LocalDeclID> Decls;
>
> diff --git a/clang/lib/AST/TextNodeDumper.cpp
> b/clang/lib/AST/TextNodeDumper.cpp
> index 561c76a45cbc..0ff95213118f 100644
> --- a/clang/lib/AST/TextNodeDumper.cpp
> +++ b/clang/lib/AST/TextNodeDumper.cpp
> @@ -1338,17 +1338,6 @@ void TextNodeDumper::VisitFunctionDecl(const
> FunctionDecl *D) {
> OS << " <<<NULL params x " << D->getNumParams() << ">>>";
> }
>
> -void TextNodeDumper::VisitLifetimeExtendedTemporaryDecl(
> - const LifetimeExtendedTemporaryDecl *D) {
> - OS << " extended by ";
> - dumpBareDeclRef(D->getExtendingDecl());
> - OS << " mangling ";
> - {
> - ColorScope Color(OS, ShowColors, ValueColor);
> - OS << D->getManglingNumber();
> - }
> -}
> -
> void TextNodeDumper::VisitFieldDecl(const FieldDecl *D) {
> dumpName(D);
> dumpType(D->getType());
>
> diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp
> b/clang/lib/Serialization/ASTReaderDecl.cpp
> index d6c57757cf8c..8991a39a7067 100644
> --- a/clang/lib/Serialization/ASTReaderDecl.cpp
> +++ b/clang/lib/Serialization/ASTReaderDecl.cpp
> @@ -424,9 +424,6 @@ namespace clang {
> template<typename T>
> void mergeMergeable(Mergeable<T> *D);
>
> - template <>
> - void mergeMergeable(Mergeable<LifetimeExtendedTemporaryDecl> *D);
> -
> void mergeTemplatePattern(RedeclarableTemplateDecl *D,
> RedeclarableTemplateDecl *Existing,
> DeclID DsID, bool IsKeyDecl);
> @@ -2361,7 +2358,6 @@ void
> ASTDeclReader::VisitLifetimeExtendedTemporaryDecl(
> if (Record.readInt())
> D->Value = new (D->getASTContext()) APValue(Record.readAPValue());
> D->ManglingNumber = Record.readInt();
> - mergeMergeable(D);
> }
>
> std::pair<uint64_t, uint64_t>
> @@ -2559,28 +2555,6 @@ static bool allowODRLikeMergeInC(NamedDecl *ND) {
> return false;
> }
>
> -/// Attempts to merge LifetimeExtendedTemporaryDecl with
> -/// identical class definitions from two
> diff erent modules.
> -template<>
> -void ASTDeclReader::mergeMergeable(
> - Mergeable<LifetimeExtendedTemporaryDecl> *D) {
> - // If modules are not available, there is no reason to perform this
> merge.
> - if (!Reader.getContext().getLangOpts().Modules)
> - return;
> -
> - LifetimeExtendedTemporaryDecl *LETDecl =
> - static_cast<LifetimeExtendedTemporaryDecl *>(D);
> -
> - LifetimeExtendedTemporaryDecl *&LookupResult =
> - Reader.LETemporaryForMerging[std::make_pair(
> - LETDecl->getExtendingDecl(), LETDecl->getManglingNumber())];
> - if (LookupResult)
> - Reader.getContext().setPrimaryMergedDecl(LETDecl,
> -
> LookupResult->getCanonicalDecl());
> - else
> - LookupResult = LETDecl;
> -}
> -
> /// Attempts to merge the given declaration (D) with another declaration
> /// of the same entity, for the case where the entity is not actually
> /// redeclarable. This happens, for instance, when merging the fields of
>
> diff --git
> a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/a.h
> b/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/a.h
> deleted file mode 100644
> index 8adab29eafc7..000000000000
> --- a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/a.h
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -
> -constexpr const int& LETemp = 0;
>
> diff --git
> a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/b.h
> b/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/b.h
> deleted file mode 100644
> index 2bd1b096d607..000000000000
> --- a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/b.h
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -
> -#include "a.h"
> -
> -constexpr const int* PtrTemp1 = &LETemp;
>
> diff --git
> a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/c.h
> b/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/c.h
> deleted file mode 100644
> index b023eebca49c..000000000000
> --- a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/c.h
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -
> -#include "a.h"
> -
> -constexpr const int* PtrTemp2 = &LETemp;
>
> diff --git
> a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/module.modulemap
> b/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/module.modulemap
> deleted file mode 100644
> index 1339d627a44a..000000000000
> ---
> a/clang/test/Modules/Inputs/merge-lifetime-extended-temporary/module.modulemap
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -module "a" {
> - export *
> - header "a.h"
> -}
> -
> -module "b" {
> - export *
> - header "b.h"
> -}
> -
> -module "c" {
> - export *
> - header "c.h"
> -}
>
> diff --git a/clang/test/Modules/merge-lifetime-extended-temporary.cpp
> b/clang/test/Modules/merge-lifetime-extended-temporary.cpp
> deleted file mode 100644
> index 36db948b2c4e..000000000000
> --- a/clang/test/Modules/merge-lifetime-extended-temporary.cpp
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps
> -fmodules-cache-path=%t -x c++
> -I%S/Inputs/merge-lifetime-extended-temporary -verify -std=c++11 %s
> -DORDER=1
> -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps
> -fmodules-cache-path=%t -x c++
> -I%S/Inputs/merge-lifetime-extended-temporary -verify -std=c++11 %s
> -DORDER=2
> -
> -// expected-no-diagnostics
> -#if ORDER == 1
> -#include "c.h"
> -#include "b.h"
> -#else
> -#include "b.h"
> -#include "c.h"
> -#endif
> -
> -static_assert(PtrTemp1 == &LETemp, "");
> -static_assert(PtrTemp1 == PtrTemp2, "");
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191226/1e08a8ac/attachment-0001.html>
More information about the cfe-commits
mailing list