Mercurial > projects > ldc
comparison gen/configfile.cpp @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | ee6b20e7aedb |
children |
comparison
equal
deleted
inserted
replaced
1649:36da40ecbbe0 | 1650:40bd4a0d4870 |
---|---|
92 p = sys::Path::GetMainExecutable(argv0, mainAddr); | 92 p = sys::Path::GetMainExecutable(argv0, mainAddr); |
93 p.eraseComponent(); | 93 p.eraseComponent(); |
94 p.appendComponent(filename); | 94 p.appendComponent(filename); |
95 if (p.exists()) | 95 if (p.exists()) |
96 return true; | 96 return true; |
97 | 97 |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 bool ConfigFile::read(const char* argv0, void* mainAddr, const char* filename) | 101 bool ConfigFile::read(const char* argv0, void* mainAddr, const char* filename) |
102 { | 102 { |
103 sys::Path p; | 103 sys::Path p; |
104 if (!locate(p, argv0, mainAddr, filename)) | 104 if (!locate(p, argv0, mainAddr, filename)) |
105 { | 105 { |
106 // failed to find cfg, users still have the DFLAGS environment var | 106 // failed to find cfg, users still have the DFLAGS environment var |
107 std::cerr << "Error failed to locate the configuration file: " << filename << std::endl; | 107 std::cerr << "Error failed to locate the configuration file: " << filename << std::endl; |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 // save config file path for -v output | 111 // save config file path for -v output |
112 pathstr = p.toString(); | 112 pathstr = p.str(); |
113 | 113 |
114 try | 114 try |
115 { | 115 { |
116 // read the cfg | 116 // read the cfg |
117 cfg->readFile(p.c_str()); | 117 cfg->readFile(p.c_str()); |
139 libconfig::Setting& arr = cfg->lookup("default.switches"); | 139 libconfig::Setting& arr = cfg->lookup("default.switches"); |
140 int len = arr.getLength(); | 140 int len = arr.getLength(); |
141 for (int i=0; i<len; i++) | 141 for (int i=0; i<len; i++) |
142 { | 142 { |
143 std::string v = arr[i]; | 143 std::string v = arr[i]; |
144 | 144 |
145 // replace binpathkey with binpath | 145 // replace binpathkey with binpath |
146 size_t p; | 146 size_t p; |
147 while (std::string::npos != (p = v.find(binpathkey))) | 147 while (std::string::npos != (p = v.find(binpathkey))) |
148 v.replace(p, binpathkey.size(), binpath); | 148 v.replace(p, binpathkey.size(), binpath); |
149 | 149 |
150 switches.push_back(strdup(v.c_str())); | 150 switches.push_back(strdup(v.c_str())); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } | 154 } |