r235565 - InstrProf: Fix a shadowing error that would break length of profile names

Justin Bogner mail at justinbogner.com
Wed Apr 22 17:31:16 PDT 2015


Author: bogner
Date: Wed Apr 22 19:31:16 2015
New Revision: 235565

URL: http://llvm.org/viewvc/llvm-project?rev=235565&view=rev
Log:
InstrProf: Fix a shadowing error that would break length of profile names

We try to use the member variable "FuncName" here, but we've also used
that name as a parameter. This ends with us getting the length of the
function name wrong when we generate the coverage data.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
    cfe/trunk/test/CoverageMapping/unused_names.c

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=235565&r1=235564&r2=235565&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Wed Apr 22 19:31:16 2015
@@ -729,7 +729,7 @@ void CodeGenPGO::emitCounterRegionMappin
 }
 
 void
-CodeGenPGO::emitEmptyCounterMapping(const Decl *D, StringRef FuncName,
+CodeGenPGO::emitEmptyCounterMapping(const Decl *D, StringRef Name,
                                     llvm::GlobalValue::LinkageTypes Linkage) {
   if (SkipCoverageMapping)
     return;
@@ -749,7 +749,7 @@ CodeGenPGO::emitEmptyCounterMapping(cons
   if (CoverageMapping.empty())
     return;
 
-  setFuncName(FuncName, Linkage);
+  setFuncName(Name, Linkage);
   CGM.getCoverageMapping()->addFunctionMappingRecord(
       FuncNameVar, FuncName, FunctionHash, CoverageMapping);
 }

Modified: cfe/trunk/test/CoverageMapping/unused_names.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/unused_names.c?rev=235565&r1=235564&r2=235565&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/unused_names.c (original)
+++ cfe/trunk/test/CoverageMapping/unused_names.c Wed Apr 22 19:31:16 2015
@@ -4,9 +4,9 @@
 
 // Since foo is never emitted, there should not be a profile name for it.
 
-// CHECK-DAG: @__llvm_profile_name_bar = {{.*}} section "{{.*}}__llvm_prf_names"
-// CHECK-DAG: @__llvm_profile_name_baz = {{.*}} section "{{.*}}__llvm_prf_names"
-// CHECK-DAG: @"__llvm_profile_name_unused_names.c:qux" = {{.*}} section "{{.*}}__llvm_prf_names"
+// CHECK-DAG: @__llvm_profile_name_bar = {{.*}} [3 x i8] c"bar", section "{{.*}}__llvm_prf_names"
+// CHECK-DAG: @__llvm_profile_name_baz = {{.*}} [3 x i8] c"baz", section "{{.*}}__llvm_prf_names"
+// CHECK-DAG: @"__llvm_profile_name_unused_names.c:qux" = {{.*}} [18 x i8] c"unused_names.c:qux", section "{{.*}}__llvm_prf_names"
 
 // SYSHEADER-NOT: @__llvm_profile_name_foo =
 





More information about the cfe-commits mailing list