简体   繁体   中英

Android NDK - static analysis for native c++ code

Is there a static analysis tool integrated into the Android NDK for native code? From my understanding, it looks like the NDK recently transitioned to CLang which I think has a built-in static analyzer ( https://clang-analyzer.llvm.org/scan-build.html ), but I can't seem to find out how to use it. I am guessing I just need to update my CMake file somehow?

I searched through all the gradle tasks using "./gradlew tasks --all" and I saw the "externalNativeBuild" task but that just builds the native source code.

Ideally, I would like to just run a single command/task and an output file is generated with all the static analysis issues for my native code -- similar to Java's "lint" task where an HTML file is created.

Thanks!

I do not think you have an integrated tool for that in Android Studio. However, you can also try CppCheck . It is not perfect, but it is not bad at all and saved me in several occasions. You can use it for single files or build a project once and load it each time. It is also free.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM