On Mar 26, 2014, at 12:36 PM, David Blaikie <[email protected]> wrote:
> On Wed, Mar 26, 2014 at 12:26 PM, Duncan P. N. Exon Smith > <[email protected]> wrote: >> Author: dexonsmith >> Date: Wed Mar 26 14:26:05 2014 >> New Revision: 204846 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=204846&view=rev >> Log: >> InstrProf: Use unique_ptr >> >> Modified: >> cfe/trunk/lib/CodeGen/CodeGenPGO.cpp >> cfe/trunk/lib/CodeGen/CodeGenPGO.h >> >> Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=204846&r1=204845&r2=204846&view=diff >> ============================================================================== >> --- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original) >> +++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Wed Mar 26 14:26:05 2014 >> @@ -162,7 +162,7 @@ void CodeGenPGO::setFuncName(llvm::Funct >> RawFuncName = RawFuncName.substr(1); >> >> if (!Fn->hasLocalLinkage()) { >> - PrefixedFuncName = new std::string(RawFuncName); >> + PrefixedFuncName.reset(new std::string(RawFuncName)); > > Um - why do you have a new'd std::string? Any reason you can't just > have a straight value-std::string and use the empty string to > represent "not present" (if that's what the unique_ptr is for - to > allow null to represent the "not a string" case?) > > (or, if you need "not a string" and "empty string" to be separate > concepts - Optional<std::string> might be appropriate) I’ve been wondering that myself since I found it :). There’s a series of containers in CodeGenPGO that use new that probably needn’t (the same series that I just converted to unique_ptr). On my list of things to clean up when I get a chance. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
