Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2376,9 +2376,14 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
return nullptr;
}

// Warn for implicit uses of header dependent libraries,
// except in system headers.
if (!ForRedeclaration &&
(Context.BuiltinInfo.isPredefinedLibFunction(ID) ||
Context.BuiltinInfo.isHeaderDependentFunction(ID))) {
Context.BuiltinInfo.isHeaderDependentFunction(ID)) &&
(!getDiagnostics().getSuppressSystemWarnings() ||
!Context.getSourceManager().isInSystemHeader(
Context.getSourceManager().getSpellingLoc(Loc)))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to narrow down the scope of which diagnostics we want to suppress and when.
While we do know that we may need it for these builting for windows on ARM, I can not say whether we want to do that to other intrinsics for other targets.

Diag(Loc, LangOpts.C99 ? diag::ext_implicit_lib_function_decl_c99
: diag::ext_implicit_lib_function_decl)
<< Context.BuiltinInfo.getName(ID) << R;
Expand Down
1 change: 1 addition & 0 deletions clang/test/Sema/Inputs/builtin-system-header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define MACRO(x,y) _InterlockedOr64(x,y);
8 changes: 8 additions & 0 deletions clang/test/Sema/builtin-system-header.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify -triple arm64-windows -isystem %S/Inputs %s

// expected-no-diagnostics
#include <builtin-system-header.h>

void foo() {
MACRO(0,0);
}