diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-12-02 22:38:52 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-12-02 22:38:52 +0000 |
| commit | 7f8cf5bff7c8a87a878f684fe50a739929a416de (patch) | |
| tree | 1e7e17611610bfb4d5ac874a1a1d53b3b523746f /clang/lib/CodeGen/CodeGenPGO.cpp | |
| parent | 6b988ad8f2285e8bb3c56db38c0416f6186d3889 (diff) | |
| download | bcm5719-llvm-7f8cf5bff7c8a87a878f684fe50a739929a416de.tar.gz bcm5719-llvm-7f8cf5bff7c8a87a878f684fe50a739929a416de.zip | |
InstrProf: Remove some pointless indirection (NFC)
It doesn't make much sense to have std::unique_ptrs of std::string and
std::vector. Avoid some useless indirection by using these types
directly.
llvm-svn: 223166
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 2f1f211b72c..107b29c303e 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -36,7 +36,7 @@ void CodeGenPGO::setFuncName(StringRef Name, RawFuncName = RawFuncName.substr(1); if (!llvm::GlobalValue::isLocalLinkage(Linkage)) { - PrefixedFuncName.reset(new std::string(RawFuncName)); + PrefixedFuncName = RawFuncName; return; } @@ -44,11 +44,11 @@ void CodeGenPGO::setFuncName(StringRef Name, // Do not include the full path in the file name since there's no guarantee // that it will stay the same, e.g., if the files are checked out from // version control in different locations. - PrefixedFuncName.reset(new std::string(CGM.getCodeGenOpts().MainFileName)); - if (PrefixedFuncName->empty()) - PrefixedFuncName->assign("<unknown>"); - PrefixedFuncName->append(":"); - PrefixedFuncName->append(RawFuncName); + PrefixedFuncName = CGM.getCodeGenOpts().MainFileName; + if (PrefixedFuncName.empty()) + PrefixedFuncName.assign("<unknown>"); + PrefixedFuncName.append(":"); + PrefixedFuncName.append(RawFuncName); } void CodeGenPGO::setFuncName(llvm::Function *Fn) { @@ -991,9 +991,9 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, unsigned Counter) { void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader, bool IsInMainFile) { CGM.getPGOStats().addVisited(IsInMainFile); - RegionCounts.reset(new std::vector<uint64_t>); + RegionCounts.clear(); if (std::error_code EC = PGOReader->getFunctionCounts( - getFuncName(), FunctionHash, *RegionCounts)) { + getFuncName(), FunctionHash, RegionCounts)) { if (EC == llvm::instrprof_error::unknown_function) CGM.getPGOStats().addMissing(IsInMainFile); else if (EC == llvm::instrprof_error::hash_mismatch) @@ -1001,14 +1001,14 @@ void CodeGenPGO::loadRegionCounts(llvm::IndexedInstrProfReader *PGOReader, else if (EC == llvm::instrprof_error::malformed) // TODO: Consider a more specific warning for this case. CGM.getPGOStats().addMismatched(IsInMainFile); - RegionCounts.reset(); + RegionCounts.clear(); } } void CodeGenPGO::destroyRegionCounters() { RegionCounterMap.reset(); StmtCountMap.reset(); - RegionCounts.reset(); + RegionCounts.clear(); RegionCounters = nullptr; } |

