aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteBlocks.cpp
AgeCommit message (Collapse)Author
2009-03-24Move <root>/Driver into <root>/tools/clang-cc.Daniel Dunbar
Again, I tried to update cmake but it is untested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67605 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12API fix: All "bodies" for functions, Objective-C methods, blocks, are assumed toTed Kremenek
be CompoundStmts. I think this is a valid assumption, and felt that the API should reflect it. Others please validate this assumption to make sure I didn't break anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26Create a new TypeNodes.def file that enumerates all of the types,Douglas Gregor
giving them rough classifications (normal types, never-canonical types, always-dependent types, abstract type representations) and making it far easier to make sure that we've hit all of the cases when decoding types. Switched some switch() statements on the type class over to using this mechanism, and filtering out those things we don't care about. For example, CodeGen should never see always-dependent or non-canonical types, while debug info generation should never see always-dependent types. More switch() statements on the type class need to be moved over to using this approach, so that we'll get warnings when we add a new type then fail to account for it somewhere in the compiler. As part of this, some types have been renamed: TypeOfExpr -> TypeOfExprType FunctionTypeProto -> FunctionProtoType FunctionTypeNoProto -> FunctionNoProtoType There shouldn't be any functionality change... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25use simpler methodChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor
that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17this massive patch introduces a simple new abstraction: it makesChris Lattner
"FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16more SourceLocation lexicon change: instead of referring to theChris Lattner
"logical" location, refer to the "instantiation" location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11Actually distinguish between RecordDecl::field_iterator and ↵Douglas Gregor
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-11-24Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make itChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24Rename Selector::getName() to Selector::getAsString(), and addChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17Introduction the DeclarationName class, as a single, general method ofDouglas Gregor
representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03Fix <rdar://problem/6336774> clang block rewriter: Assertion failed: ↵Steve Naroff
Offset+NumBytes <= size() && "Invalid region to erase!", file c:\cygwin\home\Administrator\llvm\to ols\clang\include\clang/Rewrite/RewriteRope.h, line 219. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22Fix <rdar://problem/6312683> clang block rewriter:Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15Tighten up blocks rewriter to handle casts and some other interesting cases.Steve Naroff
This fixes <rdar://problem/6289007> clang block rewriter: ^ in cast is not rewritten. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().Steve Naroff
This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08- Add BlockDecl AST node.Steve Naroff
- Modify BlockExpr to reference the BlockDecl. This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?). Still some follow-up work to finish this (forthcoming). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls ↵Ted Kremenek
in a DeclStmt instead of using getDecl() to fetch the first Decl. Steve: Please review this patch. 'make test' passes, and my cursory scan of the rewriter leads me to believe this doesn't break anything, but I'm not sure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05Remove old diag that alerted the user to a limitation we no longer have:-)Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05Create a function, eliminating some redundancy between ↵Steve Naroff
SynthesizeBlockInitExpr() and SynthesizeBlockLiterals(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Finish implementing copy/dispose helpers for imported block decls.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Add indirection required for byref BlockDeclRefExpr's.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Handle bookkeeping for imported blocks (in SynthesizeBlockImpl).Steve Naroff
This code was "lost" with my recent changes to SynthesizeBlockFunc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Cut/paste error...need to use the expression "name" for member references ↵Steve Naroff
(or other complex expressions that can embed a block pointer type) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Clear the map that associated the rewritten block with it's corresponding ↵Steve Naroff
BlockExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04Moved main control flow functions to bottom of file.Steve Naroff
Reworked control flow to: - rewrite the block expr body "in place". - used Chris's new rewriter hook "getRewritenText" to "lift" the text for later use. - finally, we do the block expr text replacement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03Remove an old/vacuous if clause.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03More fun & games with the block rewriter.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03Rewrite global block expressions.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03- Add a convenience constructor to Type.Steve Naroff
- Many rewriter modifications. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03Rework SynthesizeBlockImpl() to include a constructor.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03Get the right location to insert the synthesized block literals/functions.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02Name changes and some cleanup of preamble.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02Changed Sema::CheckForConstantInitializer to allow global block literals.Steve Naroff
This commit also includes some name changes in the blocks rewriter (no functionality change). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24Fix a couple harmless warnings when compiling optimized with gcc (reported ↵Steve Naroff
by mrs@apple.com). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24Fix some const-ness to keep the VisualStudio C++ compiler happy.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23RewriteBlocks::RewriteBlockPointerDecl(): Handle TypedefDecl's and VarDecl's ↵Steve Naroff
uniformly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23Teach block rewriter to replace '^' with '*' in VarDecls.Steve Naroff
Since we don't have DeclGroup's and location information for types, there is some fancy footwork to do this fairly reliably. O.K...it's a kludge. One day, we can use this as motivation to do this more gracefully:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18Add driver support for invoking block rewriter.Steve Naroff
Also tweaked the create function to take an explicit output file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17Remove BlockStmtExpr. Steve Naroff
Block literals are now represented by the concrete BlockExpr class. This is cleanup (removes a FIXME). No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17Add support for rewriting blocks...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56266 91177308-0d34-0410-b5e6-96231b3b80d8