diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-14 02:45:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-14 02:45:18 +0000 |
commit | 6dd66ed959b7f60749dd0040507b3f304183a1b6 (patch) | |
tree | 74e46fdabb8c12291a174290b04e2c511323c98f /lib/Frontend/AnalysisConsumer.cpp | |
parent | 280cfd70c7a536311656fbd2082cb54d59cf3a2e (diff) |
Add new static analyzer for checking LLVM coding conventions: -analyzer-check-llvm-conventions
Currently these checks are intended to be largely syntactical, but may get more
sophisticated over time.
As an initial foray into this brave new world, emit a static analyzer warning
when binding a temporary 'std::string' to an 'llvm::StringRef' where the
lifetime of the 'std::string' does not outlive the 'llvm::StringRef'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/AnalysisConsumer.cpp')
-rw-r--r-- | lib/Frontend/AnalysisConsumer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index 62073269c1..64fa1d24f7 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -446,6 +446,14 @@ static void ActionSecuritySyntacticChecks(AnalysisConsumer &C, CheckSecuritySyntaxOnly(D, BR); } +static void ActionLLVMConventionChecker(AnalysisConsumer &C, + AnalysisManager &mgr, + Decl *D) { + C.DisplayFunction(D); + BugReporter BR(mgr); + CheckLLVMConventions(D, BR); +} + static void ActionWarnObjCDealloc(AnalysisConsumer &C, AnalysisManager& mgr, Decl *D) { if (mgr.getLangOptions().getGCMode() == LangOptions::GCOnly) |