rsmith added a subscriber: rsmith. ================ Comment at: lib/Driver/ToolChains.cpp:718-720 @@ +717,5 @@ + StringRef isysroot = A->getValue(); + // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk + size_t BeginSDK = isysroot.rfind("SDKs/"); + size_t EndSDK = isysroot.rfind(".sdk"); + if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) { ---------------- This seems to get a couple of corner cases wrong (`/` between the platform name and `.sdk`, `.sdk` not at the end of the path component, ...). Have you considered using `llvm::sys::path`'s path iterators here? Not a big deal either way, though.
================ Comment at: lib/Driver/ToolChains.cpp:722 @@ +721,3 @@ + if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) { + StringRef SDK = isysroot.slice(BeginSDK + 5, EndSDK); + if (!SDK.startswith(getPlatformFamily())) ---------------- According to `slice`'s documentation, if `EndSDK < BeginSDK + 5`, this `slice` call will return a slice from `BeginSDK + 5` to the end of the string, and you won't be checking for a `.sdk` prefix as you intended to. http://reviews.llvm.org/D18088 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits