[clang] bea5e88 - [clang][Sema] Fix typo in checkBuiltinArgument helper
Alex Bradbury via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 06:42:45 PDT 2022
Author: Alex Bradbury
Date: 2022-04-20T14:42:41+01:00
New Revision: bea5e88bcf5908b676da35fb8c64f9f8449ba73b
URL: https://github.com/llvm/llvm-project/commit/bea5e88bcf5908b676da35fb8c64f9f8449ba73b
DIFF: https://github.com/llvm/llvm-project/commit/bea5e88bcf5908b676da35fb8c64f9f8449ba73b.diff
LOG: [clang][Sema] Fix typo in checkBuiltinArgument helper
The checkBuiltinArgument helper takes an integer ArgIndex and is
documented as performing normal type-checking on that argument. However,
it mistakenly hardcodes the argument index to zero when retrieving the
argument from the call expression.
This hadn't been noticed previously as all in-tree uses typecheck the
0th argument anyway.
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index cd069d5664571..f575c0775e7f9 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6222,7 +6222,7 @@ static bool checkBuiltinArgument(Sema &S, CallExpr *E, unsigned ArgIndex) {
InitializedEntity Entity =
InitializedEntity::InitializeParameter(S.Context, Param);
- ExprResult Arg = E->getArg(0);
+ ExprResult Arg = E->getArg(ArgIndex);
Arg = S.PerformCopyInitialization(Entity, SourceLocation(), Arg);
if (Arg.isInvalid())
return true;
More information about the cfe-commits
mailing list