Commit Graph

12 Commits

Author SHA1 Message Date
Richard Smith cf681266e6 Diagnose attempt to take address of bitfield members in anonymous structs.
Patch by Jacob Young!

Differential Revision: https://reviews.llvm.org/D27263

llvm-svn: 300264
2017-04-13 21:49:46 +00:00
Richard Smith c084bd2888 PR15132: Replace "address expression must be an lvalue or a function
designator" diagnostic with more correct and more human-friendly "cannot take
address of rvalue of type 'T'".

For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully
saying "cannot take address of rvalue of type '<overloaded function type>'".

For the case of &array_temporary, treat it just like a class temporary
(including allowing it as an extension); the existing diagnostic wording
for the class temporary case works fine.

llvm-svn: 174262
2013-02-02 02:14:45 +00:00
Peter Collingbourne 133587f08b Add a new expression classification, CL_AddressableVoid
CL_AddressableVoid is the expression classification used for void
expressions whose address can be taken, i.e. the result of [], *
or void variable references in C, as opposed to things like the
result of a void function call.

llvm-svn: 129783
2011-04-19 18:51:51 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Eli Friedman 3a1e692fed Some cleanup and bug-fixing for address-of checking. This causes a couple of
minor accepts-invalid regressions, but we weren't really rejecting them for 
the right reason.  We really need a more general solution to detect all the 
cases of the promotion of arrays with a register storage class.

llvm-svn: 69586
2009-04-20 08:23:18 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Nate Begeman a6b47a4142 Don't allow taking the address of an element in an ext_vector
llvm-svn: 64614
2009-02-15 22:45:20 +00:00
Daniel Dunbar 0ff4192f3a Set register storage class correctly for function parameters.
- PR2730

llvm-svn: 55739
2008-09-03 21:54:21 +00:00
Daniel Dunbar b692ef405b Fix several issues in checking of address-of expressions.
- clang was erroneously accepting address-of applied to lvalue
   expressions involving pointer arithmetic.
 - clang was erroneously rejecting address-of applied to deref
   expressions of pointer-typed variables.
 - Improved existing test case.
 - Fixes: <rdar://problem/6113867>, <rdar://problem/6080158>

llvm-svn: 54326
2008-08-04 20:02:37 +00:00
Steve Naroff b96e4ab649 Fix http://llvm.org/bugs/show_bug.cgi?id=2103.
llvm-svn: 47775
2008-02-29 23:30:25 +00:00
Anders Carlsson 806700f973 It is allowed to get the address of an array subscript, even if the array has the register qualifier, if the array is really a pointer.
llvm-svn: 46634
2008-02-01 07:15:58 +00:00
Chris Lattner 48d52848d7 Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
This fixes a bug reported by Seo Sanghyeon.

This was meant to be committed yesterday, but the commit failed.  doh.

llvm-svn: 44190
2007-11-16 17:46:48 +00:00