Commit Graph

31791 Commits

Author SHA1 Message Date
Anna Zaks 59546b8f79 Static Analyzer diagnostics visualization: when the last location on a path is end of the function, the arrow should point to the closing brace, not the statement before it. Patch by Ted Kremenek.
llvm-svn: 136761
2011-08-03 01:57:49 +00:00
John McCall 625ed88f07 When rewriting a call to a K&R function to lead to a well-prototyped
function, be sure to drop parameter attributes when dropping their
associated arguments.  Patch by Aaron Landwehr!

llvm-svn: 136753
2011-08-03 00:43:55 +00:00
Eli Friedman b3bfd84ebb A couple fixes for preprocessor expressions:
1. Be more tolerant of comments in -CC (comment-preserving) mode.  We were missing a few cases.

2. Make sure to expand the second FOO in "#if defined FOO FOO".  (See also
r97253, which addressed the case of "#if defined(FOO FOO".)

Fixes PR10286.

llvm-svn: 136748
2011-08-03 00:04:13 +00:00
Rafael Espindola 11d994b769 Implements alignment for long long and double types in va_arg on ARM AAPCS.
Patch by Jim (Ningjie) Chen.

llvm-svn: 136734
2011-08-02 22:33:37 +00:00
Rafael Espindola 56a7dab0c4 Update for LLVM change in PassManagerBuilder.
llvm-svn: 136728
2011-08-02 21:51:02 +00:00
Chris Lattner f51dae0378 disable array bounds overflow warning for cases where an array
has a single element.  This disables the warning in cases where
there is a clear bug, but this is really rare (who uses arrays
with one element?) and it also silences a large class of false
positive issues with C89 code that is using tail padding in structs.

A better version of this patch would detect when an array is in
a tail position in a struct, but at least patch fixes the huge
false positives that are hitting postgres and other code.

llvm-svn: 136724
2011-08-02 21:44:23 +00:00
Chad Rosier 7b15b2e828 Fix cmake for r136702 (at least for the most part). Chandler has been kind
enough to offer to investigate the underlying issue.  Thanks to Doug for his
assistance as well.

llvm-svn: 136719
2011-08-02 20:44:34 +00:00
Fariborz Jahanian c7c346fd13 objective-c rewrite: Fixes rewriting of objective-c collection
statement inside a block. // rdar://9878420

llvm-svn: 136717
2011-08-02 20:28:46 +00:00
Chad Rosier edbb3ef902 Temporarily revert parts of r136702 to make cmake builds happy.
Someone with more cmake experience want to throw me a bone? :)

llvm-svn: 136709
2011-08-02 18:33:29 +00:00
Douglas Gregor 3b65ed0a5c Change the hashing function for DeclContext lookup within an AST file
by eliminating the type ID from constructor, destructor, and
conversion function names. There are several reasons for this change:
  - A given type (say, int*) isn't guaranteed to have a single, unique
  type ID within a chain of PCH files. Hence, we could end up hashing
  based on the wrong type ID, causing name lookup to fail.

  - The mapping from types back to type IDs required one DenseMap
  entry for every type that was ever deserialized, which was an
  unacceptable cost to support just the name lookup of constructors,
  destructors, and conversion functions. Plus, this mapping could
  never actually work with chained or multiple PCH, based on the first
  bullet.

Once we have eliminated the type from the hash function, these
problems go away, as does my horrible "reverse type remap" hack, which
was doomed from the start (see bullet #1 above) and far too
complicated. 

However, note that removing the type from the hash function means that
all constructors, destructors, and conversion functions have the same
hash key, so I've updated the caller to double-check that the
declarations found have the appropriate name.

llvm-svn: 136708
2011-08-02 18:32:54 +00:00
Ted Kremenek 9a2001a817 [analyzer] Drastically simplify ExprEngine::VisitInitListExpr() by assuming all initializer expressions have already been evaluated.
llvm-svn: 136706
2011-08-02 18:27:05 +00:00
Eli Friedman b23533db13 PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.
llvm-svn: 136703
2011-08-02 18:05:30 +00:00
Chad Rosier be10f9853c 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.
rdar://9575623

llvm-svn: 136702
2011-08-02 17:58:04 +00:00
Jonathan D. Turner db1c9e3226 Following up the earlier refactoring/cleanup work by fixing up how we manage the virtual files the ASTReader has to handle. Specifically, this occurs when the reader is reading AST files that were created in memory and not written to disk. For example, when a user creates a chained PCH using command line flags. These virtual files are stored in MemoryBuffers in ChainIncludeSource.cpp, and then read back in by the ASTReader. This patch moves the management of these buffers into the ModuleManager, so that it becomes the authority on where these buffers are located.
llvm-svn: 136697
2011-08-02 17:40:32 +00:00
Anna Zaks 9ab728bb05 KeychainAPI checker: only check the paths on which the allocator function returned noErr. (+ minor cleanup)
llvm-svn: 136694
2011-08-02 17:11:03 +00:00
Douglas Gregor 5204bded1d Implement a proper local -> global type ID remapping scheme in the AST
reader. This scheme permits an AST file to be loaded with its type IDs
shifted anywhere in the type ID space. 

At present, the type indices are still allocated in the same boring
way they always have been, just by adding up the number of types in
each PCH file within the chain. However, I've done testing with this
patch by randomly sliding the base indices at load time, to ensure
that remapping is occurring as expected. I may eventually formalize
this in some testing flag, but loading multiple (non-chained) AST
files at once will eventually exercise the same code.

There is one known problem with this patch, which involves name lookup
of operator names (e.g., "x.operator int*()") in cases where multiple
PCH files in the chain. The hash function itself depends on having a
stable type ID, which doesn't happen with chained PCH and *certainly*
doesn't happen when sliding type IDs around. We'll need another
approach. I'll tackle that next.

llvm-svn: 136693
2011-08-02 16:26:37 +00:00
Douglas Gregor 1cc9c0675c Add a debugging dump for Module (also emitted as part of the AST
reader statistics), to show the local-to-global mappings. The only
such mapping we have (at least, for now) is for source location
offsets.

llvm-svn: 136687
2011-08-02 11:12:41 +00:00
Douglas Gregor 006599011d Generalize the module offset map to include mapping information for
all of the kinds of IDs that can be offset. No effectively
functionality change; this is preparation for adding remapping for
IDs.

llvm-svn: 136686
2011-08-02 10:56:51 +00:00
Benjamin Kramer 3c05b7c161 Make helper functions static.
llvm-svn: 136679
2011-08-02 04:50:49 +00:00
Richard Trieu cfc491d308 Fix formatting of SemaExpr.cpp, mainly fixing lines greater than 80 characters.
No functional change.

llvm-svn: 136678
2011-08-02 04:35:43 +00:00
Bob Wilson 8e2b75dbad Revert "Re-enable byval for ARM in clang. rdar://problem/7662569"
This reverts commit 67d097e1232b7d66f58989c16a45b8a11721f76e.
We found a miscompile with ARM byval, which is still being investigated.
In the meantime, this works around the problem by disabling ARM byval.

Conflicts:
	lib/CodeGen/TargetInfo.cpp

llvm-svn: 136662
2011-08-01 23:39:04 +00:00
Anna Zaks 15f496c118 Add a skeleton for the Keychain Services API Checker. Register it as OSX experimental for now. Note, the checker still does not handle tracking of escaped values, taking into account the return value of the allocator functions, nor the actual bug reporting..
llvm-svn: 136659
2011-08-01 22:40:01 +00:00
Fariborz Jahanian e1506cbfda objective-c: reverse patch for // rdar://9818354
llvm-svn: 136658
2011-08-01 22:39:49 +00:00
Akira Hatanaka fb1d9f325c Implement MipsABIInfo::EmitVAArg. This fix enables clang to complete compilation
without bailing out when va_arg is an aggregate expression. However, 
alignment checking needs to be added in isSafeToEliminateVarargsCast in
InstCombineCalls.cpp in order to produce correct mips code (see link below).

http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/042047.html

llvm-svn: 136647
2011-08-01 20:48:01 +00:00
Chad Rosier 96d690ccdf Driver: When compiling i386 -fapple-kext code, we fallback to llvmgcc.
Unfortunately, llvmgcc doesn't always work when writing temporary output to
/dev/null.  Therefore, create a temp file that is later deleted.
rdar://9837692

llvm-svn: 136644
2011-08-01 19:58:48 +00:00
Akira Hatanaka df425dbf04 Pass records with non-trivial destructors or constructors indirectly.
llvm-svn: 136630
2011-08-01 18:09:58 +00:00
David Chisnall 28dc7f94f8 Fix linkage type for tentative definition of ivar offset variables (GNUstep runtime)
llvm-svn: 136628
2011-08-01 17:36:53 +00:00
Douglas Gregor 2df17cbeeb Move the serialization of the MODULE_OFFSET_MAP out of the source-manager-writing code and into the general chained-PCH writing code
llvm-svn: 136624
2011-08-01 16:54:33 +00:00
Douglas Gregor 5a1797c67b Rename the AST file's SOURCE_LOCATION_MAP to MODULE_OFFSET_MAP, to indicate the greater role it will soon play in remapping.
llvm-svn: 136619
2011-08-01 16:01:55 +00:00
Fariborz Jahanian c81decc0f5 Test for // rdar://9846759
llvm-svn: 136602
2011-07-31 20:27:31 +00:00
Benjamin Kramer 558e37858b Remove dead code flagged by GCC's -Wunused-but-set-variable.
llvm-svn: 136581
2011-07-31 01:06:41 +00:00
Argyrios Kyrtzidis 582ae9916a Not sure why we bother updating FunctionDecl's EndRangeLoc in FunctionDecl::setParams.
EndRangeLoc should always be set to at least the ending paren or brace.

llvm-svn: 136573
2011-07-30 17:23:28 +00:00
Argyrios Kyrtzidis 4c6efa62e0 [libclang] Annotation of parameters that got default args from a previous declarations was
broken because the end location of the parameter was the end location of the default arg,
resulting in a source range that could begin in one file and end in another.

llvm-svn: 136572
2011-07-30 17:23:26 +00:00
Douglas Gregor 5ff4e98c61 Introduce a Fix-It for the "missing sentinel" warning, adding an
appropriate sentinel at the end of the argument list. Also, put the
sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>.

llvm-svn: 136566
2011-07-30 08:57:03 +00:00
Douglas Gregor 4ecb7209bf Add code completion to produce "else" blocks after an "if"
statement. Fixes <rdar://problem/9229438>.

llvm-svn: 136564
2011-07-30 08:36:53 +00:00
Douglas Gregor 0c50531a46 When producing code completion results for variadic macros, fold the
variadic bit (", ..." or ", args...") into the prior placeholder, like
we do with functions and methods. Fixes <rdar://problem/9740808>.

llvm-svn: 136563
2011-07-30 08:17:44 +00:00
Douglas Gregor 8f08d74ee5 Add the various parameter-passing keywords for Distributed Objects
(such as in, inout, byref, and oneway) to code completion
results. Fixes <rdar://problem/8844158>.

llvm-svn: 136562
2011-07-30 07:55:26 +00:00
Douglas Gregor 6d40c57009 Fix a thinko in my __is_empty/__is_pod commit.
llvm-svn: 136561
2011-07-30 07:08:19 +00:00
Douglas Gregor df445f0ae1 Turn off __has_feature(is_empty) and __has_feature(is_pod) if the
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.

llvm-svn: 136560
2011-07-30 07:01:49 +00:00
Douglas Gregor 2c595adf2e When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.

llvm-svn: 136559
2011-07-30 06:55:39 +00:00
Douglas Gregor 7e1eb935db When complaining about a non-POD second argument to va_arg, use a
special diagnostic for ARC ownership-qualified types. We wouldn't want
to expose Objective-C programmers to the term "POD", would we? Fixes
<rdar://problem/9772982>.

llvm-svn: 136558
2011-07-30 06:45:27 +00:00
Douglas Gregor d8575e1e1d Use the "Bar.h" -> <Foo/Bar.h> remapping for index header maps only as
a fallback, if normal header search fails. Another attempt at
<rdar://problem/9824020>.

llvm-svn: 136557
2011-07-30 06:28:34 +00:00
Fariborz Jahanian d560ed7f1b objc rewriter - my last patch was not quite right.
Fixed again. // rdar://9846759

llvm-svn: 136550
2011-07-30 01:21:41 +00:00
Fariborz Jahanian bce9ee2ae6 objc rewriter - set the flag passed to _Block_object_assign/_Block_object_dispose correctly
for copying a captured block object. // rdar://9846759

llvm-svn: 136549
2011-07-30 01:07:55 +00:00
Douglas Gregor d451ea9ca9 Teach the ASTImporter to cope with cases where we have already
imported a forward declaration, but later the full definition of the
same entity becomes available. When this happens, import the definition.

llvm-svn: 136537
2011-07-29 23:31:30 +00:00
Eric Christopher b081ba651c Add support for the 'Q' arm memory constraint.
Fixes rdar://9866494

llvm-svn: 136524
2011-07-29 21:20:35 +00:00
Ted Kremenek 67d7136f26 [analyzer] Remove recursive visitation in ExprEngine::VisitDeclStmt because it isn't needed anymore.
llvm-svn: 136522
2011-07-29 21:18:41 +00:00
Ted Kremenek e905c68cbd [analyzer] Remove recursive visitation in ExprEngine::VisitCompoundLiteralExpr because it isn't needed anymore.
llvm-svn: 136521
2011-07-29 21:18:39 +00:00
Ted Kremenek dc492c29f7 [analyzer] Remove recursive visitation in ExprEngine::VisitCastExpr because it isn't needed anymore.
llvm-svn: 136520
2011-07-29 21:18:37 +00:00
Ted Kremenek cf36b0c64d [analyzer] Remove recursive visitation in ExprEngine::VisitObjCForCollectionStmt because it isn't needed anymore.
llvm-svn: 136519
2011-07-29 21:18:35 +00:00
Ted Kremenek 65eefed6c6 [analyzer] Remove explicit argument processing from ExprEngine::VisitObjCMessage() since it is no longer needed.
llvm-svn: 136518
2011-07-29 21:18:31 +00:00
Ted Kremenek 4e577fae2c [analyzer] Remove recursive visitation in ExprEngine::VisitLValObjCIvarRefExpr because it isn't needed anymore.
llvm-svn: 136517
2011-07-29 21:18:28 +00:00
Ted Kremenek 003ec6ff83 [analyzer] tighten up ExprEngine::VisitObjCAtSynchronizationStmt().
llvm-svn: 136516
2011-07-29 21:18:26 +00:00
Ted Kremenek f8c0bcf101 [analyzer] Remove recursive visitation in ExprEngine::VisitObjCPropertyRefExpr because it isn't needed anymore.
llvm-svn: 136515
2011-07-29 21:18:24 +00:00
Ted Kremenek 298e5cc7f4 [analyzer] Remove recursive visitation in ExprEngine::VisitCallExpr because it isn't needed anymore.
llvm-svn: 136514
2011-07-29 21:18:22 +00:00
Ted Kremenek 22a1e65532 [analyzer] Remove recursive visitation in ExprEngine::VisitMemberExpr because it isn't needed anymore.
llvm-svn: 136513
2011-07-29 21:18:19 +00:00
Ted Kremenek db835cc213 [analyzer] Remove recursive visitation in ExprEngine::VisitLvalArraySubscriptExpr() because it is no longer needed.
llvm-svn: 136512
2011-07-29 21:18:17 +00:00
Douglas Gregor f4016fdf71 On Darwin, libc++ may be installed alongside the compiler in
lib/c++/v1. Look there first, before falling back to the normal
/usr/include/c++/v1. <rdar://problem/9866149>

llvm-svn: 136507
2011-07-29 20:21:18 +00:00
Jonathan D. Turner 10d52011d8 Renamed Loaded member to ImportedBy, as it's easier to read. Added another set to represent the modules a module imports.
llvm-svn: 136476
2011-07-29 18:09:09 +00:00
Douglas Gregor 9ea0537d23 Add a missing \endcode for Doxygen
llvm-svn: 136469
2011-07-29 17:35:37 +00:00
Jay Foad 5709f7c5f7 Remove some unnecessary single element array temporaries.
llvm-svn: 136461
2011-07-29 13:56:53 +00:00
Argyrios Kyrtzidis 1fa8b4b204 Make DiagnosticErrorTrap keep a count of the errors that occurred so multiple
DiagnosticErrorTraps can be composed (e.g. a trap inside another trap).

Fixes http://llvm.org/PR10462 & rdar://9852007.

llvm-svn: 136447
2011-07-29 01:25:44 +00:00
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