[PATCH] D20542: [esan|cfrag] Add the skeleton to handle the cfrag argument
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 15:53:19 PDT 2016
zhaoqin updated this revision to Diff 58853.
zhaoqin updated the summary for this revision.
zhaoqin added a comment.
Remove ToolInfo
http://reviews.llvm.org/D20542
Files:
lib/esan/cache_frag.cpp
lib/esan/esan.cpp
test/esan/TestCases/struct-simple.cpp
Index: test/esan/TestCases/struct-simple.cpp
===================================================================
--- test/esan/TestCases/struct-simple.cpp
+++ 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
Index: lib/esan/esan.cpp
===================================================================
--- lib/esan/esan.cpp
+++ lib/esan/esan.cpp
@@ -197,16 +197,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: lib/esan/cache_frag.cpp
===================================================================
--- lib/esan/cache_frag.cpp
+++ 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 *CFI = (CacheFragInfo *)Ptr;
+ VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
+ __FUNCTION__, CFI->UnitName, CFI->NumOfStructs);
}
void processCacheFragCompilationUnitExit(void *Ptr) {
- VPrintf(2, "in esan::%s\n", __FUNCTION__);
+ CacheFragInfo *CFI = (CacheFragInfo *)Ptr;
+ VPrintf(2, "in esan::%s: %s with %u class(es)/struct(s)\n",
+ __FUNCTION__, CFI->UnitName, CFI->NumOfStructs);
}
void initializeCacheFrag() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20542.58853.patch
Type: text/x-patch
Size: 3575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/8b4f4a15/attachment.bin>
More information about the llvm-commits
mailing list