diff options
| author | Erich Keane <erich.keane@intel.com> | 2018-11-13 15:48:08 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2018-11-13 15:48:08 +0000 |
| commit | 43f8ad7966404a3caab540f2ef8b79a69628b6bb (patch) | |
| tree | a6c6e2f29befbf0a7f4aa74383d4173e09fa2e16 /lib/CodeGen/CGExpr.cpp | |
| parent | 3919b8d9833d23d98e8be71fe608627866d5c40c (diff) | |
| download | clang-43f8ad7966404a3caab540f2ef8b79a69628b6bb.tar.gz | |
[NFC] Move storage of dispatch-version to GlobalDecl
As suggested by Richard Smith, and initially put up for review here:
https://reviews.llvm.org/D53341, this patch removes a hack that was used
to ensure that proper target-feature lists were used when emitting
cpu-dispatch (and eventually, target-clones) implementations. As a part
of this, the GlobalDecl object is proliferated to a bunch more
locations.
Originally, this was put up for review (see above) to get acceptance on
the approach, though discussion with Richard in San Diego showed he
approved of the approach taken here. Thus, I believe this is acceptable
for Review-After-commit
Differential Revision: https://reviews.llvm.org/D53341
Change-Id: I0a0bd673340d334d93feac789d653e03d9f6b1d5
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index dafca7cf7c..c2e2031dd3 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -4375,7 +4375,7 @@ static CGCallee EmitDirectCallee(CodeGenFunction &CGF, const FunctionDecl *FD) { } llvm::Constant *calleePtr = EmitFunctionDeclPointer(CGF.CGM, FD); - return CGCallee::forDirect(calleePtr, FD); + return CGCallee::forDirect(calleePtr, GlobalDecl(FD)); } CGCallee CodeGenFunction::EmitCallee(const Expr *E) { @@ -4419,8 +4419,13 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) { calleePtr = EmitLValue(E).getPointer(); } assert(functionType->isFunctionType()); - CGCalleeInfo calleeInfo(functionType->getAs<FunctionProtoType>(), - E->getReferencedDeclOfCallee()); + + GlobalDecl GD; + if (const auto *VD = + dyn_cast_or_null<VarDecl>(E->getReferencedDeclOfCallee())) + GD = GlobalDecl(VD); + + CGCalleeInfo calleeInfo(functionType->getAs<FunctionProtoType>(), GD); CGCallee callee(calleeInfo, calleePtr); return callee; } @@ -4605,7 +4610,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee assert(CalleeType->isFunctionPointerType() && "Call must have function pointer type!"); - const Decl *TargetDecl = OrigCallee.getAbstractInfo().getCalleeDecl(); + const Decl *TargetDecl = + OrigCallee.getAbstractInfo().getCalleeDecl().getDecl(); if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(TargetDecl)) // We can only guarantee that a function is called from the correct |
