[clang] - b26e9e2 - Revert "[static analyzer] Define __clang_analyzer__ macro in driver"
Mike Edwards via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 19:08:52 PDT 2019
Sorry folks, please ignore this email. I'm working on the GitHub email
hooks. My apologies for any confusion.
-Mike
On Wed, Oct 16, 2019 at 7:07 PM Jan Korous via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
>
> Author: Jan Korous
> Date: 2019-09-24T03:21:22Z
> New Revision: b26e9e2a8f1865711c4e9b9aa7be712589169b3d
>
> URL:
> https://github.com/llvm/llvm-project/commit/b26e9e2a8f1865711c4e9b9aa7be712589169b3d
> DIFF:
> https://github.com/llvm/llvm-project/commit/b26e9e2a8f1865711c4e9b9aa7be712589169b3d.diff
>
> LOG: Revert "[static analyzer] Define __clang_analyzer__ macro in
> driver"
>
> This reverts commit fbd13570b0d5f92ef2cf6bcfe7cc2f6178500187.
>
> llvm-svn: 372687
>
> Added:
>
>
> Modified:
> clang/lib/Driver/ToolChains/Clang.cpp
> clang/lib/Frontend/InitPreprocessor.cpp
> clang/test/Analysis/misc-ps.m
>
> Removed:
> clang/test/Analysis/misc-driver.c
>
>
>
> ################################################################################
> diff --git a/clang/lib/Driver/ToolChains/Clang.cpp
> b/clang/lib/Driver/ToolChains/Clang.cpp
> index 6453af73b0a5..aa17efbee32b 100644
> --- a/clang/lib/Driver/ToolChains/Clang.cpp
> +++ b/clang/lib/Driver/ToolChains/Clang.cpp
> @@ -3896,10 +3896,8 @@ void Clang::ConstructJob(Compilation &C, const
> JobAction &JA,
> if (Args.hasArg(options::OPT_municode))
> CmdArgs.push_back("-DUNICODE");
>
> - if (isa<AnalyzeJobAction>(JA)) {
> + if (isa<AnalyzeJobAction>(JA))
> RenderAnalyzerOptions(Args, CmdArgs, Triple, Input);
> - CmdArgs.push_back("-D__clang_analyzer__");
> - }
>
> // Enable compatilibily mode to avoid analyzer-config related errors.
> // Since we can't access frontend flags through hasArg, let's manually
> iterate
>
> diff --git a/clang/lib/Frontend/InitPreprocessor.cpp
> b/clang/lib/Frontend/InitPreprocessor.cpp
> index 9da37e0a446d..95d9f62c6087 100644
> --- a/clang/lib/Frontend/InitPreprocessor.cpp
> +++ b/clang/lib/Frontend/InitPreprocessor.cpp
> @@ -990,6 +990,10 @@ static void InitializePredefinedMacros(const
> TargetInfo &TI,
> else if (LangOpts.getStackProtector() == LangOptions::SSPReq)
> Builder.defineMacro("__SSP_ALL__", "3");
>
> + // Define a macro that exists only when using the static analyzer.
> + if (FEOpts.ProgramAction == frontend::RunAnalysis)
> + Builder.defineMacro("__clang_analyzer__");
> +
> if (LangOpts.FastRelaxedMath)
> Builder.defineMacro("__FAST_RELAXED_MATH__");
>
>
> diff --git a/clang/test/Analysis/misc-driver.c
> b/clang/test/Analysis/misc-driver.c
> deleted file mode 100644
> index f9e7fe373d3c..000000000000
> --- a/clang/test/Analysis/misc-driver.c
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -// RUN: %clang --analyze %s
> -
> -#ifndef __clang_analyzer__
> -#error __clang_analyzer__ not defined
> -#endif
>
> diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m
> index 1cfd2eb1caf2..9a75cfd87b62 100644
> --- a/clang/test/Analysis/misc-ps.m
> +++ b/clang/test/Analysis/misc-ps.m
> @@ -2,6 +2,10 @@
> // RUN: %clang_analyze_cc1 -triple i386-apple-darwin10
> -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region
> -verify -fblocks -Wno-unreachable-code -Wno-null-dereference
> -Wno-objc-root-class %s
> // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10
> -analyzer-checker=core,alpha.core,osx.cocoa.AtSync -analyzer-store=region
> -verify -fblocks -Wno-unreachable-code -Wno-null-dereference
> -Wno-objc-root-class %s
>
> +#ifndef __clang_analyzer__
> +#error __clang_analyzer__ not defined
> +#endif
> +
> typedef struct objc_ivar *Ivar;
> typedef struct objc_selector *SEL;
> typedef signed char BOOL;
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191016/adbb76a0/attachment.html>
More information about the cfe-commits
mailing list