Page MenuHomePhabricator

Avoid building analyzer plugins if CLANG_ENABLE_STATIC_ANALYZER is OFF
AbandonedPublic

Authored by dim on Jun 4 2019, 12:48 PM.

Details

Summary

Attempting to build clang with CLANG_ENABLE_STATIC_ANALYZER=OFF fails
after rC362328, because the new plugins under lib/Analysis/plugins are
dependent on the static analyzer libraries.

Add checks to disable building these if CLANG_ENABLE_STATIC_ANALYZER is
OFF.

Diff Detail

Event Timeline

dim created this revision.Jun 4 2019, 12:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2019, 12:48 PM

Experienced the same, updated my test build configuration to always force CLANG_ENABLE_STATIC_ANALYZER to On when building with tests. Maybe it's worth adding a warning about when Clang tests are being built?

Thanks for the quick fix, looks good to me!

Thanks for the quick fix, looks good to me!

Ah, sorry, just saw this. I just committed r362555 that addresses this.

hintonda accepted this revision.Jun 4 2019, 3:59 PM

LGTM...

test/CMakeLists.txt
122

I didn't fix this one, but makes sense.

This revision is now accepted and ready to land.Jun 4 2019, 3:59 PM
Szelethus added inline comments.Jun 4 2019, 4:14 PM
lib/Analysis/plugins/CMakeLists.txt
1

Is this file a thing? lib/Analysis/plugins/CMakeLists.txt? I can't seem to find it anywhere.

hintonda added inline comments.Jun 4 2019, 5:10 PM
lib/Analysis/plugins/CMakeLists.txt
1

commit a33eaad00cca99ca0b5d2b0cc6dec33be6d7ee7f (origin/master, origin/HEAD, master)
Author: Don Hinton <hintonda@gmail.com>
Date: Tue Jun 4 22:07:40 2019 +0000

[Analysis] Only build Analysis plugins when CLANG_ENABLE_STATIC_ANALYZER is enabled.

Fixes bug introduced in r362328.

Thanks to Nathan Chancellor for reporting this!

llvm-svn: 362555

$ git diff 06c801e153347d24ec7ce93f6ffbbc58b64a89ba a33eaad00cca99ca0b5d2b0cc6dec33be6d7ee7f
diff --git a/clang/lib/Analysis/plugins/CMakeLists.txt b/clang/lib/Analysis/plugins/CMakeLists.txt
index f7dbc936952..bd7314a871f 100644

  • a/clang/lib/Analysis/plugins/CMakeLists.txt

+++ b/clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)

add_subdirectory(SampleAnalyzer)
add_subdirectory(CheckerDependencyHandling)
add_subdirectory(CheckerOptionHandling)
Szelethus accepted this revision.Jun 4 2019, 5:19 PM

I seem to have missed out on previous commits that moved analyzer plugins around -- would you mind adding [analyzer] to the revision names that affect the Static Analyzer? Many of us are automatically subscribed to such patches.

In any case, LGTM!

lib/Analysis/plugins/CMakeLists.txt
1

Oops, my apologies, was on the wrong branch.

I seem to have missed out on previous commits that moved analyzer plugins around -- would you mind adding [analyzer] to the revision names that affect the Static Analyzer? Many of us are automatically subscribed to such patches.

In any case, LGTM!

Sorry about that. I was mainly trying to fix broken llvm plugins that were no longer available with the previous changes to LLVM_ENABLE_PLUGIN.

dim abandoned this revision.Jun 15 2019, 2:05 PM

No longer needed after rC362328 and follow-ups.