On Thu, Jul 16, 2015 at 6:11 PM, Yunzhong Gao <[email protected]> wrote: > ygao updated this revision to Diff 29953. > ygao added a comment. > >> Would this be more clear as: > >> return (Lib.find(" ") != StringRef::npos) ? "\"" + Lib.str() + "\"" : Lib; > >> ~Aaron > > > Seems like a good idea. I have a slight preference of if statement over the > ternary operator if that is okay with you.
I don't have a strong feeling about it, but it seems like this wouldn't require a static helper function given how short it is (either way). ~Aaron > > > http://reviews.llvm.org/D11275 > > Files: > lib/CodeGen/TargetInfo.cpp > test/CodeGen/pragma-comment.c > > Index: test/CodeGen/pragma-comment.c > =================================================================== > --- test/CodeGen/pragma-comment.c > +++ test/CodeGen/pragma-comment.c > @@ -30,3 +30,4 @@ > // PS4: !{!"\01msvcrt.lib"} > // PS4: !{!"\01kernel32"} > // PS4: !{!"\01USER32.LIB"} > +// PS4: !{!"\01\22with space\22"} > Index: lib/CodeGen/TargetInfo.cpp > =================================================================== > --- lib/CodeGen/TargetInfo.cpp > +++ lib/CodeGen/TargetInfo.cpp > @@ -1647,6 +1647,13 @@ > } > }; > > +static std::string qualifyPSLibrary(llvm::StringRef Lib) { > + // If the argument contains a space, enclose it in quotes. > + if (Lib.find(" ") == StringRef::npos) > + return Lib.str(); > + return "\"" + Lib.str() + "\""; > +} > + > class PS4TargetCodeGenInfo : public X86_64TargetCodeGenInfo { > public: > PS4TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, X86AVXABILevel AVXLevel) > @@ -1655,7 +1662,7 @@ > void getDependentLibraryOption(llvm::StringRef Lib, > llvm::SmallString<24> &Opt) const override { > Opt = "\01"; > - Opt += Lib; > + Opt += qualifyPSLibrary(Lib); > } > }; > > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
