================
@@ -1487,6 +1487,66 @@ void 
Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
     break;
   }
 
+  case Builtin::BIread:
+  case Builtin::BIpread:
+  case Builtin::BIpread64:
+  case Builtin::BIreadlink:
+  case Builtin::BIreadlinkat:
+  case Builtin::BIgetcwd: {
+    unsigned BufIdx = 1;
+    if (BuiltinID == Builtin::BIgetcwd)
+      BufIdx = 0;
+    else if (BuiltinID == Builtin::BIreadlinkat)
+      BufIdx = 2;
----------------
nickdesaulniers wrote:

I think you might better reduce the redundant conditional checks in the case by 
grouping the builtins into these 3 groupings based on roughly on function 
signature:

1. read, write, pread, pread64, pwrite, pwrite64: `(int fd, [const] void *buf, 
size_t count[, off_t offset])`
2. readlink, readlinkat: ([int dirfd, ]const char *path, char *buf, size_t 
bufsiz)
3. getcwd: (char *buf, size_t size)

i.e. have blocks of case labels for each of the three above.

https://github.com/llvm/llvm-project/pull/224979
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to