Commit Graph

31791 Commits

Author SHA1 Message Date
Douglas Gregor fb65e592e0 Add support for C++0x unicode string and character literals, from Craig Topper!
llvm-svn: 136210
2011-07-27 05:40:30 +00:00
Argyrios Kyrtzidis fdafb7f7e6 [arcmt] Revert r135382, there's a different approach in r135764. rdar://9821111.
llvm-svn: 136209
2011-07-27 05:28:22 +00:00
Argyrios Kyrtzidis 9390747349 [arcmt] More automatic transformations and safety improvements; rdar://9615812 :
- Replace calling -zone with 'nil'. -zone is obsolete in ARC.
- Allow removing retain/release on a static global var.
- Fix assertion hit when scanning for name references outside a NSAutoreleasePool scope.
- Automatically add bridged casts for results of objc method calls and when calling CFRetain, for example:

NSString *s;
CFStringRef ref = [s string];   -> CFStringRef ref = (__bridge CFStringRef)([s string]);
ref = s.string;                 -> ref = (__bridge CFStringRef)(s.string);
ref = [NSString new];           -> ref = (__bridge_retained CFStringRef)([NSString new]);
ref = [s newString];            -> ref = (__bridge_retained CFStringRef)([s newString]);
ref = [[NSString alloc] init];  -> ref = (__bridge_retained CFStringRef)([[NSString alloc] init]);
ref = [[s string] retain];      -> ref = (__bridge_retained CFStringRef)([s string]);
ref = CFRetain(s);              -> ref = (__bridge_retained CFTypeRef)(s);
ref = [s retain];               -> ref = (__bridge_retained CFStringRef)(s);

- Emit migrator error when trying to cast to CF type the result of autorelease/release:
  for

CFStringRef f3() {
  return (CFStringRef)[[[NSString alloc] init] autorelease];
}

emits:

t.m:12:10: error: [rewriter] it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object
  return (CFStringRef)[[[NSString alloc] init] autorelease];
         ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t.m:12:3: note: [rewriter] remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased
  return (CFStringRef)[[[NSString alloc] init] autorelease];
  ^

- Before changing attributes to weak/unsafe_unretained, check if the backing ivar
  is set to a +1 object, in which case use 'strong' instead.

llvm-svn: 136208
2011-07-27 05:28:18 +00:00
Douglas Gregor d99d49c6cb Easier debugging with Visual Studio Visualizers, from Nikola Smiljanic!
llvm-svn: 136207
2011-07-27 05:22:46 +00:00
John McCall 538482373b Clean up the analysis of the collection operand to ObjC
for-in statements;  specifically, make sure to close over any
temporaries or cleanups it might require.  In ARC, this has
implications for the lifetime of the collection, so emit it
with a retain and release it upon exit from the loop.

rdar://problem/9817306

llvm-svn: 136204
2011-07-27 01:07:15 +00:00
Francois Pichet b23dc0950b In Microsoft mode, if we are within a templated function and we can't resolve Identifier during BuildCXXNestedNameSpecifier, then extend the SS with Identifier. This will have the effect of resolving Identifier during template instantiation. The goal is to be able to resolve a function call whose nested-name-specifier is located inside a dependent base class.
class C {
public:
    static void foo2() {  }
};

template <class T> class A {
public:
   typedef C D;
};

template <class T> class B : public A<T> {
public:
  void foo() { D::foo2(); }
};

Note that this won't work if the NestedNameSpecifier refers to a type.
This fixes 1 error when parsing the MSVC 2010 standard headers file with clang.

llvm-svn: 136203
2011-07-27 01:05:24 +00:00
Eric Christopher 12ff9528b2 Handle different sized wchar_t for windows.
llvm-svn: 136192
2011-07-26 23:56:49 +00:00
Ted Kremenek fbcce6fba3 clang_getCXTUResourceUsage: report memory used by HeaderSearch.
This required converting the StringMaps to use a BumpPtrAllocator.  I measured the
compile time and saw no observable regression.

llvm-svn: 136190
2011-07-26 23:46:11 +00:00
Ted Kremenek 120992ad81 clang_getCXTUResourceUsage: Report memory used by data structures in SourceManager.
llvm-svn: 136189
2011-07-26 23:46:06 +00:00
Eric Christopher 99c3638935 Use the correct definition for memset.
llvm-svn: 136188
2011-07-26 23:44:22 +00:00
Eric Christopher fde54ab8b5 Make this darwin only to simplify the padding calculations per arch.
llvm-svn: 136185
2011-07-26 23:39:23 +00:00
Eli Friedman 1b71a22b28 Re-fix r136172 so it isn't an error; apparently, some people are fond of their undefined behavior.
llvm-svn: 136183
2011-07-26 23:27:24 +00:00
Eric Christopher 8f95f425aa This appears to be passing on all hosts.
llvm-svn: 136182
2011-07-26 23:26:00 +00:00
Jeffrey Yasskin a6667816d5 This patch implements as much of the narrowing conversion error specified by
[dcl.init.list] as is possible without generalized initializer lists or full
constant expression support, and adds a c++0x-compat warning in C++98 mode.

The FixIt currently uses a typedef's basename without qualification, which is
likely to be incorrect on some code.  If it's incorrect on too much code, we
should write a function to get the string that refers to a type from a
particular context.

The warning is currently off by default. I'll fix LLVM and clang before turning
it on.

llvm-svn: 136181
2011-07-26 23:20:30 +00:00
Douglas Gregor 8771796493 Disable the optimization that skips emission of complete, non-virtual
destructors of abstract classes. It's undefined behavior to actually
call the destructor (e.g., via delete), but the presence of code that
calls this destructor doesn't make the program
ill-formed. Fixes <rdar://problem/9819242>.

llvm-svn: 136180
2011-07-26 23:18:30 +00:00
Eric Christopher ebc113d1d3 Try a little hack to fix the memset duplication on windows.
llvm-svn: 136179
2011-07-26 23:18:10 +00:00
Eric Christopher 9688a17bff Try harder to fix these for windows.
llvm-svn: 136177
2011-07-26 23:12:06 +00:00
Eric Christopher 28f8189866 Generalize for various build bots.
llvm-svn: 136173
2011-07-26 22:52:35 +00:00
Eli Friedman 1260f59f5e Diagnose trying to delete a pointer to an abstract class with a non-virtual destructor. PR10504.
I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :)

llvm-svn: 136172
2011-07-26 22:50:18 +00:00
Eric Christopher 19520147fc Rewrite match line to be friendlier to misc buildbots.
llvm-svn: 136169
2011-07-26 22:44:31 +00:00
Eric Christopher cf2ea54160 Rewrite matching line to be friendlier to misc buildbots.
llvm-svn: 136168
2011-07-26 22:43:37 +00:00
Eric Christopher f883941903 Attempt to rewrite the matching for this test to pacify the windows
build bots.

llvm-svn: 136166
2011-07-26 22:42:01 +00:00
Anna Zaks 6868b35f01 Remove unused diagnostic definition.
llvm-svn: 136165
2011-07-26 22:34:49 +00:00
Eric Christopher 970fa44d70 Rework the match here to silence release mode windows buildbots.
llvm-svn: 136164
2011-07-26 22:32:44 +00:00
Eric Christopher 738c7ef5bb Attempt to generalize this test for release mode buildbots.
llvm-svn: 136163
2011-07-26 22:31:33 +00:00
Eric Christopher 4a8bc43083 Try to generalize the match to quiet the windows build bot.
llvm-svn: 136162
2011-07-26 22:27:01 +00:00
Eli Friedman ae4280f721 A couple minor issues with Sema for delete:
1. Attempting to delete an expression of incomplete class type should be an error, not a warning.

2. If someone tries to delete a pointer to an incomplete class type, make sure we actually emit
the delete expression after we warn.

llvm-svn: 136161
2011-07-26 22:25:31 +00:00
Eric Christopher aee57b4948 Use unsigned long long for uint64_t. Fixes part of the windows buildbot.
llvm-svn: 136160
2011-07-26 22:19:01 +00:00
Eric Christopher 85e5156598 Migrate most of the rest of test/FrontendC from llvm and migrate
most of them to FileCheck.

llvm-svn: 136159
2011-07-26 22:17:02 +00:00
Eric Christopher 2dfed48cae Adjust check for release mode.
llvm-svn: 136158
2011-07-26 22:07:13 +00:00
Argyrios Kyrtzidis e3be9795c8 In ARC we emit an error when compiling:
@interface Foo : NSObject
@property (readonly) id myProp;
@end

@implementation Foo
@synthesize myProp;
@end

t.m:9:13: error: ARC forbids synthesizing a property of an Objective-C object with unspecified storage attribute
@synthesize myProp;
            ^

which is fine, we want the ownership of the synthesized ivar to be explicit. But we should _not_ emit an error
for the following cases, because we can get the ownership either from the declared ivar or from the property type:

@interface Foo : NSObject {
	__weak id _myProp1;
	id myProp2;
}
@property (readonly) id myProp1;
@property (readonly) id myProp2;
@property (readonly) __strong id myProp3;
@end

@implementation Foo
@synthesize myProp1 = _myProp1;
@synthesize myProp2;
@synthesize myProp3;
@end

rdar://9844006.

llvm-svn: 136155
2011-07-26 21:48:26 +00:00
Eric Christopher e70ea8b806 Migrate:
CodeGen/2003-08-21-WideString.c
       CodeGen/2003-10-02-UnionLValueError.c
       CodeGen/2004-02-20-Builtins.c
       CodeGen/2008-01-04-WideBitfield.c
       CodeGen/2002-07-14-MiscTests3.c
       CodeGen/2005-04-09-ComplexOps.c
       CodeGen/2008-12-23-AsmIntPointerTie.c
       CodeGen/2005-07-20-SqrtNoErrno.c
       CodeGen/2005-01-02-VAArgError-ICE.c
       CodeGen/2004-06-17-UnorderedCompares.c
       CodeGen/2002-06-25-FWriteInterfaceFailure.c
       CodeGen/2002-02-18-64bitConstant.c
       CodeGen/2002-05-24-Alloca.c
       CodeGen/2006-01-13-Includes.c
       CodeGen/2007-09-27-ComplexIntCompare.c
       CodeGen/2004-02-13-IllegalVararg.c
       CodeGen/2007-09-12-PragmaPack.c
       CodeGen/2002-08-02-UnionTest.c

from test/FrontendC with changes to remove header file includes.

llvm-svn: 136153
2011-07-26 21:42:32 +00:00
Ted Kremenek 182543aba2 Report more memory using in Preprocessor::getTotalMemory() and PreprocessingRecord::getTotalMemory().
Most of the memory was already reported; but now we report more memory from side data structures.

Fixes <rdar://problem/9379717>.

llvm-svn: 136150
2011-07-26 21:17:24 +00:00
Eric Christopher def19fb79d Migrate CodeGen/2007-03-05-DataLayout.c from test/FrontendC with changes
to remove header file includes.

llvm-svn: 136134
2011-07-26 20:44:55 +00:00
Eric Christopher 5a1d214c4a Migrate CodeGen/2005-02-20-AggregateSAVEEXPR.c from test/FrontendC with
changes to remove any #include lines.

llvm-svn: 136129
2011-07-26 20:38:19 +00:00
Eric Christopher 1d9aab8c9e Migrate CodeGen/2009-09-24-SqrtErrno.c from test/FrontendC with changes
to avoid header inclusions.

llvm-svn: 136128
2011-07-26 20:31:17 +00:00
Eric Christopher 63683b1e64 Migrate CodeGen/2002-03-11-LargeCharInString.c from test/FrontendC and
modify to avoid any outside includes.

llvm-svn: 136127
2011-07-26 20:29:08 +00:00
Eric Christopher 0a887eca46 Add CodeGen/2009-07-15-pad-wchar_t-array.c migrated from test/FrontendC
and modified to avoid includes.

llvm-svn: 136126
2011-07-26 20:27:12 +00:00
Eric Christopher 320db01d13 Migrate wchar-const.c with fixes and FileCheck from llvm/test/FrontendC.
llvm-svn: 136114
2011-07-26 18:39:16 +00:00
Kaelyn Uhrain c45dcd2594 Revert r136046 while fixing handling of e.g. &foo[index_one_past_size]
llvm-svn: 136113
2011-07-26 18:36:36 +00:00
Jonathan D. Turner b2b0823d00 This patch extends the previous patch by starting to incorporate more functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager).
llvm-svn: 136107
2011-07-26 18:21:30 +00:00
Fariborz Jahanian 6507135e12 Provide fixit for static use of objective-c type
in few more places and in each instance, fix up
the type to the expected type. // rdar://9603056

llvm-svn: 136103
2011-07-26 17:58:54 +00:00
Benjamin Kramer 632500cb85 Eliminate a bunch of temporary strings.
llvm-svn: 136092
2011-07-26 16:59:25 +00:00
Douglas Gregor ea777403f9 Add new libclang API, clang_codeCompleteGetObjCSelector(), which
provides the partial Objective-C selector used in a code
completion. From Connor Wakamo!

llvm-svn: 136084
2011-07-26 15:24:30 +00:00
Douglas Gregor 72912fb9a4 When we decide not to rebuild an instantiated C++ 'new' expression
that allocates an array of objects with a non-trivial destructor, be
sure to mark the destructor is "used". Fixes PR10480 /
<rdar://problem/9834317>.

llvm-svn: 136081
2011-07-26 15:11:03 +00:00
Douglas Gregor a4f2b430e0 Objective-C++ ARC: When performing template argument deduction for a
lifetime-qualified template parameter, ensure that the deduced
template argument is a lifetime type. Fixes <rdar://problem/9828157>.

llvm-svn: 136078
2011-07-26 14:53:44 +00:00
Chad Rosier 99ee7829ff After further discussion it has been determined that alignof should report
the preferred alignment.  Thus, revert r135934, r135935, and r135940.

llvm-svn: 136062
2011-07-26 07:03:04 +00:00
Chandler Carruth c22845abe2 Cleanup the stray comments and variables I could dig out of Sema to
refer to 'expansion' instead of 'instantiation'.

llvm-svn: 136060
2011-07-26 05:40:03 +00:00
Chandler Carruth 0b5cf7c863 Fix a stray instantiation comment in Parse.
llvm-svn: 136059
2011-07-26 05:19:46 +00:00
Chandler Carruth 64ee782e2f Clean up as many of the comments in Basic I can find to talk in terms of
'expansion' rather than 'instantiation' for macro source locations.

llvm-svn: 136058
2011-07-26 05:17:23 +00:00
Chandler Carruth ee4c1d1298 Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'
etc. With this I think essentially all of the SourceManager APIs are
converted. Comments and random other bits of cleanup should be all thats
left.

llvm-svn: 136057
2011-07-26 04:56:51 +00:00
Chandler Carruth 73ee5d7fae Convert InstantiationInfo and much of the related code to ExpansionInfo
and various other 'expansion' based terms. I've tried to reformat where
appropriate and catch as many references in comments but I'm going to do
several more passes. Also I've tried to expand parameter names to be
more clear where appropriate.

llvm-svn: 136056
2011-07-26 04:41:47 +00:00
Chandler Carruth 115b077f30 Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.
llvm-svn: 136054
2011-07-26 03:03:05 +00:00
Chandler Carruth aa63153ff7 Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation API
to isMacroArgExpansion.

llvm-svn: 136053
2011-07-26 03:03:00 +00:00
Kaelyn Uhrain 980bdb9dfb Expand array bounds checking to work in the presence of unary & and *,
and to work with pointer arithmetic in addition to array indexing.

The new pointer arithmetic porition of the array bounds checking can be
turned on by -Warray-bounds-pointer-arithmetic (and is off by default).

llvm-svn: 136046
2011-07-26 01:52:28 +00:00
Evan Cheng 5a7a4ea505 Assembler really doesn't need to create TargetMachine anymore.
llvm-svn: 136045
2011-07-26 01:49:26 +00:00
Kaelyn Uhrain 15a67b97df Test commit
llvm-svn: 136044
2011-07-26 01:42:22 +00:00
NAKAMURA Takumi a2fd936107 test/CodeGen/2003-08-18-SigSetJmp.c: XFAIL: mingw, too!
llvm-svn: 136043
2011-07-26 01:40:37 +00:00
Eric Christopher 1c7ea99456 win32 doesn't have sigsetjmp, just xfail this test there.
llvm-svn: 136041
2011-07-26 01:32:19 +00:00
Eric Christopher 2da8b9c652 Rework this slightly to work for optimized compilers and remove the
optimization from the test.

llvm-svn: 136039
2011-07-26 01:24:10 +00:00
Eric Christopher 6f2a0d7234 These tests use standard headers and so need ms extensions with MSVC headers.
Use the driver instead of just clang -cc1.

llvm-svn: 136037
2011-07-26 01:12:27 +00:00
Eric Christopher ad869153ba Remove this test, it's more properly an optimizer test.
llvm-svn: 136036
2011-07-26 01:11:20 +00:00
Eric Christopher e6051006ba Migrate and FileCheck-ize some of:
2003-09-18-BitfieldTests.c 2007-04-11-PR1321.c 2003-11-13-TypeSafety.c 2003-08-29-StructLayoutBug.c 2010-05-14-Optimized-VarType.c 2003-10-06-NegateExprType.c 2007-06-05-NoInlineAttribute.c 2011-03-31-ArrayRefFolding.c 2010-07-14-ref-off-end.c Atomics-no64bit.c 2007-05-11-str-const.c 2004-11-27-InvalidConstantExpr.c 2007-04-05-UnPackedStruct.c 2004-03-15-SimpleIndirectGoto.c 2004-01-08-ExternInlineRedefine.c sret2.c 2007-02-07-AddrLabel.c 2002-09-19-StarInLabel.c 2003-11-16-StaticArrayInit.c 2003-08-18-SigSetJmp.c 2007-04-24-VolatileStructCopy.c 2002-07-29-Casts.c 2005-06-15-ExpandGotoInternalProblem.c 2007-09-17-WeakRef.c 2007-04-24-str-const.c 2003-08-30-LargeIntegerBitfieldMember.c inline-asm-mrv.c

from llvm/test/FrontendC.

llvm-svn: 136035
2011-07-26 00:57:50 +00:00
Eric Christopher 06b9d065a2 Migrate over 2009-04-22-UnknownSize.c, 2009-07-17-VoidParameter.c,
2009-03-09-WeakDeclarations-1.c, and 2010-05-31-palignr.c from
llvm/test/FrontendC.

llvm-svn: 136033
2011-07-26 00:47:54 +00:00
Evan Cheng 9568f27950 Rename createCodeEmitter to createMCCodeEmitter; createObjectStreamer to createMCObjectStreamer.
llvm-svn: 136032
2011-07-26 00:42:40 +00:00
Evan Cheng 939f809ce9 Rename createAsmParser to createMCAsmParser.
llvm-svn: 136029
2011-07-26 00:24:45 +00:00
Evan Cheng 4b89983662 Rename TargetAsmBackend to MCAsmBackend; rename createAsmBackend to createMCAsmBackend.
llvm-svn: 136011
2011-07-25 23:25:09 +00:00
Francois Pichet ece689f336 Fix the MSVC build. 2 problems:
- buildPieces was return a C++ object from inside an extern "C". (MSVC didn't like that)
   - clang_getCursorReferenceNameRange was missing a CINDEX_LINKAGE causing a link error.

llvm-svn: 135983
2011-07-25 22:00:44 +00:00
Fariborz Jahanian 9a14c21cfd objective-c: Provide a 'fixit' when class was used
to declare a static object. // rdar://9603056

llvm-svn: 135970
2011-07-25 21:12:27 +00:00
Chandler Carruth d48db2115a Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135969
2011-07-25 21:09:52 +00:00
Chandler Carruth ae67e0828a Repair some indentation I missed in my previous commit.
llvm-svn: 135967
2011-07-25 20:59:15 +00:00
Chandler Carruth 42f35f9cd2 Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135965
2011-07-25 20:57:57 +00:00
Evan Cheng c2d8c6be92 Assembler doesn't need to initialize TargetMachine's anymore.
llvm-svn: 135964
2011-07-25 20:53:26 +00:00
Chandler Carruth c7ca5218b6 Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.
llvm-svn: 135962
2011-07-25 20:52:32 +00:00
Chandler Carruth c84d769c68 getInstantiationLocSlowCase -> getExpansionLocSlowCase
llvm-svn: 135961
2011-07-25 20:52:26 +00:00
Chandler Carruth ca757587a3 Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

llvm-svn: 135960
2011-07-25 20:52:21 +00:00
Jonathan D. Turner 16f57d38ca Refactor of how modules are handled in ASTReader to remove explicit uses of a chain of AST files, instead redirect calls through a module manager. This should help move toward a DAG and the potential of loading multiple, unrelated PCH files. It's still early in development.
llvm-svn: 135957
2011-07-25 20:32:21 +00:00
Chad Rosier b23ee96cd5 Allow target to specify about using minimum alignment vs preferred. Takes care of
FIXME: Override "preferred align" for double and long long for ARM apcs-gnu ABI. 
Also part of rdar://9802874

llvm-svn: 135940
2011-07-25 19:39:39 +00:00
Axel Naumann ac50dcf6d3 Pick up expected diagnostics not only in the main file but also in the file where the first diagnostic occurred.
Useful if the main file is not relevant (like with cling).
By Vassil Vassilev.

llvm-svn: 135936
2011-07-25 19:18:12 +00:00
Chad Rosier af83fb773b Fix r135934. Rename was intended, but without additional tests for double.
llvm-svn: 135935
2011-07-25 19:17:48 +00:00
Chad Rosier ccd89122aa Rename an alignment test to be more precise and add another test for the default
ABI.

llvm-svn: 135934
2011-07-25 19:00:00 +00:00
Douglas Gregor 918f98ab42 Update C++0x status for explicit override controls and explicit
conversion operators, from Jonathan Sauer.

llvm-svn: 135932
2011-07-25 18:53:48 +00:00
Howard Hinnant 854a3966d4 http://llvm.org/bugs/show_bug.cgi?id=10472
llvm-svn: 135927
2011-07-25 18:09:56 +00:00
Douglas Gregor c1679ecf3b Added clang_getCursorReferenceNameRange to libclang to to retrieve parts of
a cursor reference, from Erik Verbruggen!

llvm-svn: 135920
2011-07-25 17:48:11 +00:00
Chandler Carruth 6d28d7f2a3 Rename SourceManager::getInstantiationRange to getExpansionRange.
llvm-svn: 135915
2011-07-25 16:56:02 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

llvm-svn: 135914
2011-07-25 16:49:02 +00:00
Frits van Bommel ede0dc6dda Shorten some expressions by using ArrayRef::slice().
llvm-svn: 135910
2011-07-25 15:13:01 +00:00
NAKAMURA Takumi b44cd82d90 www/get_started.html: Fix a phrase, "in the *build* directory* in the instructions of Visual Studio. Thanks to Andreas Bittel to point it out.
llvm-svn: 135907
2011-07-25 12:40:26 +00:00
Chris Lattner 640eddea29 add link to 2010 dev mtg
llvm-svn: 135892
2011-07-24 21:00:45 +00:00
Fariborz Jahanian 4ceec3f0d1 objc: clang should warn if redeclaration of methods
declared in protocol in the class qualified by the
protocol have type conflicts. To reduce amount of
noise, this is done when class is implemented.
// rdar://9352731

llvm-svn: 135890
2011-07-24 20:53:26 +00:00
NAKAMURA Takumi fb66d5cc9c lib/AST/CMakeLists.txt: Update LLVM_USED_LIBS, not to miss symbols with building shared lib. Thanks to Ryuta Suzuki.
llvm-svn: 135864
2011-07-23 23:29:47 +00:00
Chris Lattner 84037d3d0a fix PR10415, tidying up IR representation of module level inline asm
to avoid extraneous \n's.

llvm-svn: 135862
2011-07-23 20:04:25 +00:00
Douglas Gregor 757e38b47e Extend libclang with clang_equalRanges, from Erik Verbruggen!
llvm-svn: 135860
2011-07-23 19:35:14 +00:00
Douglas Gregor c14b763865 Add a link-friendly name to the Clang extension acceptance criteria
llvm-svn: 135859
2011-07-23 19:22:17 +00:00
Douglas Gregor da2f675c5c Document the criteria for evaluating a proposed extension to Clang.
llvm-svn: 135858
2011-07-23 19:21:07 +00:00
Douglas Gregor 38b2d3fa3e Tests for explicit conversion operators, along with a fix to avoid
considering explicit conversion operators when determining surrogate
functions. Fixes PR10453. Note that there are a few test cases where
Clang is still wrong because it does not implement DR899; see PR10456.

Patch by Jonathan Sauer!

llvm-svn: 135857
2011-07-23 18:59:35 +00:00
Chris Lattner 54b1677d23 Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!
llvm-svn: 135855
2011-07-23 17:14:25 +00:00
Francois Pichet 24fc69e531 Unbreak the MSVC build, using namespace clang is required otherwise MSVC will not find raw_ostream.
llvm-svn: 135853
2011-07-23 11:36:43 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chris Lattner 95c664b300 clean up forward declarations of raw_ostream to use the new LLVM.h
patch by Jon Mulder!

llvm-svn: 135851
2011-07-23 10:35:09 +00:00
Eric Christopher 279c20fde8 Migrate 2007-10-01-BuildArrayRef.c from llvm/test/FrontendC.
llvm-svn: 135840
2011-07-23 02:16:25 +00:00
Evan Cheng 06e70d33fc Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
llvm-svn: 135834
2011-07-23 00:45:53 +00:00
Anna Zaks 588e129989 Add ext_backslash_newline_eof to Wnewline-eof group.
llvm-svn: 135830
2011-07-23 00:36:52 +00:00
Sean Callanan 81d577c5c9 This patch (thanks to Doug Gregor) fixes a
problem where Clang was setting the
hasExternalVisibleDecls() bit for all
DeclContexts it imported.  This caused Clang
to make unnecessary calls to
findExternalVisibleDecls() when an external
AST source was installed.

In fact, Clang sometimes interpreted a failure
by one of these spurious calls to find a
Decl as meaning the Decl didn't exist, even
though findExternalLexicalDecls() did locate
that decl.  This produced amusing errors of
the form:

-
error: no member named 'b' in 'A'; did you
mean 'b'?
-

Now, if hasExternalVisibleDecls() or
hasExternalLexicalDecls() should be set, the
external AST source must do so itself.

llvm-svn: 135824
2011-07-22 23:46:03 +00:00
Anna Zaks c8eab671cf Expose no newline at end of file warning under Wnewline-eof flag.
llvm-svn: 135822
2011-07-22 23:08:19 +00:00
Evan Cheng c391a58b2b Match LLVM API change.
llvm-svn: 135813
2011-07-22 21:59:11 +00:00
David Majnemer fa01a583e7 kill a FIXME in IsIntegralPromotion
IsIntegralPromotion should consider the signedness of FromType when
calculating promotions. This, as of now, cannot be exercised on any
platform so there is no corresponding test.

llvm-svn: 135803
2011-07-22 21:09:04 +00:00
Jonathan D. Turner 2214acd86e Remove prepending of '$' to module names.
llvm-svn: 135775
2011-07-22 17:25:03 +00:00
Douglas Gregor c567ba26e9 Switch all of the "isysroot" const char*'s throughout the AST reader
and writer to StringRef or std::string, as appropriate.

llvm-svn: 135769
2011-07-22 16:35:34 +00:00
Douglas Gregor a6895d8a8f Rename ASTReader::PerFileData to serialization::Module, pulling it out
of ASTReader so it can become its own full-fledged class
(eventually). No functionality change.

llvm-svn: 135767
2011-07-22 16:00:58 +00:00
Francois Pichet 7f1e2a5c03 Use -ffreestanding with clang_cc1 to make the test picks the clang builtin include.
llvm-svn: 135766
2011-07-22 10:49:54 +00:00
Chandler Carruth 9cf99a61d6 Add a missing forward declaration and namespace qualifier to this
header. This showed up in client code that has a different include
ordering after Chris's shuffle of raw_ostream. All of the Clang code
ends up with a header included before this one that provides the needed
type and using declaration.

llvm-svn: 135765
2011-07-22 10:16:15 +00:00
John McCall cf1667022f Document the existing objc_precise_lifetime attribute.
Introduce and document a new objc_returns_inner_pointer
attribute, and consume it by performing a retain+autorelease
on message receivers when they're not immediately loaded from
an object with precise lifetime.

llvm-svn: 135764
2011-07-22 08:53:00 +00:00
Francois Pichet 969c32acb2 Fix test on MSVC: since the test includes a system header it cannot use clang_cc1.
llvm-svn: 135763
2011-07-22 08:52:55 +00:00
Jay Foad 040dd82f44 Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to use
ArrayRef.

llvm-svn: 135761
2011-07-22 08:16:57 +00:00
Eric Christopher 516a79e32c Bring over a test from llvm/test/FrontendC that is for Sema and not CodeGen.
llvm-svn: 135753
2011-07-22 07:26:22 +00:00
Chris Lattner e135b089d8 fix PR10384: C++ allows external arrays of incomplete type as well.
Many thanks to Eli for reducing this great testcase.

llvm-svn: 135752
2011-07-22 06:27:26 +00:00
Chris Lattner 43cae02689 rename test.
llvm-svn: 135751
2011-07-22 06:26:12 +00:00
Douglas Gregor d32f035267 Introduce a global bit-offset continuous range map into the ASTReader,
so that we have one, simple way to map from global bit offsets to
local bit offsets. Eliminates a number of loops over the chain, and
generalizes for more interesting bit remappings.

Also, as an amusing oddity, we were computing global bit offsets
*backwards* for preprocessed entities (e.g., the directly included PCH
file in the chain would start at offset zero, rather than the original
PCH that occurs first in translation unit). Even more amusingly, it
made precompiled preambles work, because we were forgetting to adjust
the local bit offset to a global bit offset when storing preprocessed
entity offsets in the ASTUnit. Two wrongs made a right, and now
they're both right.

llvm-svn: 135750
2011-07-22 06:10:01 +00:00
Douglas Gregor 77d993d3aa Fix an embarrassing bug in relocatable PCH support, where we were
passing a temporary const char* down as the "isysroot" parameter and
then accessing it later. Fixes <rdar://problem/9035180>.

llvm-svn: 135749
2011-07-22 06:03:18 +00:00
Chandler Carruth 4dd6c043ae Move duplicate uninitialized warning suppression into the
AnalysisBasedWarnings Sema layer and out of the Analysis library itself.
This returns the uninitialized values analysis to a more pure form,
allowing its original logic to correctly detect some categories of
definitely uninitialized values. Fixes PR10358 (again).

Thanks to Ted for reviewing and updating this patch after his rewrite of
several portions of this analysis.

llvm-svn: 135748
2011-07-22 05:27:52 +00:00
John McCall 24fada127f In ARC, non-atomic getters do not need to retain and autorelease
their loaded values, although it still worth doing this for __weak
properties to get the autoreleased-return-value optimization.

llvm-svn: 135747
2011-07-22 05:23:13 +00:00
John McCall 0410e572b9 Move this ObjCImplementationDecl member function into libAST
where it belongs.

llvm-svn: 135746
2011-07-22 04:15:06 +00:00
John McCall d2930c2100 In Objective-C, pull arbitrary attributes from overridden
methods, including indirectly overridden methods like those
declared in protocols and categories.  There are mismatches
that we would like to diagnose but aren't yet, but this   
is fine for now.

I looked at approaches that avoided doing this lookup 
unless we needed it, but the infer-related-result-type
checks were doing it anyway, so I left it with the same
fast-path check for no previous declartions of that 
selector.

llvm-svn: 135743
2011-07-22 02:45:48 +00:00
Jordy Rose a91768e569 Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.
This was previously not-const only because it has to lazily construct a chain
of ivars the first time it is called (and after the chain is invalidated).
In practice, all the clients were just const_casting their const Decls;
all those now-unnecessary const_casts have been removed.

llvm-svn: 135741
2011-07-22 02:08:32 +00:00
Fariborz Jahanian dff8de77a6 objective-c: Any use of @synthesize or @dynamic lexically after a method (or C function) implementation
will be rejected with a compilation error in ARC mode, and a compiler warning otherwise.
This may cause breakage in non-arc (and arc) tests which don't expect warning/error. Feel free
to fix the tests, or reverse the patch, if I am unavailable. // rdar://9818354 - WIP

llvm-svn: 135740
2011-07-22 01:06:53 +00:00
Douglas Gregor 903b7e9b65 In the AST reader, factor out the mapping of local type IDs to global
type IDs into a single place, and make sure that all of the callers
use the appropriate functions to do the mapping. Since the mapping is
still the identity function, this is essentially a no-op.

llvm-svn: 135733
2011-07-22 00:38:23 +00:00
Rafael Espindola a7431924ab Avoid warning on "clang -c -Dfoo test.i". Lines like these are created
when using ccache and libtool.m4 assumes that the compiler cannot print
warnings about options it knows about.

llvm-svn: 135723
2011-07-21 23:40:37 +00:00
Douglas Gregor f224ae06d2 Clean up the rest of the local -> global declaration ID mappings
within the ASTReader (I hope).

llvm-svn: 135720
2011-07-21 23:29:11 +00:00
Douglas Gregor 7fb091977d In the ASTReader, factor out the loading of (local) declaration IDs,
such that every declaration ID loaded from an AST file will go through
a central local -> global mapping function. At present, this change
does nothing, since the local -> global mapping function is the
identity function.

This is the mechanical part of the refactoring; a follow-up patch will
address a few remaining areas where it's not obvious whether we're
dealing with local or global IDs.

llvm-svn: 135711
2011-07-21 22:35:25 +00:00
Alexis Hunt 82bb089e87 Add a missing test for the limits on wchar
llvm-svn: 135708
2011-07-21 22:01:12 +00:00
Argyrios Kyrtzidis 4145732818 Fix diagnostic when loading a PCH which has different enabled/disabled state of -fobjc-arc. rdar://9818341
llvm-svn: 135707
2011-07-21 21:56:04 +00:00
Jonathan D. Turner 3766fdb654 Cleaning up more of the ID situation in the AST reader. This patch relaxes and generalizes how CXX base specifiers are identified and loaded by using a ContinuousRangeMap. This also adds a global bit offset (or base) to the PerFileData.
llvm-svn: 135705
2011-07-21 21:15:19 +00:00
Douglas Gregor 204b8717d4 Add some debugging output to the AST reader, so we can see the global remappings we generate
llvm-svn: 135701
2011-07-21 19:50:14 +00:00
Douglas Gregor 49bf76bab3 In the AST reader, keep track of the total number of source locations
entries incrementally, rather than iterating over the chain when
loading a single AST file.

llvm-svn: 135692
2011-07-21 18:46:38 +00:00
Argyrios Kyrtzidis 55e7557481 For ASTUnit::Save, write the AST to a temporary and then rename it to the actual filename.
Should avoid race conditions. Addresses rdar://9788943.

llvm-svn: 135691
2011-07-21 18:44:49 +00:00
Argyrios Kyrtzidis ff9a5506c9 Cut down one open/close pair of system calls by using Path's makeUnique instead of createTemporaryFileOnDisk.
llvm-svn: 135690
2011-07-21 18:44:46 +00:00
Richard Smith 42a4996b5a Update cxx_status page on www: clang has had full support for in-class initializers since r132890.
llvm-svn: 135689
2011-07-21 18:02:57 +00:00
Douglas Gregor 17aa45d431 Clean up the C++ status page by eliminating the utterly unnecessary set of projects. C++98/03 is sooooo yesterday
llvm-svn: 135687
2011-07-21 17:46:15 +00:00
Douglas Gregor 80d6322c00 Update C++0x nullptr status, from Jonathan Sauer
llvm-svn: 135686
2011-07-21 17:41:00 +00:00
Fariborz Jahanian b21138fc25 Add FixIt hint for missing 'id' type.
// rdar://9615045

llvm-svn: 135685
2011-07-21 17:38:14 +00:00
Fariborz Jahanian b5a52ca0c9 objc - Diagnose missing method return type specifier under
a warning flag. // rdar://9615045

llvm-svn: 135681
2011-07-21 17:00:47 +00:00
Douglas Gregor f676fdc8ea One last RandomAccessIterator operator for PreprocessingRecord::iterator
llvm-svn: 135680
2011-07-21 16:37:44 +00:00
Douglas Gregor cbd50c3201 Add the remaining RandomAccessIterator operations to
PreprocessingRecord::iterator. Where's concept_map when I need it?

llvm-svn: 135679
2011-07-21 16:35:41 +00:00
Bruno Cardoso Lopes 3aa2f0a064 Define the _MIPS_SIM builtin macro on MIPS platforms. Patch by Robert Millan!
llvm-svn: 135675
2011-07-21 15:10:57 +00:00
Jay Foad ed8db7d9df Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.

llvm-svn: 135673
2011-07-21 14:31:17 +00:00
Francois Pichet 14c7ed4b0b For some reason I don't fully comprehend, the MSVC debug build will fail with a huge 50+ lines template error message if PreprocessingRecord::iterator has no operator<()
llvm-svn: 135670
2011-07-21 06:26:00 +00:00
Eric Christopher 6f228b5a53 Speculatively revert 135649 to bring back the g++ testing bots.
llvm-svn: 135668
2011-07-21 05:34:24 +00:00
Ted Kremenek 86070b9c0f Move AnalysisManager constructor out of line. No functionality change (yet).
llvm-svn: 135667
2011-07-21 05:22:52 +00:00
Ted Kremenek 189ecec4db Simplify passing of CFGBuildOptions around for AnalysisContext. No functionality change.
llvm-svn: 135666
2011-07-21 05:22:47 +00:00
Richard Trieu 713f429d8c Fix a test in warn-sign-conversion.cpp. Removed a part of a directory path so that the directory seperator, which may change on different platforms, is no longer part of the string checked for.
llvm-svn: 135665
2011-07-21 03:20:52 +00:00
Richard Trieu bb43dec255 Remove warning for conditional operands of differend signedness from -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.
llvm-svn: 135664
2011-07-21 02:46:28 +00:00
Douglas Gregor 63745d5935 New libclang API to expose container type for code completion, from
Connor Wakamo!

llvm-svn: 135651
2011-07-21 01:05:26 +00:00
Alexis Hunt 4ace035c55 When copping out on a friend template declaration, be sure to mark its
access specifier as public.

llvm-svn: 135649
2011-07-21 00:59:23 +00:00
Douglas Gregor 4a9c39a2f6 Rework the detailed preprocessing record to separate preprocessing
entities generated directly by the preprocessor from those loaded from
the external source (e.g., the ASTReader). By separating these two
sets of entities into different vectors, we allow both to grow
independently, and eliminate the need for preallocating all of the
loaded preprocessing entities. This is similar to the way the recent
SourceManager refactoring treats FileIDs and the source location
address space.

As part of this, switch over to building a continuous range map to
track preprocessing entities.

llvm-svn: 135646
2011-07-21 00:47:40 +00:00
Anna Zaks 9ccf84e35d Addressing code review comments for commit 135509 - Add FixItHints in case a C++ function call is missing * or & operators on
llvm-svn: 135643
2011-07-21 00:34:39 +00:00
Fariborz Jahanian 53a495bd75 Removes a comment.
llvm-svn: 135640
2011-07-20 23:53:57 +00:00
Fariborz Jahanian 517695b27c objc-arc: Fixes a crash @throw'ing an objc message.
// pr10411

llvm-svn: 135638
2011-07-20 23:39:56 +00:00
Jonathan D. Turner 350056821a Continuing to improve and generalize how IDs are handled in ASTReader. This patch cleans up and generalizes TypeID loading and uses a similar table-lookup to Doug's previous Decl patch.
llvm-svn: 135622
2011-07-20 21:31:32 +00:00
Chad Rosier 1988642124 Temporarily revert r135614 while I fix the cmake build.
llvm-svn: 135621
2011-07-20 21:16:17 +00:00
Bill Wendling 03400e17fe Remove extraneous period.
llvm-svn: 135619
2011-07-20 21:02:28 +00:00
Chad Rosier e3805fc118 When the compiler crashes, the compiler driver now produces diagnostic information
including the fully preprocessed source file(s) and command line arguments.  The 
developer is asked to attach this diagnostic information to a bug report.

llvm-svn: 135614
2011-07-20 20:26:32 +00:00
Evan Cheng b5517a4d8c Match MCContext change.
llvm-svn: 135612
2011-07-20 19:53:19 +00:00
Ted Kremenek 81383c20e4 Fix -Wuninitialized regression involving functions invalidating parameters passed by reference.
llvm-svn: 135610
2011-07-20 19:49:47 +00:00
Chad Rosier 7802c389da Whitespace.
llvm-svn: 135605
2011-07-20 19:27:01 +00:00
Chad Rosier 5371243dab If -ccc-host-triple i386-pc-win32-macho or -ccc-host-triple
x86_64-pc-win32-macho is used in conjunction with -no-integrated-as go ahead and
use the Darwin system assembler.
rdar://9785470

llvm-svn: 135604
2011-07-20 19:14:30 +00:00
Fariborz Jahanian a644f9cb73 arc-objc++: Issue an arc specific diagnostic when overload resolution
fails because of lifetime differences of parameter and argument type.
// rdar://9790531

llvm-svn: 135593
2011-07-20 17:14:09 +00:00
NAKAMURA Takumi 6657e979f5 test/CMakeLists.txt: Re-indent.
llvm-svn: 135591
2011-07-20 16:35:49 +00:00
Benjamin Kramer 0d3d777041 Unbreak build after API change.
llvm-svn: 135585
2011-07-20 14:43:06 +00:00
Chris Lattner d2b92d6544 arrayref should now move in here, and redundant #includes of <cassert> can go
away (since it comes in through Casting.h).  This will have to wait for another
day when I'm unmotivated though, or someone else to pick it up :)

llvm-svn: 135579
2011-07-20 07:13:40 +00:00
Chris Lattner c5efe4e520 remove some now-redundant forward declarations.
llvm-svn: 135578
2011-07-20 07:12:43 +00:00
Chris Lattner 62ff6e8b17 add raw_ostream and Twine to LLVM.h, eliminating a ton of llvm:: qualifications.
llvm-svn: 135577
2011-07-20 07:06:53 +00:00
Chris Lattner 01cf8db38b now that we have a centralized place to do so, add some using declarations for
some common llvm types: stringref and smallvector.  This cleans up the codebase
quite a bit.

llvm-svn: 135576
2011-07-20 06:58:45 +00:00
Chris Lattner dba38736a5 introduce a centralized place to introduce and inject llvm types into the
clang namespace.  There are a number of LLVM types that are used pervasively
and it doesn't make sense to keep qualifying them.  Start with casting
operators.

llvm-svn: 135574
2011-07-20 06:37:11 +00:00
Chris Lattner 7369c14b6a fix rdar://9780211 - Clang crashes with an assertion failure building WKView.mm from WebKit
This is something of a hack, the problem is as follows:

1. we instantiate both copied of RetainPtr with the two different argument types
   (an id and protocol-qualified id).
2. We refer to the ctor of one of the instantiations when introducing global "x",
   this causes us to emit an llvm::Function for a prototype whose "this" has type
   "RetainPtr<id<bork> >*".
3. We refer to the ctor of the other instantiation when introducing global "y",
   however, because it *mangles to the same name as the other ctor* we just use
   a bitcasted version of the llvm::Function we previously emitted.
4. We emit deferred declarations, causing us to emit the body of the ctor, however
   the body we emit is for RetainPtr<id>, which expects its 'this' to have an IR
   type of "RetainPtr<id>*".

Because of the mangling collision, we don't have this case, and explode.

This is really some sort of weird AST invariant violation or something, but hey
a bitcast makes the pain go away.

llvm-svn: 135572
2011-07-20 06:29:00 +00:00
Chris Lattner 58c62473cd fix a case where we're using ConvertType for a memory object.
It doesn't matter in practice, but it is good to be tidy.

llvm-svn: 135571
2011-07-20 06:23:59 +00:00
Evan Cheng 347033fd8b Match LLVM API change.
llvm-svn: 135570
2011-07-20 06:22:27 +00:00
Chris Lattner 245169620a as eli points out, we're not doing memory stuff here. While ConvertType
and ConvertTypeForMem are the same for pointers, it is best to just
use ConvertType.  Thanks Eli!

llvm-svn: 135567
2011-07-20 04:59:57 +00:00
Chris Lattner 71bd0c3263 fix PR10395 - array decay can produce an interesting type when
decaying an array of incomplete type (which has type [0 x i8]*) to a
normal pointer (which has incompletetype*).

llvm-svn: 135565
2011-07-20 04:31:01 +00:00
Douglas Gregor 270e014b7a Use a ContinuousRangeMap to map from the global macro definition ID in
the AST reader down to the AST file + local ID, rather than walking
the PCH chain. More cleanup/generalization, although there is more
work to do for preprocessed entities. In particular, the
"preallocation" scheme for preprocessed entities is not going to work
well with late loading of PCH files, and it's likely we'll have to do
something akin to the SourceManager's negative/positive loading.

llvm-svn: 135556
2011-07-20 01:29:15 +00:00
Douglas Gregor 2262d28bab Use a ContinuousRangeMap to map from the global selector ID in the AST
reader down to the AST file + local ID, rather than walking the PCH
chain. No functionality change; this is generalization and cleanup.

llvm-svn: 135554
2011-07-20 01:10:58 +00:00
Joerg Sonnenberger 869f0b70d4 PR10392: "#pragma GCC visibility" must not expand macros in its
arguments.

llvm-svn: 135552
2011-07-20 01:03:50 +00:00
Douglas Gregor 19d2635d8c Use a ContinuousRangeMap to map from the global identifier ID in the
AST reader down to the AST file + local ID, rather than walking the
PCH chain. No functionality change; this is generalization and cleanup.

llvm-svn: 135551
2011-07-20 00:59:32 +00:00
Douglas Gregor 551273e176 Try to appease MSVC's standard library.
llvm-svn: 135549
2011-07-20 00:31:58 +00:00
Douglas Gregor 047d2effea Use a ContinuousRangeMap to map from the global declaration ID in the
AST reader down to the AST file + local ID within that file, rather
than lamely walking the PCH chain. There's no actual functionality
change now, but this is cleaner and more general.

llvm-svn: 135548
2011-07-20 00:27:43 +00:00
Joerg Sonnenberger da5d2b761a Spelling
llvm-svn: 135545
2011-07-20 00:14:37 +00:00
Richard Smith e3daab2449 Replace r134583's fix for PR10290 with one which also works for non-value-dependent cases.
llvm-svn: 135543
2011-07-20 00:12:52 +00:00
Richard Smith 2b5c61197f Use the zero from the correct enumeration when initializing this variable.
llvm-svn: 135541
2011-07-20 00:10:13 +00:00
Sean Callanan 53a6bff7e1 This fix (thanks to Doug Gregor) corrects a bug
in ImportDefinition when replacing a previously
forward-declared CXXRecordDecl with its full
definition.  The forward-declared type's
DefinitionData had not been intialized for the
forward-declared type, so adding fields to the
Decl caused CXXRecordDecl::addedMember() to
crash when accessing the DefinitionData.

llvm-svn: 135530
2011-07-19 22:38:25 +00:00
Ted Kremenek 65b3e0649c Fix false negative in -Wuninitialized involving a () wrapping an lvalue-to-rvalue conversion in a DeclStmt.
llvm-svn: 135525
2011-07-19 21:41:51 +00:00
Ted Kremenek 5d855bf7f2 Fix assertion failure in UninitializedValues.cpp where an lvalue to rvalue conversion is wrapped in a parenthesis.
llvm-svn: 135519
2011-07-19 20:33:49 +00:00
Jordy Rose a39e10fd7c [analyzer] Very minor cleanup in PthreadLockChecker. No functionality change.
llvm-svn: 135518
2011-07-19 20:31:42 +00:00
Jordy Rose d9c522100e [analysis] Add checks for double-locking and lock order reversal bugs for
pthread and XNU locks. Patch by Rui Paulo!

llvm-svn: 135515
2011-07-19 20:21:41 +00:00
Chad Rosier b90e40256c Refactor r135502 to avoid an empty if else condition, per Eric's suggestion (good call!).
llvm-svn: 135510
2011-07-19 20:00:06 +00:00
Anna Zaks df92ddf846 Add FixItHints in case a C++ function call is missing * or & operators on one/several of it's parameters (addresses http://llvm.org/PR5941).
llvm-svn: 135509
2011-07-19 19:49:12 +00:00
Chad Rosier dcf7732065 Clang asserts "Invalid environment!" when using -ccc-host-triple
arch-pc-win32-macho (e.g., x86_64-pc-win32-macho), which appears to be a false
positive.
rdar://9786307

llvm-svn: 135502
2011-07-19 19:36:03 +00:00
Benjamin Kramer 33824e5722 Update CMake build.
llvm-svn: 135492
2011-07-19 17:26:28 +00:00
Argyrios Kyrtzidis d571363e45 [arcmt] Add some additional driver flags to optionally emit or save the pre-migration ARC errors.
-arcmt-migrate-emit-errors : Emits the pre-migration ARC errors but it doesn't affect anything else
-arcmt-migrate-report-output : Writes out the pre-migration ARC errors to the provided plist file

rdar://9791454

llvm-svn: 135491
2011-07-19 17:20:03 +00:00
Jeffrey Yasskin 7ac472e22a Name the "c++0x-compat" warning group, and fix the names of two
warnings that were intended to be inside it.

llvm-svn: 135487
2011-07-19 16:38:48 +00:00
Douglas Gregor 925296b4c2 Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.

llvm-svn: 135484
2011-07-19 16:10:42 +00:00
Ted Kremenek 9e100ea1a8 Reduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST crawl.
This is accomplished by forcing the needed expressions for -Wuninitialized to always be CFGElements in the CFG.
This allows us to remove a fair amount of the code for -Wuninitialized.

Some fallout:
- AnalysisBasedWarnings.cpp now specifically toggles the CFGBuilder to create a CFG that is suitable for -Wuninitialized.  This
is a layering violation, since the logic for -Wuninitialized is in libAnalysis.  This can be fixed with the proper refactoring.
- Some of the source locations for -Wunreachable-code warnings have shifted.  While not ideal, this is okay because that analysis
already needs some serious reworking.

llvm-svn: 135480
2011-07-19 14:18:48 +00:00
Ted Kremenek 8b46c00b5f Add hooks into the CFG builder to force that specific expressions are always CFGElements.
llvm-svn: 135479
2011-07-19 14:18:43 +00:00
Nick Lewycky c3218637bd Fix typo.
llvm-svn: 135473
2011-07-19 08:48:08 +00:00
Evan Cheng 3f37dd065b Match createTargetMachine API change.
llvm-svn: 135469
2011-07-19 06:37:41 +00:00
Devang Patel 206f5093e3 Simplify.
llvm-svn: 135456
2011-07-19 00:52:18 +00:00
Alexis Hunt 8cb46bb51c Implement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and
WCHAR_MAX in limits.h, thus solving the problem where the system header
thinks it knows better.

llvm-svn: 135455
2011-07-19 00:50:57 +00:00
Eric Christopher 6fdc34054f Add .gitignore file.
llvm-svn: 135440
2011-07-18 23:05:36 +00:00
Devang Patel 11de9a966a Check column number also.
llvm-svn: 135437
2011-07-18 22:18:04 +00:00
Evan Cheng b505ace101 MCContext now takes MCRegisterInfo.
llvm-svn: 135425
2011-07-18 20:57:51 +00:00
Alexis Hunt 106b4924e2 Thanks to Chandler for reminding me to update the documentation for the
__underlying_type feature.

llvm-svn: 135402
2011-07-18 17:22:33 +00:00
Alexis Hunt c6d1d946e7 Remember to add a has_feature macro for __underlying_type now that it is
correctly impelmented

llvm-svn: 135401
2011-07-18 17:08:00 +00:00
Jeffrey Yasskin d2af962eee Define DiagnosticBuilder<<APValue so it's easy to include APValues in
diagnostics.

llvm-svn: 135398
2011-07-18 16:43:53 +00:00
Frits van Bommel 717d7edd3e Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.

llvm-svn: 135390
2011-07-18 12:00:32 +00:00
NAKAMURA Takumi a185c78d4d lib/Headers/mm_malloc.h: Use __mingw_aligned_malloc() in _mm_malloc() on mingw.
By default, mingw does not have _mm_alloc() nor _aligned_malloc().

llvm-svn: 135388
2011-07-18 11:13:50 +00:00
Argyrios Kyrtzidis 91c62bfc03 [arcmt] When a NSData's 'bytes' family of methods are used on a local var,
add __attribute__((objc_precise_lifetime)) to make sure that the object
(and its data) will not get released before the var goes out-of-scope.

rdar://9206226

llvm-svn: 135382
2011-07-18 07:44:50 +00:00
Argyrios Kyrtzidis 73a0d32df5 [arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safe
with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226

llvm-svn: 135381
2011-07-18 07:44:45 +00:00
Nick Lewycky ba4cc01a1f Don't crash when codegen'ing an empty redecl of a function in C99 mode, when
neither was inline. Fixes bug introduced in r135377.

llvm-svn: 135380
2011-07-18 07:11:55 +00:00
Nick Lewycky 26da4ddfa6 In C99, emit an inline function when encountering an extern redeclaration.
Fixes PR10233!

llvm-svn: 135377
2011-07-18 05:26:13 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Chris Lattner 83cfc7c03a Use the new llvm::TinyPtrVector class, which implements exactly what
ShadowMapEntry was.

llvm-svn: 135368
2011-07-18 01:54:02 +00:00
Chandler Carruth 7cf5a37605 Revert r135217, which wasn't the correct fix for PR10358. With this
patch, we actually move the state-machine for the value set backwards
one step. This can pretty easily lead to infinite loops where we
continually try to propagate a bit, succeed for one iteration, but then
back up because we find an uninitialized use.

A reduced test case from PR10379 is included.

llvm-svn: 135359
2011-07-16 22:27:02 +00:00
Francois Pichet 8e122b9fca Do not modify string returned by getenv on Windows.
Fixes PR9875, patch by Nikola Smiljanic!

llvm-svn: 135356
2011-07-16 21:17:14 +00:00
Benjamin Kramer e492cb41b7 Zero this struct in a way that neither depends on the size of the struct nor triggers warnings from GCC.
llvm-svn: 135351
2011-07-16 20:13:06 +00:00
Ted Kremenek 6dcbbe8547 [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>.
llvm-svn: 135350
2011-07-16 19:50:36 +00:00
Ted Kremenek c85964ed90 [analyzer] Place checking for Core Foundation "Create" rule into a proper API. No functionality change.
llvm-svn: 135349
2011-07-16 19:50:32 +00:00
Fariborz Jahanian 8809a9d91c Remove a gcc warning.
llvm-svn: 135348
2011-07-16 18:31:33 +00:00
Joerg Sonnenberger 9c3e69ba88 Correctly handle sysroot prefix in -print-search-dirs. Makes libtool
more happy on NetBSD.

llvm-svn: 135344
2011-07-16 10:50:05 +00:00
Fariborz Jahanian f9ae68af85 Fix a typo.
llvm-svn: 135328
2011-07-16 00:08:33 +00:00
Argyrios Kyrtzidis a6fe4bfdf5 [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

llvm-svn: 135327
2011-07-15 23:48:56 +00:00
Tanya Lattner 8355938fcd This handles the missing cases of opencl vector literals.
Test cases provided by Anton Lokhmot.

llvm-svn: 135322
2011-07-15 23:07:01 +00:00
Jordy Rose 5737d073bd Update retain-release.m to match updated warnings from r135310
llvm-svn: 135317
2011-07-15 22:38:26 +00:00
Argyrios Kyrtzidis e6cd072517 [libclang] Map canonical decl of a category implementation to the category decl.
llvm-svn: 135316
2011-07-15 22:37:58 +00:00
Argyrios Kyrtzidis 238ea53793 Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.
llvm-svn: 135314
2011-07-15 22:27:18 +00:00
Jordy Rose 43426f8fcb Add tests for CFRefReport's path notes, and fix a few typos and non-standard terminology ('+0 retain counts') caught by the tests.
llvm-svn: 135310
2011-07-15 22:17:54 +00:00
Argyrios Kyrtzidis f59daff52e [arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.
llvm-svn: 135309
2011-07-15 22:04:00 +00:00
Chad Rosier f8412cdae9 Prevent the -save-temps flag from modifying the input file if the input filename
conflicts with a to be produced temp filename.
rdar://9724657

llvm-svn: 135308
2011-07-15 21:54:29 +00:00
Douglas Gregor 3d0adb3201 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.

llvm-svn: 135306
2011-07-15 21:46:17 +00:00
Argyrios Kyrtzidis f5d99dc2cc The canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.
llvm-svn: 135304
2011-07-15 21:39:32 +00:00
Argyrios Kyrtzidis 6a8a14d217 [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

llvm-svn: 135301
2011-07-15 21:11:23 +00:00
Douglas Gregor 653b51a938 Don't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled
llvm-svn: 135300
2011-07-15 21:03:20 +00:00
Jordy Rose b72bd53f7d [analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.
llvm-svn: 135294
2011-07-15 20:29:02 +00:00
Joerg Sonnenberger 4921fe2f9e Fix typo
llvm-svn: 135285
2011-07-15 18:23:44 +00:00
Jeffrey Yasskin d0f079dad4 Use the new APFloat::convertToInt(APSInt) function to simplify uses of
convertToInt(integerParts*) and make them more reliable.

llvm-svn: 135279
2011-07-15 17:03:07 +00:00
Douglas Gregor e9d62935d3 Store bracket locations for array subscript expressions, from Erik Verbruggen!
llvm-svn: 135275
2011-07-15 16:25:15 +00:00
Douglas Gregor 397745e540 When creating a property in a class extension, make sure to check its
attributes. Fixes <rdar://problem/9561076>.

llvm-svn: 135273
2011-07-15 15:30:21 +00:00
Jay Foad 5bd375a6cc Convert CallInst and InvokeInst APIs to use ArrayRef.
llvm-svn: 135265
2011-07-15 08:37:34 +00:00
John McCall 6730e4d904 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.

llvm-svn: 135262
2011-07-15 07:47:58 +00:00
Chandler Carruth f92ac9eb7d Move the Serialization library from 'instantiation' to 'expansion', with
the exception of its uses of SourceManager and SourceLocation APIs.

llvm-svn: 135260
2011-07-15 07:25:21 +00:00
John McCall fa19404c27 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.

llvm-svn: 135258
2011-07-15 07:00:14 +00:00
John McCall b33fb3670b 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.

llvm-svn: 135257
2011-07-15 06:56:33 +00:00
Chris Lattner 1a65133b11 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.

llvm-svn: 135256
2011-07-15 06:41:05 +00:00
Jordy Rose f3dd00a26c Clean up UnixAPIChecker, including switching its array of BugTypes to llvm::OwningPtr<BugType> vars (the new convention). No functionality change.
llvm-svn: 135255
2011-07-15 06:28:59 +00:00
Jordy Rose ede26958bf Clean up MacOSXAPIChecker, including switching its array of BugTypes to a single llvm::OwningPtr<BugType> (the new convention). No functionality change.
llvm-svn: 135250
2011-07-15 06:02:19 +00:00
Chris Lattner 6fb0ccfa0f 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.

llvm-svn: 135244
2011-07-15 05:16:14 +00:00
John McCall 7c454bb8ce 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.

llvm-svn: 135243
2011-07-15 05:09:51 +00:00
Ted Kremenek 105f8db1f6 Add 'Contains()' method to GRStateTrait for ImmutableList. Patch by Rui Paulo.
llvm-svn: 135241
2011-07-15 03:32:56 +00:00
Chandler Carruth 5d4aff0c4d Switch a comment in Rewrite from 'instantiation' to 'expansion'.
llvm-svn: 135226
2011-07-15 00:04:40 +00:00
Chandler Carruth d755d08c52 Switch help text in the CC1 driver from 'instantiation' to 'expansion'.
llvm-svn: 135225
2011-07-15 00:04:38 +00:00
Chandler Carruth 2536641cd5 Switch comments and assert text in AST from 'instantiation' to
'expansion'.

llvm-svn: 135224
2011-07-15 00:04:35 +00:00
Chandler Carruth 3f610268d7 Switch comments about 'macro instantiation' to 'macro expansion' in
ARCMigrate.

llvm-svn: 135223
2011-07-15 00:04:31 +00:00
Richard Trieu cfe3926ae9 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.

llvm-svn: 135222
2011-07-15 00:00:51 +00:00
Evan Cheng 6d188f5f1c Match llvm API change.
llvm-svn: 135220
2011-07-14 23:50:56 +00:00
Ted Kremenek f0b28d7fe5 Fix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to avoid cascading warnings. Patch by Kaelyn Uhrain.
llvm-svn: 135217
2011-07-14 23:43:06 +00:00
Douglas Gregor d7f2f9d07b 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.

llvm-svn: 135216
2011-07-14 23:42:32 +00:00
Argyrios Kyrtzidis f2a27f40d6 [arcmt] Don't remove retains/releases on a global variable, flag them with errors. rdar://9402555.
llvm-svn: 135213
2011-07-14 23:32:04 +00:00
Rafael Espindola 699fc4d15c 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.

llvm-svn: 135210
2011-07-14 22:58:04 +00:00
Argyrios Kyrtzidis 08903e4c16 [arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Keep the error if the result is unused. rdar://9552694.

llvm-svn: 135209
2011-07-14 22:46:12 +00:00
John McCall 5143181ff9 Teach -Wconversion, -Wsign-compare etc. about division and remainder.
llvm-svn: 135208
2011-07-14 22:39:48 +00:00
Richard Smith 7b8c3c91f4 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 

llvm-svn: 135195
2011-07-14 21:35:26 +00:00
Argyrios Kyrtzidis 84b528f3b1 [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

llvm-svn: 135193
2011-07-14 21:26:49 +00:00
Sebastian Redl 9c61809c23 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.

llvm-svn: 135177
2011-07-14 19:08:10 +00:00
Sebastian Redl 771ee36966 Fix problems Johannes noticed, and extend test cases further.
llvm-svn: 135176
2011-07-14 19:08:01 +00:00
Sebastian Redl 112aa826c7 Remove InitializationSequence::ReferenceBinding, the last redundant sequence kind.
llvm-svn: 135175
2011-07-14 19:07:55 +00:00
Chris Lattner 2dc4b55bd8 simplify
llvm-svn: 135170
2011-07-14 18:45:41 +00:00
Chris Lattner d386df4dbd StringMap::first() is about to start returning a StringRef, adapt.
llvm-svn: 135166
2011-07-14 18:24:21 +00:00
Benjamin Kramer 8d375cef55 Change intrinsic getter to take an ArrayRef, now that the underlying function in LLVM does.
llvm-svn: 135155
2011-07-14 17:45:50 +00:00
Caitlin Sadowski 512148fbeb Moving one misplaced entry in the attribute enum in AttributeList.h into alphabetical order.
llvm-svn: 135153
2011-07-14 17:39:11 +00:00
Ted Kremenek d0c2afd2c3 Revert r135147 and r135075. The consensus was that this wasn't the right thing to do.
llvm-svn: 135152
2011-07-14 17:05:32 +00:00
Chandler Carruth 46a32c2f0a Update the remaining comments in Frontend to 'expansion'.
llvm-svn: 135150
2011-07-14 16:14:52 +00:00
Chandler Carruth 6d900dff2d 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.

llvm-svn: 135149
2011-07-14 16:08:00 +00:00
Chandler Carruth 65c9c9bd69 Clean up two lingering comments that mention 'instantiation' w.r.t.
macros in libclang.

llvm-svn: 135148
2011-07-14 16:07:57 +00:00
Ted Kremenek 2df6485d51 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.
llvm-svn: 135147
2011-07-14 15:43:21 +00:00
Chandler Carruth de81fc8557 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.

llvm-svn: 135141
2011-07-14 09:02:10 +00:00
Chandler Carruth 9e4704ab07 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.

llvm-svn: 135140
2011-07-14 08:41:15 +00:00
Chandler Carruth a88a221855 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.

llvm-svn: 135139
2011-07-14 08:20:46 +00:00
Chandler Carruth e2c09ebcaa 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.

llvm-svn: 135138
2011-07-14 08:20:40 +00:00
Chandler Carruth c9c8419c38 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.

llvm-svn: 135137
2011-07-14 08:20:34 +00:00
Chandler Carruth 64d376a8fa Switch all local code and comments from '[Ii]nstantiat(ion|ed)' to
'[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter.

No functionality changed.

llvm-svn: 135136
2011-07-14 08:20:31 +00:00
Chandler Carruth cd7a02ec1b 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'.

llvm-svn: 135135
2011-07-14 08:20:28 +00:00
Ted Kremenek ba84cf53bc Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.
llvm-svn: 135134
2011-07-14 06:49:52 +00:00
NAKAMURA Takumi 91d831bc2d 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.

llvm-svn: 135129
2011-07-14 05:16:18 +00:00
Douglas Gregor 5cf0e1534a 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.

llvm-svn: 135128
2011-07-14 04:54:23 +00:00
Argyrios Kyrtzidis e2e40b4dc7 [arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824
llvm-svn: 135115
2011-07-14 00:17:54 +00:00
John McCall 7c3ed3d0c5 Document the behavior of property modifiers in ARC.
rdar://problem/9768338

llvm-svn: 135104
2011-07-13 23:15:32 +00:00
Richard Smith 48d2464c3f PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.
llvm-svn: 135101
2011-07-13 22:53:21 +00:00
Bruno Cardoso Lopes 98154a76fd Reapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.
llvm-svn: 135091
2011-07-13 21:58:55 +00:00
Douglas Gregor ad69e65a39 Add 'mutable' to the function declarator chunk, to be used when
parsing lambda expressions, from John Freeman!

llvm-svn: 135090
2011-07-13 21:47:47 +00:00
Douglas Gregor 385cfc073e Fix an incorrect namespace typo-correction diagnostic, from Kaelyn
Uhrain! Fixes PR10318.

llvm-svn: 135086
2011-07-13 21:36:26 +00:00
Devang Patel f0335ce632 Emit debug info for extended vectors.
llvm-svn: 135083
2011-07-13 21:23:30 +00:00
Ted Kremenek 60654d697a 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.

llvm-svn: 135075
2011-07-13 20:20:58 +00:00
John McCall 928a25714e 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.

llvm-svn: 135073
2011-07-13 20:12:57 +00:00
Argyrios Kyrtzidis de223c3a7b [arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizing it.
llvm-svn: 135067
2011-07-13 19:47:57 +00:00
Argyrios Kyrtzidis c8b3619773 [arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain' -> 'strong', and add
'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589.

llvm-svn: 135065
2011-07-13 19:22:00 +00:00
Fariborz Jahanian 9a881019a5 With -Wselector, don't warn about unimplemented optional method
used in @selector expression because, well, their implementation 
is optional. // rdar://9545564

llvm-svn: 135057
2011-07-13 19:05:43 +00:00
John McCall dffafded6c Don't crash if defining -dealloc in a category.
llvm-svn: 135054
2011-07-13 18:26:47 +00:00
John McCall 3f4138c5d0 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.

llvm-svn: 135051
2011-07-13 17:56:40 +00:00
Fariborz Jahanian 17585e7940 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

llvm-svn: 135050
2011-07-13 17:55:01 +00:00
Ted Kremenek cc47e0fad1 Re-relax conversion specifier checking for printf format strings and conversion specifiers. My recent change was a mistake.
llvm-svn: 135048
2011-07-13 17:35:14 +00:00
Ted Kremenek 1d3fb8af68 Fix inversion in argument type checking for format strings with conversion specifiers for character types.
llvm-svn: 135046
2011-07-13 17:25:47 +00:00
John McCall 97eab0a271 Okay, that rule about zero-length arrays applies to destroying
them, too.

llvm-svn: 135038
2011-07-13 08:09:46 +00:00
John McCall 6549b31fe9 Arrays are permitted to be zero-length in some situations.
llvm-svn: 135036
2011-07-13 07:37:11 +00:00
John McCall c368838b20 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.

llvm-svn: 135034
2011-07-13 06:35:24 +00:00
John McCall f677a8e99e Convert the standard default-construction loops to use phis and
partial destruction.

llvm-svn: 135033
2011-07-13 06:10:41 +00:00
Chris Lattner 46ca3272e4 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.

llvm-svn: 135032
2011-07-13 05:31:19 +00:00
Chris Lattner 3517f14219 PR10337 reminds me that calls return values, lets handle them just
like arguments.  Thanks PR10337! :)

llvm-svn: 135030
2011-07-13 03:59:32 +00:00
John McCall f47c069162 Aggressive dead code elimination.
llvm-svn: 135029
2011-07-13 03:03:51 +00:00
John McCall 98de3d74d2 Generalize the routine for destroying an object with static
storage duration, then explicitly exempt ownership-qualified
types from it.

llvm-svn: 135028
2011-07-13 03:01:35 +00:00
Douglas Gregor d29fde248e 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.

llvm-svn: 135027
2011-07-13 02:14:02 +00:00
Eli Friedman 609ada27ce 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. :(
llvm-svn: 135026
2011-07-13 02:05:57 +00:00
John McCall ca2c56f20b Switch delete[] IR-generation over to the destroy framework,
which implicitly makes it EH-safe as well.

llvm-svn: 135025
2011-07-13 01:41:37 +00:00
Douglas Gregor 1c2e20d73d 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.

llvm-svn: 135021
2011-07-13 00:54:47 +00:00
Richard Smith 26935e60b6 Correctly set up the list of virtual base classes for a CXXRecordDecl. Previously we got the source range wrong for everything in the virtual bases list.
llvm-svn: 135011
2011-07-12 23:49:11 +00:00
Fariborz Jahanian c87c8799ec revert fix for // rdar://9740328
llvm-svn: 135010
2011-07-12 23:20:13 +00:00
Bruno Cardoso Lopes 0aadf83f80 Revert r134946
llvm-svn: 135004
2011-07-12 22:30:58 +00:00
Argyrios Kyrtzidis a200973ead [arcmt] Also avoid 'weak' for forward references to objc classes.
llvm-svn: 135003
2011-07-12 22:16:25 +00:00
Argyrios Kyrtzidis ce9b739999 [arcmt] Before applying '__weak' check whether the objc class is annotated with objc_arc_weak_reference_unavailable
or is in a list of classes not supporting 'weak'.

rdar://9489367.

llvm-svn: 135002
2011-07-12 22:05:17 +00:00
Fariborz Jahanian c0f6af2103 objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. // rdar://9740328

llvm-svn: 135001
2011-07-12 22:05:16 +00:00
David Chisnall c2800aab7b Fix another typo (int -> id for captured_obj).
llvm-svn: 134998
2011-07-12 20:34:06 +00:00
John McCall 30317fda63 Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags.  No functionality change.

llvm-svn: 134997
2011-07-12 20:27:29 +00:00
Peter Collingbourne 77b0e7f296 Implement -MG. Fixes PR9613
llvm-svn: 134996
2011-07-12 19:35:15 +00:00
Benjamin Kramer ae2d344384 Add more compiler workarounds. Should fix the build with old GCCs and MSVC.
llvm-svn: 134995
2011-07-12 18:37:23 +00:00
Douglas Gregor 7e6bfb4a0d In ARC mode, consider Objective-C lifetime types (object pointers and
block pointers) that don't have any qualification to be POD types. We
were previously considering them to be non-POD types, because this was
convenient in C++ for is_pod-like traits. However, we now end up
inferring lifetime in such cases (template arguments infer __strong),
so it is not necessary.

Moreover, we want rvalues of object type (which have their lifetime
stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function
properly. Fixes <rdar://problem/9758798>.

llvm-svn: 134993
2011-07-12 17:28:52 +00:00
Fariborz Jahanian 7f4427fc60 Fix a bug where a local variable named 'self' is causing
implicit ivar accesses to go through the 'self' variable
rather than the real 'self' for the method. // rdar://9730771

llvm-svn: 134992
2011-07-12 17:16:56 +00:00
John McCall 5fa8e20878 Ugh, use this compiler workaround again.
llvm-svn: 134989
2011-07-12 16:53:04 +00:00
John McCall 4bd0fb1f09 Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

llvm-svn: 134988
2011-07-12 16:41:08 +00:00
Douglas Gregor 2207ec273a Improve name mangling for instantiation-dependent types that are not
dependent. This covers an odd class of types such as

  int (&)[sizeof(sizeof(T() + T()))];

which involve template parameters but, because of some trick typically
involving a form of expression that is never type-dependent, resolve
down to a non-dependent type. Such types need to be mangled
essentially as they were written in the source code (involving
template parameters), rather than via their canonical type.

In general, instantiation-dependent types should be mangled as
they were written in the source. However, since we can't do that now
without non-trivial refactoring of the AST (see the new FIXME), I've
gone for this partial solution: only use the as-written-in-the-source
mangling for these strange types that are instantiation-dependent but
not dependent. This provides better compatibility with previous
incarnations of Clang and with GCC. In the future, we'd like to get
this right.

Fixes <rdar://problem/9663282>.

llvm-svn: 134984
2011-07-12 15:18:55 +00:00
Benjamin Kramer a4fb836f06 Pop block scope after reading from it.
Found by valgrind.

llvm-svn: 134983
2011-07-12 14:11:05 +00:00
Jay Foad b804a2b751 Second attempt at de-constifying LLVM Types in FunctionType::get(),
StructType::get() and TargetData::getIntPtrType().

llvm-svn: 134982
2011-07-12 14:06:48 +00:00
Chandler Carruth 4678f67139 Work around a problem with a static helper's formulation in release
builds introduced in r134972:

lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType'
lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument

This fixes the issue by passing CodeGenFunction on down, and using its
builder directly rather than passing just the builder down.

This may not be the best / cleanest fix, Chris please review. It at
least fixes builds.

llvm-svn: 134977
2011-07-12 08:58:26 +00:00
Hans Wennborg 38198ded24 Fix typo correction crash on overloaded functions, pr10283.
It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.

llvm-svn: 134976
2011-07-12 08:45:31 +00:00
Douglas Gregor e5802234f9 Implement name mangling for sizeof...(function parameter pack).
llvm-svn: 134974
2011-07-12 07:03:48 +00:00
Douglas Gregor 4a80f9fd98 Fix the desugaring of dependent decltype and typeof(expr) nodes. The
isSugared() and desugar() routines previously provided were never
actually called, since the corresponding types
(DependentTypeOfExprType, DependentDecltypeType) don't have
corresponding type classes. Outside of the current (incomplete) patch
I'm working on, I haven't found a way to trigger this problem.

llvm-svn: 134973
2011-07-12 06:55:29 +00:00
Chris Lattner 3f32d69699 Fix a problem Eli ran into where we now reject incomplete arrays of
uncompleted struct types.  We now do what llvm-gcc does and compile
them into [i8 x 0].  If the type is later completed, we make sure that
it is appropriately cast.

We compile the terrible example to something like this now:

%struct.A = type { i32, i32, i32 }

@g = external global [0 x i8]

define void @_Z1fv() nounwind {
entry:
  call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*))
  ret void
}

declare void @_Z3fooP1A(%struct.A*)

define %struct.A* @_Z2f2v() nounwind {
entry:
  ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1)
}

llvm-svn: 134972
2011-07-12 06:52:18 +00:00
Chris Lattner d59d867ca5 insert a bitcast in the 'expand' case of argument passing when needed. This
fixes the -m32 build of oggenc.

llvm-svn: 134971
2011-07-12 06:29:11 +00:00
Chris Lattner 73e3004e75 fix an unintended behavior change in the type system rewrite, which caused us to compile
stuff like this:

typedef struct {
 int x, y, z; 
} foo_t;

foo_t g;

into:
%"struct.<anonymous>" = type { i32, i32, i32 }
we now get:
%struct.foo_t = type { i32, i32, i32 }

This doesn't change the behavior of the compiler, but makes the IR much easier to read.

llvm-svn: 134969
2011-07-12 05:53:08 +00:00
Douglas Gregor 1cf9dd21dc Mangle dependent template names of unknown arity
llvm-svn: 134967
2011-07-12 05:06:05 +00:00
Chris Lattner 3ce8668273 fix PR10335 by watching out for IR type compatibility in call argument lists.
llvm-svn: 134966
2011-07-12 04:53:39 +00:00
Argyrios Kyrtzidis 9b72b0c7d5 Move OBJC_PR_NumBits out of PropertyAttributeKind enum, to its own NumPropertyAttrsBits.
No functionality change.

llvm-svn: 134965
2011-07-12 04:52:08 +00:00
Chris Lattner 5e3ef09f20 make test name less specific
llvm-svn: 134964
2011-07-12 04:51:05 +00:00
Douglas Gregor 6ef06cc48d Implement the Itanium C++ ABI's mangling rule for
non-instantiation-dependent sizeof and alignof expressions.

llvm-svn: 134963
2011-07-12 04:47:20 +00:00
Chris Lattner bb1952cfda add some aggressive assertions that call arguments match up to callee
expectations in EmitCall.  Next patch will take this further.

llvm-svn: 134962
2011-07-12 04:46:18 +00:00
Douglas Gregor 842806450c Centralize the getCanonicalType() calls in the Itanium C++ mangling
code so that they only occur in a single place. No functionality change.

llvm-svn: 134961
2011-07-12 04:42:08 +00:00
Argyrios Kyrtzidis 52bfc2b668 [ARC] Complain about property without storage attribute when @synthesizing it, not at its declaration.
For this sample:

@interface Foo
@property id x;
@end

we get:

t.m:2:1: error: ARC forbids properties of Objective-C objects with unspecified storage attribute
@property  id x;
^
1 error generated.

The error should be imposed on the implementor of the interface, not the user. If the user uses
a header of a non-ARC library whose source code he does not have, we are basically asking him to
go change the header of the library (bad in general), possible overriding how the property is
implemented if he gets confused and says "Oh I'll just add 'copy' then" (even worse).

Second issue is that we don't emit any error for 'readonly' properties, e.g:

@interface Foo
@property (readonly) id x; // no error  here
@end

@implementation Foo
@synthesize x; // no error here too
@end

We should give an error when the implementor is @synthesizing a property which doesn't have
any storage specifier; this is when the explicit specifier is important, because we are
going to create an ivar and we want its ownership to be explicit.

Related improvements:
-OBJC_PR_unsafe_unretained turned out to not fit in ObjCPropertyDecl's bitfields, fix it.
-For properties of extension classes don't drop PropertyAttributesAsWritten values.
-Have PropertyAttributesAsWritten actually only reflect what the user wrote

rdar://9756610.

llvm-svn: 134960
2011-07-12 04:30:16 +00:00
Bruno Cardoso Lopes 37b7fd0ab2 Fix a typo!
llvm-svn: 134952
2011-07-12 02:47:38 +00:00
Bruno Cardoso Lopes 75541d00e0 Do the same as r134946 for arrays. Add more testcases for avx x86_64 arg
passing.

llvm-svn: 134951
2011-07-12 01:27:38 +00:00
Bill Wendling 7475113d74 Revert r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, line 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134888 into '.':
U    lib/CodeGen/CodeGenModule.cpp

llvm-svn: 134950
2011-07-12 01:16:47 +00:00
Bruno Cardoso Lopes 7a26681092 Fix one x86_64 abi issue and the test to actually look for the right thing,
which is: { <4 x float>, <4 x float> } should continue to go through memory.

llvm-svn: 134946
2011-07-12 00:30:27 +00:00
John McCall 5fcf8da33d Do full-expression cleanups in a much more sensible way that still lets
people write useful cleanup classes.

llvm-svn: 134942
2011-07-12 00:15:30 +00:00
Bruno Cardoso Lopes 3472838c7a Disable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
specified, 128 avx code is used and we're not sure yet if this the behavior
we want (and if it does, some improvements are needed before relying on it).

llvm-svn: 134939
2011-07-11 23:33:46 +00:00
Chandler Carruth 9312c6464d Style tweak to the more idiomatic 'assert(!bad_state())'.
Patch by Caitlin Sadowski.

llvm-svn: 134938
2011-07-11 23:33:05 +00:00
Chandler Carruth fcc48d9e71 Hoist the logic for checking the number of arguments to an attribute
into a static helper.

Original patch by Caitlin Sadowski, style tweaks by me.

llvm-svn: 134937
2011-07-11 23:30:35 +00:00
Bruno Cardoso Lopes 571419bae6 Enable "avx" feature, so it can be seen by llvm
llvm-svn: 134935
2011-07-11 22:50:13 +00:00
Bruno Cardoso Lopes 21a41bb5ec Reapply r134754, which turns out to be working correctly and also
add one more testcase.

llvm-svn: 134934
2011-07-11 22:41:29 +00:00
Douglas Gregor 2e12550e37 Allow us to compute linkage et al for instantiation-dependent types.
llvm-svn: 134932
2011-07-11 22:38:07 +00:00
NAKAMURA Takumi 9a9ec73665 Revert r134898, "test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331. to appease mingw-target (and non-mingw-host) builds.
PR10331 is still alive I suppose.

llvm-svn: 134931
2011-07-11 22:34:14 +00:00
Argyrios Kyrtzidis bf65d2d820 Reenable test.
llvm-svn: 134928
2011-07-11 21:58:47 +00:00
Argyrios Kyrtzidis c645d60f12 Add missing header file for the test.
llvm-svn: 134927
2011-07-11 21:58:44 +00:00
Eli Friedman 6290ae476e Add diagnostic for constructs like "va_arg(l, float)" which have undefined behavior. PR10201.
llvm-svn: 134926
2011-07-11 21:45:59 +00:00
Eli Friedman 8532db2ec4 Test is broken; XFAIL it until Argyrios gets a chance to look at it.
llvm-svn: 134925
2011-07-11 21:44:14 +00:00
Argyrios Kyrtzidis 2299889f87 Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065
llvm-svn: 134919
2011-07-11 20:39:47 +00:00
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
John McCall 3b935d33a1 Emit partial destruction of structs with initializer lists.
llvm-svn: 134913
2011-07-11 19:35:02 +00:00
Fariborz Jahanian 256d39d47d objc-arc: Diagnose when captured variable in block literals
require destruction and there is possibility of that without
construction. Thanks Johnm for review and suggestions offline.
// rdar://9535237.

llvm-svn: 134906
2011-07-11 18:04:54 +00:00
Chandler Carruth d517395248 Apply patch from Richard Trieu to fix PR9548:
When two different types has the same text representation in the same
diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra
information about the type.

class versa_string;

typedef versa_string string;

namespace std {template <typename T> class vector;}

using std::vector;

void f(vector<string> v);

namespace std {
class basic_string;
typedef basic_string string;
template <typename T> class vector {};
void g() {
  vector<string> v;
  f(v);
}
}

Old message:
----------------
test.cc:15:3: error: no matching function for call to 'f'
  f(&v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' to 'vector<string>' for 1st argument
void f(vector<string> v);
     ^
1 error generated.

New message:
---------------
test.cc:15:3: error: no matching function for call to 'f'
  f(v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' (aka 'std::vector<std::basic_string>') to
      'vector<string>' (aka 'std::vector<versa_string>') for 1st argument
void f(vector<string> v);
     ^
1 error generated.

llvm-svn: 134904
2011-07-11 17:49:21 +00:00
NAKAMURA Takumi c7ec4539ed Tweak two tests with MSYS-bash tolerant.
llvm-svn: 134899
2011-07-11 16:21:34 +00:00
NAKAMURA Takumi 7392a5f92f test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331.
llvm-svn: 134898
2011-07-11 16:21:28 +00:00
Douglas Gregor 9824aec830 Don't complain about missing return statements for naked
functions. Fixes <rdar://problem/9731999>.

llvm-svn: 134897
2011-07-11 15:24:01 +00:00
NAKAMURA Takumi 1f2aacf276 test/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_next on mingw.
llvm-svn: 134896
2011-07-11 14:53:27 +00:00
Jay Foad 7c57be3e2b De-constify Types in StructType::get() and TargetData::getIntPtrType().
llvm-svn: 134893
2011-07-11 09:56:20 +00:00
Abramo Bagnara dd8fc04e9b Fixed PR10243.
llvm-svn: 134892
2011-07-11 08:52:40 +00:00
Abramo Bagnara 612f6dc4e9 Added removeBitWidth method.
llvm-svn: 134891
2011-07-11 08:43:20 +00:00
John McCall 178360e1cd Fix a lot of problems with the partial destruction of arrays:
- an off-by-one error in emission of irregular array limits for
   InitListExprs
 - use an EH partial-destruction cleanup within the normal
   array-destruction cleanup
 - get the branch destinations right for the empty check
Also some refactoring which unfortunately obscures these changes.

llvm-svn: 134890
2011-07-11 08:38:19 +00:00
Jay Foad 56cc1530ee De-constify Types in FunctionType::get().
llvm-svn: 134888
2011-07-11 07:56:41 +00:00
Evan Cheng 279f2907ed Match createCodeEmitter change.
llvm-svn: 134885
2011-07-11 04:24:19 +00:00
John McCall 944e502cb4 Use cached types; no functionality change.
llvm-svn: 134880
2011-07-10 20:11:30 +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
Argyrios Kyrtzidis 3a1e336b74 [arcmt] Remove redundant has_error() check.
llvm-svn: 134876
2011-07-10 18:57:18 +00:00
Argyrios Kyrtzidis 0371ececd8 [arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.
llvm-svn: 134875
2011-07-10 18:57:15 +00:00
NAKAMURA Takumi 43ab08340b test/CMakeLists.txt: clang-test may depend on llc when LLVM is built together.
llvm-svn: 134874
2011-07-10 17:45:28 +00:00
NAKAMURA Takumi 797bac56ad test/CMakeLists.txt: Fix ClangUnitTests to be built with clang-test and check-all.
llvm-svn: 134873
2011-07-10 17:45:23 +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
Chris Lattner 709af79e0a relax this test a bit to hopefully work with VC++
llvm-svn: 134870
2011-07-10 14:52:52 +00:00
Francois Pichet 4ad2a27065 Change __debugbreak signature to void __debugbreak(void); MSVC compatibility.
llvm-svn: 134869
2011-07-10 14:15:07 +00:00
Chris Lattner 18ca0475d7 implement a nice new optimization: CodeGenTypes::UpdateCompletedType
is called whenever a tag type is completed.  We previously used that
as the sign to layout the codegen representation for the tag type,
which worked but meant that we laid out *every* completed type, whether
it was used or not.

Now we just lay out the type if we've already seen it somehow else.
This means that we lay out types we've used but haven't seen a body
for, but we don't lay out tons of stuff that noone cares about.

llvm-svn: 134866
2011-07-10 06:03:22 +00:00
Chris Lattner d7c59353bd enhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
us to revert the other half of r134860.  Now things are back to a relatively tidy state.

llvm-svn: 134865
2011-07-10 05:53:24 +00:00
Chris Lattner a2673ce134 revert part of r134860, which is empirically unnecessary after the proper fix
llvm-svn: 134864
2011-07-10 05:44:18 +00:00
Chris Lattner 117b724b59 keep track of whether being in a RS_StructPointer state
caused us to skip layout out a function accurately.  If
so, flush the type cache for both the function and struct
case to ensure that any pointers to the functions get
recomputed.  This is overconservative, but with this patch
clang can build itself again.

llvm-svn: 134863
2011-07-10 05:39:13 +00:00
Chris Lattner 13ee4f4834 change EmitLValueForField to cast the returned lvalue to the right
type, even when in the struct case.  This was one root issue that was
causing type mismatches throughout the compiler.

llvm-svn: 134862
2011-07-10 05:34:54 +00:00