Author: kamil Date: Wed Feb 1 10:02:55 2017 New Revision: 293774 URL: http://llvm.org/viewvc/llvm-project?rev=293774&view=rev Log: Do not pass non-POD type variables through variadic function
Summary: Cannot pass object of non-POD type 'const CMIUtilString' through variadic function. This behavior is undefined according to C++11 5.2.2/7: > Passing a potentially-evaluated argument of class type having a non-trivial > copy constructor, a non-trivial move contructor, or a non-trivial destructor, > with no corresponding parameter, is conditionally-supported with > implementation-defined semantics. Replace SetErrorDescriptionn(errMsg); with SetErrorDescription(errMsg); Original patch by Tobias Nygren (NetBSD). Sponsored by <The NetBSD Foundation> Reviewers: clayborg, labath, emaste, joerg, ki.stfu Reviewed By: labath, ki.stfu Subscribers: tnn, ki.stfu, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29256 Modified: lldb/trunk/tools/lldb-mi/MICmnBase.cpp lldb/trunk/tools/lldb-mi/MICmnBase.h lldb/trunk/tools/lldb-mi/MIDriver.cpp lldb/trunk/tools/lldb-mi/MIUtilString.cpp lldb/trunk/tools/lldb-mi/MIUtilString.h Modified: lldb/trunk/tools/lldb-mi/MICmnBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnBase.cpp?rev=293774&r1=293773&r2=293774&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnBase.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnBase.cpp Wed Feb 1 10:02:55 2017 @@ -122,7 +122,7 @@ void CMICmnBase::ClrErrorDescription() c // Return: None. // Throws: None. //-- -void CMICmnBase::SetErrorDescriptionn(const CMIUtilString vFormat, ...) const { +void CMICmnBase::SetErrorDescriptionn(const char *vFormat, ...) const { va_list args; va_start(args, vFormat); CMIUtilString strResult = CMIUtilString::FormatValist(vFormat, args); Modified: lldb/trunk/tools/lldb-mi/MICmnBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnBase.h?rev=293774&r1=293773&r2=293774&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnBase.h (original) +++ lldb/trunk/tools/lldb-mi/MICmnBase.h Wed Feb 1 10:02:55 2017 @@ -28,7 +28,7 @@ public: bool HaveErrorDescription() const; const CMIUtilString &GetErrorDescription() const; void SetErrorDescription(const CMIUtilString &vrTxt) const; - void SetErrorDescriptionn(const CMIUtilString vFormat, ...) const; + void SetErrorDescriptionn(const char *vFormat, ...) const; void SetErrorDescriptionNoLog(const CMIUtilString &vrTxt) const; void ClrErrorDescription() const; Modified: lldb/trunk/tools/lldb-mi/MIDriver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=293774&r1=293773&r2=293774&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIDriver.cpp Wed Feb 1 10:02:55 2017 @@ -509,7 +509,7 @@ bool CMIDriver::StartWorkerThreads() { const CMIUtilString errMsg = CMIUtilString::Format( MIRSRC(IDS_THREADMGR_ERR_THREAD_FAIL_CREATE), CMICmnThreadMgrStd::Instance().GetErrorDescription().c_str()); - SetErrorDescriptionn(errMsg); + SetErrorDescription(errMsg); return MIstatus::failure; } Modified: lldb/trunk/tools/lldb-mi/MIUtilString.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=293774&r1=293773&r2=293774&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp Wed Feb 1 10:02:55 2017 @@ -157,7 +157,7 @@ CMIUtilString CMIUtilString::FormatPriv( // Return: CMIUtilString - Number of splits found in the string data. // Throws: None. //-- -CMIUtilString CMIUtilString::Format(const CMIUtilString vFormating, ...) { +CMIUtilString CMIUtilString::Format(const char *vFormating, ...) { va_list args; va_start(args, vFormating); CMIUtilString strResult = CMIUtilString::FormatPriv(vFormating, args); Modified: lldb/trunk/tools/lldb-mi/MIUtilString.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.h?rev=293774&r1=293773&r2=293774&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MIUtilString.h (original) +++ lldb/trunk/tools/lldb-mi/MIUtilString.h Wed Feb 1 10:02:55 2017 @@ -30,7 +30,7 @@ public: // Static method: public: - static CMIUtilString Format(const CMIUtilString vFormating, ...); + static CMIUtilString Format(const char *vFormating, ...); static CMIUtilString FormatBinary(const MIuint64 vnDecimal); static CMIUtilString FormatValist(const CMIUtilString &vrFormating, va_list vArgs); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits