mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
GNUNullExpr is a valid sentinel even though it isn't of pointer type.
llvm-svn: 89778
This commit is contained in:
@@ -152,9 +152,10 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
|
||||
++sentinel;
|
||||
}
|
||||
Expr *sentinelExpr = Args[sentinel];
|
||||
if (sentinelExpr && (!sentinelExpr->getType()->isPointerType() ||
|
||||
!sentinelExpr->isNullPointerConstant(Context,
|
||||
Expr::NPC_ValueDependentIsNull))) {
|
||||
if (sentinelExpr && (!isa<GNUNullExpr>(sentinelExpr) &&
|
||||
(!sentinelExpr->getType()->isPointerType() ||
|
||||
!sentinelExpr->isNullPointerConstant(Context,
|
||||
Expr::NPC_ValueDependentIsNull)))) {
|
||||
Diag(Loc, diag::warn_missing_sentinel) << isMethod;
|
||||
Diag(D->getLocation(), diag::note_sentinel_here) << isMethod;
|
||||
}
|
||||
|
||||
6
clang/test/SemaCXX/attr-sentinel.cpp
Normal file
6
clang/test/SemaCXX/attr-sentinel.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
void f(int, ...) __attribute__((sentinel));
|
||||
|
||||
void g() {
|
||||
f(1, 2, __null);
|
||||
}
|
||||
Reference in New Issue
Block a user