[cfe-commits] r44551 - in /cfe/trunk: Basic/TargetInfo.cpp Driver/Targets.cpp Driver/clang.cpp Driver/clang.h include/clang/Basic/TargetInfo.h test/Parser/portability.c

Chris Lattner clattner at apple.com
Mon Dec 3 14:37:06 PST 2007


> +static TargetInfoImpl *CreateTarget(const std::string& T) {
> +  if (T.find("darwin") != std::string::npos) {
> +    if (T.find("ppc-") == 0)
> +      return new DarwinPPCTargetInfo(T);
> +    else if (T.find("ppc64-") == 0)
> +      return new DarwinPPC64TargetInfo(T);
> +    else if (T.find("x86_64-") == 0)
> +      return new DarwinX86_64TargetInfo(T);
> +    else if (IsX86(T))
> +      return new DarwinI386TargetInfo(T);
> +    else if (T.find("bogusW16W16-") == 0) // For testing portability.
> +      return new LinuxTargetInfo(T);
> +  }

Ok.

> +  else {
> +    // Make a copy of the triple that is all lowercase.
> +    std::string T_lower(T);
> +    std::transform(T_lower.begin(), T_lower.end(),
> +                   T_lower.begin(), (int(*)(int)) std::tolower);
> +
> +    if (T_lower.find("linux") != std::string::npos && IsX86(T))
> +      return new LinuxTargetInfo(T);

The linux target info is not really useful.  I'd suggest just  
dropping LinuxTargetInfo for now, and removing the "if darwin" check  
above.


>    }
> +
> +  assert (false && "Unknown target!");

Please make this return null and print out a nice error message to  
the user in the driver.

Thanks Ted!

-Chris




More information about the cfe-commits mailing list