[PATCH] D20542: [esan|cfrag] Add the skeleton to handle the cfrag argument
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Tue May 31 14:34:16 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271337: [esan|cfrag] Add the skeleton to handle the cfrag argument (authored by zhaoqin).
Changed prior to commit:
http://reviews.llvm.org/D20542?vs=59088&id=59134#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20542
Files:
compiler-rt/trunk/lib/esan/cache_frag.cpp
compiler-rt/trunk/lib/esan/esan.cpp
compiler-rt/trunk/test/esan/TestCases/struct-simple.cpp
Index: compiler-rt/trunk/lib/esan/cache_frag.cpp
===================================================================
--- compiler-rt/trunk/lib/esan/cache_frag.cpp
+++ compiler-rt/trunk/lib/esan/cache_frag.cpp
@@ -16,14 +16,34 @@
namespace __esan {
+// This should be kept consistent with LLVM's EfficiencySanitizer StructInfo.
+struct StructInfo {
+ const char *StructName;
+ u32 NumOfFields;
+ u64 *FieldCounters;
+ const char **FieldTypeNames;
+};
+
+// This should be kept consistent with LLVM's EfficiencySanitizer CacheFragInfo.
+// The tool-specific information per compilation unit (module).
+struct CacheFragInfo {
+ const char *UnitName;
+ u32 NumOfStructs;
+ StructInfo *Structs;
+};
+
//===-- Init/exit functions -----------------------------------------------===//
void processCacheFragCompilationUnitInit(void *Ptr) {
- VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr;
+ VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
+ __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs);
}
void processCacheFragCompilationUnitExit(void *Ptr) {
- VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ CacheFragInfo *CacheFrag = (CacheFragInfo *)Ptr;
+ VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
+ __FUNCTION__, CacheFrag->UnitName, CacheFrag->NumOfStructs);
}
void initializeCacheFrag() {
Index: compiler-rt/trunk/lib/esan/esan.cpp
===================================================================
--- compiler-rt/trunk/lib/esan/esan.cpp
+++ compiler-rt/trunk/lib/esan/esan.cpp
@@ -219,16 +219,22 @@
void processCompilationUnitInit(void *Ptr) {
VPrintf(2, "in esan::%s\n", __FUNCTION__);
if (WhichTool == ESAN_CacheFrag) {
+ DCHECK(Ptr != nullptr);
processCacheFragCompilationUnitInit(Ptr);
+ } else {
+ DCHECK(Ptr == nullptr);
}
}
// This is called when the containing module is unloaded.
// For the main executable module, this is called after finalizeLibrary.
void processCompilationUnitExit(void *Ptr) {
VPrintf(2, "in esan::%s\n", __FUNCTION__);
if (WhichTool == ESAN_CacheFrag) {
+ DCHECK(Ptr != nullptr);
processCacheFragCompilationUnitExit(Ptr);
+ } else {
+ DCHECK(Ptr == nullptr);
}
}
Index: compiler-rt/trunk/test/esan/TestCases/struct-simple.cpp
===================================================================
--- compiler-rt/trunk/test/esan/TestCases/struct-simple.cpp
+++ compiler-rt/trunk/test/esan/TestCases/struct-simple.cpp
@@ -28,17 +28,17 @@
// CHECK: in esan::initializeLibrary
// CHECK: in esan::initializeCacheFrag
// CHECK-NEXT: in esan::processCompilationUnitInit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit: {{.*}}struct-simple.cpp with 0 class(es)/struct(s)
// CHECK-NEXT: in esan::processCompilationUnitInit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitInit: {{.*}}struct-simple.cpp with 0 class(es)/struct(s)
part();
return 0;
// CHECK: in esan::finalizeLibrary
// CHECK-NEXT: in esan::finalizeCacheFrag
// CHECK-NEXT: {{.*}}EfficiencySanitizer is not finished: nothing yet to report
// CHECK-NEXT: in esan::processCompilationUnitExit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp with 0 class(es)/struct(s)
// CHECK-NEXT: in esan::processCompilationUnitExit
- // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit
+ // CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp with 0 class(es)/struct(s)
}
#endif // MAIN
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20542.59134.patch
Type: text/x-patch
Size: 3773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160531/93c1f538/attachment.bin>
More information about the llvm-commits
mailing list