1 //= UninitializedValues.h - Finding uses of uninitialized values --*- C++ -*-==// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file defines APIs for invoking and reported uninitialized values 11 // warnings. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_UNINIT_VALS_H 16 #define LLVM_CLANG_UNINIT_VALS_H 17 18 namespace clang { 19 20 class AnalysisContext; 21 class CFG; 22 class DeclContext; 23 class Expr; 24 class VarDecl; 25 26 class UninitVariablesHandler { 27 public: UninitVariablesHandler()28 UninitVariablesHandler() {} 29 virtual ~UninitVariablesHandler(); 30 handleUseOfUninitVariable(const Expr * ex,const VarDecl * vd,bool isAlwaysUninit)31 virtual void handleUseOfUninitVariable(const Expr *ex, 32 const VarDecl *vd, 33 bool isAlwaysUninit) {} 34 }; 35 36 struct UninitVariablesAnalysisStats { 37 unsigned NumVariablesAnalyzed; 38 unsigned NumBlockVisits; 39 }; 40 41 void runUninitializedVariablesAnalysis(const DeclContext &dc, const CFG &cfg, 42 AnalysisContext &ac, 43 UninitVariablesHandler &handler, 44 UninitVariablesAnalysisStats &stats); 45 46 } 47 #endif 48