[PATCH] D122956: [clang] NFC: Simplify the interface to CodeGenModule::GetOrCreateMultiVersionResolver().

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 2 14:11:49 PDT 2022


tahonermann created this revision.
tahonermann added reviewers: erichkeane, aaron.ballman.
Herald added a project: All.
tahonermann added inline comments.
tahonermann published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3539-3540
 
-  if (const auto *CXXFD = dyn_cast<CXXMethodDecl>(FD)) {
-    const CGFunctionInfo &FInfo = getTypes().arrangeCXXMethodDeclaration(CXXFD);
-    DeclTy = getTypes().GetFunctionType(FInfo);
-  }
+  const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
+  llvm::FunctionType *DeclTy = getTypes().GetFunctionType(FI);
 
----------------
This is a drive by cleanup. `arrangeGlobalDeclaration()` handles the `CXXMethodDecl` special case (as well as other special cases). We rely on such calls elsewhere; see `CodeGenModule::emitMultiVersionFunctions()` for example.


Previously, GetOrCreateMultiVersionResolver() required the caller to provide
a GlobalDecl along with an llvm::type and FunctionDecl. The latter two can be
cheaply obtained from the first, and the llvm::type parameter is not always
used, so requiring the caller to provide them was unnecessary and created the
possibility that callers would pass an inconsistent set. This change simplifies
the interface to only require the GlobalDecl value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122956

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122956.419915.patch
Type: text/x-patch
Size: 4605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220402/72fafa7c/attachment.bin>


More information about the cfe-commits mailing list