[clang] 8fe0449 - [RISCV] Fix required features checking with empty string
Jim Lin via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 14 01:14:02 PDT 2023
Author: Jim Lin
Date: 2023-07-14T16:09:11+08:00
New Revision: 8fe0449ac99087c74f785ddbdd4fbba65b396b3b
URL: https://github.com/llvm/llvm-project/commit/8fe0449ac99087c74f785ddbdd4fbba65b396b3b
DIFF: https://github.com/llvm/llvm-project/commit/8fe0449ac99087c74f785ddbdd4fbba65b396b3b.diff
LOG: [RISCV] Fix required features checking with empty string
In our downstream, we define some intrinsics that don't require any
extra extension enabled. Such as
TARGET_BUILTIN(__builtin_riscv_xxx, "LiLi", "nc", "")
But `split` function's `KeepEmpty` argument is True. Got the error message
error: builtin requires at least one of the following extensions support to be enabled : ''
when we use our customized intrinsic.
Reviewed By: craig.topper, wangpc
Differential Revision: https://reviews.llvm.org/D154596
Added:
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 392062ea64a1fc..f9a50f6ef3be6f 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4481,7 +4481,7 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
bool FeatureMissing = false;
SmallVector<StringRef> ReqFeatures;
StringRef Features = Context.BuiltinInfo.getRequiredFeatures(BuiltinID);
- Features.split(ReqFeatures, ',');
+ Features.split(ReqFeatures, ',', -1, false);
// Check if each required feature is included
for (StringRef F : ReqFeatures) {
More information about the cfe-commits
mailing list