svn commit: r359826 - head/contrib/llvm-project/clang/lib/CodeGen

Dimitry Andric dim at FreeBSD.org
Sun Apr 12 16:07:01 UTC 2020


Author: dim
Date: Sun Apr 12 16:06:59 2020
New Revision: 359826
URL: https://svnweb.freebsd.org/changeset/base/359826

Log:
  Merge commit 30588a739 from llvm git (by Erich Keane):
  
    Make target features check work with ctor and dtor-
  
    The problem was reported in PR45468, applying target features to an
    always_inline constructor/destructor runs afoul of GlobalDecl
    construction assert when checking for target-feature compatibility.
  
    The core problem is fixed by using the version of the check that
    takes a FunctionDecl rather than the GlobalDecl. However, while
    writing the test, I discovered that source locations weren't properly
    set for this check on ctors/dtors. This patch also fixes constructors
    and CALLED destructors.
  
    Unfortunately, it doesn't seem too possible to get a meaningful
    source location for a 'cleanup' destructor, so those are still
    'frontend' level errors unfortunately. A fixme was added to the test
    to cover that situation.
  
  This should fix 'Assertion failed: (!isa<CXXConstructorDecl>(D) && "Use
  other ctor with ctor decls!"), function Init, file
  /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h, line
  45' when compiling the security/botan2 port.
  
  PR:		245550
  MFC after:	6 weeks
  X-MFC-With:	358851

Modified:
  head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp

Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp
==============================================================================
--- head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp	Sun Apr 12 15:30:00 2020	(r359825)
+++ head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp	Sun Apr 12 16:06:59 2020	(r359826)
@@ -2157,7 +2157,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXX
   const CGFunctionInfo &Info = CGM.getTypes().arrangeCXXConstructorCall(
       Args, D, Type, ExtraArgs.Prefix, ExtraArgs.Suffix, PassPrototypeArgs);
   CGCallee Callee = CGCallee::forDirect(CalleePtr, GlobalDecl(D, Type));
-  EmitCall(Info, Callee, ReturnValueSlot(), Args);
+  EmitCall(Info, Callee, ReturnValueSlot(), Args, nullptr, Loc);
 
   // Generate vtable assumptions if we're constructing a complete object
   // with a vtable.  We don't do this for base subobjects for two reasons:

Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp
==============================================================================
--- head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp	Sun Apr 12 15:30:00 2020	(r359825)
+++ head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp	Sun Apr 12 16:06:59 2020	(r359826)
@@ -112,7 +112,8 @@ RValue CodeGenFunction::EmitCXXDestructorCall(
   commonEmitCXXMemberOrOperatorCall(*this, DtorDecl, This, ImplicitParam,
                                     ImplicitParamTy, CE, Args, nullptr);
   return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(Dtor), Callee,
-                  ReturnValueSlot(), Args);
+                  ReturnValueSlot(), Args, nullptr,
+                  CE ? CE->getExprLoc() : SourceLocation{});
 }
 
 RValue CodeGenFunction::EmitCXXPseudoDestructorExpr(
@@ -380,7 +381,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberC
           IsArrow ? Base->getType()->getPointeeType() : Base->getType();
       EmitCXXDestructorCall(GD, Callee, This.getPointer(*this), ThisTy,
                             /*ImplicitParam=*/nullptr,
-                            /*ImplicitParamTy=*/QualType(), nullptr);
+                            /*ImplicitParamTy=*/QualType(), CE);
     }
     return RValue::get(nullptr);
   }

Modified: head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp
==============================================================================
--- head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp	Sun Apr 12 15:30:00 2020	(r359825)
+++ head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp	Sun Apr 12 16:06:59 2020	(r359826)
@@ -2324,8 +2324,7 @@ void CodeGenFunction::checkTargetFeatures(SourceLocati
 
     SmallVector<StringRef, 1> ReqFeatures;
     llvm::StringMap<bool> CalleeFeatureMap;
-    CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap,
-                                           GlobalDecl(TargetDecl));
+    CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap, TargetDecl);
 
     for (const auto &F : ParsedAttr.Features) {
       if (F[0] == '+' && CalleeFeatureMap.lookup(F.substr(1)))


More information about the svn-src-all mailing list