Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 1 | //===--- Driver.cpp - Clang GCC Compatible Driver -----------------------*-===// |
| 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 | |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 10 | #include "clang/Driver/Driver.h" |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 11 | |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 12 | #include "clang/Driver/Action.h" |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 13 | #include "clang/Driver/Arg.h" |
| 14 | #include "clang/Driver/ArgList.h" |
| 15 | #include "clang/Driver/Compilation.h" |
Daniel Dunbar | 9346849 | 2009-03-12 08:55:43 +0000 | [diff] [blame] | 16 | #include "clang/Driver/DriverDiagnostic.h" |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 17 | #include "clang/Driver/HostInfo.h" |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 18 | #include "clang/Driver/Option.h" |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 19 | #include "clang/Driver/Options.h" |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 20 | #include "clang/Driver/Types.h" |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 21 | |
Daniel Dunbar | fba157b | 2009-03-12 18:40:18 +0000 | [diff] [blame] | 22 | #include "llvm/ADT/StringMap.h" |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 23 | #include "llvm/Support/raw_ostream.h" |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 24 | #include "llvm/System/Path.h" |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 25 | using namespace clang::driver; |
| 26 | |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 27 | Driver::Driver(const char *_Name, const char *_Dir, |
Daniel Dunbar | 9346849 | 2009-03-12 08:55:43 +0000 | [diff] [blame] | 28 | const char *_DefaultHostTriple, |
| 29 | Diagnostic &_Diags) |
| 30 | : Opts(new OptTable()), Diags(_Diags), |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 31 | Name(_Name), Dir(_Dir), DefaultHostTriple(_DefaultHostTriple), |
| 32 | Host(0), |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 33 | CCCIsCXX(false), CCCEcho(false), |
| 34 | CCCNoClang(false), CCCNoClangCXX(false), CCCNoClangCPP(false) |
| 35 | { |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 36 | |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | Driver::~Driver() { |
Daniel Dunbar | d6f0e37 | 2009-03-04 20:49:20 +0000 | [diff] [blame] | 40 | delete Opts; |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 43 | ArgList *Driver::ParseArgStrings(const char **ArgBegin, const char **ArgEnd) { |
| 44 | ArgList *Args = new ArgList(ArgBegin, ArgEnd); |
| 45 | |
| 46 | unsigned Index = 0, End = ArgEnd - ArgBegin; |
| 47 | while (Index < End) { |
| 48 | unsigned Prev = Index; |
| 49 | Arg *A = getOpts().ParseOneArg(*Args, Index, End); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 50 | if (A) { |
| 51 | if (A->getOption().isUnsupported()) { |
Daniel Dunbar | d724e33 | 2009-03-12 09:13:48 +0000 | [diff] [blame] | 52 | Diag(clang::diag::err_drv_unsupported_opt) << A->getOption().getName(); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 53 | continue; |
| 54 | } |
| 55 | |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 56 | Args->append(A); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 57 | } |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 58 | |
| 59 | assert(Index > Prev && "Parser failed to consume argument."); |
| 60 | } |
| 61 | |
| 62 | return Args; |
| 63 | } |
| 64 | |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 65 | Compilation *Driver::BuildCompilation(int argc, const char **argv) { |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 66 | // FIXME: This stuff needs to go into the Compilation, not the |
| 67 | // driver. |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 68 | bool CCCPrintOptions = false, CCCPrintActions = false; |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 69 | |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 70 | const char **Start = argv + 1, **End = argv + argc; |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 71 | const char *HostTriple = DefaultHostTriple.c_str(); |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 72 | |
| 73 | // Read -ccc args. |
| 74 | // |
| 75 | // FIXME: We need to figure out where this behavior should |
| 76 | // live. Most of it should be outside in the client; the parts that |
| 77 | // aren't should have proper options, either by introducing new ones |
| 78 | // or by overloading gcc ones like -V or -b. |
| 79 | for (; Start != End && memcmp(*Start, "-ccc-", 5) == 0; ++Start) { |
| 80 | const char *Opt = *Start + 5; |
| 81 | |
| 82 | if (!strcmp(Opt, "print-options")) { |
| 83 | CCCPrintOptions = true; |
| 84 | } else if (!strcmp(Opt, "print-phases")) { |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 85 | CCCPrintActions = true; |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 86 | } else if (!strcmp(Opt, "cxx")) { |
| 87 | CCCIsCXX = true; |
| 88 | } else if (!strcmp(Opt, "echo")) { |
| 89 | CCCEcho = true; |
| 90 | |
| 91 | } else if (!strcmp(Opt, "no-clang")) { |
| 92 | CCCNoClang = true; |
| 93 | } else if (!strcmp(Opt, "no-clang-cxx")) { |
| 94 | CCCNoClangCXX = true; |
| 95 | } else if (!strcmp(Opt, "no-clang-cpp")) { |
| 96 | CCCNoClangCPP = true; |
| 97 | } else if (!strcmp(Opt, "clang-archs")) { |
| 98 | assert(Start+1 < End && "FIXME: -ccc- argument handling."); |
| 99 | const char *Cur = *++Start; |
| 100 | |
| 101 | for (;;) { |
| 102 | const char *Next = strchr(Cur, ','); |
| 103 | |
| 104 | if (Next) { |
| 105 | CCCClangArchs.insert(std::string(Cur, Next)); |
| 106 | Cur = Next + 1; |
| 107 | } else { |
| 108 | CCCClangArchs.insert(std::string(Cur)); |
| 109 | break; |
| 110 | } |
| 111 | } |
| 112 | |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 113 | } else if (!strcmp(Opt, "host-triple")) { |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 114 | assert(Start+1 < End && "FIXME: -ccc- argument handling."); |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 115 | HostTriple = *++Start; |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 116 | |
| 117 | } else { |
| 118 | // FIXME: Error handling. |
| 119 | llvm::errs() << "invalid option: " << *Start << "\n"; |
| 120 | exit(1); |
| 121 | } |
| 122 | } |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 123 | |
| 124 | Host = Driver::GetHostInfo(HostTriple); |
| 125 | |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 126 | ArgList *Args = ParseArgStrings(Start, End); |
| 127 | |
| 128 | // FIXME: This behavior shouldn't be here. |
| 129 | if (CCCPrintOptions) { |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 130 | PrintOptions(*Args); |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 131 | exit(0); |
| 132 | } |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 133 | |
| 134 | // Construct the list of abstract actions to perform for this |
| 135 | // compilation. |
Daniel Dunbar | a790d37 | 2009-03-12 18:24:49 +0000 | [diff] [blame] | 136 | ActionList Actions; |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 137 | if (Host->useDriverDriver()) |
| 138 | BuildUniversalActions(*Args, Actions); |
| 139 | else |
| 140 | BuildActions(*Args, Actions); |
| 141 | |
| 142 | // FIXME: This behavior shouldn't be here. |
| 143 | if (CCCPrintActions) { |
| 144 | PrintActions(Actions); |
| 145 | exit(0); |
| 146 | } |
| 147 | |
Daniel Dunbar | b282ced | 2009-03-10 20:52:46 +0000 | [diff] [blame] | 148 | assert(0 && "FIXME: Implement"); |
| 149 | |
| 150 | return new Compilation(); |
| 151 | } |
| 152 | |
Daniel Dunbar | a790d37 | 2009-03-12 18:24:49 +0000 | [diff] [blame] | 153 | void Driver::PrintOptions(const ArgList &Args) const { |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 154 | unsigned i = 0; |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 155 | for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 156 | it != ie; ++it, ++i) { |
| 157 | Arg *A = *it; |
| 158 | llvm::errs() << "Option " << i << " - " |
| 159 | << "Name: \"" << A->getOption().getName() << "\", " |
| 160 | << "Values: {"; |
| 161 | for (unsigned j = 0; j < A->getNumValues(); ++j) { |
| 162 | if (j) |
| 163 | llvm::errs() << ", "; |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 164 | llvm::errs() << '"' << A->getValue(Args, j) << '"'; |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 165 | } |
| 166 | llvm::errs() << "}\n"; |
Daniel Dunbar | 7dc2a04 | 2009-03-05 06:38:47 +0000 | [diff] [blame] | 167 | } |
Daniel Dunbar | 63c4da9 | 2009-03-02 19:59:07 +0000 | [diff] [blame] | 168 | } |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 169 | |
Daniel Dunbar | a790d37 | 2009-03-12 18:24:49 +0000 | [diff] [blame] | 170 | void Driver::PrintActions(const ActionList &Actions) const { |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 171 | llvm::errs() << "FIXME: Print actions."; |
| 172 | } |
| 173 | |
Daniel Dunbar | a790d37 | 2009-03-12 18:24:49 +0000 | [diff] [blame] | 174 | void Driver::BuildUniversalActions(ArgList &Args, ActionList &Actions) { |
Daniel Dunbar | fba157b | 2009-03-12 18:40:18 +0000 | [diff] [blame] | 175 | llvm::StringMap<Arg *> Archs; |
| 176 | for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); |
| 177 | it != ie; ++it) { |
| 178 | Arg *A = *it; |
| 179 | |
| 180 | if (A->getOption().getId() == options::OPT_arch) { |
| 181 | // FIXME: We need to handle canonicalization of the specified |
| 182 | // arch? |
| 183 | |
| 184 | Archs[A->getValue(Args)] = A; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | // When there is no explicit arch for this platform, get one from |
| 189 | // the host so that -Xarch_ is handled correctly. |
| 190 | if (!Archs.size()) { |
| 191 | const char *Arch = Host->getArchName().c_str(); |
| 192 | Archs[Arch] = Args.MakeSeparateArg(getOpts().getOption(options::OPT_arch), |
| 193 | Arch); |
| 194 | } |
| 195 | |
| 196 | // FIXME: We killed off some others but these aren't yet detected in |
| 197 | // a functional manner. If we added information to jobs about which |
| 198 | // "auxiliary" files they wrote then we could detect the conflict |
| 199 | // these cause downstream. |
| 200 | if (Archs.size() > 1) { |
| 201 | // No recovery needed, the point of this is just to prevent |
| 202 | // overwriting the same files. |
| 203 | if (const Arg *A = Args.getLastArg(options::OPT_M_Group)) |
| 204 | Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs) |
| 205 | << A->getOption().getName(); |
| 206 | if (const Arg *A = Args.getLastArg(options::OPT_save_temps)) |
| 207 | Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs) |
| 208 | << A->getOption().getName(); |
| 209 | } |
| 210 | |
| 211 | ActionList SingleActions; |
| 212 | BuildActions(Args, SingleActions); |
| 213 | |
| 214 | // Add in arch binding and lipo (if necessary) for every top level |
| 215 | // action. |
| 216 | for (unsigned i = 0, e = SingleActions.size(); i != e; ++i) { |
| 217 | Action *Act = SingleActions[i]; |
| 218 | |
| 219 | // Make sure we can lipo this kind of output. If not (and it is an |
| 220 | // actual output) then we disallow, since we can't create an |
| 221 | // output file with the right name without overwriting it. We |
| 222 | // could remove this oddity by just changing the output names to |
| 223 | // include the arch, which would also fix |
| 224 | // -save-temps. Compatibility wins for now. |
| 225 | |
| 226 | if (Archs.size() > 1 && types::canLipoType(Act->getType())) |
| 227 | Diag(clang::diag::err_drv_invalid_output_with_multiple_archs) |
| 228 | << types::getTypeName(Act->getType()); |
| 229 | |
| 230 | ActionList Inputs; |
| 231 | for (llvm::StringMap<Arg*>::iterator it = Archs.begin(), ie = Archs.end(); |
| 232 | it != ie; ++it) |
| 233 | Inputs.push_back(new BindArchAction(Act, it->second->getValue(Args))); |
| 234 | |
| 235 | // Lipo if necessary, We do it this way because we need to set the |
| 236 | // arch flag so that -Xarch_ gets overwritten. |
| 237 | if (Inputs.size() == 1 || Act->getType() == types::TY_Nothing) |
| 238 | Actions.append(Inputs.begin(), Inputs.end()); |
| 239 | else |
| 240 | Actions.push_back(new LipoJobAction(Inputs, Act->getType())); |
| 241 | } |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Daniel Dunbar | a790d37 | 2009-03-12 18:24:49 +0000 | [diff] [blame] | 244 | void Driver::BuildActions(ArgList &Args, ActionList &Actions) { |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 245 | types::ID InputType = types::TY_INVALID; |
| 246 | Arg *InputTypeArg = 0; |
| 247 | |
| 248 | llvm::SmallVector<std::pair<types::ID, const Arg*>, 16> Inputs; |
| 249 | for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); |
| 250 | it != ie; ++it) { |
| 251 | Arg *A = *it; |
| 252 | |
| 253 | if (isa<InputOption>(A->getOption())) { |
| 254 | const char *Value = A->getValue(Args); |
| 255 | types::ID Ty = types::TY_INVALID; |
| 256 | |
| 257 | // Infer the input type if necessary. |
Daniel Dunbar | 9346849 | 2009-03-12 08:55:43 +0000 | [diff] [blame] | 258 | if (InputType == types::TY_INVALID) { |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 259 | // stdin must be handled specially. |
| 260 | if (memcmp(Value, "-", 2) == 0) { |
| 261 | // If running with -E, treat as a C input (this changes the |
| 262 | // builtin macros, for example). This may be overridden by |
| 263 | // -ObjC below. |
| 264 | // |
| 265 | // Otherwise emit an error but still use a valid type to |
| 266 | // avoid spurious errors (e.g., no inputs). |
| 267 | if (!Args.hasArg(options::OPT_E)) |
Daniel Dunbar | d724e33 | 2009-03-12 09:13:48 +0000 | [diff] [blame] | 268 | Diag(clang::diag::err_drv_unknown_stdin_type); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 269 | Ty = types::TY_C; |
| 270 | } else { |
| 271 | // Otherwise lookup by extension, and fallback to ObjectType |
| 272 | // if not found. |
| 273 | if (const char *Ext = strrchr(Value, '.')) |
| 274 | Ty = types::lookupTypeForExtension(Ext + 1); |
| 275 | if (Ty == types::TY_INVALID) |
| 276 | Ty = types::TY_Object; |
| 277 | } |
| 278 | |
| 279 | // -ObjC and -ObjC++ override the default language, but only |
| 280 | // -for "source files". We just treat everything that isn't a |
| 281 | // -linker input as a source file. |
| 282 | // |
| 283 | // FIXME: Clean this up if we move the phase sequence into the |
| 284 | // type. |
| 285 | if (Ty != types::TY_Object) { |
| 286 | if (Args.hasArg(options::OPT_ObjC)) |
| 287 | Ty = types::TY_ObjC; |
| 288 | else if (Args.hasArg(options::OPT_ObjCXX)) |
| 289 | Ty = types::TY_ObjCXX; |
| 290 | } |
| 291 | } else { |
| 292 | assert(InputTypeArg && "InputType set w/o InputTypeArg"); |
| 293 | InputTypeArg->claim(); |
| 294 | Ty = InputType; |
| 295 | } |
| 296 | |
| 297 | // Check that the file exists. It isn't clear this is worth |
| 298 | // doing, since the tool presumably does this anyway, and this |
| 299 | // just adds an extra stat to the equation, but this is gcc |
| 300 | // compatible. |
| 301 | if (memcmp(Value, "-", 2) != 0 && !llvm::sys::Path(Value).exists()) |
Daniel Dunbar | d724e33 | 2009-03-12 09:13:48 +0000 | [diff] [blame] | 302 | Diag(clang::diag::err_drv_no_such_file) << A->getValue(Args); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 303 | else |
| 304 | Inputs.push_back(std::make_pair(Ty, A)); |
| 305 | |
| 306 | } else if (A->getOption().isLinkerInput()) { |
| 307 | // Just treat as object type, we could make a special type for |
| 308 | // this if necessary. |
| 309 | Inputs.push_back(std::make_pair(types::TY_Object, A)); |
| 310 | |
| 311 | } else if (A->getOption().getId() == options::OPT_x) { |
| 312 | InputTypeArg = A; |
| 313 | InputType = types::lookupTypeForTypeSpecifier(A->getValue(Args)); |
| 314 | |
| 315 | // Follow gcc behavior and treat as linker input for invalid -x |
| 316 | // options. Its not clear why we shouldn't just revert to |
| 317 | // unknown; but this isn't very important, we might as well be |
| 318 | // bug comatible. |
| 319 | if (!InputType) { |
Daniel Dunbar | d724e33 | 2009-03-12 09:13:48 +0000 | [diff] [blame] | 320 | Diag(clang::diag::err_drv_unknown_language) << A->getValue(Args); |
Daniel Dunbar | db62cc3 | 2009-03-12 07:58:46 +0000 | [diff] [blame] | 321 | InputType = types::TY_Object; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | for (unsigned i = 0, e = Inputs.size(); i != e; ++i) { |
| 327 | llvm::errs() << "input " << i << ": " |
| 328 | << Inputs[i].second->getValue(Args) << "\n"; |
| 329 | } |
| 330 | exit(0); |
| 331 | } |
| 332 | |
Daniel Dunbar | d25acaa | 2009-03-10 23:41:59 +0000 | [diff] [blame] | 333 | HostInfo *Driver::GetHostInfo(const char *Triple) { |
| 334 | // Dice into arch, platform, and OS. This matches |
| 335 | // arch,platform,os = '(.*?)-(.*?)-(.*?)' |
| 336 | // and missing fields are left empty. |
| 337 | std::string Arch, Platform, OS; |
| 338 | |
| 339 | if (const char *ArchEnd = strchr(Triple, '-')) { |
| 340 | Arch = std::string(Triple, ArchEnd); |
| 341 | |
| 342 | if (const char *PlatformEnd = strchr(ArchEnd+1, '-')) { |
| 343 | Platform = std::string(ArchEnd+1, PlatformEnd); |
| 344 | OS = PlatformEnd+1; |
| 345 | } else |
| 346 | Platform = ArchEnd+1; |
| 347 | } else |
| 348 | Arch = Triple; |
| 349 | |
| 350 | if (memcmp(&Platform[0], "darwin", 6) == 0) |
| 351 | return new DarwinHostInfo(Arch.c_str(), Platform.c_str(), OS.c_str()); |
| 352 | |
| 353 | return new UnknownHostInfo(Arch.c_str(), Platform.c_str(), OS.c_str()); |
| 354 | } |