aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorZahira Ammarguellat <zahira.ammarguellat@intel.com>2024-01-22 11:38:30 -0800
committerGitHub <noreply@github.com>2024-01-22 14:38:30 -0500
commit1e2a4ccb6237b6db9db7dc3fd11a94410ec9b0df (patch)
treeff5165df69305afc3df13fc1a3154d115386e5e9 /clang/lib/Lex/Preprocessor.cpp
parent0dd72eb269dd485b98afba2c58a1d747db53dcad (diff)
downloadllvm-1e2a4ccb6237b6db9db7dc3fd11a94410ec9b0df.zip
llvm-1e2a4ccb6237b6db9db7dc3fd11a94410ec9b0df.tar.gz
llvm-1e2a4ccb6237b6db9db7dc3fd11a94410ec9b0df.tar.bz2
[CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (#76873)
Check for operations using INF or NaN when in ffast-math mode and generate a warning.
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 64f54c6..7fdb5d4c 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -1457,6 +1457,11 @@ void Preprocessor::emitRestrictExpansionWarning(const Token &Identifier) const {
Diag(Info.Location, diag::note_pp_macro_annotation) << 1;
}
+void Preprocessor::emitRestrictInfNaNWarning(const Token &Identifier,
+ unsigned DiagSelection) const {
+ Diag(Identifier, diag::warn_fp_nan_inf_when_disabled) << DiagSelection << 1;
+}
+
void Preprocessor::emitFinalMacroWarning(const Token &Identifier,
bool IsUndef) const {
const MacroAnnotations &A =