Commit Graph

11 Commits

Author SHA1 Message Date
David Majnemer ee4f4025c3 Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4.  The program would get a strong definition instead
of getting a function with linkonce_odr linkage.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3220

llvm-svn: 205129
2014-03-30 06:44:54 +00:00
Alp Toker 19bff32e09 Check "late parsed" friend functions for redefinition
r177003 applied the late parsed template technique to friend functions
but omitted the corresponding check for redefinitions.

This patch adds the same check already in use for templates to the
new code path in order to diagnose and reject invalid redefinitions
that were being silently accepted.

Fixes PR17324.

Reviewed by Richard Smith.

llvm-svn: 192948
2013-10-18 05:54:24 +00:00
Douglas Gregor 932aac6492 Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.

llvm-svn: 131153
2011-05-10 21:23:31 +00:00
Douglas Gregor 3b4abb6792 Improve handling of friend types in several ways:
- When instantiating a friend type template, perform semantic
  analysis on the resulting type.
  - Downgrade the errors concerning friend type declarations that do
  not refer to classes to ExtWarns in C++98/03. C++0x allows
  practically any type to be befriended, and ignores the friend
  declaration if the type is not a class.

llvm-svn: 100635
2010-04-07 17:57:12 +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
Chris Lattner 045cbffb65 fix a crash on invalid I found when working on something unrelated.
llvm-svn: 90729
2009-12-07 00:48:47 +00:00
Douglas Gregor 3dad842b35 Rework the Parse-Sema interaction for friends to better support friend
class templates. We now treat friend class templates much more like
normal class templates, except that they still get special name lookup
rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in
<iostream>.

llvm-svn: 82848
2009-09-26 06:47:28 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
John McCall 07e91c04ba First pass at friend semantics.
llvm-svn: 78274
2009-08-06 02:15:43 +00:00
Anders Carlsson 22e3784c79 For friend class decls, always use TK_Reference so we'll try to look up existing class decls first.
llvm-svn: 71481
2009-05-11 22:25:03 +00:00
Anders Carlsson cd8db41c52 Add parsing of friend specifiers.
llvm-svn: 71067
2009-05-06 04:46:28 +00:00