r372679 - [static analyzer] Define __clang_analyzer__ macro in driver
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 20:00:35 PDT 2019
Even after all the fixup attempts, there's still a failing
clang-tools-extra test:
ninja: Entering directory `out/gn'
[0/2] ACTION
//clang-tools-extra/test:check-clang-tools(//llvm/utils/gn/build/toolchain:unix)
-- Testing: 787 tests, 64 threads --
Testing: 0 .. 10
FAIL: Clang Tools :: clang-tidy/clang-tidy-__clang_analyzer__macro.cpp (112
of 787)
******************** TEST 'Clang Tools ::
clang-tidy/clang-tidy-__clang_analyzer__macro.cpp' FAILED
********************
Script:
--
: 'RUN: at line 1'; clang-tidy
/usr/local/google/home/thakis/src/llvm-project/clang-tools-extra/test/clang-tidy/clang-tidy-__clang_analyzer__macro.cpp
-checks=-*,modernize-use-nullptr -- | count 0
--
Exit Code: 1
Command Output (stderr):
--
1 error generated.
Error while processing
/usr/local/google/home/thakis/src/llvm-project/clang-tools-extra/test/clang-tidy/clang-tidy-__clang_analyzer__macro.cpp.
Found compiler error(s).
Expected 0 lines, got 3.
--
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 4.11s
********************
Failing Tests (1):
Clang Tools :: clang-tidy/clang-tidy-__clang_analyzer__macro.cpp
On Mon, Sep 23, 2019 at 8:31 PM Jan Korous via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: jkorous
> Date: Mon Sep 23 17:33:47 2019
> New Revision: 372679
>
> URL: http://llvm.org/viewvc/llvm-project?rev=372679&view=rev
> Log:
> [static analyzer] Define __clang_analyzer__ macro in driver
>
> Differential Revision: https://reviews.llvm.org/D67938
>
> Added:
> cfe/trunk/test/Analysis/misc-driver.c
> Modified:
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/Analysis/misc-ps.m
>
> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=372679&r1=372678&r2=372679&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Sep 23 17:33:47 2019
> @@ -3896,8 +3896,10 @@ void Clang::ConstructJob(Compilation &C,
> 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
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=372679&r1=372678&r2=372679&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Sep 23 17:33:47 2019
> @@ -990,10 +990,6 @@ static void InitializePredefinedMacros(c
> 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__");
>
>
> Added: cfe/trunk/test/Analysis/misc-driver.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-driver.c?rev=372679&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/Analysis/misc-driver.c (added)
> +++ cfe/trunk/test/Analysis/misc-driver.c Mon Sep 23 17:33:47 2019
> @@ -0,0 +1,5 @@
> +// RUN: %clang --analyze %s
> +
> +#ifndef __clang_analyzer__
> +#error __clang_analyzer__ not defined
> +#endif
>
> Modified: cfe/trunk/test/Analysis/misc-ps.m
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=372679&r1=372678&r2=372679&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Analysis/misc-ps.m (original)
> +++ cfe/trunk/test/Analysis/misc-ps.m Mon Sep 23 17:33:47 2019
> @@ -2,10 +2,6 @@
> // 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/20190923/aa881209/attachment-0001.html>
More information about the cfe-commits
mailing list