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

26 Коммитов

Автор SHA1 Сообщение Дата
Chandler Carruth 55fc873017 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 09:13:33 +00:00
Argyrios Kyrtzidis 37ed12720a Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169229 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:27:05 +00:00
Eli Friedman a6c66cedc0 Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call.  Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 00:14:07 +00:00
NAKAMURA Takumi 11abf2ad01 clang/lib: [CMake] Update tblgen'd dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 866abce3b9 clang/lib: [CMake] Reformat, alphabetize lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27 06:18:12 +00:00
Ted Kremenek 4e56c42cac Add libEdit dependency on ClangDiagnosticCommon. Hopefully this will unbreak the VS build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160309 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 18:53:42 +00:00
Argyrios Kyrtzidis 1838703fea [objcmt] Check for classes that accept 'objectForKey:' (or the other selectors
that the migrator handles) but return their instances as 'id', resulting
in the compiler resolving 'objectForKey:' as the method from NSDictionary.

When checking if we can convert to subscripting syntax, check whether
the receiver is a result of a class method from a hardcoded list of
such classes. In such a case return the specific class as the interface
of the receiver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:07:09 +00:00
Argyrios Kyrtzidis c2abbe0b98 [objcmt] Allow migrating to subscripting syntax for other classes
(apart from NSDictionary/NSArray) that implement objectForKey:/objectAtIndex/etc.
and the subscripting methods as well.

Part of rdar://11734969

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-05 21:49:51 +00:00
Benjamin Kramer 478851c3ed Drop the ASTContext.h include from Stmt.h and fix up transitive users.
This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-04 17:04:04 +00:00
Argyrios Kyrtzidis af505c5822 Fix uninitialized variable use bug found by the clairvoyant static analyzer.
Commit::canReplaceText would not initialize its out 'Len' parameter before
returning true and it would be used uninitialized in Commit::replaceText.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159306 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-27 23:45:44 +00:00
Chandler Carruth b0d8671f95 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-21 01:30:21 +00:00
Argyrios Kyrtzidis 8b9fcd7cd1 [objcmt] Have the modern objc migration warning change from:
[NSNumber numberWithDouble:cppb];
warning: converting to boxing syntax requires a cast

to something like:

[NSNumber numberWithDouble:cppb];
warning: converting to boxing syntax requires casting 'bool' to 'double'

This is way better to fully understand the warning.
rdar://11705106

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 01:28:32 +00:00
Argyrios Kyrtzidis 12b732a86c [objcmt] When checking whether the subscripting methods are declared use
ObjCInterfaceDec::lookupInstanceMethod to make sure we check categories as well
and update related tests.

rdar://11695288

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158697 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 02:22:02 +00:00
Argyrios Kyrtzidis 6b4db9b329 [objcmt] When in ARC mode, also convert "[[.. alloc] init]" messages to literals,
since the change from +1 to +0 will be handled fine by ARC.

rdar://11606358

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158114 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-06 22:23:12 +00:00
Argyrios Kyrtzidis cacf718381 [objcmt] Don't migrate to subscripting syntax if the required methods have not
been declared on NSArray/NSDictionary.

rdar://11581975

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157951 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-04 21:23:26 +00:00
Argyrios Kyrtzidis 013a254a5b [objcmt] Warn when modern objc migrator does not convert a NSNumber message because it requires a cast.
rdar://11525138

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 16:48:23 +00:00
Argyrios Kyrtzidis 2bddd43bd8 [objcmt] Don't add redundant parentheses when migrating subscripting of an ivar.
rdar://11501256

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157227 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-22 00:47:53 +00:00
Argyrios Kyrtzidis 0773659881 [objcmt] Accept char arrays for rewriting to @() syntax.
Part of rdar://11438360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156880 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-16 00:21:21 +00:00
Argyrios Kyrtzidis c5d33e959b [objcmt] When using NSNumber numberWithInteger:/numberWithUnsignedInteger: be
more liberal in rewriting when the parameter is an enum constant.

Part of rdar://11438360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 22:59:54 +00:00
Argyrios Kyrtzidis 7fe103cdcc [objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
to use the @() boxing syntax.

It will also rewrite uses of stringWithCString:encoding: where the encoding that is
used is NSASCIIStringEncoding or NSUTF8StringEncoding.

rdar://11438360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156868 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 22:22:10 +00:00
Argyrios Kyrtzidis 0d578a6f87 [objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.
There are some caveats:
-If an implicit cast (e.g. int -> float for numberWithFloat:) was required, the message
 will not get rewritten
-If the message was with numberWithInteger:/numberWithUnsignedInteger:, which are very
 commonly used, be more liberal and allow the boxing syntax if the underlying type has
 same signedness and will not lose precision.

Part of rdar://11438360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156844 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 19:17:49 +00:00
Argyrios Kyrtzidis 20119a87fb [objcmt] When rewriting to subscripting syntax, make sure we put
the receiver in parentheses when necessary.

Part of rdar://11438360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156789 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-14 23:33:49 +00:00
Argyrios Kyrtzidis 055b395294 [objcmt] When rewriting to array/dictionary literals, add an explicit
cast to 'id' for any argument that requires it.

Part of rdar://11438360.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-14 22:01:53 +00:00
Benjamin Kramer bea6c0a2e7 Remove unused-but-set variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152633 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-13 17:05:43 +00:00
David Blaikie 4e4d08403c Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 07:00:24 +00:00
Ted Kremenek 30660a8985 Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152141 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 20:06:33 +00:00