This fixes a false positive on the following, where st is configured to have
different sizes based on some preprocessor logic:
if (sizeof(buf) == sizeof(*st))
memcpy(&buf, st, sizeof(*st));
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357041
91177308-0d34-0410-b5e6-
96231b3b80d8
FunctionName = FunctionName.drop_front(std::strlen("__builtin_"));
}
- Diag(TheCall->getBeginLoc(), DiagID)
- << FunctionName << ObjectSize.toString(/*Radix=*/10)
- << UsedSize.toString(/*Radix=*/10);
+ DiagRuntimeBehavior(TheCall->getBeginLoc(), TheCall,
+ PDiag(DiagID)
+ << FunctionName << ObjectSize.toString(/*Radix=*/10)
+ << UsedSize.toString(/*Radix=*/10));
}
static bool SemaBuiltinSEHScopeCheck(Sema &SemaRef, CallExpr *TheCall,
char dst[10];
char src[20];
memcpy(dst, src, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 10, but size argument is 20}}
+
+ if (sizeof(dst) == sizeof(src))
+ memcpy(dst, src, 20); // no warning, unreachable
}
void call_memcpy_type() {