Commit Graph

242 Commits

Author SHA1 Message Date
Chandler Carruth dd1bc0f1b5 Add support for differentiating between attributes ignored when handled and
unknown attributes that we discard. Add a diagnostic group for unknown
attribute warnings to allow turning these off when we don't care. Also
consolidates the tests for this case.

llvm-svn: 107864
2010-07-08 09:42:26 +00:00
Argyrios Kyrtzidis 36ea322579 Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.
Makes de-serialization of the function body even more "lazier".

llvm-svn: 107768
2010-07-07 11:31:19 +00:00
Douglas Gregor 2187266120 Complain about the application of a transparent_union attribute to a
union whose first field has integral vector type. Also, clean up this
diagnostic a bit. Thanks to Eli for spotting this change in semantics
last week.

llvm-svn: 107296
2010-06-30 17:24:13 +00:00
Chandler Carruth f40c42f2cd Implement dependent alignment attribute support. This is a bit gross given the
current attribute system, but it is enough to handle class templates which
specify parts of their alignment in terms of their template parameters.

This also replaces the attributes test in SemaTemplate with one that actually
tests working attributes instead of broken ones. I plan to add more tests here
for non-dependent attributes in a subsequent patch.

Thanks to John for walking me through some of this. =D

llvm-svn: 106818
2010-06-25 03:22:07 +00:00
Douglas Gregor 4ffbad1904 Change Type::isFloatingType() to reflect the actual definition of a
"floating type" in C, which does not include vector types. Introduce
Type::hasFloatingRepresentation() for the places where we want to know
whether the underlying representation is one or more floating-point
values. Remove some hacks we had where the former behavior of
Type::isFloatingType() was at odds with the language definition of the
term.

llvm-svn: 106584
2010-06-22 22:12:46 +00:00
Chris Lattner 3c77a355e0 implement support for -finstrument-functions, patch by Nelson
Elhage!

llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Fariborz Jahanian 9f2a4eed0d IRGen for implementation of init-priority attribute.
Test case will be checked in llvm test suite.
(finishes off radar 8076356).

llvm-svn: 106441
2010-06-21 18:45:05 +00:00
Fariborz Jahanian 0bf5ee74c4 More Sema Check and a test case for init_priority attr.
(radar 8076356).

llvm-svn: 106350
2010-06-18 23:14:53 +00:00
Fariborz Jahanian ef5f621215 Implements Sema part of init_priority(priority) attribute
(radar 8076356) - wip.

llvm-svn: 106322
2010-06-18 21:44:06 +00:00
Douglas Gregor b90df60b3b Introduce Type::isIntegralOrEnumerationType(), to cover those places
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.

llvm-svn: 106071
2010-06-16 00:17:44 +00:00
John McCall 61d8258fa3 Roll back r104941.
llvm-svn: 104990
2010-05-28 18:25:28 +00:00
John McCall 2177a9b65a Add a new attribute on records, __attribute__((adl_invisible)), and define
the x86-64 __va_list_tag with this attribute.  The attribute causes the
affected type to behave like a fundamental type when considered by ADL.

(x86-64 is the only target we currently provide with a struct-based
__builtin_va_list)

Fixes PR6762.

llvm-svn: 104941
2010-05-28 08:20:36 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Douglas Gregor bdb604a806 Protect isIntegerConstantExpr from seeing type- or value-dependent
expressions in attributes, pragmas.

llvm-svn: 104083
2010-05-18 23:01:22 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
John McCall 96fa4845f7 Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

llvm-svn: 103973
2010-05-17 21:00:27 +00:00
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Abramo Bagnara 5009937f47 Add calling convention related attributes to related declaration. Mark attributes invalid on type related checking so to add them to declarations only when everything is ok.
llvm-svn: 102710
2010-04-30 13:10:51 +00:00
Abramo Bagnara b639ab9ffc Attribute noreturn is now put in declaration attributes. Fixed a double warning generation.
llvm-svn: 102705
2010-04-30 09:13:03 +00:00
Ted Kremenek 8af4f40f4a Rename BlockDecl::IsVariadic() to BlockDecl::isVariadic() to match the casing
for similar methods.  No functionality change.

llvm-svn: 102634
2010-04-29 16:48:58 +00:00
Douglas Gregor c4df407604 Keep track of the actual storage specifier written on a variable or
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.

llvm-svn: 101826
2010-04-19 22:54:31 +00:00
Douglas Gregor b2ccf010fb Feed proper source-location information into Sema::LookupSingleResult,
in case it ends up doing something that might trigger diagnostics
(template instantiation, ambiguity reporting, access
reporting). Noticed while working on PR6831.

llvm-svn: 101412
2010-04-15 22:33:43 +00:00
Fariborz Jahanian ea70a17626 Twik to radar 7839485. Do not attach weak_import attribute to class
for non-fragile abi on darwin.

llvm-svn: 101168
2010-04-13 20:22:35 +00:00
Fariborz Jahanian dd9a259975 Turn off warning about weak_import attribute
on objc classes for Darwin. Radar 7839485.

llvm-svn: 101164
2010-04-13 19:02:07 +00:00
Fariborz Jahanian 5ea6bdd0ea Issue warning when 'weak_import' attribute is applied on a class only
when it is not supported in versions of MacOs.

llvm-svn: 101044
2010-04-12 16:57:31 +00:00
John McCall cef1582923 Support __attribute__((unused)) on types. This suddenly started firing
a lot for me on selfhosts, I dunno why.

llvm-svn: 99981
2010-03-31 02:47:45 +00:00
Fariborz Jahanian 5cab26d058 Add Support for 'warn_unused_result" attribute on
objective-c methods. (radar 7418262).

llvm-svn: 99903
2010-03-30 18:22:15 +00:00
Ted Kremenek ee0934e05d Add comment indicating that we intentionally don't add the noreturn
attribute to a FunctionDecl.

llvm-svn: 99662
2010-03-26 22:57:10 +00:00
Duncan Sands de4fe3538a Ignore a more comprehensive set of gcc-special format attributes.
llvm-svn: 99277
2010-03-23 14:44:19 +00:00
Chris Lattner 12161d3d1a (re)implement PR6542, accepting and discarding the __gcc_tdiag__
format attribute specifier.

llvm-svn: 99213
2010-03-22 21:08:50 +00:00
John McCall 1064d7ef29 Perform access control for the implicit base and member destructor calls
required when emitting a destructor definition.

llvm-svn: 98609
2010-03-16 05:22:47 +00:00
John McCall 3e11ebebc8 Remember declaration scope qualifiers in the AST. Imposes no memory overhead
on unqualified declarations.

Patch by Enea Zaffanella!  Minimal adjustments:  allocate the ExtInfo nodes
with the ASTContext and delete them during Destroy().  I audited a bunch of
Destroy methods at the same time, to ensure that the correct teardown was
being done.

llvm-svn: 98540
2010-03-15 10:12:16 +00:00
Ted Kremenek 6bf658abef Allow __attribute__((unused)) to be applied to ObjC ivars.
llvm-svn: 97103
2010-02-25 03:26:51 +00:00
Rafael Espindola c18086ae17 Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
llvm-svn: 96992
2010-02-23 22:00:30 +00:00
Ted Kremenek 2fb89539f7 Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
instead it crashes on them.  We might extend this attribute to work on methods, but for
now fix the crasher.  Addresses <rdar://problem/7670939>.

llvm-svn: 96723
2010-02-21 05:15:32 +00:00
Ted Kremenek 1f672829fb Change the behavior of ibaction attributes to be attached to methods, not ivars.
llvm-svn: 96562
2010-02-18 03:08:58 +00:00
Ted Kremenek d9c6663124 Add 'ns_returns_not_retained' and 'cf_returns_not_retained' attributes to
match 'ns_returns_retained' and 'cf_returns_retained' respectively.  These
are not yet hooked up to the static analyzer.

llvm-svn: 96535
2010-02-18 00:05:45 +00:00
Ted Kremenek 06be968942 Add IBAction attribute to keep the IBOutlet attribute company.
llvm-svn: 96447
2010-02-17 02:37:45 +00:00
Charles Davis 163855f46d dllimport and dllexport are declspec attributes, too. They're also
Win32-specific.

Also, fix a test to use FileCheck instead of grepping LLVM IR.

llvm-svn: 96364
2010-02-16 18:27:26 +00:00
Ted Kremenek 510ee2594e Use the allocator associated with ASTContext to allocate the args
array associated with NonNullAttr.  This fixes yet another leak when
ASTContext uses a BumpPtrAllocator.

Fixes: <rdar://problem/7637150>
llvm-svn: 95863
2010-02-11 07:31:47 +00:00
Ted Kremenek 7f4945aa9c Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>
llvm-svn: 95853
2010-02-11 05:28:37 +00:00
John McCall ab26cfa58d Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior:  attributes
written on return types that don't apply there are applied to the function
instead, etc.  Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks).  Consistently consume CC/noreturn
information throughout codegen;  enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Charles Davis e4e604b5d6 Testing, 1, 2, 3...
Also make the comments I added in r95291 consistent.

llvm-svn: 95394
2010-02-05 17:53:51 +00:00
John McCall cddbad000d Allow calling convention attributes to apply to types. Patch by Chip Davis!
llvm-svn: 95291
2010-02-04 05:44:44 +00:00
John McCall 86121519ca Implement access-check delays for out-of-line member definitions
using the same framework we use for deprecation warnings.

llvm-svn: 94659
2010-01-27 03:50:35 +00:00
Chandler Carruth 72343706c1 Correctly treat 64 bit integers specified via the mode attribute as the 'long'
type when that type is 64 bits wide, and the 'long long' type when 'long' is
only 32 bits wide. This fixes PR6108.

Also adds a bunch of test cases to ensure proper conversion between equally
sized standard types and mode-specified types on both 32 and 64 bit targets.

llvm-svn: 94527
2010-01-26 06:39:24 +00:00
Benjamin Kramer 12a6ce7cad Simplify code with StringRef.
llvm-svn: 94314
2010-01-23 18:16:35 +00:00
Chris Lattner 20aee9b914 implement PR6007, diagnosing invalid attribute((section))
llvm-svn: 93255
2010-01-12 20:58:53 +00:00
Anton Korobeynikov 55bcea1e65 Generalize target weirdness handling having proper layering in mind:
1. Add helper class for sema checks for target attributes
 2. Add helper class for codegen of target attributes

As a proof-of-concept - implement msp430's 'interrupt' attribute.

llvm-svn: 93118
2010-01-10 12:58:08 +00:00
Anders Carlsson 88ea2455f8 Get rid of FixedWidthIntType, as suggested by Chris and Eli.
llvm-svn: 92246
2009-12-29 07:07:36 +00:00