From 89a0c4066b0e70edd257e30d7189f303e26251a0 Mon Sep 17 00:00:00 2001 From: Zixu Wang Date: Tue, 30 Jun 2020 09:28:06 -0700 Subject: [clang][diagnostics] Add '-Wundef-prefix' warning option Summary: Add an `-Wundef-prefix=,...` option, which is similar to `-Wundef`, but only give warnings for undefined macros with the given prefixes. Reviewers: ributzka, steven_wu, cishida, bruno, arphaman, rsmith Reviewed By: ributzka, arphaman Subscribers: riccibruno, dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D80751 This patch was authored by Zixu Wang --- clang/lib/Frontend/CompilerInvocation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 8bd248c..e12931a 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1688,6 +1688,9 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, } Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length_EQ, 0, Diags); + + Opts.UndefPrefixes = Args.getAllArgValues(OPT_Wundef_prefix_EQ); + addDiagnosticArgs(Args, OPT_W_Group, OPT_W_value_Group, Opts.Warnings); addDiagnosticArgs(Args, OPT_R_Group, OPT_R_value_Group, Opts.Remarks); -- cgit v1.1