Commit Graph

31729 Commits

Author SHA1 Message Date
Douglas Gregor 5e6fcb108f This patch makes the string/character literal tests run in C,
C++98/03, and C++0x mode, from Craig Topper!

llvm-svn: 136443
2011-07-29 01:08:54 +00:00
Douglas Gregor f6f2810c1f Remove unused debug function
llvm-svn: 136442
2011-07-29 00:59:35 +00:00
Douglas Gregor bab6d2c2d4 In the ASTReader, replace the continuous range maps whose value types
were (Module*, Offset) with equivalent maps whose value type is just a
Module*. The offsets have moved into corresponding "Base" fields
within the Module itself, where they will also be helpful for
local->global translation (eventually).

llvm-svn: 136441
2011-07-29 00:56:45 +00:00
Peter Collingbourne 05500ba6ec Fix assertion failure in CodeGen where the input operand to an asm
instruction is tied to an output operand which is a pointer, and
the input operand is narrower than the output operand.

llvm-svn: 136438
2011-07-29 00:24:50 +00:00
Peter Collingbourne 3bc84ca376 Fix an inconsistency in Sema::ConvertArgumentsForCall in that
the callee note diagnostic was not emitted in the case where
there were too few arguments.

llvm-svn: 136437
2011-07-29 00:24:42 +00:00
Douglas Gregor 8ab4ea8571 Move the base type ID from the ASTReader's global type map into the
Module itself, which makes more sense. This pattern to be repeated
several more times.

llvm-svn: 136436
2011-07-29 00:21:44 +00:00
Chandler Carruth 605415923f Remove an unused function (found by Clang's -Wunused-function)
llvm-svn: 136434
2011-07-29 00:15:44 +00:00
Fariborz Jahanian 9f8b19e9ae objective-c: warn if implementation of a method in category
masks an existing method in its primary class, class extensions,
and primary class's non-optional protocol methods; as primary
class, or one of its subclass's will implement this method.
This warning has potential of being noisy so it has its own
group.  // rdar://7020493

llvm-svn: 136426
2011-07-28 23:19:50 +00:00
Jonathan D. Turner 269f256645 Some documentation fixes so that we are explicit about which iteration order is source-order. Also, removing unused NextInSource field of Module.
llvm-svn: 136423
2011-07-28 23:15:22 +00:00
Ted Kremenek 73665188fc Really remove FlatStoreManager and BasicStoreManager, this time from the driver. Also remove associated tests. Sorry for the messy commits; this is the result of a botched Git merge.
llvm-svn: 136422
2011-07-28 23:08:16 +00:00
Ted Kremenek 7c7ce00265 Remove flat store tests.
llvm-svn: 136421
2011-07-28 23:08:04 +00:00
Ted Kremenek e2e37b9afc Remove FlatStoreManager and BasicStoreManager. The latter has long been obsolete and the former has no had development in a long time.
llvm-svn: 136420
2011-07-28 23:08:02 +00:00
Ted Kremenek e9fda1e48a [analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs.
The motivation of this large change is to drastically simplify the logic in ExprEngine going forward.

Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will
need to be fixed over time.  There is also some possible performance regression as RemoveDeadBindings
will be called frequently; this can also be improved over time.

llvm-svn: 136419
2011-07-28 23:07:59 +00:00
Ted Kremenek e227f49302 [analyzer] fix bug in malloc checker where the tracked symbol would not properly be removed from the state.
llvm-svn: 136418
2011-07-28 23:07:51 +00:00
Ted Kremenek 9b6ce7d3fa [analyzer] add accessor to StoreRef.
llvm-svn: 136417
2011-07-28 23:07:49 +00:00
Ted Kremenek ae16d1cc67 [analyzer] Add StoreManager::includedInBindings() to to query whether a region is used in any bindings.
llvm-svn: 136416
2011-07-28 23:07:46 +00:00
Ted Kremenek 6b1a761f3e [analyzer] Add safety checking in RegionStoreManager for string literal underruns.
llvm-svn: 136415
2011-07-28 23:07:43 +00:00
Ted Kremenek 47fc816b96 [analyzer] Teach Environment to not look through MaterializeTemporaryExprs.
llvm-svn: 136414
2011-07-28 23:07:41 +00:00
Ted Kremenek 3b446215d1 [analyzer] Fix bug in ObjCMessage where casts were being incorrectly ignored.
llvm-svn: 136413
2011-07-28 23:07:38 +00:00
Ted Kremenek a644668193 [analyzer] fix handling of MaterializeTemporaryExpr by binding the result value to
the proper expression.

llvm-svn: 136412
2011-07-28 23:07:36 +00:00
Douglas Gregor caed7c6954 Introduce the local-global mapping for preprocessed entities, and use
it appropriately. Also, patch up a place where we were failing to map
local macro definition IDs into global macro definition IDs.

llvm-svn: 136411
2011-07-28 22:39:26 +00:00
Douglas Gregor 035611e655 Use local-to-global mapping appropriately for macro definitions in the ASTReader
llvm-svn: 136410
2011-07-28 22:16:57 +00:00
Douglas Gregor 074fdc5a10 Use the local -> global mapping functions for selectors more
consistently in the ASTReader.

llvm-svn: 136395
2011-07-28 21:16:51 +00:00
Douglas Gregor a3e41533f2 Teach the ASTReader to perform local and global mapping of identifier
IDs properly, although the mapping itself is still trivial.

llvm-svn: 136391
2011-07-28 20:55:49 +00:00
Anna Zaks 964f4c6147 Add a fixit for removal of unused label.
llvm-svn: 136389
2011-07-28 20:52:06 +00:00
Richard Trieu ff5dc53c7a Fix a test case that was intermittently failing. The issue was that instantiations are not stored in an order preserving structure, so the print order may be impacted. Modified test case to do two FileCheck passes to ensure that both instantiations are in the same place.
Test originially commited at r136306 and temporarily silenced at r136348.

llvm-svn: 136385
2011-07-28 20:30:10 +00:00
Caitlin Sadowski 63fa667c68 Added basic parsing for all remaining attributes, thread safety
analysis. This includes checking that the attributes are applied in the
correct contexts and with the correct number of arguments.

llvm-svn: 136383
2011-07-28 20:12:35 +00:00
Anna Zaks 67a704818b Another test case for the &/* mismatch fixit.
llvm-svn: 136380
2011-07-28 19:55:52 +00:00
Anna Zaks 3b402716b1 Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().
llvm-svn: 136379
2011-07-28 19:51:27 +00:00
Douglas Gregor e39f97c869 Make the deserialization of Sema::PendingInstantiations lazy. At this
point, ASTReader::InitializeSema() has very little interesting work,
*except* issues stemming from preloaded declarations. That's something
we'll still need to cope with.

llvm-svn: 136378
2011-07-28 19:49:54 +00:00
Anna Zaks 1b06812f46 Refactor the */& mismatch fixit generation out of SemaOverload and provide a simple conversion checking function.
llvm-svn: 136376
2011-07-28 19:46:48 +00:00
Douglas Gregor bbbc367337 Promote the deserialized PendingInstantiations vector from being a
Module member to being an ASTReader member; we want it to be
centralized for lazy deserialization.

llvm-svn: 136373
2011-07-28 19:26:52 +00:00
Douglas Gregor 4daf6a30e7 Lazily deserialize Sema::VTableUses. Plus, fix the utterly and
completely broken deserialization mapping code we had for VTableUses,
which would have broken horribly as soon as our local-to-global ID
mapping became interesting.

llvm-svn: 136371
2011-07-28 19:11:31 +00:00
Caitlin Sadowski 13d4444f96 Thread safety: Fix typo in documentation
llvm-svn: 136370
2011-07-28 18:38:36 +00:00
Douglas Gregor 1c4bfe5ac6 Make Sema::WeakUndeclaredIdentifiers lazily deserialized.
llvm-svn: 136368
2011-07-28 18:09:57 +00:00
Jonathan D. Turner ed56499503 Add missing documentation onto new member variable.
llvm-svn: 136365
2011-07-28 17:42:18 +00:00
Caitlin Sadowski aac4d21ba7 Added parsing for guarded_var, pt_guarded_var, lockable,
scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis

llvm-svn: 136364
2011-07-28 17:21:07 +00:00
Jonathan D. Turner ecc2740b32 Switch the ModuleManager over to using a FileManager and FileEntry* as part of its lookup instead of the filename. This is a more correct unique identifier, as symlinks can be handled by the FileManager.
llvm-svn: 136363
2011-07-28 17:20:23 +00:00
Douglas Gregor 72e357fc60 Make Sema::ReferencedSelectors lazily deserialized.
llvm-svn: 136357
2011-07-28 14:54:22 +00:00
Douglas Gregor 3f8f04f1e9 Move a Module's ReferencedSelectorsData into the ASTReader itself, so
that it accumulates referenced selectors from each of the modules/PCH
files as they are loaded. No actual functionality change, yet.

llvm-svn: 136356
2011-07-28 14:41:43 +00:00
Douglas Gregor dc5c958602 Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,
we could turn this into an on-disk hash table so we don't load the
whole thing the first time we need it. However, it tends to be very,
very small (i.e., empty) for most precompiled headers, so it isn't all
that interesting.

llvm-svn: 136352
2011-07-28 14:20:37 +00:00
NAKAMURA Takumi 0bbacea5b7 test/Misc/ast-dump-templates.cpp: Disable this temporarily due to unstable output.
llvm-svn: 136348
2011-07-28 12:10:58 +00:00
NAKAMURA Takumi 9b249eecca test/CodeGen/2004-03-16-AsmRegisterCrash.c: XTARGET should accept the part of triplet. ("x86" is not the part of triplet)
llvm-svn: 136346
2011-07-28 11:25:02 +00:00
John McCall fabe079108 Make a note about a missing optimization.
llvm-svn: 136340
2011-07-28 07:41:22 +00:00
John McCall b726a55729 Fix a couple of problems with initialization and assignment to
__block variables where the act of initialization/assignment
itself causes the __block variable to be copied to the heap
because the variable is of block type and is being assigned
a block literal which captures the variable.

rdar://problem/9814099

llvm-svn: 136337
2011-07-28 07:23:35 +00:00
NAKAMURA Takumi 6a662d30e4 test/CodeGen/struct-matching-constraint.c: Fixup not to emit garbage to source tree.
llvm-svn: 136333
2011-07-28 04:50:11 +00:00
Douglas Gregor 4b123cbf34 AST serialization support for the Framework in IndexHeaderMapHeader
fields of HeaderFileInfo.

llvm-svn: 136332
2011-07-28 04:50:02 +00:00
Douglas Gregor 9f93e38aaf Introduce the "-index-header-map" option, to give special semantics
for quoted header lookup when dealing with not-yet-installed
frameworks. Fixes <rdar://problem/9824020>.

llvm-svn: 136331
2011-07-28 04:45:53 +00:00
NAKAMURA Takumi 449e4c0f43 test/CodeGen/struct-init.c, struct-matching-constraint.c: Tweak commandline, or they would not be recognized as armv7 on some hosts.
llvm-svn: 136330
2011-07-28 03:53:54 +00:00
Douglas Gregor b0f3ae60cb Don't set Sema's StdNamespace or StdBadAlloc if they've already been set
llvm-svn: 136318
2011-07-28 00:57:24 +00:00
Douglas Gregor 32002197b2 Switch Sema::DynamicClasses over to LazyVector
llvm-svn: 136317
2011-07-28 00:53:40 +00:00
Argyrios Kyrtzidis 08a2bfd230 Cut down the number of open/close system calls for output files.
For PCH files, have only one open/close for temporary + rename to be safe from race conditions.
For all other output files open/close the output file directly.

Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374.

llvm-svn: 136315
2011-07-28 00:45:10 +00:00
Douglas Gregor b7098a38b3 Switch Sema::ExtVectorDecls over to LazyVector.
llvm-svn: 136314
2011-07-28 00:39:29 +00:00
Eric Christopher 7089f25dd6 Fix thinko in last checkin.
llvm-svn: 136311
2011-07-28 00:30:42 +00:00
Eric Christopher e040c27fb8 Remove the need for a header and specify a triple so that the type
sizes make sense.

llvm-svn: 136309
2011-07-28 00:28:22 +00:00
Eric Christopher 1137086e19 Fix this up for clang codegen versus llvm-gcc.
llvm-svn: 136308
2011-07-28 00:25:28 +00:00
Eric Christopher 9c8dece1b6 Fix this test to work for arm and on all platforms.
llvm-svn: 136307
2011-07-28 00:22:59 +00:00
Richard Trieu 82398f9cd6 Add template instantiations to the output of -ast-dump.
llvm-svn: 136306
2011-07-28 00:19:05 +00:00
Eric Christopher 18a53fca27 Add a triple to this test and make sure it passes on arm where it was
supposed to.

llvm-svn: 136305
2011-07-28 00:13:53 +00:00
Eric Christopher ddc29f002e Correct the triple here.
llvm-svn: 136304
2011-07-28 00:11:03 +00:00
Eric Christopher 6455d84653 This works on arm.
llvm-svn: 136303
2011-07-28 00:10:10 +00:00
Eric Christopher 1aa80a57e0 Apparently this does work on arm.
llvm-svn: 136302
2011-07-28 00:09:38 +00:00
Eric Christopher 8afab4d19e This was meant to test arm anyhow, make the registers agree with the
instruction and the architecture for which the instruction exists.

llvm-svn: 136301
2011-07-28 00:08:06 +00:00
Eric Christopher f65a0e50ff Remove this test, it's actually testing something that clang doesn't support.
llvm-svn: 136300
2011-07-28 00:03:07 +00:00
Eric Christopher 3befed71c6 XFAIL this test on ARM. Filed PR10518 to track.
llvm-svn: 136299
2011-07-27 23:48:42 +00:00
Eric Christopher 93dd260cc9 Remove the optimization option for this test.
llvm-svn: 136298
2011-07-27 23:46:26 +00:00
Eric Christopher 60962757d1 No one cares about ppc, but make this work for arm and x86 and xfail the rest.
llvm-svn: 136297
2011-07-27 23:44:48 +00:00
Chad Rosier 02cc82c234 Test for r136294.
llvm-svn: 136296
2011-07-27 23:37:42 +00:00
Chad Rosier 7742b5de70 The -fapple-kext flag was designed to "do the right thing" for building code for
use in KEXTs. However, users/Xcode still need to tweak the linker flags to do 
the right thing, and end up using -Xlinker, for example.  Instead, have the 
driver "do the right thing" when linking when -fapple-kext is present on the 
command line, and we should have Xcode use -fapple-kext instead of setting other
flags like -Xlinker -kext or -nodefaultlibs.
rdar://7809940

llvm-svn: 136294
2011-07-27 23:36:45 +00:00
Douglas Gregor bae31201bb Turn Sema::DelegatingCtorDecls into a LazyVector.
llvm-svn: 136273
2011-07-27 21:57:17 +00:00
John McCall d9bb743e0d The lock operand to an @synchronized statement is also
supposed to be a full-expression;  make it so.  In ARC, make sure
we retain the lock for the entire protected block. 

llvm-svn: 136271
2011-07-27 21:50:02 +00:00
Douglas Gregor a94a1544d8 Switch Sema::UnusedFileScopedDecls over to a LazyVector.
- Added LazyVector::erase() to support this use case.
  - Factored out the LazyDecl-of-Decls to RecordData translation in
  the ASTWriter. There is still a pile of code duplication here to
  eliminate.

llvm-svn: 136270
2011-07-27 21:45:57 +00:00
Anna Zaks 59a3c80717 Add a utility function to the Lexer, which makes it easier to find a token after the given location. (It is a generalized version of trans::findLocationAfterSemi from ArcMigrate, which will be changed to use the Lexer utility).
llvm-svn: 136268
2011-07-27 21:43:43 +00:00
Douglas Gregor eb08bd48e6 Introduce a new data structure, LazyVector, which is a vector whose
contents are lazily loaded on demand from an external source (e.g., an
ExternalASTSource or ExternalSemaSource). The "loaded" entities are
kept separate from the "local" entities, so that the two can grow
independently.

Switch Sema::TentativeDefinitions from a normal vector that is eagerly
populated by the ASTReader into one of these LazyVectors, making the
ASTReader a bit more like me (i.e., lazy).

llvm-svn: 136262
2011-07-27 20:58:46 +00:00
Peter Collingbourne 40a6ae61eb Silence gcc warning
llvm-svn: 136258
2011-07-27 20:32:00 +00:00
Peter Collingbourne 8f5f520653 Forbid address-space-qualified function types, per TR 18037
llvm-svn: 136257
2011-07-27 20:30:05 +00:00
Peter Collingbourne 78769e691a Fix TR 18037 citation in SemaType.cpp
llvm-svn: 136256
2011-07-27 20:29:53 +00:00
Peter Collingbourne e1d209911f CodeGen: rename CodeGenModule::Runtime to ObjCRuntime
llvm-svn: 136254
2011-07-27 20:29:46 +00:00
Eli Friedman 9d155aa061 Fix typo in test.
llvm-svn: 136251
2011-07-27 20:09:36 +00:00
Eli Friedman b2f3695e9a Make CodeGen for array delete involving incomplete class work without crashing. Should fix regression on g++.dg/init/delete1.C.
llvm-svn: 136241
2011-07-27 18:54:57 +00:00
Ted Kremenek 8b77fe75af Change Preprocessor::getTotalMemory() to use llvm::capacity_in_bytes().
llvm-svn: 136239
2011-07-27 18:41:23 +00:00
Ted Kremenek f1c3881109 Change PreprocessingRecord::getTotalMemory() to use llvm::capacity_in_bytes().
llvm-svn: 136238
2011-07-27 18:41:20 +00:00
Ted Kremenek ae63d101ef Change HeaderSearch::getTotalMemory() to use llvm::capacity_in_bytes().
llvm-svn: 136237
2011-07-27 18:41:18 +00:00
Ted Kremenek 43e0c4a887 Change SourceManager::getDataStructureSizes() to use llvm::capacity_in_bytes().
llvm-svn: 136236
2011-07-27 18:41:16 +00:00
Ted Kremenek 7d39c9ae36 Change ASTContext::getSideTableAllocatedMemory() to use llvm::capacity_in_bytes().
llvm-svn: 136235
2011-07-27 18:41:12 +00:00
Douglas Gregor 9125bd6a1b Modules don't require validation of the predefines buffer
llvm-svn: 136224
2011-07-27 16:30:06 +00:00
Eric Christopher 87d383b695 Make this darwin only for now while investigating to clear up x86_64
Release+Asserts linux tests.

llvm-svn: 136223
2011-07-27 16:26:09 +00:00
Douglas Gregor 9bcdc82642 Update C++0x status page to reflect support for unicode string and character literals, from Craig Topper
llvm-svn: 136216
2011-07-27 15:10:09 +00:00
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