Commit Graph

1741 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis a59dbea017 Fix CMake.
llvm-svn: 134918
2011-07-11 20:28:59 +00:00
Argyrios Kyrtzidis f89cc69eac [arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix to 'clang_'.
llvm-svn: 134916
2011-07-11 20:15:00 +00:00
Evan Cheng 279f2907ed Match createCodeEmitter change.
llvm-svn: 134885
2011-07-11 04:24:19 +00:00
Francois Pichet 9a22177c3e Fix ARCMT/migrate.m on MSVC.
Solution is to set output stdout to binary mode to prevent newline conversion (\n => \r\n).

llvm-svn: 134879
2011-07-10 19:48:34 +00:00
Joerg Sonnenberger e3531fcf88 Unbreak -cc1as mode after MC subtarget changes
llvm-svn: 134877
2011-07-10 19:16:25 +00:00
NAKAMURA Takumi e65e4778f2 tools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to satisfy linking on cygming.
FIXME: tools/c-*.exe should be linked to clang.dll on cygming. llvm/Makefile.rules is not aware of bin/clang.dll.
llvm-svn: 134871
2011-07-10 15:50:19 +00:00
NAKAMURA Takumi 3310effb24 c-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.
llvm-svn: 134859
2011-07-10 03:10:43 +00:00
Argyrios Kyrtzidis dd76300464 Fix linker problem in buildbot.
llvm-svn: 134849
2011-07-09 22:35:06 +00:00
Argyrios Kyrtzidis 347bf910b9 Ugh, fix CMake.
llvm-svn: 134848
2011-07-09 22:05:50 +00:00
Argyrios Kyrtzidis 27019be903 [libclang] Fix linker error in buildbots.
llvm-svn: 134847
2011-07-09 21:35:58 +00:00
Argyrios Kyrtzidis 7fbd97f641 [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.

<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.

Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.

Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.

rdar://9735086.

llvm-svn: 134844
2011-07-09 20:00:58 +00:00
Evan Cheng 7b15d1885f cc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c
llvm-svn: 134811
2011-07-09 07:32:07 +00:00
Evan Cheng dec3187e7f createAsmParser API change.
llvm-svn: 134797
2011-07-09 06:04:17 +00:00
Chandler Carruth 961995dc9a Update the creation of the TargetAsmParser based on API change in r134678.
llvm-svn: 134680
2011-07-08 03:15:48 +00:00
Joerg Sonnenberger 39ec119132 Slightly improve the code to derive target from program name to not
fault if no arguments are given.

llvm-svn: 134618
2011-07-07 16:57:26 +00:00
Douglas Gregor 2132584d36 Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!

llvm-svn: 134615
2011-07-07 16:03:39 +00:00
Francois Pichet abcfbecf39 MSVC doesn't like mixing declarations and statements in a C file.
llvm-svn: 134550
2011-07-06 22:09:44 +00:00
Evan Cheng 299b36fa72 createMCInstPrinter doesn't need TargetMachine anymore.
llvm-svn: 134526
2011-07-06 19:45:57 +00:00
Douglas Gregor 30c80fa3eb libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.

llvm-svn: 134495
2011-07-06 16:43:36 +00:00
Douglas Gregor a98034a25e Improve the Python bindings for libclang in a few ways, from Eli
Bendersky. Specifically: 

* Implemented a new function in libclang: clang_isAttribute

* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows 

* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name) 
* Exposed clang_getCursorDisplayName to the python bindings

llvm-svn: 134460
2011-07-06 03:00:34 +00:00
John McCall d9dfe3a1f8 Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.

llvm-svn: 134137
2011-06-30 08:33:18 +00:00
Evan Cheng adc7959851 createTargetMachine now takes a CPU string.
llvm-svn: 134128
2011-06-30 02:06:32 +00:00
Argyrios Kyrtzidis 8bb2ecf32d [libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp
No functionality change.

llvm-svn: 134104
2011-06-29 22:20:07 +00:00
Argyrios Kyrtzidis e379ee31c0 Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.
llvm-svn: 134103
2011-06-29 22:20:04 +00:00
Eli Friedman 03aff72eff Revert unintentional commit.
llvm-svn: 133971
2011-06-28 00:03:31 +00:00
Eli Friedman 5f3ab2248c Merge some calls to FoldingSetNodeID::AddInteger; assuming my measurements aren't completely off, roughly a 1% speedup on SingleSource/UnitTests/ObjC/trivial-interface.m .
llvm-svn: 133968
2011-06-27 23:58:21 +00:00
Argyrios Kyrtzidis d289104e29 [libclang] Avoid having the cursor of an expression replace the declaration cursor
when the expression source range overlaps the declaration range.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure pointing at 'foo' returns a VarDecl cursor.

rdar://9124499.

llvm-svn: 133930
2011-06-27 19:42:23 +00:00
Argyrios Kyrtzidis 66cd1dacbc [libclang] Avoid having the cursor of an expression "overwrite" the annotation of the
variable declaration that it belongs to.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor.

rdar://9124499.

llvm-svn: 133929
2011-06-27 19:42:20 +00:00
Douglas Gregor fe31481f68 Introduce a new AST node describing reference binding to temporaries.
MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

  const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value. 

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.

llvm-svn: 133521
2011-06-21 17:03:29 +00:00
Chandler Carruth 54a2c06cf2 Remove more unnecessary dependencies now that the Frontend -> ARCMigrate
edge has been broken.

llvm-svn: 133343
2011-06-18 09:07:35 +00:00
NAKAMURA Takumi 16484a6bc8 tools/arcmt-test: Don't attempt to link redundant libclang (clang-c).
llvm-svn: 133342
2011-06-18 08:52:27 +00:00
Argyrios Kyrtzidis 90b6a2a6a7 [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.

llvm-svn: 133323
2011-06-18 00:53:41 +00:00
Chandler Carruth 5dea0dc575 Remove ARCMigrate from more builds that it isn't needed in now that the
layering problem has been addressed.

llvm-svn: 133217
2011-06-16 23:53:28 +00:00
John McCall 32e02a431b c-index-test also depends on ARCMigrate, oh boy
llvm-svn: 133147
2011-06-16 05:29:03 +00:00
John McCall 2af9866fc9 ARCMigrate depends on libAnalysis, and on unhelpful linkers must appear
before it on the link line.

llvm-svn: 133145
2011-06-16 04:30:11 +00:00
John McCall e70c8987d3 Grr. Of course libARCMigrate depends on libRewrite. This is a lot to be
linking unnecessarily into libclang.

llvm-svn: 133129
2011-06-16 01:29:56 +00:00
Argyrios Kyrtzidis 6e4ef20baf [arcmt] Make arcmt-test accept cc1 options to make it more portable and hopefully fix MSVC failures.
llvm-svn: 133119
2011-06-16 00:53:46 +00:00
John McCall 0a6ba2684f libFrontend depends on ARCMigrate, so link it into libclang.
llvm-svn: 133116
2011-06-16 00:38:00 +00:00
John McCall d70fb9812a The ARC Migration Tool. All the credit goes to Argyrios and Fariborz
for this.

llvm-svn: 133104
2011-06-15 23:25:17 +00:00
John McCall 31168b077c Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Tanya Lattner 55808c1026 Add support for builtin astype:
__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types.
Added test case.

llvm-svn: 132612
2011-06-04 00:47:47 +00:00
Douglas Gregor 4cd65962dc Expose @synthesize and @dynamic via their own cursor kinds in
libclang. Fixes <rdar://problem/9537904>.

llvm-svn: 132603
2011-06-03 23:08:58 +00:00
Douglas Gregor a9d8493310 Objective-C doesn't consider the use of incomplete types as method
parameter types to be ill-formed. However, it relies on the
completeness of method parameter types when producing metadata, e.g.,
for a protocol, leading IR generating to crash in such cases.

Since there's no real way to tighten down the semantics of Objective-C
here without breaking existing code, do something safe but lame:
suppress the generation of metadata when this happens.

Fixes <rdar://problem/9123036>.

llvm-svn: 132171
2011-05-27 01:19:52 +00:00
Argyrios Kyrtzidis 0e37afa15e A StringRef-ication of the DiagnosticIDs API and internals.
Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

llvm-svn: 132047
2011-05-25 05:05:01 +00:00
Alexis Hunt e852b100e2 Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

llvm-svn: 132017
2011-05-24 22:41:36 +00:00
Joerg Sonnenberger b487d2d815 Support -fatal-warnings for the assembler frontend
llvm-svn: 131662
2011-05-19 18:42:29 +00:00
Argyrios Kyrtzidis f15eac1110 Do some safety checks.
llvm-svn: 131491
2011-05-17 22:09:53 +00:00
Douglas Gregor a8d0c774da Add c-index-test printing and tests for static and virtual method
query functions, from Erik Verbruggen!

llvm-svn: 131295
2011-05-13 15:54:42 +00:00
Douglas Gregor 9519d92ef6 Add clang_CXXMethod_isVirtual() to libclang, from Erik Verbruggen!
llvm-svn: 131230
2011-05-12 15:17:24 +00:00
Alexis Hunt 4a8ea1092a Modify some deleted function methods to better reflect reality:
- New isDefined() function checks for deletedness
 - isThisDeclarationADefinition checks for deletedness
 - New doesThisDeclarationHaveABody() does what
   isThisDeclarationADefinition() used to do
 - The IsDeleted bit is not propagated across redeclarations
 - isDeleted() now checks the canoncial declaration
 - New isDeletedAsWritten() does what it says on the tin.
 - isUserProvided() now correct (thanks Richard!)

This fixes the bug that we weren't catching

void foo() = delete;
void foo() {}

as being a redefinition.

llvm-svn: 131013
2011-05-06 20:44:56 +00:00