[clang] f0f16be - [clang][Sema][NFC] Clean up BuildOverloadedCallExpr

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 06:05:44 PST 2024


Author: Timm Bäder
Date: 2024-01-08T15:04:52+01:00
New Revision: f0f16be77e1977d04535556ef69eaccd5bfef36f

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

LOG: [clang][Sema][NFC] Clean up BuildOverloadedCallExpr

Added: 
    

Modified: 
    clang/lib/Sema/SemaOverload.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 8e3a2d1288079b..07da5cb150b467 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -13999,17 +13999,14 @@ ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn,
   // encloses the call and whose return type contains a placeholder type as if
   // the UnresolvedLookupExpr was type-dependent.
   if (OverloadResult == OR_Success) {
-    FunctionDecl *FDecl = Best->Function;
+    const FunctionDecl *FDecl = Best->Function;
     if (FDecl && FDecl->isTemplateInstantiation() &&
         FDecl->getReturnType()->isUndeducedType()) {
-      if (auto TP = FDecl->getTemplateInstantiationPattern(false)) {
-        if (TP->willHaveBody()) {
-          CallExpr *CE =
-              CallExpr::Create(Context, Fn, Args, Context.DependentTy,
-                               VK_PRValue, RParenLoc, CurFPFeatureOverrides());
-          result = CE;
-          return result;
-        }
+      if (const auto *TP =
+              FDecl->getTemplateInstantiationPattern(/*ForDefinition=*/false);
+          TP && TP->willHaveBody()) {
+        return CallExpr::Create(Context, Fn, Args, Context.DependentTy,
+                                VK_PRValue, RParenLoc, CurFPFeatureOverrides());
       }
     }
   }


        


More information about the cfe-commits mailing list