[clang] 37be748 - Revert "[clang][ObjC] Add fix it for missing methods in impl"

2022-01-04 Thread Rumeet Dhindsa via cfe-commits

Author: Rumeet Dhindsa
Date: 2022-01-04T16:43:54-08:00
New Revision: 37be74885946f18dbeb70343ad659924c61d2549

URL: 
https://github.com/llvm/llvm-project/commit/37be74885946f18dbeb70343ad659924c61d2549
DIFF: 
https://github.com/llvm/llvm-project/commit/37be74885946f18dbeb70343ad659924c61d2549.diff

LOG: Revert "[clang][ObjC] Add fix it for missing methods in impl"

This reverts commit dd72ae3dcc6895f95e1203b40aabcb069c76a0ab.

Notified the author of the internal failure and author suggested to revert it 
for
now.

Added: 


Modified: 
clang/lib/Sema/SemaDeclObjC.cpp

Removed: 
clang/test/FixIt/fixit-objc-missing-method-impl.m



diff  --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index d4fefc3d18d8a..d6e659e17069c 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -2212,8 +2212,9 @@ void 
Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
 Diag(IVI->getLocation(), diag::err_inconsistent_ivar_count);
 }
 
-static void WarnUndefinedMethod(Sema , ObjCImplDecl *Impl,
-ObjCMethodDecl *method, bool ,
+static void WarnUndefinedMethod(Sema , SourceLocation ImpLoc,
+ObjCMethodDecl *method,
+bool ,
 unsigned DiagID,
 NamedDecl *NeededFor = nullptr) {
   // No point warning no definition of method which is 'unavailable'.
@@ -2226,19 +2227,10 @@ static void WarnUndefinedMethod(Sema , ObjCImplDecl 
*Impl,
   // separate warnings.  We will give that approach a try, as that
   // matches what we do with protocols.
   {
-const Sema::SemaDiagnosticBuilder  = S.Diag(Impl->getLocation(), DiagID);
+const Sema::SemaDiagnosticBuilder  = S.Diag(ImpLoc, DiagID);
 B << method;
 if (NeededFor)
   B << NeededFor;
-
-// Add an empty definition at the end of the @implementation.
-std::string FixItStr;
-llvm::raw_string_ostream Out(FixItStr);
-method->print(Out, Impl->getASTContext().getPrintingPolicy());
-Out << " {\n}\n\n";
-
-SourceLocation Loc = Impl->getAtEndRange().getBegin();
-B << FixItHint::CreateInsertion(Loc, FixItStr);
   }
 
   // Issue a note to the original declaration.
@@ -2687,10 +2679,14 @@ static void findProtocolsWithExplicitImpls(const 
ObjCInterfaceDecl *Super,
 
 /// CheckProtocolMethodDefs - This routine checks unimplemented methods
 /// Declared in protocol, and those referenced by it.
-static void CheckProtocolMethodDefs(
-Sema , ObjCImplDecl *Impl, ObjCProtocolDecl *PDecl, bool ,
-const Sema::SelectorSet , const Sema::SelectorSet ,
-ObjCContainerDecl *CDecl, LazyProtocolNameSet ) {
+static void CheckProtocolMethodDefs(Sema ,
+SourceLocation ImpLoc,
+ObjCProtocolDecl *PDecl,
+bool& IncompleteImpl,
+const Sema::SelectorSet ,
+const Sema::SelectorSet ,
+ObjCContainerDecl *CDecl,
+LazyProtocolNameSet ) 
{
   ObjCCategoryDecl *C = dyn_cast(CDecl);
   ObjCInterfaceDecl *IDecl = C ? C->getClassInterface()
: dyn_cast(CDecl);
@@ -2777,8 +2773,9 @@ static void CheckProtocolMethodDefs(
   if (C || MethodInClass->isPropertyAccessor())
 continue;
 unsigned DIAG = diag::warn_unimplemented_protocol_method;
-if (!S.Diags.isIgnored(DIAG, Impl->getLocation())) {
-  WarnUndefinedMethod(S, Impl, method, IncompleteImpl, DIAG, 
PDecl);
+if (!S.Diags.isIgnored(DIAG, ImpLoc)) {
+  WarnUndefinedMethod(S, ImpLoc, method, IncompleteImpl, DIAG,
+  PDecl);
 }
   }
 }
@@ -2799,15 +2796,15 @@ static void CheckProtocolMethodDefs(
 continue;
 
   unsigned DIAG = diag::warn_unimplemented_protocol_method;
-  if (!S.Diags.isIgnored(DIAG, Impl->getLocation())) {
-WarnUndefinedMethod(S, Impl, method, IncompleteImpl, DIAG, PDecl);
+  if (!S.Diags.isIgnored(DIAG, ImpLoc)) {
+WarnUndefinedMethod(S, ImpLoc, method, IncompleteImpl, DIAG, PDecl);
   }
 }
   }
   // Check on this protocols's referenced protocols, recursively.
   for (auto *PI : PDecl->protocols())
-CheckProtocolMethodDefs(S, Impl, PI, IncompleteImpl, InsMap, ClsMap, CDecl,
-ProtocolsExplictImpl);
+CheckProtocolMethodDefs(S, ImpLoc, PI, IncompleteImpl, InsMap, ClsMap,
+CDecl, ProtocolsExplictImpl);
 }
 
 /// MatchAllMethodDeclarations - Check methods declared in interface
@@ -2830,7 +2827,7 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet 
,
 if 

[clang] 9b2ab41 - Revert "[MS] Fix assert handling enum forward decls in hasVisibleDefinition"

2020-04-20 Thread Rumeet Dhindsa via cfe-commits

Author: Rumeet Dhindsa
Date: 2020-04-20T10:40:27-07:00
New Revision: 9b2ab41037f45ad92ab4e850591093ffc45d3e10

URL: 
https://github.com/llvm/llvm-project/commit/9b2ab41037f45ad92ab4e850591093ffc45d3e10
DIFF: 
https://github.com/llvm/llvm-project/commit/9b2ab41037f45ad92ab4e850591093ffc45d3e10.diff

LOG: Revert "[MS] Fix assert handling enum forward decls in 
hasVisibleDefinition"

This reverts commit e62dc1f6252c1dcdcc2a64e8e3b07a32412e9d89.

Reverting as per discussion with the patch author.
This patch causes module import error, but there was no intended
behavior change for code that does not use Microsoft extensions.

Added: 


Modified: 
clang/lib/Sema/SemaType.cpp

Removed: 
clang/test/Modules/Inputs/ms-enums/A.h
clang/test/Modules/Inputs/ms-enums/B.h
clang/test/Modules/Inputs/ms-enums/module.map
clang/test/Modules/ms-enums.cpp



diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 4ecd36209e5b..075c30f88b3f 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -8120,10 +8120,10 @@ bool Sema::hasVisibleDefinition(NamedDecl *D, NamedDecl 
**Suggested,
   } else if (auto *ED = dyn_cast(D)) {
 if (auto *Pattern = ED->getTemplateInstantiationPattern())
   ED = Pattern;
-if (OnlyNeedComplete && !ED->getIntegerType().isNull()) {
-  // If the enum has an integer type, it may have been forward declared.
-  // Since we're only looking for a complete type (not a definition), any
-  // visible declaration of it will do.
+if (OnlyNeedComplete && ED->isFixed()) {
+  // If the enum has a fixed underlying type, and we're only looking for a
+  // complete type (not a definition), any visible declaration of it will
+  // do.
   *Suggested = nullptr;
   for (auto *Redecl : ED->redecls()) {
 if (isVisible(Redecl))

diff  --git a/clang/test/Modules/Inputs/ms-enums/A.h 
b/clang/test/Modules/Inputs/ms-enums/A.h
deleted file mode 100644
index 168445221c03..
--- a/clang/test/Modules/Inputs/ms-enums/A.h
+++ /dev/null
@@ -1 +0,0 @@
-enum fwd_enum;

diff  --git a/clang/test/Modules/Inputs/ms-enums/B.h 
b/clang/test/Modules/Inputs/ms-enums/B.h
deleted file mode 100644
index 7a13ba4d72d4..
--- a/clang/test/Modules/Inputs/ms-enums/B.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "A.h"

diff  --git a/clang/test/Modules/Inputs/ms-enums/module.map 
b/clang/test/Modules/Inputs/ms-enums/module.map
deleted file mode 100644
index d9aed01430c4..
--- a/clang/test/Modules/Inputs/ms-enums/module.map
+++ /dev/null
@@ -1,2 +0,0 @@
-module A { header "A.h" }
-module B { header "B.h" }

diff  --git a/clang/test/Modules/ms-enums.cpp b/clang/test/Modules/ms-enums.cpp
deleted file mode 100644
index b3a377c6fa63..
--- a/clang/test/Modules/ms-enums.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions 
-fms-compatibility -x c++ -std=c++20 -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -I %S/Inputs/ms-enums %s -verify 
-fno-modules-error-recovery
-
-#include "B.h"
-// expected-note@A.h:1 {{previous declaration is here}}
-// expected-note@A.h:1 2 {{previous definition is here}}
-
-fwd_enum gv_enum; // expected-error {{must be imported}}
-
-struct Foo {
-  enum fwd_enum enum_field; // expected-error 2 {{must be imported}}
-};



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 57a2eaf - Revert "[modules] Do not cache invalid state for modules that we attempted to load."

2020-03-10 Thread Rumeet Dhindsa via cfe-commits

Author: Rumeet Dhindsa
Date: 2020-03-10T10:59:26-07:00
New Revision: 57a2eaf3c1aa1a08e9b474b873064e075c52daef

URL: 
https://github.com/llvm/llvm-project/commit/57a2eaf3c1aa1a08e9b474b873064e075c52daef
DIFF: 
https://github.com/llvm/llvm-project/commit/57a2eaf3c1aa1a08e9b474b873064e075c52daef.diff

LOG: Revert "[modules] Do not cache invalid state for modules that we attempted 
to load."
As per comment on https://reviews.llvm.org/D72860, it is suggested to
revert this change in the meantime, since it has introduced regression.

This reverts commit 83f4c3af021cd5322ea10fd1c4e839874c1dae49.

Added: 
clang/test/Modules/Inputs/implicit-invalidate-chain/A.h
clang/test/Modules/Inputs/implicit-invalidate-chain/B.h
clang/test/Modules/Inputs/implicit-invalidate-chain/C.h
clang/test/Modules/Inputs/implicit-invalidate-chain/module.modulemap
clang/test/Modules/implicit-invalidate-chain.c

Modified: 
clang/include/clang/Serialization/InMemoryModuleCache.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/InMemoryModuleCache.cpp
clang/lib/Serialization/ModuleManager.cpp
clang/unittests/Frontend/FrontendActionTest.cpp
clang/unittests/Serialization/InMemoryModuleCacheTest.cpp

Removed: 




diff  --git a/clang/include/clang/Serialization/InMemoryModuleCache.h 
b/clang/include/clang/Serialization/InMemoryModuleCache.h
index c4814c40e1df..7b5b5c1cf1be 100644
--- a/clang/include/clang/Serialization/InMemoryModuleCache.h
+++ b/clang/include/clang/Serialization/InMemoryModuleCache.h
@@ -45,35 +45,61 @@ class InMemoryModuleCache : public 
llvm::RefCountedBase {
   llvm::StringMap PCMs;
 
 public:
+  /// There are four states for a PCM.  It must monotonically increase.
+  ///
+  ///  1. Unknown: the PCM has neither been read from disk nor built.
+  ///  2. Tentative: the PCM has been read from disk but not yet imported or
+  /// built.  It might work.
+  ///  3. ToBuild: the PCM read from disk did not work but a new one has not
+  /// been built yet.
+  ///  4. Final: indicating that the current PCM was either built in this
+  /// process or has been successfully imported.
+  enum State { Unknown, Tentative, ToBuild, Final };
+
+  /// Get the state of the PCM.
+  State getPCMState(llvm::StringRef Filename) const;
+
   /// Store the PCM under the Filename.
   ///
-  /// \pre PCM for the same Filename shouldn't be in cache already.
+  /// \pre state is Unknown
+  /// \post state is Tentative
   /// \return a reference to the buffer as a convenience.
   llvm::MemoryBuffer (llvm::StringRef Filename,
  std::unique_ptr Buffer);
 
-  /// Store a final PCM under the Filename.
+  /// Store a just-built PCM under the Filename.
   ///
-  /// \pre PCM for the same Filename shouldn't be in cache already.
+  /// \pre state is Unknown or ToBuild.
+  /// \pre state is not Tentative.
   /// \return a reference to the buffer as a convenience.
-  llvm::MemoryBuffer (llvm::StringRef Filename,
+  llvm::MemoryBuffer (llvm::StringRef Filename,
   std::unique_ptr Buffer);
 
-  /// Try to remove a PCM from the cache.  No effect if it is Final.
+  /// Try to remove a buffer from the cache.  No effect if state is Final.
   ///
-  /// \return false on success.
-  bool tryToRemovePCM(llvm::StringRef Filename);
+  /// \pre state is Tentative/Final.
+  /// \post Tentative => ToBuild or Final => Final.
+  /// \return false on success, i.e. if Tentative => ToBuild.
+  bool tryToDropPCM(llvm::StringRef Filename);
 
   /// Mark a PCM as final.
+  ///
+  /// \pre state is Tentative or Final.
+  /// \post state is Final.
   void finalizePCM(llvm::StringRef Filename);
 
-  /// Get a pointer to the PCM if it exists; else nullptr.
+  /// Get a pointer to the pCM if it exists; else nullptr.
   llvm::MemoryBuffer *lookupPCM(llvm::StringRef Filename) const;
 
   /// Check whether the PCM is final and has been shown to work.
   ///
   /// \return true iff state is Final.
   bool isPCMFinal(llvm::StringRef Filename) const;
+
+  /// Check whether the PCM is waiting to be built.
+  ///
+  /// \return true iff state is ToBuild.
+  bool shouldBuildPCM(llvm::StringRef Filename) const;
 };
 
 } // end namespace clang

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index b5ca1e1841ac..63c817b02bf1 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4502,7 +4502,7 @@ ASTReader::ReadASTCore(StringRef FileName,
 if (ShouldFinalizePCM)
   MC.finalizePCM(FileName);
 else
-  MC.tryToRemovePCM(FileName);
+  MC.tryToDropPCM(FileName);
   });
   ModuleFile  = *M;
   BitstreamCursor  = F.Stream;

diff  --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index bf893c7ff3bf..1278841a15a2 100644

Re: [clang] abd0905 - Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""

2020-02-25 Thread Rumeet Dhindsa via cfe-commits
Hi,

I saw that this patch was reverted again later, but wanted to let you know
the performance impact we saw with this patch.
We are testing this on a variety of x86 machines and saw across the board
regressions in Eigen of around 25-50%, changing no compile time options.

Thanks,
Rumeet

On Wed, Feb 12, 2020 at 7:31 AM Melanie Blower via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Melanie Blower
> Date: 2020-02-12T07:30:43-08:00
> New Revision: abd09053bc7aa6144873c196a7d50aa6ce6ca430
>
> URL:
> https://github.com/llvm/llvm-project/commit/abd09053bc7aa6144873c196a7d50aa6ce6ca430
> DIFF:
> https://github.com/llvm/llvm-project/commit/abd09053bc7aa6144873c196a7d50aa6ce6ca430.diff
>
> LOG: Revert "Revert "Change clang option -ffp-model=precise to select
> ffp-contract=on""
>
> This reverts commit 99c5bcbce89f07e68ccd89891a0300346705d013.
> Change clang option -ffp-model=precise to select ffp-contract=on
> Including some small touch-ups to the original commit
>
> Reviewers: rjmccall, Andy Kaylor
>
> Differential Revision: https://reviews.llvm.org/D74436
>
> Added:
>
>
> Modified:
> clang/docs/UsersManual.rst
> clang/lib/Driver/ToolChains/Clang.cpp
> clang/test/CodeGen/ppc-emmintrin.c
> clang/test/CodeGen/ppc-xmmintrin.c
> clang/test/Driver/fp-model.c
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
> index 856d5e34bbcc..6c8c9f802082 100644
> --- a/clang/docs/UsersManual.rst
> +++ b/clang/docs/UsersManual.rst
> @@ -1190,8 +1190,50 @@ installed.
>  Controlling Floating Point Behavior
>  ---
>
> -Clang provides a number of ways to control floating point behavior. The
> options
> -are listed below.
> +Clang provides a number of ways to control floating point behavior,
> including
> +with command line options and source pragmas. This section
> +describes the various floating point semantic modes and the corresponding
> options.
> +
> +.. csv-table:: Floating Point Semantic Modes
> +  :header: "Mode", "Values"
> +  :widths: 15, 30, 30
> +
> +  "except_behavior", "{ignore, strict, may_trap}",
> "ffp-exception-behavior"
> +  "fenv_access", "{off, on}", "(none)"
> +  "rounding_mode", "{dynamic, tonearest, downward, upward, towardzero}",
> "frounding-math"
> +  "contract", "{on, off, fast}", "ffp-contract"
> +  "denormal_fp_math", "{IEEE, PreserveSign, PositiveZero}",
> "fdenormal-fp-math"
> +  "denormal_fp32_math", "{IEEE, PreserveSign, PositiveZero}",
> "fdenormal-fp-math-fp32"
> +  "support_math_errno", "{on, off}", "fmath-errno"
> +  "no_honor_nans", "{on, off}", "fhonor-nans"
> +  "no_honor_infinities", "{on, off}", "fhonor-infinities"
> +  "no_signed_zeros", "{on, off}", "fsigned-zeros"
> +  "allow_reciprocal", "{on, off}", "freciprocal-math"
> +  "allow_approximate_fns", "{on, off}", "(none)"
> +  "allow_reassociation", "{on, off}", "fassociative-math"
> +
> +
> +This table describes the option settings that correspond to the three
> +floating point semantic models: precise (the default), strict, and fast.
> +
> +
> +.. csv-table:: Floating Point Models
> +  :header: "Mode", "Precise", "Strict", "Fast"
> +  :widths: 25, 15, 15, 15
> +
> +  "except_behavior", "ignore", "strict", "ignore"
> +  "fenv_access", "off", "on", "off"
> +  "rounding_mode", "tonearest", "dynamic", "tonearest"
> +  "contract", "on", "off", "fast"
> +  "denormal_fp_math", "IEEE", "IEEE", "PreserveSign"
> +  "denormal_fp32_math", "IEEE","IEEE", "PreserveSign"
> +  "support_math_errno", "on", "on", "off"
> +  "no_honor_nans", "off", "off", "on"
> +  "no_honor_infinities", "off", "off", "on"
> +  "no_signed_zeros", "off", "off", "on"
> +  "allow_reciprocal", "off", "off", "on"
> +  "allow_approximate_fns", "off", "off", "on"
> +  "allow_reassociation", "off", "off", "on"
>
>  .. option:: -ffast-math
>
> @@ -1385,7 +1427,7 @@ Note that floating-point operations performed as
> part of constant initialization
> and ``fast``.
> Details:
>
> -   * ``precise`` Disables optimizations that are not value-safe on
> floating-point data, although FP contraction (FMA) is enabled
> (``-ffp-contract=fast``).  This is the default behavior.
> +   * ``precise`` Disables optimizations that are not value-safe on
> floating-point data, although FP contraction (FMA) is enabled
> (``-ffp-contract=on``).  This is the default behavior.
> * ``strict`` Enables ``-frounding-math`` and
> ``-ffp-exception-behavior=strict``, and disables contractions (FMA).  All
> of the ``-ffast-math`` enablements are disabled.
> * ``fast`` Behaves identically to specifying both ``-ffast-math`` and
> ``ffp-contract=fast``
>
>
> diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp
> b/clang/lib/Driver/ToolChains/Clang.cpp
> index 4424d8e6f72c..a11a5423b0b9 100644
> --- a/clang/lib/Driver/ToolChains/Clang.cpp
> +++ b/clang/lib/Driver/ToolChains/Clang.cpp
> @@ -2525,10 +2525,9 @@ 

Re: r364359 - Revert Devirtualize destructor of final class.

2019-06-25 Thread Rumeet Dhindsa via cfe-commits
Sorry for not including the reason, I discussed offline with the author to
temporarily revert this patch.

On Tue, Jun 25, 2019 at 4:00 PM Roman Lebedev  wrote:

> On Wed, Jun 26, 2019 at 1:58 AM Rumeet Dhindsa via cfe-commits
>  wrote:
> >
> > Author: rdhindsa
> > Date: Tue Jun 25 15:58:25 2019
> > New Revision: 364359
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=364359=rev
> > Log:
> > Revert Devirtualize destructor of final class.
> >
> > This reverts r364100 (git commit
> 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)
> It is usually customary to specify the reason of the revert in the
> commit message.
>
> > Removed:
> > cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
> > Modified:
> > cfe/trunk/lib/CodeGen/CGExprCXX.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=364359=364358=364359=diff
> >
> ==
> > --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Jun 25 15:58:25 2019
> > @@ -1865,33 +1865,9 @@ static void EmitObjectDelete(CodeGenFunc
> >Dtor = RD->getDestructor();
> >
> >if (Dtor->isVirtual()) {
> > -bool UseVirtualCall = true;
> > -const Expr *Base = DE->getArgument();
> > -if (auto *DevirtualizedDtor =
> > -dyn_cast_or_null(
> > -Dtor->getDevirtualizedMethod(
> > -Base, CGF.CGM.getLangOpts().AppleKext))) {
> > -  UseVirtualCall = false;
> > -  const CXXRecordDecl *DevirtualizedClass =
> > -  DevirtualizedDtor->getParent();
> > -  if (declaresSameEntity(getCXXRecord(Base),
> DevirtualizedClass)) {
> > -// Devirtualized to the class of the base type (the type of
> the
> > -// whole expression).
> > -Dtor = DevirtualizedDtor;
> > -  } else {
> > -// Devirtualized to some other type. Would need to cast the
> this
> > -// pointer to that type but we don't have support for that
> yet, so
> > -// do a virtual call. FIXME: handle the case where it is
> > -// devirtualized to the derived type (the type of the inner
> > -// expression) as in EmitCXXMemberOrOperatorMemberCallExpr.
> > -UseVirtualCall = true;
> > -  }
> > -}
> > -if (UseVirtualCall) {
> > -  CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr,
> ElementType,
> > -  Dtor);
> > -  return;
> > -}
> > +CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr,
> ElementType,
> > +Dtor);
> > +return;
> >}
> >  }
> >}
> >
> > Removed: cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp?rev=364358=auto
> >
> ==
> > --- cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (original)
> > +++ cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (removed)
> > @@ -1,23 +0,0 @@
> > -// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 %s
> -emit-llvm -o - | FileCheck %s
> > -
> > -namespace Test1 {
> > -  struct A { virtual ~A() {} };
> > -  struct B final : A {};
> > -  struct C : A { virtual ~C() final {} };
> > -  struct D { virtual ~D() final = 0; };
> > -  // CHECK-LABEL: define void @_ZN5Test13fooEPNS_1BE
> > -  void foo(B *b) {
> > -// CHECK: call void @_ZN5Test11BD1Ev
> > -delete b;
> > -  }
> > -  // CHECK-LABEL: define void @_ZN5Test14foo2EPNS_1CE
> > -  void foo2(C *c) {
> > -// CHECK: call void @_ZN5Test11CD1Ev
> > -delete c;
> > -  }
> > -  // CHECK-LABEL: define void @_ZN5Test14evilEPNS_1DE
> > -  void evil(D *p) {
> > -// CHECK-NOT: call void @_ZN5Test11DD1Ev
> > -delete p;
> > -  }
> > -}
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r364359 - Revert Devirtualize destructor of final class.

2019-06-25 Thread Rumeet Dhindsa via cfe-commits
Author: rdhindsa
Date: Tue Jun 25 15:58:25 2019
New Revision: 364359

URL: http://llvm.org/viewvc/llvm-project?rev=364359=rev
Log:
Revert Devirtualize destructor of final class.

This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)

Removed:
cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=364359=364358=364359=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Jun 25 15:58:25 2019
@@ -1865,33 +1865,9 @@ static void EmitObjectDelete(CodeGenFunc
   Dtor = RD->getDestructor();
 
   if (Dtor->isVirtual()) {
-bool UseVirtualCall = true;
-const Expr *Base = DE->getArgument();
-if (auto *DevirtualizedDtor =
-dyn_cast_or_null(
-Dtor->getDevirtualizedMethod(
-Base, CGF.CGM.getLangOpts().AppleKext))) {
-  UseVirtualCall = false;
-  const CXXRecordDecl *DevirtualizedClass =
-  DevirtualizedDtor->getParent();
-  if (declaresSameEntity(getCXXRecord(Base), DevirtualizedClass)) {
-// Devirtualized to the class of the base type (the type of the
-// whole expression).
-Dtor = DevirtualizedDtor;
-  } else {
-// Devirtualized to some other type. Would need to cast the this
-// pointer to that type but we don't have support for that yet, so
-// do a virtual call. FIXME: handle the case where it is
-// devirtualized to the derived type (the type of the inner
-// expression) as in EmitCXXMemberOrOperatorMemberCallExpr.
-UseVirtualCall = true;
-  }
-}
-if (UseVirtualCall) {
-  CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, 
ElementType,
-  Dtor);
-  return;
-}
+CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType,
+Dtor);
+return;
   }
 }
   }

Removed: cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp?rev=364358=auto
==
--- cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 %s -emit-llvm -o - 
| FileCheck %s
-
-namespace Test1 {
-  struct A { virtual ~A() {} };
-  struct B final : A {};
-  struct C : A { virtual ~C() final {} };
-  struct D { virtual ~D() final = 0; };
-  // CHECK-LABEL: define void @_ZN5Test13fooEPNS_1BE
-  void foo(B *b) {
-// CHECK: call void @_ZN5Test11BD1Ev
-delete b;
-  }
-  // CHECK-LABEL: define void @_ZN5Test14foo2EPNS_1CE
-  void foo2(C *c) {
-// CHECK: call void @_ZN5Test11CD1Ev
-delete c;
-  }
-  // CHECK-LABEL: define void @_ZN5Test14evilEPNS_1DE
-  void evil(D *p) {
-// CHECK-NOT: call void @_ZN5Test11DD1Ev
-delete p;
-  }
-}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits