[PATCH] Modeling APIs in the Static Analyzer

Gábor Horváth xazax.hun at gmail.com
Wed Aug 20 01:11:54 PDT 2014


Hi Ted,



On 20 August 2014 07:18, Ted Kremenek <kremenek at apple.com> wrote:

>
> On Aug 16, 2014, at 5:47 AM, Gábor Horváth <xazax.hun at gmail.com> wrote:
>
> Sorry for my oversight about the turned off asserts, I guess we need to
> iterate a bit more on the patch.
>
>
> Hi Gábor,
>
> Sounds good!
>
> The attached patch appears to generate new warnings when compiled:
>
>   lib/StaticAnalyzer/Core/BugReporter.cpp:3091:30: warning: unused
> variable 'LCtx' [-Wunused-variable]
>         const LocationContext *LCtx = E->getLocationContext();
>                                ^
>
>
Fixed.


> I'm also still seeing assertion failures, but this time in other tests:
>
> Assertion failed: (NumEnteredSourceFiles == 0 && "Cannot reenter the main
> file!"), function EnterMainSourceFile, file lib/Lex/Preprocessor.cpp, line
> 484.
> 0  clang                    0x000000010cfcb668
> llvm::sys::PrintStackTrace(__sFILE*) + 40
> 1  clang                    0x000000010cfcbb54 SignalHandler(int) + 564
> 2  libsystem_platform.dylib 0x00007fff8f835f1a _sigtramp + 26
> 3  clang                    0x000000010e7775e9 guard variable for
> isAllowedIDChar(unsigned int, clang::LangOptions const&)::C99AllowedIDChars
> + 58369
> 4  clang                    0x000000010cfcb906 abort + 22
> 5  clang                    0x000000010cfcb8e1 __assert_rtn + 81
> 6  clang                    0x000000010e27c449
> clang::Preprocessor::EnterMainSourceFile() + 537
> 7  clang                    0x000000010d874e7b
> clang::ParseAST(clang::Sema&, bool, bool) + 187
> 8  clang                    0x000000010d1ce1d3
> clang::FrontendAction::Execute() + 67
> 9  clang                    0x000000010d1a1b7c
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 972
> 10 clang                    0x000000010d208bc5
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4149
> 11 clang                    0x000000010c699834
> cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 804
> 12 clang                    0x000000010c697fa4 main + 8788
> 13 libdyld.dylib            0x00007fff97fa15c9 start + 1
> Stack dump:
> 0. Program arguments:/trunk-RelWithDebInfo/./bin/clang -cc1
> -internal-isystem/trunk-RelWithDebInfo/bin/../lib/clang/3.6.0/include -Wall
> -fsyntax-only  clang/test/Misc/serialized-diags-single-issue.c /clang/test/Misc/serialized-diags-single-issue.c
> -serialize-diagnostic-file/trunk-RelWithDebInfo/tools/clang/test/Misc/Output/serialized-diags-single-issue.c.tmp
> 1. <eof> parser at end of file
> /cmake-make/trunk-RelWithDebInfo/tools/clang/test/Misc/Output/serialized-diags-single-issue.c.script:
> line 6: 56078 Illegal instruction: 4  trunk-RelWithDebInfo/./bin/clang -cc1
> -internal-isystem/trunk-RelWithDebInfo/bin/../lib/clang/3.6.0/include -Wall
> -fsyntax-only /clang/test/Misc/serialized-diags-single-issue.c /clang/test/Misc/serialized-diags-single-issue.c
> -serialize-diagnostic-file/trunk-RelWithDebInfo/tools/clang/test/Misc/Output/serialized-diags-single-issue.c.tmp
>
>
> and
>
> Assertion failed: (NumEnteredSourceFiles == 0 && "Cannot reenter the main
> file!"), function EnterMainSourceFile,
> file /llvm-trunk/tools/clang/lib/Lex/Preprocessor.cpp, line 484.
> 0  clang                    0x00000001105fa668
> llvm::sys::PrintStackTrace(__sFILE*) + 40
> 1  clang                    0x00000001105fab54 SignalHandler(int) + 564
> 2  libsystem_platform.dylib 0x00007fff8f835f1a _sigtramp + 26
> 3  libsystem_platform.dylib 0x00007fff65330764 _sigtramp + 3585058916
> 4  clang                    0x00000001105fa906 abort + 22
> 5  clang                    0x00000001105fa8e1 __assert_rtn + 81
> 6  clang                    0x00000001118ab449
> clang::Preprocessor::EnterMainSourceFile() + 537
> 7  clang                    0x0000000110ea3e7b
> clang::ParseAST(clang::Sema&, bool, bool) + 187
> 8  clang                    0x0000000110b48c7b
> clang::CodeGenAction::ExecuteAction() + 123
> 9  clang                    0x00000001107fd1d3
> clang::FrontendAction::Execute() + 67
> 10 clang                    0x00000001107d0b7c
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 972
> 11 clang                    0x0000000110837bc5
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4149
> 12 clang                    0x000000010fcc8834
> cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 804
> 13 clang                    0x000000010fcc6fa4 main + 8788
> 14 libdyld.dylib            0x00007fff97fa15c9 start + 1
> Stack dump:
> 0. Program arguments: /cmake-make/trunk-RelWithDebInfo/./bin/clang -cc1
> -internal-isystem  cmake-make/trunk-RelWithDebInfo/bin/../lib/clang/3.6.0/include
> -triple x86_64-apple-macosx10.9.0 -include /clang/test/PCH/local_static.h
> -fsyntax-only  clang/test/PCH/local_static.cpp -emit-llvm
> -o  cmake-make/trunk-RelWithDebInfo/tools/clang/test/PCH/Output/local_static.cpp.tmp.no_pch.ll /clang/test/PCH/local_static.cpp
> 1. <eof> parser at end of file
> /cmake-make/trunk-RelWithDebInfo/tools/clang/test/PCH/Output/local_static.cpp.script:
> line 5: 57780 Illegal instruction: 4
>  /cmake-make/trunk-RelWithDebInfo/./bin/clang -cc1
> -internal-isystem /cmake-make/trunk-RelWithDebInfo/bin/../lib/clang/3.6.0/include
> -triple x86_64-apple-macosx10.9.0 -include  clang/test/PCH/local_static.h
> -fsyntax-only /clang/test/PCH/local_static.cpp -emit-llvm
> -o /cmake-make/trunk-RelWithDebInfo/tools/clang/test/PCH/Output/local_static.cpp.tmp.no_pch.ll /clang/test/PCH/local_static.cpp
>
> Are you seeing these failures as well?
>
>
It looks like in some scenarios the preprocessor was reused even though the
source file was not a model file. I have fixed this issue as well.

Thanks,
Gábor



> Thanks,
> Ted
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140820/676d6547/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: api_modeling.patch
Type: text/x-patch
Size: 48041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140820/676d6547/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugreporter.patch
Type: text/x-patch
Size: 1388 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140820/676d6547/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clangTidy.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140820/676d6547/attachment-0002.bin>


More information about the cfe-commits mailing list