Граф коммитов

55 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson f6e35d0b9f Add sema support for the cleanup attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 01:16:18 +00:00
Chris Lattner 500d3297d2 move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes.  Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 05:15:15 +00:00
Chris Lattner 20c6b3b85e Split the single monolithic DiagnosticKinds.def file into one
.def file for each library.  This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 18:30:58 +00:00
Fariborz Jahanian fa23c1d9ad Implemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
objects as an objective-c object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 23:34:40 +00:00
Anton Korobeynikov 2f402708e6 Add full dllimport / dllexport support: both sema checks and codegen.
Patch by Ilya Okonsky

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-26 00:52:02 +00:00
Anton Korobeynikov 7b0a52f982 Sema for fastcall/stdcall stuff. Tests will follow.
Patch by Ilya Okonsky!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 22:24:07 +00:00
Sebastian Redl a89d82c1c8 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-21 19:24:58 +00:00
Fariborz Jahanian bc1c877fe2 Semantics of @protocol attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 01:07:27 +00:00
Douglas Gregor 44b4321fea Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
  * Make DeclContext the central data structure for storing and
    looking up declarations within existing declarations, e.g., members
    of structs/unions/classes, enumerators in C++0x enums, members of
    C++ namespaces, and (later) members of Objective-C
    interfaces/implementations. DeclContext uses a lazily-constructed
    data structure optimized for fast lookup (array for small contexts,
    hash table for larger contexts). 

  * Implement C++ qualified name lookup in terms of lookup into
    DeclContext.

  * Implement C++ unqualified name lookup in terms of
    qualified+unqualified name lookup (since unqualified lookup is not
    purely lexical in C++!)

  * Limit the use of the chains of declarations stored in
    IdentifierInfo to those names declared lexically.

  * Eliminate CXXFieldDecl, collapsing its behavior into
    FieldDecl. (FieldDecl is now a ScopedDecl).

  * Make RecordDecl into a DeclContext and eliminates its
    Members/NumMembers fields (since one can just iterate through the
    DeclContext to get the fields).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 16:49:14 +00:00
Ted Kremenek f5e8834747 Fix bug in attribute(nonnull) processing where not all of the parameter indices in nonnull(...) were actually processed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 19:38:33 +00:00
Chris Lattner d162584991 Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first.  This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 06:25:27 +00:00
Chris Lattner 08631c5fa0 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 21:45:46 +00:00
Fariborz Jahanian 24b93f2deb __weak ivar need not warn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 19:35:51 +00:00
Chris Lattner 92e62b0222 Rename IdentifierInfo::isName to ::isStr. Use a nifty trick
from Sebastian to enforce that a literal string is passed in,
and use this to avoid having to call strlen on it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 04:42:34 +00:00
Fariborz Jahanian 2682d8b3a0 More objc gc stuff. Read/Write barriers for local static/extern,
diagnostics on use of __weak attribute on fields,
Early support for read/write barriers for objc fields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 00:15:42 +00:00
Chris Lattner 3c73c41cef stop calling II::getName() unnecesarily in sema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:23:25 +00:00
Chris Lattner 30bc965443 add direct support for signed and unsigned integer arguments to diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:22:31 +00:00
Chris Lattner fa25bbb351 Switch several more Sema Diag methods over. This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 05:08:23 +00:00
Ted Kremenek 46bbacac37 Attribute nonnull can be applied to block pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 06:52:58 +00:00
Daniel Dunbar af668b0e7d Add attribute always_inline support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:17:57 +00:00
Daniel Dunbar d3f2c10f88 Improve attribute parsing & tests.
- Support noreturn on function-typed variables.

 - Extend isFunctionOrMethod to return true for K&R functions and
   provide hasFunctionProto to check if a decl has information about
   its arguments. This code needs some serious cleaning, but works.

 - Add/improve test cases for noreturn and unused.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 02:04:16 +00:00
Daniel Dunbar 3b0db908eb Implement #pragma pack use in structure packing. The general approach
is to encode the state of the #pragma pack stack as an attribute when
the structure is declared. 

 - Extend PackedAttr to take an alignment (in bits), and reuse for
   both __attribute__((packed)) (which takes no argument, instead
   packing tightly (to "minimize the memory required") and for #pragma
   pack (which allows specification of the maximum alignment in
   bytes). __attribute__((packed)) is just encoded as Alignment=1.

   This conflates two related but different mechanisms, but it didn't
   seem worth another attribute.

 - I have attempted to follow the MSVC semantics as opposed to the gcc
   ones, since if I understand correctly #pragma pack originated with
   MSVC. The semantics are generally equivalent except when the stack
   is altered during the definition of a structure; its not clear if
   anyone does this in practice. See testcase if curious.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 02:34:03 +00:00
Anders Carlsson 232eb7d33b Implement support for the const and pure attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 23:32:53 +00:00
Anders Carlsson 770918281c Add parsing of the sentinel attribute. Still need to create the attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 18:05:59 +00:00
Daniel Dunbar 3568249c2d Sema support for format and noreturn attributes on Objective-C methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 04:12:28 +00:00
Daniel Dunbar 085e8f7da3 Add support for CFString in format attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 03:32:58 +00:00
Steve Naroff 9eae5761c0 Finish pushing blocks attribute through the clang attribute machinery.
Also added a couple simple tests from the "gcc.apple" test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 16:44:58 +00:00
Eli Friedman bc88745b43 An extremely hacky version of transparent_union support; it isn't
anywhere near correct in terms of missing cases and missing 
diagnostics, but it's good enough to handle the uses in the 
Linux system headers, which are currently a constant pain for compiling 
applications on Linux.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 05:19:23 +00:00
Ted Kremenek 7fb43c17eb Tidy up sema processing of attribute "nonull":
- warn about nonnull being applied to functions with no pointer arguments
- continue processing argument list in the attribute when we encounter a non-pointer parameter being marked as nonnull
- when no argument list is specified, only mark pointers as nonnull.  This fixes PR 2732 and radar 6188814.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 19:57:52 +00:00
Anders Carlsson 6e14a8f2ac Fix silly bug in objc_gc attribute parsing and add test case
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 16:33:25 +00:00
Anders Carlsson aa0d25b44e Add support for parsing the objc_gc attribute. Tests will come shortly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 23:22:21 +00:00
Anders Carlsson 6782fc6925 Use isa instead of dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55207 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 22:10:48 +00:00
Daniel Dunbar acc5f3e423 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 06:23:49 +00:00
Daniel Dunbar e4858a65a9 More #include cleaning
- Drop Diagnostic.h from DeclSpec.h, move utility Diag methods into
   implementation .cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54626 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 03:45:03 +00:00
Daniel Dunbar 12bc692a78 Minor #include cleaning
- Drop TokenKinds.h from Action.h
 - Move DeclSpec.h from Sema.h into individual Sema .cpp files


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 03:27:53 +00:00
Ted Kremenek 356b63a666 attribute "unused" also applies to functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 01:02:05 +00:00
Daniel Dunbar 3068ae0feb Support __attribute__(({con,de}structor)) in Parse & Sema
- Including possible priority argument
 - In other news, the attribute parsing code really needs a cleanup


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 22:40:48 +00:00
Chris Lattner b77792eabf change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 22:17:49 +00:00
Ted Kremenek 7379889275 Implemented Sema support for attribute "unused".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 04:39:19 +00:00
Ted Kremenek 6e1eb87c04 Use llvm::utostr_32 instead of ostringstream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53914 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 16:56:21 +00:00
Ted Kremenek 465172f304 Add test case for nonnull attribute.
Fix indexing bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 22:09:15 +00:00
Ted Kremenek eb2b2a3f18 Added sema support for the nonnull attribute. Will add test cases soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:53:04 +00:00
Ted Kremenek 96329d4e07 Added parsing/sema support for __attribute__ ((IBOutlet)), a clang-specific attribute that the static analyzer will use to recognize what ivars are IBOutlets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 22:26:48 +00:00
Chris Lattner 803d08039c make the rest of the decl attribute processing methods be
static functions instead of methods on sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:43:07 +00:00
Chris Lattner 0b2f4da765 make most of Sema public. Sema is a class private to the Sema library
anyway, so there is no real loss here.  Start making attribute processing
methods static functions instead of methods on Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:28:59 +00:00
Chris Lattner 0744e5f332 move a few methods, no other change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:23:49 +00:00
Chris Lattner 0bf29ad534 handle type attributes when converting types, not when processing decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:19:33 +00:00
Chris Lattner e5c5ee1cff Make ProcessDeclAttributes walk the declarator structure pulling
decl attributes out of the various places they can hide.  This makes
us correctly reject things like this:

t.c:2:22: error: mode attribute only supported for integer and floating-point types
  int **__attribute((mode(HI)))* i32;
                     ^

because you can't make a pointer be HImode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:16:31 +00:00
Chris Lattner 3ff30c8e6e move some code from all callers of ProcessDeclAttributes into
the implementation of ProcessDeclAttributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:02:00 +00:00
Chris Lattner f2e4bd51aa more attribute refactoring/renaming, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 23:58:55 +00:00