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

922 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 1b95a6546d Always print out SourceManager stats with 'Stats' is true. This revealed that PTH always pulls in the source pages with -fsyntax-only (investigating further).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 18:20:21 +00:00
Douglas Gregor f8d49f64ef Provide a new kind of iterator, the specific_decl_iterator, that
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61994 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 17:18:27 +00:00
Steve Naroff 09c4719788 Move property API's up to ObjCContainerDecl (removing a lot of duplicate code).
Add isa/cast/dyncast support for ObjCContainerDecl.
Renamed classprop_iterator/begin/end to prop_iterator/begin/end (the class prefix was confusing).
More simplifications to Sema::ActOnAtEnd()...
Added/changed some FIXME's as a result of the above work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61988 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 15:36:25 +00:00
Douglas Gregor 51efe56116 Don't crash when our FunctionDecl has a non-identifier name
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 01:47:02 +00:00
Douglas Gregor d04341000d Addressed the issue in <rdar://problem/6479085>, where we failed to
rewrite @class declarations that showed up within linkage
specifications because those @class declarations never made it any
place where the rewriter could find them.

Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can
live in the appropriate top-level or transparent DeclContext near the
top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C
declarations now show up in a traversal of the declarations in a
DeclContext (they didn't before!). This way, the rewriter finds all
Objective-C declarations within linkage specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 00:49:46 +00:00
Ted Kremenek f890191057 Enable support for '-x objective-c++-header'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 00:38:08 +00:00
Ted Kremenek e338ccdedb Simpler solution to LiteralSupport compatibility: just add one whitespace character after each cached string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 00:37:37 +00:00
Ted Kremenek f89f7f9723 PTH: For the cached spellings of literals, store one whitespace character after the spelling to accomodate sanity checking in LiteralSuppoert.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 23:40:50 +00:00
Fariborz Jahanian 17d0d0d7ca Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 23:23:10 +00:00
Steve Naroff 3e0a540b6d Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).
Convert clients to use the standard getDeclContext() API.

Doug, thanks for the review!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 19:41:02 +00:00
Steve Naroff 0701bbb228 This is a large/messy diff that unifies the ObjC AST's with DeclContext.
- ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts.
- ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext).
- ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-)
- Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective.
- Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch().
- Simplified Sema::ActOnAtEnd() considerably. Still more work to do.
- Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl.
- Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl.

This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 17:28:14 +00:00
Ted Kremenek 500bab244c Remove debugging variable I forgot to remove in my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 02:44:52 +00:00
Ted Kremenek be29533f57 Cache the "spellings" of string, character, and numeric literals in the PTH
file. For Cocoa.h, this enlarges the PTH file by 310K (4%).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 02:44:06 +00:00
Ted Kremenek b978c66430 Refactor CacheTokens to use a PTHWriter class that creates and manages most of the PTH generation data structures. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 01:17:37 +00:00
Ted Kremenek b789103464 Remove redunant (and incorrect) call to SourceManager::PrintStats(). This would be called after a SourceManager was 'cleared', so it printed bogus results. Moreover, these stats are already printed earlier in the code path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 22:16:26 +00:00
Chris Lattner 1b230149be use getBuffer() to fix compile error. Ted, please review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 04:47:20 +00:00
Douglas Gregor 074149e11b Introduce support for "transparent" DeclContexts, which are
DeclContexts whose members are visible from enclosing DeclContexts up
to (and including) the innermost enclosing non-transparent
DeclContexts. Transparent DeclContexts unify the mechanism to be used
for various language features, including C enumerations, anonymous
unions, C++0x inline namespaces, and C++ linkage
specifications. Please refer to the documentation in the Clang
internals manual for more information.

Only enumerations and linkage specifications currently use transparent
DeclContexts.

Still to do: use transparent DeclContexts to implement anonymous
unions and GCC's anonymous structs extension, and, later, the C++0x
features. We also need to tighten up the DeclContext/ScopedDecl link
to ensure that every ScopedDecl is in a single DeclContext, which
will ensure that we can then enforce ownership and reduce the memory
footprint of DeclContext.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:45:36 +00:00
Bill Wendling 5c5a7ee242 Rename AddReadAttrs to FunctionAttrs. This is related to Duncan's patch r61525.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 19:51:31 +00:00
Sebastian Redl 117054a99f Convert a two more statement actions to smart pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61456 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-28 16:13:43 +00:00
Douglas Gregor c4b4e7b8f6 Keep track of template arguments when we parse them. Right now, we don't actually do anything with the template arguments, but they'll be used to create template declarations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-24 02:52:09 +00:00
Steve Naroff 46a98a7df0 Fix <rdar://problem/6465284> clang ObjC rewriter: objc_super messed up again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 20:11:22 +00:00
Ted Kremenek 18d9afb815 PTH: Use 3 bytes instead of 4 bytes to encode the persistent ID for a token.
- This reduces the PTH size for Cocoa.h by 7%.
- The increases PTH -Eonly speed for Cocoa.h by 0.8%.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 18:41:34 +00:00
Ted Kremenek 8f174e173c PTH:
- Encode the token length with 2 bytes instead of 4.
- This reduces the size of the .pth file for Cocoa.h by 12%.
- This speeds up PTH time (-Eonly) on Cocoa.h by 1.6%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 02:52:12 +00:00
Ted Kremenek e5680f3cd6 PTH:
- Embed 'eom' tokens in PTH file.
- Use embedded 'eom' tokens to not lazily generate them in the PTHLexer.
  This means that PTHLexer can always advance to the next token after
  reading a token (instead of buffering tokens using a copy).
- Moved logic of 'ReadToken' into Lex.  GetToken & ReadToken no longer exist.
- These changes result in a 3.3% speedup (-Eonly) on Cocoa.h.
- The code is a little gross.  Many cleanups are possible and should be done.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61360 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 01:30:52 +00:00
Douglas Gregor 3fc749d899 Don't explicitly represent OverloadedFunctionDecls within
DeclContext. Instead, just keep the list of currently-active
declarations and only build the OverloadedFunctionDecl when we
absolutely need it.

This is a half-step toward eliminating the need to explicitly build
OverloadedFunctionDecls that store sets of overloaded
functions. This was suggested by Argiris a while back, and it's a good
thing for several reasons: first, it eliminates the messy logic that
currently tries to keep the OverloadedFunctionDecl in sync with the 
declarations that are being added. Second, it will (eventually)
eliminate the need to allocate memory for overload sets, which could
help performance. Finally, it helps set us up for when name lookup can
return multiple (possibly ambiguous) results, as can happen with
lookup of class members in C++.

Next steps: make the IdentifierResolver store overloads as separate
entries in its list rather than replacing them with an
OverloadedFunctionDecl now, then see how far we can go toward
eliminating OverloadedFunctionDecl entirely.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 00:26:44 +00:00
Steve Naroff 1a93764089 Fix <rdar://problem/6463613> clang ObjC rewriter: assertion failure rewriting @selector?.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 22:16:07 +00:00
Zhongxing Xu ff944a8c48 Add an option to make 'RemoveDeadBindings' a configurable behavior. This enables
us to measure the effect of this optimization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 01:52:37 +00:00
Sebastian Redl a0fd8652f3 Parser support for C++ try-catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-21 16:41:36 +00:00
Sebastian Redl a60528cdac Convert a few Stmt actions to smart pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-21 12:04:03 +00:00
Steve Naroff 5605fdf94c Remove rewriter dependency on 'nil' macro (used when rewriting for(...))
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 14:24:39 +00:00
Douglas Gregor 45579f5e29 Make sure that enumerators show up within the enumeration declaration. Fixes. PR clang/3220
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 02:04:30 +00:00
Douglas Gregor e79837aacd Fix PrintParserCallbacks for the new ActOnLinkageSpec actions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 01:46:43 +00:00
Steve Naroff cb73530987 Tweaks to allow us to rewrite with -x=objective-c++ enabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 00:20:22 +00:00
Douglas Gregor f44515a49b Make linkage-specifications hold on to all of their declarations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 22:23:02 +00:00
Eli Friedman f595eb04a7 Fix crash with -ast-dump in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 22:14:15 +00:00
Steve Naroff 5bc60d0c32 Fix <rdar://problem/6445502> clang ObjC rewriter: _Block_release has wrong parameter type in preamble
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 15:50:30 +00:00
Sebastian Redl 798d119415 Some utilities for using the smart pointers in Actions, especially Sema. Convert a few functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 16:23:55 +00:00
Steve Naroff 2badf1ee28 Fix <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 21:05:34 +00:00
Daniel Dunbar a629190326 Force i[0-9]86 to i386 when using LLVM_HOSTTRIPLE.
Only use major part of OS version when on darwin and modifying OS part
of target triple.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 18:34:35 +00:00
Ted Kremenek dad7b34a33 Enhance PTH preprocessor-condition-block side table to track #elseinformation as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 18:31:09 +00:00
Ted Kremenek fb645b6547 PTH:
- Added a side-table per each token-cached file with the preprocessor conditional stack.  This tracks what #if's are matched with what #endifs and where their respective tokens are in the PTH file.  This will allow for quick skipping of excluded conditional branches in the Preprocessor.
- Performance testing shows the addition of this information (without actually utilizing it) leads to no performance regressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 23:36:38 +00:00
Steve Naroff 01f2ffacc4 Rename a local predicate to avoid confusion with Type::isBlockPointerType().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 21:05:33 +00:00
Steve Naroff 47a2422088 Fixup generated code for imported block decl refs.
Found while investigating <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 20:51:38 +00:00
Steve Naroff 9fa72ef7e8 Fix <rdar://problem/6435842> clang ObjC rewriter: #include Block.h, Block_private.h or come up with #define to prevent double-definition
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:43:14 +00:00
Steve Naroff f4312dc9b6 Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and blocks don't work together
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 19:29:16 +00:00
Douglas Gregor a4c46df1cd Actually distinguish between RecordDecl::field_iterator and RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60883 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 17:59:21 +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
Steve Naroff e58ee0ca7c Fix regression caused by fixing <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 14:53:27 +00:00
Steve Naroff b619d957b0 Fix <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
More fancy footwork to cope with rewriting property 'setters'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 12:56:34 +00:00
Ted Kremenek ca9bab0dcb Update Driver to new interface for LiveVariables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60732 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 00:17:51 +00:00