From 60927405f5612158ae0419798838be45a1637911 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 28 Jan 2025 18:59:05 -0800 Subject: Don't use CLANG_VERSION_MAJOR to check that the value passed to -fclang-abi-compat= is valid (#123998) Use LLVM_VERSION_MAJOR instead as the maximum allowed value. This change is needed to fix regression tests that fail when vendors set CLANG_VERSION_MAJOR to a value that is lower than LLVM_VERSION_MAJOR when building the compiler. For example, clang/test/CodeGenCXX/mangle-concept.cpp fails with the following error if -DCLANG_VERSION_MAJOR=17 is passed to cmake: invalid value '19' in '-fclang-abi-compat=19' --- clang/lib/Frontend/CompilerInvocation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 44dd699..2097a83 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -4413,7 +4413,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, // y or y.0 (4 <= y <= current version). if (!VerParts.first.starts_with("0") && !VerParts.first.getAsInteger(10, Major) && 3 <= Major && - Major <= CLANG_VERSION_MAJOR && + Major <= MAX_CLANG_ABI_COMPAT_VERSION && (Major == 3 ? VerParts.second.size() == 1 && !VerParts.second.getAsInteger(10, Minor) -- cgit v1.1