]> granicus.if.org Git - clang/commit
Add an attribute to forbid temporary instances of a type. This allows class
authorJeffrey Yasskin <jyasskin@google.com>
Tue, 25 Jan 2011 20:08:12 +0000 (20:08 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Tue, 25 Jan 2011 20:08:12 +0000 (20:08 +0000)
commitc60e13aeff96515d27638129154b1308c15ded3d
treef170899d1f2267e8b075786da203ee1633ba29c0
parent48a4ce7d484a448490edfe9e1d47b806cee85f30
Add an attribute to forbid temporary instances of a type.  This allows class
authors to write

  class __attribute__((forbid_temporaries)) Name { ... };

when they want to force users to name all variables of the type. This protects
people from doing things like creating a scoped_lock that only lives for a
single statement instead of an entire scope.

The warning produced by this attribute can be disabled by
-Wno-forbid-temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124217 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LanguageExtensions.html
include/clang/Basic/Attr.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/AttributeList.h
lib/Sema/AttributeList.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaExprCXX.cpp
test/SemaCXX/forbid-temporaries.cpp [new file with mode: 0644]