Commit Graph

1034 Commits

Author SHA1 Message Date
Ted Kremenek 864eb39233 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.

llvm-svn: 60911
2008-12-11 23:36:38 +00:00
Steve Naroff a5c0db8467 Rename a local predicate to avoid confusion with Type::isBlockPointerType().
llvm-svn: 60899
2008-12-11 21:05:33 +00:00
Steve Naroff 5ac4eac3b6 Fixup generated code for imported block decl refs.
Found while investigating <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.

llvm-svn: 60898
2008-12-11 20:51:38 +00:00
Steve Naroff e4d722bf2f Fix <rdar://problem/6435842> clang ObjC rewriter: #include Block.h, Block_private.h or come up with #define to prevent double-definition
llvm-svn: 60890
2008-12-11 19:43:14 +00:00
Steve Naroff 1fa7bd16c8 Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and blocks don't work together
llvm-svn: 60887
2008-12-11 19:29:16 +00:00
Douglas Gregor e029561346 Actually distinguish between RecordDecl::field_iterator and RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls.
llvm-svn: 60883
2008-12-11 17:59:21 +00:00
Douglas Gregor 91f84216f7 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).

llvm-svn: 60878
2008-12-11 16:49:14 +00:00
Steve Naroff df70577b9c Fix regression caused by fixing <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
llvm-svn: 60839
2008-12-10 14:53:27 +00:00
Steve Naroff 08628db9d2 Fix <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
More fancy footwork to cope with rewriting property 'setters'.

llvm-svn: 60760
2008-12-09 12:56:34 +00:00
Ted Kremenek 08134c984b Update Driver to new interface for LiveVariables.
llvm-svn: 60732
2008-12-09 00:17:51 +00:00
Steve Naroff f1ab600362 Fix a couple uninitialized variables from my previous commit.
llvm-svn: 60713
2008-12-08 20:01:41 +00:00
Dan Gohman 16873c6284 Remove the #include of ScheduleDAGSDNodes.h, which is no longer necessary.
llvm-svn: 60712
2008-12-08 19:45:33 +00:00
Steve Naroff f122ff0cad Fix <rdar://problem/6423452> clang ObjC rewriter: Don't use __declspec(dllimport) for Blocks functions, as they are linked statically.
llvm-svn: 60704
2008-12-08 17:30:33 +00:00
Steve Naroff 1042ff345a Handle chained/nested property 'getters' (obj.p1.p2.p3).
This is a follow-up to fixing <rdar://problem/6213955> clang ObjC rewriter: rewriter doesn't appear to support @property and @synthesize.

llvm-svn: 60700
2008-12-08 16:43:47 +00:00
Douglas Gregor b0846b0f51 Add support for calls to dependent names within templates, e.g.,
template<typename T> void f(T x) {
    g(x); // g is a dependent name, so don't even bother to look it up
    g(); // error: g is not a dependent name
  }

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.

llvm-svn: 60618
2008-12-06 00:22:45 +00:00
Steve Naroff 6d6da255fb Fixed <rdar://problem/6213808> clang ObjC rewriter: @finally is not always executed
llvm-svn: 60593
2008-12-05 17:03:39 +00:00
Chris Lattner 5b4927048f -std=c99 defaults blocks to off even on darwin, but -fblocks overrides
even it. 

llvm-svn: 60568
2008-12-05 00:10:44 +00:00
Steve Naroff 22216db0ec Finish up support for <rdar://problem/6213955> clang ObjC rewriter: rewriter doesn't appear to support @property and @synthesize.
llvm-svn: 60565
2008-12-04 23:50:32 +00:00
Chris Lattner 2ca529ce61 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.

llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Chris Lattner c7c6dd4d97 replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.

llvm-svn: 60561
2008-12-04 22:54:33 +00:00
Ted Kremenek bf28bceb10 Remove unneeded assertion. We already know that FE->getName() is an absolute path.
llvm-svn: 60558
2008-12-04 22:36:44 +00:00
Steve Naroff 4588d0f060 Several things...
- Implement RewritePropertySetter(). While the routine is simple, there were some tricky changes to RewriteFunctionBodyOrGlobalInitializer(), the main rewriter loop. It also required some additional instance data to distinguish setters from getters, as well as some changes to RewritePropertyGetter().

- Implement FIXME: for pretty printing ObjCPropertyRefExpr's.

- Changed ObjCPropertyRefExpr::getSourceRange() to point to the end of the property name (not the beginning). Also made a minor name change from "Loc"->"IdLoc" (to make it clear the Loc does not point to the ".").
 

llvm-svn: 60540
2008-12-04 16:24:46 +00:00
Ted Kremenek 73a4d28758 PTH:
Use an array instead of a DenseMap to cache persistent IDs -> IdentifierInfo*.  This leads to a 4% speedup at -fsyntax-only using PTH.

llvm-svn: 60452
2008-12-03 01:16:39 +00:00
Steve Naroff f326f4056e More support for rewriting property getter/setters.
llvm-svn: 60450
2008-12-03 00:56:33 +00:00
Ted Kremenek da4d9dfbca Add "-token-cache" option for using pretokenized cache files.
llvm-svn: 60440
2008-12-02 19:57:31 +00:00
Ted Kremenek ccaab17e2c PTH emission:
- Output 32 bit integers using bit-shifting + write of individual bytes.
  This is motivated because we aren't guaranteed to load 32-bit ints of the mmaped PTH file at 4-byte offsets.
- Don't emit flags for IdentifierInfos.  These are lazily populated by the Preprocessor/Parser.
- Only write out tokens for files with absolute paths.  This is potentially temporary, but simplifies things for now.

llvm-svn: 60435
2008-12-02 19:44:08 +00:00
Steve Naroff 0629704e78 Add a couple FIXME's.
llvm-svn: 60427
2008-12-02 17:54:50 +00:00
Steve Naroff c038b3af03 Make sure synthesized properties get inserted into the classes/categories meta data.
llvm-svn: 60426
2008-12-02 17:36:43 +00:00
Steve Naroff 003d00eea3 Simplify previous commit.
llvm-svn: 60416
2008-12-02 16:05:55 +00:00
Steve Naroff 9af949105a More work to rewrite synthesize properties (<rdar://problem/6213955>)
llvm-svn: 60414
2008-12-02 15:48:25 +00:00
Sebastian Redl 351bb78a10 Handle new by passing the Declaration to the Action, not a processed type.
llvm-svn: 60413
2008-12-02 14:43:59 +00:00
Steve Naroff e1908e393e -Add several ObjC types to Decl::getDeclKindName(), a useful debug hook.
-Start adding support for rewriting @synthesize.

llvm-svn: 60368
2008-12-01 20:33:01 +00:00
Daniel Dunbar 1f3d7849a8 Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!

llvm-svn: 60362
2008-12-01 18:55:22 +00:00
Douglas Gregor c12ce19595 Enable blocks in C++
llvm-svn: 60361
2008-12-01 18:34:47 +00:00
Zhongxing Xu 16e3f0e03f Add support for pluggable components of static analyzer.
- Creator function pointers are saved in ManagerRegistry.
 - The Register* class is used to notify ManagerRegistry new module is 
   available.
 - AnalysisManager queries ManagerRegistry for configurable module. Then it
   passes them to GRExprEngine, in turn to GRStateManager.

llvm-svn: 60143
2008-11-27 01:55:08 +00:00
Ted Kremenek b1ef37589c - Enhance PTH generation to write out IdentifierInfo table in two parts:
- a table including the IdentifierInfo data
  - an index from persistent IdentifierInfo IDs to indices within this file.
- Enhance PTH generation to write out file map information, mapping inodes to tokens.

llvm-svn: 60132
2008-11-26 23:58:26 +00:00
Douglas Gregor 237f96c40f Implement implicit conversions for Objective-C specific types, e.g.,
converting a pointer to one Objective-C interface into a pointer to another
Objective-C interface, and conversions with 'id'. The semantics seems
to match GCC, although they seem somewhat ad hoc.

Fixed a few cases where we assumed the C++ definition of isObjectType,
but were getting the C definition, causing failures in trouble with
conversions to void pointers.

llvm-svn: 60130
2008-11-26 23:31:11 +00:00
Zhongxing Xu 21148402d6 Add plugin loading for clang. This will be used to load alternative constraint manager for static analysis.
llvm-svn: 60091
2008-11-26 05:23:17 +00:00
Devang Patel c6fab4f50f Disable -loop-index-split for now.
llvm-svn: 60089
2008-11-26 05:01:52 +00:00
Ted Kremenek bf2d60145d Re-apply r60071 now that raw_fd_ostream::tell has been committed.
llvm-svn: 60086
2008-11-26 03:36:26 +00:00
Daniel Dunbar 3ea9485335 Revert 60071, depends on uncommitted LLVM changes.
llvm-svn: 60077
2008-11-26 02:18:33 +00:00
Ted Kremenek 22d4b885fd Migrate token-cache generation logic from dummy harness in PPLexerChange.cpp to CacheTokens.cpp.
llvm-svn: 60071
2008-11-26 00:57:55 +00:00
Ted Kremenek 3ca000af83 Display the function we are analyzing before running LiveVariables.
llvm-svn: 59983
2008-11-24 20:53:32 +00:00
Chris Lattner f3d3faeca6 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.

llvm-svn: 59947
2008-11-24 05:29:24 +00:00
Chris Lattner 86d7d91366 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.

llvm-svn: 59936
2008-11-24 03:54:41 +00:00
Chris Lattner e4b95698df Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.

llvm-svn: 59933
2008-11-24 03:33:13 +00:00
Chris Lattner 4fc69799f5 Rewrite FindDiagnostics to be more strict about the formatting of the
expected-foo strings.  Now the only allowed characters between 
expected-error and {{  is whitespace.

llvm-svn: 59925
2008-11-24 01:28:17 +00:00
Chris Lattner f3ab014308 clean up -verify mode output. If the expected-error string is
mangled, report it using the diagnostics machinery instead of printf.

llvm-svn: 59924
2008-11-23 23:38:26 +00:00
Ted Kremenek 25391e7cb7 reverting this because it breaks some blocks cases, I'll send doug a testcase
llvm-svn: 59850
2008-11-22 01:04:48 +00:00
Sebastian Redl bd150f431e Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

llvm-svn: 59835
2008-11-21 19:14:01 +00:00