clang-static-analyzer Questions

1

I am using clang-tidy to lint my code base, but the entire process is very slow. Is there a way to completely ignore header files and not only suppress the warnings? As you can see with this exampl...
Heddle asked 5/7, 2022 at 2:43

3

Solved

I'm trying to integrate clang-tidy with cmake, but there are some files that belong to a particular target which I would like to ignore. Is there any way to make clang-tidy to ignore files under c...
Statuette asked 18/5, 2020 at 10:33

3

Solved

I wanted to try out the clang static analyzer. I'm on Windows and built clang with Visual Studio. It seems to work, but at the same time it seems to be extremely useless. I made an example file e...
Oriental asked 9/3, 2017 at 13:32

1

Solved

Consider this C++ code: struct SomeStruct { SomeStruct() noexcept; }; //SomeStruct::SomeStruct() noexcept {} class SomeClass { const bool b; const SomeStruct s; public: SomeClass() : b(true)...
Stockyard asked 26/4, 2022 at 2:56

3

tldr;> How do I hide warnings from system headers in clang-tidy? I have the following minimal example source file, which triggers a clang-tidy warning in the system headers: #include <future&g...
Disapproval asked 9/10, 2017 at 3:7

3

Solved

I'd basically like to achieve the same as http://blog.alexrp.com/2013/09/26/clangs-static-analyzer-and-automake, but with CMake. analyze_srcs = foo.c analyze_plists = $(analyze_srcs:%.c=%.plist) C...
Seashore asked 27/9, 2013 at 12:11

1

I'd like to use the clang static analyzer command line tool scan-build with the convenience of cmake --build. Most of the resources I found online seem to indicate you need a two-step process: sc...
Dissimulate asked 22/2, 2017 at 14:1

4

Solved

I recently started experimenting with the clang-tidy tool of llvm. Now I am trying to suppress false warnings from third party library code. For this I want to use the command line options -header-...
Procephalic asked 16/9, 2016 at 8:41

0

I'm currently trying to integrate the Clang Static Analyzer v9.0.1 into my CMake v3.16.5 build system using the Microsoft Visual C++ Compiler (MSVC) v19.25.28610.4 on a Windows v10.0.18363.720 oper...

2

I have a templated class SafeInt<T> (By Microsoft). This class in theory can be used in place of a POD integer type and can detect any integer overflows during arithmetic operations. For ...

2

Solved

Suppose I'm working with the following C snippet: void inc(int *num) {*num++;} void dec(int *num) {*num--;} void f(int var) { inc(&var); dec(&var); } By using a static analyzer, I wan...
Overpraise asked 3/5, 2014 at 18:51

1

I'd like to match on all the ways a particular argument to a function can be null. Right now I'm using hasArgument( 3, anyOf( cxxNullPtrLiteralExpr() ,integerLiteral() // Technically this woul...
Premaxilla asked 26/8, 2019 at 21:51

2

When checking #include <stdio.h> #include <stdlib.h> int main(void) { char c[20]; size_t l; l = fread(c, sizeof c, 1, stdin); if (l != 1) return 1; return c[0] == 42; } with...
Pygmy asked 7/3, 2019 at 17:29

0

The situation: My code uses a reference-counting pointer class (similar in spirit to boost::intrusive_ptr) to manage its dynamic allocations and avoid memory leaks. AFAICT this works fine and does...
Permalloy asked 12/1, 2019 at 20:26

1

Both of these tools seem to share some common goals and while the documentation of clang-tidy is quite explicit about its capabilities, clang-check's is a bit sparse. It would be nice if I could r...
Throw asked 20/4, 2018 at 14:17

0

The binary windows installer for clang includes scan-build but when you run it with msbuild nothing happens. Even if I do something like: "C:\Program Files\LLVM\bin\scan-build.bat" "C:\Program Fil...

0

Anyone know of any sources for a LLVMHeaderGuardCheck like clang-tidy check that formats the expected include guards based on configurable information like the include path(s) given on the command ...
Carbineer asked 25/9, 2017 at 20:7

1

Solved

When trying to print the first command line argument: std::cout << argv[0] << std::endl; clang-tidy gives the warning: warning: 'do not use pointer arithmetic' from [cppcoreguide...

1

Solved

I am using clang static analysis under Xcode 6.4 (6E35b), and getting a false positive warning about a potential memory leak. I do explicitly free the memory in question, but the freeing happens in...

2

Solved

I'm trying to use make use of clang-tidy integration with cmake and I'd like to pass the -check argument. I've tried adding -DCMAKE_CXX_CLANG_TIDY="/usr/local/opt/llvm38/bin/clang-tidy-3.8;-checks=...
Petrie asked 5/11, 2016 at 0:31

0

A colleague sees a strange warning by clang static analyzer (actually from clang-check). This code: #include <regex> int main() { std::regex_match("jee", std::regex("lol&quot...
Nevis asked 20/1, 2017 at 11:57

2

I have an object hierarchy and need to be able to clone objects from the base class. I've followed the typical CRTP pattern, except that I also want to be able to return the child class if copy is ...
Boyfriend asked 11/12, 2016 at 14:7

4

Solved

The Xcode 4 static analyzer reports in my code some false positives. Is there any way to suppress them?
Desecrate asked 27/4, 2011 at 14:53

1

see this manual Using Clang Static Analyzer in Qt Creator manual can someone tell me for to set up this? I don't see this tab in analyzer settings in QtCreator and don't see the plugin in the list...
Helpmate asked 14/7, 2015 at 7:46

2

I just installed ClangOnWin,and I'm trying to get clang-tidy's "modernize" checks to work. Unfortunately, clang-tidy doesn't seem to know about them: clang-tidy -list-checks foo.cpp -- | grep moder...
Disraeli asked 16/11, 2015 at 19:53

© 2022 - 2025 — McMap. All rights reserved.