On 8/10/15 3:54 PM, Peter Finn via llvm-dev wrote:> I’ve been updating SAFECode files to work with LLVM 3.7, and I’ve run
> into a number of errors I can’t explain.
You might want to see if the "const" qualifier is causing the problem.
The ostream is a basic_ostream<char> while the string you're passing
is
a "const char".
Regarding the comment about using LLVM's stream classes, the code you're
working on is a runtime library linked into applications and is not an
LLVM compiler pass. Therefore, using std::ostream should be fine (at
least, it shouldn't be the cause of the problem).
Regards,
John Criswell>
> In LLVM_SRC/projects/safecode/runtime/BBRuntime/DebugReport.cpp, there
> are a host of std::ostream objects that, when given strings with the
> “<<“ operator, produce errors. Also, the compiler doesn’t seem to
> recognize std::dec for some reason. Here is a sample of the errors
> I’m getting:
>
>
*/Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/runtime/BBRuntime/DebugReport.cpp:30:6:
> **error: **invalid operands to binary expression*
> * ('std::ostream' (aka 'basic_ostream<char>')
and 'const char *')*
> OS << "= Fault PC Source :\t"
> * ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
>
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:5263:1:
> note: *candidate template ignored: could not match
> 'shared_ptr<type-parameter-0-2>' against 'char
const[43]'
> operator<<(basic_ostream<_CharT, _Traits>& __os,
shared_ptr<_Yp>
> const& __p);
> *^*
>
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:4191:1:
> note: *candidate template ignored: could not match
> 'basic_string<type-parameter-0-0, type-parameter-0-1,
> type-parameter-0-2>' against 'char const[43]'
> operator<<(basic_ostream<_CharT, _Traits>& __os,
> *^*
>
*/Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/runtime/BBRuntime/DebugReport.cpp:32:20:
> **error: **no member named 'dec' in namespace 'std'*
> << ":" << std::dec << this->lineNo
<< "\n";
> * ~~~~~^*
>
*/Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/runtime/BBRuntime/DebugReport.cpp:38:6:
> **error: **invalid operands to binary expression*
> * ('std::ostream' (aka 'basic_ostream<char>')
and 'const char *')*
> OS << "= Pool Handle :\t" <<
this->PoolHandle << "\n";
> * ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
>
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:5263:1:
> note: *candidate template ignored: could not match
> 'shared_ptr<type-parameter-0-2>' against 'char
const[43]'
> operator<<(basic_ostream<_CharT, _Traits>& __os,
shared_ptr<_Yp>
> const& __p);
> *^*
>
*/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:4191:1:
> note: *candidate template ignored: could not match
> 'basic_string<type-parameter-0-0, type-parameter-0-1,
> type-parameter-0-2>' against 'char const[43]'
> operator<<(basic_ostream<_CharT, _Traits>& __os,
> *^*
> *
> *
> I’ve been trying to find information online, but I’ve found nothing
> helpful. I tried creating my own test programs, with my own
> std::ostream objects, but I couldn’t recreate the errors. Do you have
> any idea what could be causing this problem?
>
> Thanks,
> Peter Finn
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150811/04bc37e3/attachment.html>