From: Chris Lattner Date: Wed, 3 Aug 2011 15:54:40 +0000 (+0000) Subject: give an example of a 'lowered vtable reference' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3de112bf38567a25d5b86790a2327290393dde4;p=clang give an example of a 'lowered vtable reference' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136780 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/www/diagnostics.html b/www/diagnostics.html index 48d222abb2..4317c67d2e 100644 --- a/www/diagnostics.html +++ b/www/diagnostics.html @@ -104,10 +104,8 @@ quickly.

No Pretty Printing of Expressions in Diagnostics

Since Clang has range highlighting, it never needs to pretty print your code -back out to you. This is particularly bad in G++ (which often emits errors -containing lowered vtable references), but even GCC can produce -inscrutible error messages in some cases when it tries to do this. In this -example P and Q have type "int*":

+back out to you. GCC can produce inscrutible error messages in some cases when +it tries to do this. In this example P and Q have type "int*":

   $ gcc-4.2 -fsyntax-only t.c
@@ -118,6 +116,31 @@ example P and Q have type "int*":

~~~~~^
+

This can be particularly bad in G++, which often emits errors + containing lowered vtable references. For example:

+ +
+  $ cat t.cc
+  struct a {
+    virtual int bar();
+  };
+  
+  struct foo : public virtual a {
+  };
+  
+  void test(foo *P) {
+    return P->bar() + *P;
+  }
+  $ gcc-4.2 t.cc
+  t.cc: In function 'void test(foo*)':
+  t.cc:9: error: no match for 'operator+' in '(((a*)P) + (*(long int*)(P->foo::<anonymous>.a::_vptr$a + -0x00000000000000020)))->a::bar() + * P'
+  t.cc:9: error: return-statement with a value, in function returning 'void'
+  $ clang t.cc
+  t.cc:9:18: error: invalid operands to binary expression ('int' and 'foo')
+    return P->bar() + *P;
+           ~~~~~~~~ ^ ~~
+
+

Typedef Preservation and Selective Unwrapping

@@ -169,7 +192,7 @@ namespace myapp { } using namespace myapp; -void addHTTPService(servers::Server const &server, ::services::WebService const *http) { +void addHTTPService(servers::Server const &;amp;server, ::services::WebService const *http) { server += http; }