]> granicus.if.org Git - clang/log
clang
13 years agoDo not modify string returned by getenv on Windows.
Francois Pichet [Sat, 16 Jul 2011 21:17:14 +0000 (21:17 +0000)]
Do not modify string returned by getenv on Windows.
Fixes PR9875, patch by Nikola Smiljanic!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135356 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoZero this struct in a way that neither depends on the size of the struct nor triggers...
Benjamin Kramer [Sat, 16 Jul 2011 20:13:06 +0000 (20:13 +0000)]
Zero this struct in a way that neither depends on the size of the struct nor triggers warnings from GCC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135351 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Per discussions with the Cocoa team, extend CF naming conventions to exten...
Ted Kremenek [Sat, 16 Jul 2011 19:50:36 +0000 (19:50 +0000)]
[analyzer] Per discussions with the Cocoa team, extend CF naming conventions to extend to camel case functions instead of just title case functions.  Fixes <rdar://problem/9732321>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135350 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Place checking for Core Foundation "Create" rule into a proper API. No...
Ted Kremenek [Sat, 16 Jul 2011 19:50:32 +0000 (19:50 +0000)]
[analyzer] Place checking for Core Foundation "Create" rule into a proper API.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135349 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove a gcc warning.
Fariborz Jahanian [Sat, 16 Jul 2011 18:31:33 +0000 (18:31 +0000)]
Remove a gcc warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135348 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCorrectly handle sysroot prefix in -print-search-dirs. Makes libtool
Joerg Sonnenberger [Sat, 16 Jul 2011 10:50:05 +0000 (10:50 +0000)]
Correctly handle sysroot prefix in -print-search-dirs. Makes libtool
more happy on NetBSD.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135344 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a typo.
Fariborz Jahanian [Sat, 16 Jul 2011 00:08:33 +0000 (00:08 +0000)]
Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135328 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] It's not safe to remove the -release on "[[someivar delegate] release];"...
Argyrios Kyrtzidis [Fri, 15 Jul 2011 23:48:56 +0000 (23:48 +0000)]
[arcmt] It's not safe to remove the -release on "[[someivar delegate] release];" since it's very likely
that, after migration, the object that was passed to 'setDelegate:' will not be properly retained, e.g:

-whatever {
  id x = [[MyDoHicky alloc] init];
  [someivar setDelegate: x]; // x won't get retained in ARC.
}
-dealloc {
  [[someivar delegate] release]; // give migration error here.
}

rdar://8858009

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135327 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThis handles the missing cases of opencl vector literals.
Tanya Lattner [Fri, 15 Jul 2011 23:07:01 +0000 (23:07 +0000)]
This handles the missing cases of opencl vector literals.
Test cases provided by Anton Lokhmot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135322 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate retain-release.m to match updated warnings from r135310
Jordy Rose [Fri, 15 Jul 2011 22:38:26 +0000 (22:38 +0000)]
Update retain-release.m to match updated warnings from r135310

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135317 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[libclang] Map canonical decl of a category implementation to the category decl.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:37:58 +0000 (22:37 +0000)]
[libclang] Map canonical decl of a category implementation to the category decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135316 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:27:18 +0000 (22:27 +0000)]
Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135314 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd tests for CFRefReport's path notes, and fix a few typos and non-standard terminol...
Jordy Rose [Fri, 15 Jul 2011 22:17:54 +0000 (22:17 +0000)]
Add tests for CFRefReport's path notes, and fix a few typos and non-standard terminology ('+0 retain counts') caught by the tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135310 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:04:00 +0000 (22:04 +0000)]
[arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135309 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPrevent the -save-temps flag from modifying the input file if the input filename
Chad Rosier [Fri, 15 Jul 2011 21:54:29 +0000 (21:54 +0000)]
Prevent the -save-temps flag from modifying the input file if the input filename
conflicts with a to be produced temp filename.
rdar://9724657

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135308 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAugment the interface of ExternalASTSource::FindExternalLexicalDecls()
Douglas Gregor [Fri, 15 Jul 2011 21:46:17 +0000 (21:46 +0000)]
Augment the interface of ExternalASTSource::FindExternalLexicalDecls()
to allow clients to specify that they've already (correctly) loaded
declarations, and that no further action is needed.

Also, make sure that we clear the "has external lexical declarations"
bit before calling FindExternalLexicalDecls(), to avoid infinite
recursion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135306 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 21:39:32 +0000 (21:39 +0000)]
The canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135304 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] For:
Argyrios Kyrtzidis [Fri, 15 Jul 2011 21:11:23 +0000 (21:11 +0000)]
[arcmt] For:

id x = ...
@try {
 ...
} @finally {
 [x release];
}

Migrator will drop the release. It's better to change it to "x = 0" in a @finally to avoid leak when exception is thrown.

rdar://9398256

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135301 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled
Douglas Gregor [Fri, 15 Jul 2011 21:03:20 +0000 (21:03 +0000)]
Don't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135300 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.
Jordy Rose [Fri, 15 Jul 2011 20:29:02 +0000 (20:29 +0000)]
[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135294 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo
Joerg Sonnenberger [Fri, 15 Jul 2011 18:23:44 +0000 (18:23 +0000)]
Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135285 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse the new APFloat::convertToInt(APSInt) function to simplify uses of
Jeffrey Yasskin [Fri, 15 Jul 2011 17:03:07 +0000 (17:03 +0000)]
Use the new APFloat::convertToInt(APSInt) function to simplify uses of
convertToInt(integerParts*) and make them more reliable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135279 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStore bracket locations for array subscript expressions, from Erik Verbruggen!
Douglas Gregor [Fri, 15 Jul 2011 16:25:15 +0000 (16:25 +0000)]
Store bracket locations for array subscript expressions, from Erik Verbruggen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135275 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen creating a property in a class extension, make sure to check its
Douglas Gregor [Fri, 15 Jul 2011 15:30:21 +0000 (15:30 +0000)]
When creating a property in a class extension, make sure to check its
attributes. Fixes <rdar://problem/9561076>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135273 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert CallInst and InvokeInst APIs to use ArrayRef.
Jay Foad [Fri, 15 Jul 2011 08:37:34 +0000 (08:37 +0000)]
Convert CallInst and InvokeInst APIs to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135265 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRestore the C-style cast hack for enum template arguments,
John McCall [Fri, 15 Jul 2011 07:47:58 +0000 (07:47 +0000)]
Restore the C-style cast hack for enum template arguments,
which is required given the current setup for template
argument deduction substitution validation, and add a test
case to make sure we don't break it in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135262 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove the Serialization library from 'instantiation' to 'expansion', with
Chandler Carruth [Fri, 15 Jul 2011 07:25:21 +0000 (07:25 +0000)]
Move the Serialization library from 'instantiation' to 'expansion', with
the exception of its uses of SourceManager and SourceLocation APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135260 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd serialization support for SubstNonTypeTemplateParmExpr.
John McCall [Fri, 15 Jul 2011 07:00:14 +0000 (07:00 +0000)]
Add serialization support for SubstNonTypeTemplateParmExpr.
Also add the missing serialization support for SEHTryStmt,
SEHFinallyStmt, and SEHExceptStmt, and fix and finish the
serialization support for AsTypeExpr.  In addition, change
the code so that it will no longer link if a Stmt subclass
is missing serialization support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135258 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix the definition of AsTypeExpr. I'm still not sure this
John McCall [Fri, 15 Jul 2011 06:56:33 +0000 (06:56 +0000)]
Fix the definition of AsTypeExpr.  I'm still not sure this
is right --- shouldn't there be a TypeLoc in here somewhere? ---
but at least it doesn't have a redundant QualType and a broken
children() method.

Noticed this while doing things in serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135257 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoprotect some calls to ConvertType when a function info is under construction
Chris Lattner [Fri, 15 Jul 2011 06:41:05 +0000 (06:41 +0000)]
protect some calls to ConvertType when a function info is under construction
to prevent recursive compilation problems.  This fixes a failure of CodeGen/decl.c
on x86-32 targets that don't fill in the coerce-to type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135256 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up UnixAPIChecker, including switching its array of BugTypes to llvm::OwningPtr...
Jordy Rose [Fri, 15 Jul 2011 06:28:59 +0000 (06:28 +0000)]
Clean up UnixAPIChecker, including switching its array of BugTypes to llvm::OwningPtr<BugType> vars (the new convention). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135255 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up MacOSXAPIChecker, including switching its array of BugTypes to a single...
Jordy Rose [Fri, 15 Jul 2011 06:02:19 +0000 (06:02 +0000)]
Clean up MacOSXAPIChecker, including switching its array of BugTypes to a single llvm::OwningPtr<BugType> (the new convention). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135250 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance the IR type lowering code to be much smarter about recursively lowering
Chris Lattner [Fri, 15 Jul 2011 05:16:14 +0000 (05:16 +0000)]
Enhance the IR type lowering code to be much smarter about recursively lowering
types.  Fore xample, we used to lower:

struct bar { int a; };
struct foo {
 void (*FP)(struct bar);
} G;

to:

%struct.foo = type { {}* }

since the function pointer would cause recursive translation of bar and
we didn't know if that would get us into trouble.  We are now smart enough
to know that it is fine, so we get this type instead:

%struct.foo = type { void (i32)* }

Codegen still needs to be prepared for uncooperative types at any place,
which is why I let the maximally uncooperative code sit around for awhile to
help shake out the bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135244 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCreate a new expression node, SubstNonTypeTemplateParmExpr,
John McCall [Fri, 15 Jul 2011 05:09:51 +0000 (05:09 +0000)]
Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd 'Contains()' method to GRStateTrait for ImmutableList. Patch by Rui Paulo.
Ted Kremenek [Fri, 15 Jul 2011 03:32:56 +0000 (03:32 +0000)]
Add 'Contains()' method to GRStateTrait for ImmutableList.  Patch by Rui Paulo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135241 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch a comment in Rewrite from 'instantiation' to 'expansion'.
Chandler Carruth [Fri, 15 Jul 2011 00:04:40 +0000 (00:04 +0000)]
Switch a comment in Rewrite from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135226 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch help text in the CC1 driver from 'instantiation' to 'expansion'.
Chandler Carruth [Fri, 15 Jul 2011 00:04:38 +0000 (00:04 +0000)]
Switch help text in the CC1 driver from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135225 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch comments and assert text in AST from 'instantiation' to
Chandler Carruth [Fri, 15 Jul 2011 00:04:35 +0000 (00:04 +0000)]
Switch comments and assert text in AST from 'instantiation' to
'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135224 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch comments about 'macro instantiation' to 'macro expansion' in
Chandler Carruth [Fri, 15 Jul 2011 00:04:31 +0000 (00:04 +0000)]
Switch comments about 'macro instantiation' to 'macro expansion' in
ARCMigrate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135223 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove warnings of constant operands of logical operators from template instantiation...
Richard Trieu [Fri, 15 Jul 2011 00:00:51 +0000 (00:00 +0000)]
Remove warnings of constant operands of logical operators from template instantiations.  Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:

template<unsigned int A, unsigned int B> struct S {
  int foo() {
    int x = A && B;
  }
}

will not warn on A && B on every instantiation.  This will still warn on other cases inside templates, which will be caught on checking the template definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135222 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMatch llvm API change.
Evan Cheng [Thu, 14 Jul 2011 23:50:56 +0000 (23:50 +0000)]
Match llvm API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135220 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to...
Ted Kremenek [Thu, 14 Jul 2011 23:43:06 +0000 (23:43 +0000)]
Fix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to avoid cascading warnings.  Patch by Kaelyn Uhrain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135217 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTweak the CMake build so that building a project just containing Clang
Douglas Gregor [Thu, 14 Jul 2011 23:42:32 +0000 (23:42 +0000)]
Tweak the CMake build so that building a project just containing Clang
(and linking to an already-build LLVM) works with Xcode. The resulting
Xcode project for Clang is quite a bit smaller and builds/loads faster.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135216 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Don't remove retains/releases on a global variable, flag them with errors...
Argyrios Kyrtzidis [Thu, 14 Jul 2011 23:32:04 +0000 (23:32 +0000)]
[arcmt] Don't remove retains/releases on a global variable, flag them with errors. rdar://9402555.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135213 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert 135177 to fix PR10363.
Rafael Espindola [Thu, 14 Jul 2011 22:58:04 +0000 (22:58 +0000)]
Revert 135177 to fix PR10363.

Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."

This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135210 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Argyrios Kyrtzidis [Thu, 14 Jul 2011 22:46:12 +0000 (22:46 +0000)]
[arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Keep the error if the result is unused. rdar://9552694.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135209 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach -Wconversion, -Wsign-compare etc. about division and remainder.
John McCall [Thu, 14 Jul 2011 22:39:48 +0000 (22:39 +0000)]
Teach -Wconversion, -Wsign-compare etc. about division and remainder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135208 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPR10359: Template declarations which define classes are not permitted to also contain...
Richard Smith [Thu, 14 Jul 2011 21:35:26 +0000 (21:35 +0000)]
PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:

  template<typename T> struct S { } f() { return 0; }

This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.

Treat this

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135195 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Emit an error for unused -autorelease messages.
Argyrios Kyrtzidis [Thu, 14 Jul 2011 21:26:49 +0000 (21:26 +0000)]
[arcmt] Emit an error for unused -autorelease messages.

An unused autorelease is badness. If we remove it the receiver
will likely die immediately while previously it was kept alive
by the autorelease pool. This is bad practice in general, so leave it
and emit an error to force the user to restructure his code.

rdar://9599884

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135193 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFor C++11, do more checking of initializer lists up-front, enabling some subset of...
Sebastian Redl [Thu, 14 Jul 2011 19:08:10 +0000 (19:08 +0000)]
For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135177 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix problems Johannes noticed, and extend test cases further.
Sebastian Redl [Thu, 14 Jul 2011 19:08:01 +0000 (19:08 +0000)]
Fix problems Johannes noticed, and extend test cases further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135176 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove InitializationSequence::ReferenceBinding, the last redundant sequence kind.
Sebastian Redl [Thu, 14 Jul 2011 19:07:55 +0000 (19:07 +0000)]
Remove InitializationSequence::ReferenceBinding, the last redundant sequence kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135175 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agosimplify
Chris Lattner [Thu, 14 Jul 2011 18:45:41 +0000 (18:45 +0000)]
simplify

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135170 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStringMap::first() is about to start returning a StringRef, adapt.
Chris Lattner [Thu, 14 Jul 2011 18:24:21 +0000 (18:24 +0000)]
StringMap::first() is about to start returning a StringRef, adapt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135166 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange intrinsic getter to take an ArrayRef, now that the underlying function in...
Benjamin Kramer [Thu, 14 Jul 2011 17:45:50 +0000 (17:45 +0000)]
Change intrinsic getter to take an ArrayRef, now that the underlying function in LLVM does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135155 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMoving one misplaced entry in the attribute enum in AttributeList.h into alphabetical...
Caitlin Sadowski [Thu, 14 Jul 2011 17:39:11 +0000 (17:39 +0000)]
Moving one misplaced entry in the attribute enum in AttributeList.h into alphabetical order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135153 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r135147 and r135075. The consensus was that this wasn't the right thing to do.
Ted Kremenek [Thu, 14 Jul 2011 17:05:32 +0000 (17:05 +0000)]
Revert r135147 and r135075.  The consensus was that this wasn't the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135152 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate the remaining comments in Frontend to 'expansion'.
Chandler Carruth [Thu, 14 Jul 2011 16:14:52 +0000 (16:14 +0000)]
Update the remaining comments in Frontend to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135150 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up some comments I missed when switching from
Chandler Carruth [Thu, 14 Jul 2011 16:08:00 +0000 (16:08 +0000)]
Clean up some comments I missed when switching from
NestedMacroInstantiations -> NestedMacroExpansions.

With this change, libclang should be completely converted except for
uses of SourceManger and SourceLocation APIs, and the C bindings for
those APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135149 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up two lingering comments that mention 'instantiation' w.r.t.
Chandler Carruth [Thu, 14 Jul 2011 16:07:57 +0000 (16:07 +0000)]
Clean up two lingering comments that mention 'instantiation' w.r.t.
macros in libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135148 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd extra sanity checking in FormatString::matchesType() that we are comparing intege...
Ted Kremenek [Thu, 14 Jul 2011 15:43:21 +0000 (15:43 +0000)]
Add extra sanity checking in FormatString::matchesType() that we are comparing integers to integers.  This happens not to be an issue now, but the extra check helps future proof in case of future refactorings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135147 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoNestedMacroInstantiations -> NestedMacroExpansions
Chandler Carruth [Thu, 14 Jul 2011 09:02:10 +0000 (09:02 +0000)]
NestedMacroInstantiations -> NestedMacroExpansions

This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135141 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate all of the libclang code corresponding to the preprocessor
Chandler Carruth [Thu, 14 Jul 2011 08:41:15 +0000 (08:41 +0000)]
Update all of the libclang code corresponding to the preprocessor
MacroInstantiation -> MacroExpansion rename. Internally, everything is
switched.

Introduce a new cursor kind enum with the new name, but retain the old
name as an alias so that we don't break backwards compatibility.

Also update the debug printing routine to use 'macro expansions' as its
explicitly not guaranteed to be stable, and mechanically switch the test
cases over to that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135140 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove the rest of the preprocessor terminology from 'instantiate' and
Chandler Carruth [Thu, 14 Jul 2011 08:20:46 +0000 (08:20 +0000)]
Move the rest of the preprocessor terminology from 'instantiate' and
variants to 'expand'. This changed a couple of public APIs, including
one public type "MacroInstantiation" which is now "MacroExpansion". The
rest of the codebase was updated to reflect this, especially the
libclang code. Two of the C++ (and thus easily changed) libclang APIs
were updated as well because they pertained directly to the old
MacroInstantiation class.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135139 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert terminology in the Lexer from 'instantiate' and variants to
Chandler Carruth [Thu, 14 Jul 2011 08:20:40 +0000 (08:20 +0000)]
Convert terminology in the Lexer from 'instantiate' and variants to
'expand'. Also update the public API it provides to the new term, and
propagate that update to the various clients.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135138 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the TokenLexer's terminology from various forms of 'instantiate'
Chandler Carruth [Thu, 14 Jul 2011 08:20:34 +0000 (08:20 +0000)]
Switch the TokenLexer's terminology from various forms of 'instantiate'
to 'expand' for macros. Only comments and uses local to the TokenLexer
are updated.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135137 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch all local code and comments from '[Ii]nstantiat(ion|ed)' to
Chandler Carruth [Thu, 14 Jul 2011 08:20:31 +0000 (08:20 +0000)]
Switch all local code and comments from '[Ii]nstantiat(ion|ed)' to
'[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135136 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the diagnostic messages about macros to use the terms 'expanded'
Chandler Carruth [Thu, 14 Jul 2011 08:20:28 +0000 (08:20 +0000)]
Switch the diagnostic messages about macros to use the terms 'expanded'
and 'expansions' rather than 'instantiated' and 'contexts'.

This is the first of several patches migrating Clang's terminology
surrounding macros from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135135 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReapply r135075, but modify format-strings.c and format-strings-fixit.c test cases...
Ted Kremenek [Thu, 14 Jul 2011 06:49:52 +0000 (06:49 +0000)]
Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135134 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r135075, "format string checking: long and int have the same widths on 32...
NAKAMURA Takumi [Thu, 14 Jul 2011 05:16:18 +0000 (05:16 +0000)]
Revert r135075, "format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using"

It fails on freebsd, mingw and msvc10.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135129 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a hackaround to avoid the crash in PR10355. However, our recovery
Douglas Gregor [Thu, 14 Jul 2011 04:54:23 +0000 (04:54 +0000)]
Add a hackaround to avoid the crash in PR10355. However, our recovery
is still terrible here because typo correction is not behaving well in
the presence of overloaded functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135128 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command...
Argyrios Kyrtzidis [Thu, 14 Jul 2011 00:17:54 +0000 (00:17 +0000)]
[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135115 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDocument the behavior of property modifiers in ARC.
John McCall [Wed, 13 Jul 2011 23:15:32 +0000 (23:15 +0000)]
Document the behavior of property modifiers in ARC.

rdar://problem/9768338

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135104 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPR8800: When building a conversion to A& using a member operatorA&(), do not require...
Richard Smith [Wed, 13 Jul 2011 22:53:21 +0000 (22:53 +0000)]
PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135101 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.
Bruno Cardoso Lopes [Wed, 13 Jul 2011 21:58:55 +0000 (21:58 +0000)]
Reapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135091 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd 'mutable' to the function declarator chunk, to be used when
Douglas Gregor [Wed, 13 Jul 2011 21:47:47 +0000 (21:47 +0000)]
Add 'mutable' to the function declarator chunk, to be used when
parsing lambda expressions, from John Freeman!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135090 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix an incorrect namespace typo-correction diagnostic, from Kaelyn
Douglas Gregor [Wed, 13 Jul 2011 21:36:26 +0000 (21:36 +0000)]
Fix an incorrect namespace typo-correction diagnostic, from Kaelyn
Uhrain! Fixes PR10318.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135086 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEmit debug info for extended vectors.
Devang Patel [Wed, 13 Jul 2011 21:23:30 +0000 (21:23 +0000)]
Emit debug info for extended vectors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135083 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoformat string checking: long and int have the same widths on 32-bit, so we shouldn...
Ted Kremenek [Wed, 13 Jul 2011 20:20:58 +0000 (20:20 +0000)]
format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using
an "int" format specifier with a "long" type in 32-bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135075 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnforce access control for the destructor in a new[] expression and mark
John McCall [Wed, 13 Jul 2011 20:12:57 +0000 (20:12 +0000)]
Enforce access control for the destructor in a new[] expression and mark
it as used.  Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135073 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizi...
Argyrios Kyrtzidis [Wed, 13 Jul 2011 19:47:57 +0000 (19:47 +0000)]
[arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135067 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain'...
Argyrios Kyrtzidis [Wed, 13 Jul 2011 19:22:00 +0000 (19:22 +0000)]
[arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain' -> 'strong', and add
'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135065 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWith -Wselector, don't warn about unimplemented optional method
Fariborz Jahanian [Wed, 13 Jul 2011 19:05:43 +0000 (19:05 +0000)]
With -Wselector, don't warn about unimplemented optional method
used in @selector expression because, well, their implementation
is optional. // rdar://9545564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135057 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't crash if defining -dealloc in a category.
John McCall [Wed, 13 Jul 2011 18:26:47 +0000 (18:26 +0000)]
Don't crash if defining -dealloc in a category.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135054 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn debugger mode, make ObjC message sends to unknown selectors return
John McCall [Wed, 13 Jul 2011 17:56:40 +0000 (17:56 +0000)]
In debugger mode, make ObjC message sends to unknown selectors return
__unknown_anytype, and rewrite such message sends correctly.

I had to bite the bullet and actually add a debugger support mode for this
one, which is a bit unfortunate, but there really isn't anything else
I could imagine doing;  this is clearly just debugger-specific behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135051 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc++: Some level of covariance is allowed in ObjC properties.
Fariborz Jahanian [Wed, 13 Jul 2011 17:55:01 +0000 (17:55 +0000)]
objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. Use common code for
objc and objc++ so they don't diverge. // rdar://9740328

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135050 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRe-relax conversion specifier checking for printf format strings and conversion speci...
Ted Kremenek [Wed, 13 Jul 2011 17:35:14 +0000 (17:35 +0000)]
Re-relax conversion specifier checking for printf format strings and conversion specifiers.  My recent change was a mistake.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135048 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix inversion in argument type checking for format strings with conversion specifiers...
Ted Kremenek [Wed, 13 Jul 2011 17:25:47 +0000 (17:25 +0000)]
Fix inversion in argument type checking for format strings with conversion specifiers for character types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135046 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOkay, that rule about zero-length arrays applies to destroying
John McCall [Wed, 13 Jul 2011 08:09:46 +0000 (08:09 +0000)]
Okay, that rule about zero-length arrays applies to destroying
them, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135038 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoArrays are permitted to be zero-length in some situations.
John McCall [Wed, 13 Jul 2011 07:37:11 +0000 (07:37 +0000)]
Arrays are permitted to be zero-length in some situations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135036 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the integer-range analysis recognize ^= correctly,
John McCall [Wed, 13 Jul 2011 06:35:24 +0000 (06:35 +0000)]
Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple
assignments.

The first is PR10336.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135034 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert the standard default-construction loops to use phis and
John McCall [Wed, 13 Jul 2011 06:10:41 +0000 (06:10 +0000)]
Convert the standard default-construction loops to use phis and
partial destruction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135033 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoper john's advice, speculatively lower uses of forward-declared enums to
Chris Lattner [Wed, 13 Jul 2011 05:31:19 +0000 (05:31 +0000)]
per john's advice, speculatively lower uses of forward-declared enums to
i32.  They almost always end up this way in the end anyway, and if we get
lucky, this avoids generating some bitcasts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135032 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPR10337 reminds me that calls return values, lets handle them just
Chris Lattner [Wed, 13 Jul 2011 03:59:32 +0000 (03:59 +0000)]
PR10337 reminds me that calls return values, lets handle them just
like arguments.  Thanks PR10337! :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135030 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAggressive dead code elimination.
John McCall [Wed, 13 Jul 2011 03:03:51 +0000 (03:03 +0000)]
Aggressive dead code elimination.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135029 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGeneralize the routine for destroying an object with static
John McCall [Wed, 13 Jul 2011 03:01:35 +0000 (03:01 +0000)]
Generalize the routine for destroying an object with static
storage duration, then explicitly exempt ownership-qualified
types from it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135028 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate an incomplete/incorrect attempt to provide support for C++0x
Douglas Gregor [Wed, 13 Jul 2011 02:14:02 +0000 (02:14 +0000)]
Eliminate an incomplete/incorrect attempt to provide support for C++0x
unrestricted unions, which ended up attempting to initialize objects
in a union (which CodeGen isn't prepared for). Fixes PR9683.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135027 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSilliness with commas, as reported at http://blog.regehr.org/archives/558 . As it...
Eli Friedman [Wed, 13 Jul 2011 02:05:57 +0000 (02:05 +0000)]
Silliness with commas, as reported at http://blog.regehr.org/archives/558 .  As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135026 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch delete[] IR-generation over to the destroy framework,
John McCall [Wed, 13 Jul 2011 01:41:37 +0000 (01:41 +0000)]
Switch delete[] IR-generation over to the destroy framework,
which implicitly makes it EH-safe as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135025 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen compiling ::delete for a class with a virtual destructor, call
Douglas Gregor [Wed, 13 Jul 2011 00:54:47 +0000 (00:54 +0000)]
When compiling ::delete for a class with a virtual destructor, call
the complete destructor and then invoke the global delete
operator. Previously, we would invoke the deleting destructor, which
calls the wrong delete operator. Fixes PR10341.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135021 91177308-0d34-0410-b5e6-96231b3b80d8