1 //= UninitializedValues.h - Finding uses of uninitialized values --*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines APIs for invoking and reported uninitialized values
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_UNINIT_VALS_H
16 #define LLVM_CLANG_UNINIT_VALS_H
20 class AnalysisContext;
26 class UninitVariablesHandler {
28 UninitVariablesHandler() {}
29 virtual ~UninitVariablesHandler();
31 /// Called when the uninitialized variable is used at the given expression.
32 virtual void handleUseOfUninitVariable(const Expr *ex,
34 bool isAlwaysUninit) {}
36 /// Called when the uninitialized variable analysis detects the
37 /// idiom 'int x = x'. All other uses of 'x' within the initializer
38 /// are handled by handleUseOfUninitVariable.
39 virtual void handleSelfInit(const VarDecl *vd) {}
42 struct UninitVariablesAnalysisStats {
43 unsigned NumVariablesAnalyzed;
44 unsigned NumBlockVisits;
47 void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg,
49 UninitVariablesHandler &handler,
50 UninitVariablesAnalysisStats &stats);