http://llvm.org/bugs/show_bug.cgi?id=16012

            Bug ID: 16012
           Summary: Improve error message with brief type-information
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Let the following be an example error message:

In file included from /Path/To/Some/File/test.cpp:3:
/usr/bin/../lib/c++/v1/algorithm:3494:18: error: no viable overloaded '='
            *__j = _VSTD::move(__t);

For errors involving the STL and Boost, the compiler usually spites messages
between one and a couple hundred pages long. Experienced developers _often_
know what to look for _and_ where (e.g. beginning/end of error report). Still,
most of the compilation errors I see are because some expression somewhere
doesn't have the type it should (e.g. forgot to dereference a pointer?). C++ is
a strongly typed language, i.e. the compiler knows all/most of the types
involved in the expression that triggered the error (unless it was a type
deduction error). So why don't display that information in a _brief_ way?

Example:

In file included from /Path/To/Some/File/test.cpp:3:
/usr/bin/../lib/c++/v1/algorithm:3494:18: error: no viable overloaded '='
  *__j = _VSTD::move(__t);

  expanded to:    // perform all macro expansions

  *__j = std::_LIBCPP_NAMESPACE::move(__t);

with types       // table with all types(local names + aka names)

             __j has type: RandomAccessIterator <aka double*>
            *__j has type: RandomAccesIterator::reference_type <aka double>
             __t has type: ...
_VSTD::move(__t) has type: ...

// From here on, provide the usual error message with all its information. 
// Hopefully the user won't have to look at it.

So I propose the following. Display:
  - expression before and after macro expansion, and
  - display types before and after substitution.

Maybe also mark types in different colors. Something like this:

   *__j = _VSTD::move(__t);

  expanded to:    // perform all macro expansions

  *__j = std::_LIBCPP_NAMESPACE::move(__t);
   ^^^                                ^^^    // use different colors for
  ^^^^   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   // different types.

I don't know how feasible this would be, but I think it would be a huge
improvement to the current error messages.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to