1 //== PseudoConstantAnalysis.h - Find Pseudo-constants in the AST -*- 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 tracks the usage of variables in a Decl body to see if they are
11 // never written to, implying that they constant. This is useful in static
12 // analysis to see if a developer might have intended a variable to be const.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_ANALYSIS_PSEUDOCONSTANTANALYSIS
17 #define LLVM_CLANG_ANALYSIS_PSEUDOCONSTANTANALYSIS
19 #include "clang/AST/Stmt.h"
23 class PseudoConstantAnalysis {
25 PseudoConstantAnalysis(const Stmt *DeclBody);
26 ~PseudoConstantAnalysis();
28 bool isPseudoConstant(const VarDecl *VD);
29 bool wasReferenced(const VarDecl *VD);
33 inline static const Decl *getDecl(const Expr *E);
35 // for storing the result of analyzed ValueDecls
36 void *NonConstantsImpl;