clang API Documentation
00001 //== TaintManager.h - Managing taint --------------------------- -*- C++ -*--=// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file provides APIs for adding, removing, querying symbol taint. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_TAINTMANAGER_H 00015 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_TAINTMANAGER_H 00016 00017 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h" 00018 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" 00019 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h" 00020 #include "clang/StaticAnalyzer/Core/PathSensitive/TaintTag.h" 00021 #include "llvm/ADT/ImmutableMap.h" 00022 00023 namespace clang { 00024 namespace ento { 00025 00026 /// The GDM component containing the tainted root symbols. We lazily infer the 00027 /// taint of the dependent symbols. Currently, this is a map from a symbol to 00028 /// tag kind. TODO: Should support multiple tag kinds. 00029 // FIXME: This does not use the nice trait macros because it must be accessible 00030 // from multiple translation units. 00031 struct TaintMap {}; 00032 typedef llvm::ImmutableMap<SymbolRef, TaintTagType> TaintMapImpl; 00033 template<> struct ProgramStateTrait<TaintMap> 00034 : public ProgramStatePartialTrait<TaintMapImpl> { 00035 static void *GDMIndex() { static int index = 0; return &index; } 00036 }; 00037 00038 class TaintManager { 00039 00040 TaintManager() {} 00041 }; 00042 00043 } 00044 } 00045 00046 #endif