Commit Graph

626 Commits

Author SHA1 Message Date
Lubos Lunak ba5ee4da1d avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)
llvm-svn: 186764
2013-07-20 14:30:01 +00:00
Lubos Lunak 4c22f6a695 fix sometimes incorrect line numbers in -frewrite-includes mode (pr#14795)
Every #include is surrounded by #if 0 in order to comment it out, which adds
lines. That is fixed up right after, but that all can be inside #if part
that is not processed, so fix up also after every end of a conditional part.

llvm-svn: 186763
2013-07-20 14:23:27 +00:00
Rafael Espindola 16125fb652 Update for llvm API change.
llvm-svn: 186448
2013-07-16 19:44:23 +00:00
Rafael Espindola 18627115f4 Use llvm::sys::fs::createUniqueFile.
Include a test that clang now produces output files with permissions matching
the umask.

llvm-svn: 185727
2013-07-05 21:13:58 +00:00
Rafael Espindola a36e78ef5d Use llvm::sys::fs::createTemporaryFile.
llvm-svn: 185717
2013-07-05 20:00:06 +00:00
Craig Topper 5603df45df Use SmallVectorImpl& for function arguments instead of SmallVector.
llvm-svn: 185715
2013-07-05 19:34:19 +00:00
Craig Topper 2341c0d3b2 Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185610
2013-07-04 03:08:24 +00:00
Benjamin Kramer fbf914ceb0 Port HTMLDiagnostics to PathV2. No intended functionality change.
llvm-svn: 183849
2013-06-12 18:13:05 +00:00
Alexander Kornienko 33a35dff83 Added Lexer::getBufferEnd().
Summary:
There's Lexer::getBufferStart(), and we need getBufferEnd() to access
the whole input buffer in clang::format::reformat. We don't want to
rely on the fact that the Lexer::BufferEnd always points to '\0', as there can
be embedded '\0's as well.

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D916

llvm-svn: 183236
2013-06-04 16:58:03 +00:00
David Blaikie 7d17010db5 Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

llvm-svn: 181869
2013-05-15 07:37:26 +00:00
Argyrios Kyrtzidis d391046930 Have SourceManager::getLocForEndOfFile() point at the "EOF" location of the FileID.
This fixes a crash due to SourceManager::getLocForEndOfFile() returning an off-by-one location
when the the FileID is for an empty file.

rdar://13803893

llvm-svn: 181285
2013-05-07 04:29:22 +00:00
Douglas Gregor 30071cead9 Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
llvm-svn: 181070
2013-05-03 23:07:45 +00:00
Benjamin Kramer b10e615c44 rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.
This broke e.g. compiling a crash report from a glibc system on Darwin. Sadly,
the implementation had to game the lexer a lot as we're not using a real
preprocessor here. It also doesn't handle special cases like arbitrary macros in
__has_include, but since this macro isn't common outside of clang's headers we
can get away with that.

Fixes PR14422.

Differential Revision: http://llvm-reviews.chandlerc.com/D594

llvm-svn: 179616
2013-04-16 19:08:41 +00:00
Argyrios Kyrtzidis cf22d1f3ab [frontend] -frewrite-includes: turn implicit module imports into @imports.
rdar://13610250

llvm-svn: 179145
2013-04-10 01:53:50 +00:00
Argyrios Kyrtzidis 953ef33f59 [frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo that indicates return from another file.
llvm-svn: 179143
2013-04-10 01:53:37 +00:00
Rafael Espindola 6ae7e50be4 Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41.

llvm-svn: 178682
2013-04-03 19:27:57 +00:00
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Fariborz Jahanian 3a65ce3a56 Objective-C modern rewriter. Fixes a bug
rewriting typedef for a qualified object type
and also when two declarations happen to be on the
same line. // rdar://13562505

llvm-svn: 178680
2013-04-03 19:11:21 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Jordan Rose 755a2ffd79 Add some assertions to appease the static analyzer.
No functionality change.

llvm-svn: 177185
2013-03-15 21:41:35 +00:00
Jordan Rose 5c38272c1a ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.
No (intended) functionality change.

llvm-svn: 176726
2013-03-08 21:51:21 +00:00
Dmitri Gribenko 20b16ace16 Use trailing documentation comments properly
Patch by Alexander Zinenko.

llvm-svn: 175376
2013-02-16 22:21:38 +00:00
Fariborz Jahanian b0fdab26d1 objective-C modern translator: Fixes a mistranslation
of @throw statement by finding location of the ';'
correctly. // rdar://13186010

llvm-svn: 174898
2013-02-11 19:30:33 +00:00
Jordan Rose a7d03840e6 Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.
Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

llvm-svn: 174768
2013-02-08 22:30:41 +00:00
Fariborz Jahanian 4254cdb7ed objective-C modern translation: Fix another random translation bug
involving property getter expressions on rhs of property setter.
// rdar://13138459

llvm-svn: 174729
2013-02-08 18:57:50 +00:00
Fariborz Jahanian e8730a3558 objective-C modern translator. Fixes a trivial
rewriting bug where #ifdef ended up on the same
line as the attribute declaration.

llvm-svn: 174719
2013-02-08 17:15:07 +00:00
Fariborz Jahanian e4c7e855f1 objective-C modern translator. Generate #line
info in the translated code under -g only.
// rdar://13138170

llvm-svn: 174684
2013-02-08 00:27:34 +00:00
Fariborz Jahanian e499613d60 objective-C modern translator. More fixups for
modern meta-data abi translation. Still wip.
// rdar://13138459

llvm-svn: 174672
2013-02-07 22:50:40 +00:00
Fariborz Jahanian 57dd66baa4 objective-C modern translator. Fix up the translated
metadata to handle ivar bitfields. This is wip.
// rdar://13138459

llvm-svn: 174573
2013-02-07 01:53:15 +00:00
Douglas Gregor 048fbfa302 Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

  visible_categories_iterator: Iterates over all visible categories
  and extensions, hiding any that have their "hidden" bit set. This is
  by far the most commonly used iterator.

  known_categories_iterator: Iterates over all categories and
  extensions, ignoring the "hidden" bit. This tends to be used for
  redeclaration-like traversals.

  visible_extensions_iterator: Iterates over all visible extensions,
  hiding any that have their "hidden" bit set.

  known_extensions_iterator: Iterates over all extensions, whether
  they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.
 

llvm-svn: 172665
2013-01-16 23:00:23 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Chad Rosier ac00fbcbd2 Fix indent and remove parameter with a matching default value.
llvm-svn: 171545
2013-01-04 22:40:33 +00:00
Roman Divacky 241f45118b Remove duplicate includes.
llvm-svn: 170903
2012-12-21 17:07:08 +00:00
Bill Wendling 4442605f18 Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.
llvm-svn: 170721
2012-12-20 19:22:21 +00:00
Bill Wendling 7967fc14b9 Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
2012-12-19 07:18:12 +00:00
Eli Friedman 07bab73c7f Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced.  <rdar://problem/12858424>.

llvm-svn: 170081
2012-12-13 01:43:21 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Benjamin Kramer 2a812288c7 Make helper classes anonymous. Make helper functions static instead of private members so the anonymous class doesn't leak out.
No functionality change.

llvm-svn: 169099
2012-12-01 20:58:01 +00:00
Benjamin Kramer 444a1304ad Include pruning and general cleanup.
llvm-svn: 169095
2012-12-01 17:12:56 +00:00
Benjamin Kramer d7d2b1fe45 Don't include Type.h in DeclarationName.h.
Recursively prune some includes.

llvm-svn: 169094
2012-12-01 16:35:25 +00:00
Benjamin Kramer ea70eb30a0 Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.
Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.

llvm-svn: 169092
2012-12-01 15:09:41 +00:00
Fariborz Jahanian 998f0a3360 objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433

llvm-svn: 168825
2012-11-28 23:12:17 +00:00
Benjamin Kramer d6e8a7964d Make libASTMatchers link its dependencies. libRewriteFrontend depends on libRewriteCore.
LLVM_USED_LIBS does nothing here.

llvm-svn: 168172
2012-11-16 17:30:58 +00:00
Fariborz Jahanian 83dadc7dd7 objective-C modern translator. Start the line
directive on a new line.

llvm-svn: 167542
2012-11-07 18:15:53 +00:00
Fariborz Jahanian e030a63868 modern ObjC translator. Insert line number for @synchronized statements.
llvm-svn: 167511
2012-11-07 00:43:05 +00:00
Fariborz Jahanian b6933bc1d0 objective-C modern rewriter. Insert line numbers in
translated code where new code makes the lines be off.
This is wip.

llvm-svn: 167500
2012-11-06 23:25:49 +00:00
NAKAMURA Takumi b46a05cdf9 RewriteModernObjC.cpp: Use Lexer::Stringify() on the file name of #line directive to escape Win32 path separator '\\'.
llvm-svn: 167497
2012-11-06 22:45:31 +00:00
Fariborz Jahanian aa4a242f53 Modern objective-C translator: Start adding line info to the
translated source where it is needed. wip.

llvm-svn: 167469
2012-11-06 17:30:23 +00:00
Douglas Gregor 811db4eac4 Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.

llvm-svn: 166508
2012-10-23 22:26:28 +00:00
Sean Silva e2bb2ff576 Remove pointless classof()'s.
Updates to llvm/Support/Casting.h have rendered these classof()'s
irrelevant.

llvm-svn: 165770
2012-10-11 23:31:23 +00:00
Aaron Ballman ac11a9b572 Silencing an MSVC warning about */ being found outside of a comment.
llvm-svn: 165007
2012-10-02 13:54:25 +00:00
Lang Hames 5de91cc35f Add FP_CONTRACT support for clang.
Clang will now honor the FP_CONTRACT pragma and emit LLVM
fmuladd intrinsics for expressions of the form A * B + C (when they occur in a
single statement).

llvm-svn: 164989
2012-10-02 04:45:10 +00:00
Argyrios Kyrtzidis 19d78b743f For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.

llvm-svn: 164874
2012-09-29 01:06:10 +00:00
Argyrios Kyrtzidis 4fcd2885de Per discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html
have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets.

rdar://11113134 & http://llvm.org/PR13880

llvm-svn: 164743
2012-09-27 01:42:07 +00:00
Dmitri Gribenko 76bb5cabfa Remove redundant semicolons which are null statements.
llvm-svn: 163546
2012-09-10 21:20:09 +00:00
Aaron Ballman 9c00446d2a Fixing the return type information for objc_sync_enter and objc_sync_exit. Patch thanks to Joe Ranieri!
llvm-svn: 163330
2012-09-06 16:44:16 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00
Benjamin Kramer c215e76f78 Push ArrayRef through the Expr hierarchy.
No functionality change.

llvm-svn: 162552
2012-08-24 11:54:20 +00:00
Fariborz Jahanian f1f36c6a9a Modern objc translator: Fixes a crash in rewriter when rewriting the API
for structure valued method messaging. // rdar://12142241

llvm-svn: 162303
2012-08-21 18:56:50 +00:00
Richard Smith 235341bc88 Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.

llvm-svn: 162011
2012-08-16 03:56:14 +00:00
Jordan Rose 11790a4810 [analyzer] Add Prev/Next links to the HTML output.
llvm-svn: 161153
2012-08-02 02:26:19 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
Fariborz Jahanian 1a11252f60 objective-c modern translator. Provide declaration of
"memset' lazily when is needed in translation of
struct-valued methods which require checkinf of nil receivers
outside their bodies. // rdar://11847319

llvm-svn: 160759
2012-07-25 21:48:36 +00:00
Fariborz Jahanian 6c7dbf5858 modern objective-c translator: conditionally include
<string.h>. // rdar://11847319

llvm-svn: 160287
2012-07-16 16:21:45 +00:00
Dmitri Gribenko ec92531c29 Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
  or verbatim command.
* Inline content is placed within some block.  Inline content includes plain
  text, inline commands and HTML as tag soup.

llvm-svn: 159790
2012-07-06 00:28:32 +00:00
Fariborz Jahanian 2794ad59aa objective-c modern translator: synthesize argument type
correctly for blocks and function pointer arguments
in the written constructor.  // rdar://11359268

llvm-svn: 159456
2012-06-29 19:55:46 +00:00
Fariborz Jahanian 0ad4d60b8c modern objc translator: string.h is unavailable on some non-OSX
platforms declare memset in rewritten code instead.

llvm-svn: 159454
2012-06-29 19:33:05 +00:00
Fariborz Jahanian 4a031bdc8f objective-c modern translator: Translation into objc_msgSend_stret
entry point which requires nil check before calling objc_msgSend_stret.
// rdar://11359268 - wip.

llvm-svn: 159445
2012-06-29 18:27:08 +00:00
Fariborz Jahanian d9c8aace7b objective-c rewriter: refactoring of rewriting of
objc_msgSend_stret() API. No functionality change.

llvm-svn: 159379
2012-06-28 21:20:35 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
James Dennett a2449fea5b Documentation cleanup: Escaped backslashes in Doxygen comments.
llvm-svn: 158567
2012-06-15 22:33:08 +00:00
David Blaikie 76cae518cf Fix crash on missing header in -rewrite-includes.
llvm-svn: 158459
2012-06-14 17:36:05 +00:00
David Blaikie 619117a31d Rename -rewrite-includes to -frewrite-includes.
llvm-svn: 158458
2012-06-14 17:36:01 +00:00
Richard Smith 2b013185f8 PR13064: Store whether an in-class initializer uses direct or copy
initialization, and use that information to produce the right kind of
initialization during template instantiation.

llvm-svn: 158288
2012-06-10 03:12:00 +00:00
Benjamin Kramer 7132638995 Replace a char counting helper function with std::count.
No functionality change.

llvm-svn: 158272
2012-06-09 13:18:14 +00:00
Dmitri Gribenko 4280e5cf97 Convert comments to proper Doxygen comments.
llvm-svn: 158241
2012-06-08 23:13:42 +00:00
Jordan Rose de1a29277e Disable _Pragma during HTML macro rewriting to keep from crashing.
The preprocessor's handling of diagnostic push/pops is stateful, so
encountering pragmas during a re-parse causes problems. HTMLRewrite
already filters out normal # directives including #pragma, so it's
clear it's not expected to be interpreting pragmas in this mode.

This fix adds a flag to Preprocessor to explicitly disable pragmas.
The "right" fix might be to separate pragma lexing from pragma
parsing so that we can throw away pragmas like we do preprocessor
directives, but right now it's important to get the fix in.

Note that this has nothing to do with the "hack" of re-using the
input preprocessor in HTMLRewrite. Even if we someday copy the
preprocessor instead of re-using it, the copy would (and should) include
the diagnostic level tables and have the same problems.

llvm-svn: 158214
2012-06-08 18:06:21 +00:00
David Blaikie 40ed29730b Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

llvm-svn: 158104
2012-06-06 20:45:41 +00:00
David Blaikie d5321247c4 Add a -rewrite-includes option, which is similar to -rewrite-macros, but only expands #include directives.
Patch contributed by Lubos Lunak (l.lunax@suse.cz).
Review by Matt Beaumont-Gay (matthewbg@google.com).

llvm-svn: 158093
2012-06-06 18:52:13 +00:00
Benjamin Kramer 474261af7b Fix typos found by http://github.com/lyda/misspell-check
llvm-svn: 157886
2012-06-02 10:20:41 +00:00
NAKAMURA Takumi ce6ad6748a clang/lib/Rewrite/Rewriter.cpp: Don't try to rename opened files on Win32. Win32 doesn't allow rename/removing opened files.
llvm-svn: 157528
2012-05-27 12:59:58 +00:00
Fariborz Jahanian c37a1d6e0f cleanup some code.
llvm-svn: 157436
2012-05-24 22:59:56 +00:00
Fariborz Jahanian 9b43c3f0c5 modern objc translation: Add translation of @autoreleasepool
statement. // rdar://11474836.

llvm-svn: 157359
2012-05-23 23:47:20 +00:00
Manuel Klimek 78d084d942 Adds a method overwriteChangedFiles to the Rewriter. This is implemented by
first writing the changed files to a temporary location and then overwriting
the original files atomically.

Also adds a RewriterTestContext to aid unit testing rewrting logic in general.

llvm-svn: 157260
2012-05-22 17:01:35 +00:00
Fariborz Jahanian 89919ccd17 Modern objective-c translation. Translating default
synthesis of property getter/setters. // rdar://11374235

llvm-svn: 156447
2012-05-08 23:54:35 +00:00
Fariborz Jahanian 9c0c0501e8 modern objc translation. objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

llvm-svn: 156418
2012-05-08 20:55:55 +00:00
Douglas Gregor 8a59a957fb Revert r156097, which appears to be causing some breakage.
llvm-svn: 156304
2012-05-07 14:17:47 +00:00
Fariborz Jahanian e9863b5c8e objc modern translator: fix up attribute for dynamic property in a category.
// rdar://11095151

llvm-svn: 156127
2012-05-03 23:19:33 +00:00
Fariborz Jahanian f687e7b2ff modern objc translator: support for default property
synthesis translation. // rdar://11374235 - wip.

llvm-svn: 156125
2012-05-03 22:52:13 +00:00
Fariborz Jahanian 2e7f638b23 modern objc translator: used size_t in couple
of places. // rdar://11375908

llvm-svn: 156106
2012-05-03 21:44:12 +00:00
Fariborz Jahanian 3dc3669858 modern objc translation. objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

llvm-svn: 156097
2012-05-03 20:23:37 +00:00
Fariborz Jahanian 70ef929561 modern objective-c translator: Fix destructor def.
for __NSContainer_literal.

llvm-svn: 156035
2012-05-02 23:53:46 +00:00
Fariborz Jahanian d7c6777d50 Modern objective-c translation: Fixing couple of bugs
related to laying out ivar structs and accessing non-fragile-ivar
in more compilated cases. // rdar://11323187

llvm-svn: 156004
2012-05-02 17:34:59 +00:00
Fariborz Jahanian 144b72288a modern objective-c translation of private ivars.
// rdar://11351299

llvm-svn: 155921
2012-05-01 17:46:45 +00:00
Fariborz Jahanian faded5bb0f modern objective-c translator. named aggregate types
defined inside the objc class belong to class's
decl. scope. This is to conform to objective-c
rules. // rdar://11351299

llvm-svn: 155855
2012-04-30 23:20:30 +00:00
Fariborz Jahanian 5979c31ea7 minor refactoring of modern objc translator.
llvm-svn: 155843
2012-04-30 19:46:53 +00:00
Fariborz Jahanian 95badad83b modern objective-c translation: de-virtualize all
local rewriting functions.

llvm-svn: 155826
2012-04-30 16:57:52 +00:00
David Blaikie 2d7c57ec1d Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

llvm-svn: 155808
2012-04-30 02:36:29 +00:00
Fariborz Jahanian bf217c8c14 objective-c modern translator: Correctly translate
nonfragile ivar access code when ivar type is a 
locally defined struct/union type. // rdar://11323187

llvm-svn: 155740
2012-04-27 22:48:54 +00:00
Fariborz Jahanian 75f2e3c3d5 modern objective-c translator: _OBJC_PROTOCOL_REFERENCE_*
symbols should be static. // rdar://11337074

llvm-svn: 155736
2012-04-27 21:39:49 +00:00
Fariborz Jahanian 16d0d6c4ad modern objective-c transltion: Fixes a translation bug
of writing a __block variable being initialized with
a constructed object. // rdar://11326988

llvm-svn: 155673
2012-04-26 23:20:25 +00:00
Fariborz Jahanian e49a42cae9 modern objc rewriter: fixes a bug writing
a const qualified static c-function. 
// rdar://11314329

llvm-svn: 155564
2012-04-25 17:56:48 +00:00
Fariborz Jahanian 847713a998 modern objc translator: Allow writing of multiple
declaration of __block variables on same lines
with initializers. // rdsr://7547630

llvm-svn: 155473
2012-04-24 19:38:45 +00:00
Fariborz Jahanian 32af25ea05 objc modern rewriter: allow translation of
multiple declaration of block variables
(with no initializer) on the same line.

llvm-svn: 155462
2012-04-24 18:16:20 +00:00
Fariborz Jahanian 3fd9bbd41e objc modern rewriter: minor refactoring.
llvm-svn: 155449
2012-04-24 16:45:27 +00:00
Fariborz Jahanian df0577de11 objective-c modern translator: Further improving the last
patch fixing writing a spurious 'static' into
the wrong place. // rdar://11275241

llvm-svn: 155130
2012-04-19 16:30:28 +00:00
Fariborz Jahanian ca357d9831 modern objective-c translator: Fix writing a spurious 'static'
into the wrong place when rewriting a static function
which declares block literals. // rdar://11275241

llvm-svn: 155084
2012-04-19 00:50:01 +00:00
Patrick Beard 0caa39474b Implements boxed expressions for Objective-C. <rdar://problem/10194391>
llvm-svn: 155082
2012-04-19 00:25:12 +00:00
Fariborz Jahanian 88773764e9 objective-c modern translation. Correct rewriting of
block meta-data of block literals declared inside
of extern "C" functions.
// rdar://1131490

llvm-svn: 154939
2012-04-17 18:40:53 +00:00
Fariborz Jahanian 35f6e12bf0 Modern objective-c translator:'self' used inside
block literal is imported. // rdar://11259664

llvm-svn: 154876
2012-04-16 23:00:57 +00:00
Fariborz Jahanian cc1722818b modern objective-c translator: translation of implicit
cast to/from block pointer types. // rdar://11202764
Also, many more modern translator tests.

llvm-svn: 154869
2012-04-16 22:14:01 +00:00
Benjamin Kramer ccdf735e52 Actually, this tree isn't necessarily binary.
llvm-svn: 154762
2012-04-15 11:35:18 +00:00
Benjamin Kramer c2a4475caa Recursively delete rewrite rope nodes when tearing down the tree.
llvm-svn: 154760
2012-04-15 11:09:40 +00:00
Fariborz Jahanian 1b085428e8 objective-c modern translator: Make metadata
definition for protocols static. // rdar://11248048

llvm-svn: 154753
2012-04-14 17:13:08 +00:00
Fariborz Jahanian 3a5d552cd7 modern objective-c translator: Fixes translation of
__typeof which is a regression by reverting
r154360. // rdar://11233924

llvm-svn: 154679
2012-04-13 18:00:54 +00:00
Fariborz Jahanian 4af0e9efdd modern objective-c translator: When translating
call to 'super' use __rw_objc_super as type of the
'super' meta-data instead of objc_super.
// rdar://11239894

llvm-svn: 154670
2012-04-13 16:20:05 +00:00
Fariborz Jahanian 27db0b3754 objective-c modern translator: beautify rewrite of
struct __rw_objc_super; no functionality change.

llvm-svn: 154632
2012-04-12 23:52:52 +00:00
Fariborz Jahanian e1240fe743 modern objective-c translator. ifdef'out
__weak and __block when rewriting.
// rdar://11236342

llvm-svn: 154592
2012-04-12 16:33:31 +00:00
Fariborz Jahanian 5811fd6cc4 modern objective-c translator. Fixes a mis-translation when
of a __block struct object. // rdar://11230308

llvm-svn: 154566
2012-04-11 23:57:12 +00:00
Fariborz Jahanian aaf4d69ac1 modern objective-c translator. Fixes a translation bug when
first ivar in the list is a bitfield.
// rdar://11229770

llvm-svn: 154534
2012-04-11 21:12:36 +00:00
Fariborz Jahanian 31176b1485 modern objective-c translation: writing container
subscripting. // rdar://11203853

llvm-svn: 154441
2012-04-10 22:06:54 +00:00
Fariborz Jahanian 2c00acd67f objective-c modern translator: rewriting specific
implicit casts which is needed to produce good c++
code. // rdar://11202764

llvm-svn: 154360
2012-04-10 00:08:18 +00:00
Fariborz Jahanian 4460e0f805 modern objective-c translation: support for
dictionary literals. This concludes // rdar://10803676

llvm-svn: 154218
2012-04-06 22:29:36 +00:00
Fariborz Jahanian e110fe4ac7 modern objective-c translator: translate array literal
expressions. // rdar://10803676

llvm-svn: 154196
2012-04-06 19:47:36 +00:00
Fariborz Jahanian f264d5dc01 objective-c modern translation. Remove commenting out
of extern "C". // rdar://11169733

llvm-svn: 154025
2012-04-04 17:16:15 +00:00
Fariborz Jahanian 08ed8921c7 modern objective-c translator: rewriter linkage spec.
// rdar://11169733

llvm-svn: 153960
2012-04-03 17:35:38 +00:00
Fariborz Jahanian 991a08d35a modern objective-c translator: writing container
literals. wip. // rdar://10803676

llvm-svn: 153784
2012-03-30 23:35:47 +00:00
Fariborz Jahanian 9c967fe51b modern objective-c translator: writing numeric
literals. // rdar://10803676

llvm-svn: 153756
2012-03-30 16:49:36 +00:00
Fariborz Jahanian 064b5386f0 modern objc translator: avoid some duplicate declarations.
llvm-svn: 153674
2012-03-29 19:04:10 +00:00
Fariborz Jahanian f35e020ef3 modern objective-c translator: fix up assortment of
visibility directives for a variety of exported
meta-data symbols. // rdar://11144048

llvm-svn: 153663
2012-03-29 17:51:09 +00:00
Fariborz Jahanian 307b7ad50c modern objective-c translator: writing objc boolean literals.
// rdar://11124775

llvm-svn: 153535
2012-03-27 20:17:30 +00:00
Fariborz Jahanian 5ed21c3154 objective-c modern translator: move all inithooks into a single array
// rdar://11124354

llvm-svn: 153526
2012-03-27 18:41:05 +00:00
Fariborz Jahanian 835cabe92a Remove few if-then-else when both branches are the
same. pr12357.

llvm-svn: 153515
2012-03-27 16:42:20 +00:00
Fariborz Jahanian 38c59108ad Commit patch reverted in r153454 with the modified test
case that I forgot to check in.

llvm-svn: 153512
2012-03-27 16:21:30 +00:00
Daniel Dunbar 94d34ca2d9 Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing.
llvm-svn: 153454
2012-03-26 18:48:59 +00:00
Fariborz Jahanian c29ebc36b1 objective-c modern translator: extern "C" exported
symbols. // rdar://11103982

llvm-svn: 153443
2012-03-26 16:29:49 +00:00
Fariborz Jahanian 16366da437 remove declaration of _objc_empty_vtable no longer
used in modern objc translator. // rdar://11105680

llvm-svn: 153386
2012-03-24 16:57:13 +00:00
Fariborz Jahanian 341348111d moderin objc translator: remove 'const' from remaining
fields in _class_ro_t metadata. //  rdar://11079898

llvm-svn: 153384
2012-03-24 16:53:16 +00:00
Fariborz Jahanian e005070ccf modern objc translation of block literal expressions
declared at file scope.
// rdar://11006566

llvm-svn: 153293
2012-03-23 00:00:49 +00:00
Fariborz Jahanian bdf975ea3f modern objc rewriter: until we can translate block literals
at global scope properly, issue diagnostics.

llvm-svn: 153271
2012-03-22 19:54:39 +00:00
Fariborz Jahanian ee1db7a0fd modern objective-c rewriter: Fix up translation of
property attributes. // rdar://11095151

llvm-svn: 153261
2012-03-22 17:39:35 +00:00
Fariborz Jahanian 167384d0da modern objective-c translator: Change declaration of
all objc_msgSend unctions to void parameters and void return.
// rdar://11094890

llvm-svn: 153227
2012-03-21 23:41:04 +00:00
Fariborz Jahanian eb4eb5cad9 modern objective-c rewriter: remove 'const' from
pointer field declarations in several meta-data.
// rdar://11079898

llvm-svn: 153196
2012-03-21 16:23:16 +00:00
Fariborz Jahanian e9de728afc Undo previous patch as I checked more than I intended.
llvm-svn: 153193
2012-03-21 16:18:21 +00:00
Fariborz Jahanian fbe392eed6 modern objective-c rewriter: remove 'const' from
pointer field declarations in several meta-data.
// rdar://11079898

llvm-svn: 153192
2012-03-21 16:17:22 +00:00
NAKAMURA Takumi 3eb0edde78 RewriteModernObjC.cpp: Don't expose temporary std::string with StringRef. (StringRef)getName() can be used here.
llvm-svn: 153156
2012-03-21 03:21:46 +00:00
Fariborz Jahanian 69a76e98fe Close the paren.
// rdar://11076938

llvm-svn: 153151
2012-03-21 00:01:15 +00:00
Fariborz Jahanian 952c3b9512 modern objective-c translator: insert couple of pragmas for optimization.
// rdar://11079898

llvm-svn: 153145
2012-03-20 22:24:05 +00:00
Fariborz Jahanian cd79a49f37 modern objective-c translator: add static function to initialize
the class pointer in the category structure.
// rdar://11076938

llvm-svn: 153138
2012-03-20 21:41:28 +00:00