Add logging for comparison behaviors
[hiphop-php.git] / hphp / compiler / option.h
blobe8501d22111bc3add77e4b82a86c3dd22db01f6b
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_OPTION_H_
18 #define incl_HPHP_OPTION_H_
20 #include <map>
21 #include <set>
22 #include <vector>
23 #include "hphp/util/functional.h"
24 #include "hphp/util/hash-map.h"
25 #include "hphp/util/string-bag.h"
27 namespace HPHP {
28 ///////////////////////////////////////////////////////////////////////////////
30 struct Hdf;
32 struct IniSettingMap;
34 struct Option {
35 /**
36 * Load options from different sources.
38 static void Load(const IniSettingMap& ini, Hdf &config);
39 static void Load(); // load default options
41 /**
42 * Directories to add to a package.
44 static std::string RootDirectory;
45 static std::set<std::string> PackageDirectories;
47 /**
48 * Files to add to a package.
50 static std::set<std::string> PackageFiles;
52 /**
53 * File path patterns for excluding files from a package scan of programs.
55 static std::set<std::string> PackageExcludeDirs;
56 static std::set<std::string> PackageExcludeFiles;
57 static std::set<std::string> PackageExcludePatterns;
58 static std::set<std::string> PackageExcludeStaticFiles;
59 static std::set<std::string> PackageExcludeStaticDirs;
60 static std::set<std::string> PackageExcludeStaticPatterns;
62 static bool IsFileExcluded(const std::string &file,
63 const std::set<std::string> &patterns);
64 static void FilterFiles(std::vector<std::string> &files,
65 const std::set<std::string> &patterns);
67 /**
68 * Directories in which files are parsed on-demand, when parse-on-demand
69 * is off.
71 static std::vector<std::string> ParseOnDemandDirs;
73 /**
74 * Whether to store PHP source files in static file cache.
76 static bool CachePHPFile;
78 static std::vector<std::string> IncludeSearchPaths;
80 /**
81 * PHP functions that can be assumed to always return a certain constant
82 * value.
84 static hphp_string_imap<std::string> ConstantFunctions;
86 static std::set<std::string> VolatileClasses;
87 static std::map<std::string,std::string, stdltistr> AutoloadClassMap;
88 static std::map<std::string,std::string, stdltistr> AutoloadFuncMap;
89 static std::map<std::string,std::string> AutoloadConstMap;
90 static std::string AutoloadRoot;
92 /**
93 * CodeGenerator options for HHBC.
95 static bool GenerateTextHHBC;
96 static bool GenerateHhasHHBC;
97 static bool GenerateBinaryHHBC;
98 static std::string RepoCentralPath;
100 static std::vector<std::string> APCProfile;
103 * A somewhat unique prefix for system identifiers.
105 static std::string IdPrefix;
106 static std::string LambdaPrefix;
107 static std::string Tab;
110 * Name resolution helpers.
112 static const char *UserFilePrefix;
115 * Turn it off for cleaner unit tests.
117 static bool KeepStatementsWithNoEffect;
120 * Turning a file name into an identifier. When id is false, preserve
121 * "/" in file paths.
123 static std::string MangleFilename(const std::string &name, bool id);
125 static std::string ProgramName;
127 static bool EnableShortTags;
128 static int ParserThreadCount;
130 static int GetScannerType();
133 * "Volatile" means a class or a function can be declared dynamically.
135 static bool AllVolatile;
138 * Output options
140 static bool WholeProgram;
141 static bool RecordErrors;
143 private:
144 static StringBag OptionStrings;
146 static void LoadRootHdf(const IniSettingMap& ini, const Hdf &roots,
147 const std::string& name,
148 std::map<std::string, std::string> &map);
151 ///////////////////////////////////////////////////////////////////////////////
153 #endif // incl_HPHP_OPTION_H_