///< linker.
CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.
CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled.
-CODEGENOPT(HeapProf , 1, 0) ///< Set when -fmemprof is enabled.
+CODEGENOPT(HeapProf , 1, 0) ///< Set when -fmemory-profile is enabled.
CODEGENOPT(MSVolatile , 1, 0) ///< Set when /volatile:ms is enabled.
CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled.
CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
def fsymbol_partition_EQ : Joined<["-"], "fsymbol-partition=">, Group<f_Group>,
Flags<[CC1Option]>;
-defm memprof : OptInFFlag<"memprof", "Enable", "Disable", " heap memory profiling">;
+defm memory_profile : OptInFFlag<"memory-profile", "Enable", "Disable", " heap memory profiling">;
// Begin sanitizer flags. These should all be core options exposed in all driver
// modes.
LinkCXXRuntimes) ||
D.CCCIsCXX();
- NeedsHeapProfRt =
- Args.hasFlag(options::OPT_fmemprof, options::OPT_fno_memprof, false);
+ NeedsHeapProfRt = Args.hasFlag(options::OPT_fmemory_profile,
+ options::OPT_fno_memory_profile, false);
// Finally, initialize the set of available and recoverable sanitizers.
Sanitizers.Mask |= Kinds;
if (Args.getLastArg(options::OPT_save_temps_EQ))
Args.AddLastArg(CmdArgs, options::OPT_save_temps_EQ);
- if (Args.hasFlag(options::OPT_fmemprof, options::OPT_fno_memprof, false))
- Args.AddLastArg(CmdArgs, options::OPT_fmemprof);
+ if (Args.hasFlag(options::OPT_fmemory_profile,
+ options::OPT_fno_memory_profile, false))
+ Args.AddLastArg(CmdArgs, options::OPT_fmemory_profile);
// Embed-bitcode option.
// Only white-listed flags below are allowed to be embedded.
Opts.ThinLinkBitcodeFile =
std::string(Args.getLastArgValue(OPT_fthin_link_bitcode_EQ));
- Opts.HeapProf = Args.hasArg(OPT_fmemprof);
+ Opts.HeapProf = Args.hasArg(OPT_fmemory_profile);
Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
-// RUN: %clangxx -target x86_64-linux-gnu -fmemprof %s -### 2>&1 | FileCheck %s
-// RUN: %clangxx -target x86_64-linux-gnu -fmemprof -fno-memprof %s -### 2>&1 | FileCheck %s --check-prefix=OFF
-// CHECK: "-cc1" {{.*}} "-fmemprof"
+// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile %s -### 2>&1 | FileCheck %s
+// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile -fno-memory-profile %s -### 2>&1 | FileCheck %s --check-prefix=OFF
+// CHECK: "-cc1" {{.*}} "-fmemory-profile"
// CHECK: ld{{.*}}libclang_rt.heapprof{{.*}}libclang_rt.heapprof_cxx
-// OFF-NOT: "-fmemprof"
+// OFF-NOT: "-fmemory-profile"
// OFF-NOT: libclang_rt.heapprof
-//===--------- Definition of the HeapProfiler class ---------*- C++ -*-===//
+//===--------- Definition of the HeapProfiler class -------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
public:
explicit ModuleHeapProfilerPass();
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-
-private:
};
// Insert HeapProfiler instrumentation
-//===- HeapProfiler.cpp - heap allocation and access profiler
-//--------------===//
+//===- HeapProfiler.cpp - heap allocation and access profiler -------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
/// If it is an interesting memory access, populate information
/// about the access and return a InterestingMemoryAccess struct.
/// Otherwise return None.
- Optional<InterestingMemoryAccess> isInterestingMemoryAccess(Instruction *I);
+ Optional<InterestingMemoryAccess>
+ isInterestingMemoryAccess(Instruction *I) const;
void instrumentMop(Instruction *I, const DataLayout &DL,
InterestingMemoryAccess &Access);
}
Optional<InterestingMemoryAccess>
-HeapProfiler::isInterestingMemoryAccess(Instruction *I) {
+HeapProfiler::isInterestingMemoryAccess(Instruction *I) const {
// Do not instrument the load fetching the dynamic shadow address.
if (DynamicShadowOffset == I)
return None;