[llvm-dev] Let ctor of DiagnosticInfoWithLocationBase take Function* instead of Function& ?
Zhao, Weiming via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 24 15:37:08 PDT 2017
Hi,
Currently the constructor of class DiagnosticInfoWithLocationBase takes
a Function reference:
/// \p Fn is the function where the diagnostic is being emitted. \p
Loc is
/// the location information to use in the diagnostic.
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind,
enum DiagnosticSeverity Severity,
const Function &Fn,
const DiagnosticLocation &Loc)
However, if we want to emit diagnostics via calls like
emitUndefinedBehaviorOptimizedWarning, the Function object may be
unavailable. For example, in the interim of inlining, under the context
of Analysis/InstructionSimplify, the Instruction in the context has no
parent BB.
So how about let the constructor takes a Function ptr? All the use of
Function object is to print out function name. Using pointer, we can
let if print somthing like "<optimized out function>" if it is null.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
More information about the llvm-dev
mailing list