Commit Graph

21646 Commits

Author SHA1 Message Date
Douglas Gregor cc9c92cfc2 XFAIL the -nostdinc++ test on Windows; it doesn't look like we even have the notion of separate C and C++ paths there
llvm-svn: 99422
2010-03-24 20:45:20 +00:00
Douglas Gregor b8ddb138a9 Control warnings about GNU extensions with -Wgnu, which has a subgroup
for GNU designated-initializer syntax (-Wgnu-designator).

llvm-svn: 99421
2010-03-24 20:42:51 +00:00
Douglas Gregor 64b046fce4 Implement support for -nostdc++. Fixes PR6446.
llvm-svn: 99417
2010-03-24 20:13:48 +00:00
Fariborz Jahanian c5b7bfc657 Improve diagnostics when ivar added to class
extension (radar 6812436).

llvm-svn: 99408
2010-03-24 18:08:23 +00:00
Douglas Gregor 8fdd0e8cd6 Silently drop dependent friend function template specializations,
since we have absolutely no way to match them when they are declared
nor do we have a way to represent these parsed-but-not-checked friend
declarations.

llvm-svn: 99407
2010-03-24 17:31:23 +00:00
Douglas Gregor 2538674a98 Change two class forward declarations to struct forward declarations, silencing a Clang warning
llvm-svn: 99405
2010-03-24 16:59:08 +00:00
Fariborz Jahanian 47b4629b3b Code gen for multi-dimensional dynamic allocations.
Fixes PR6641.

llvm-svn: 99404
2010-03-24 16:57:01 +00:00
Anders Carlsson e90954de64 More vtable improvements. We now compute and keep track of all vtable related information which avoids computing the same vtable layout over and over.
llvm-svn: 99403
2010-03-24 16:42:11 +00:00
John McCall 69f7586c5b Walk out of enums when determining effective context.
llvm-svn: 99391
2010-03-24 09:04:37 +00:00
John McCall 1f0479e3d7 Correct that last fixit: if the user wrote
template <> friend void foo(int);
we need to change it to
  friend void foo<>(int);
or else the user won't get the template specialization they obviously want.

llvm-svn: 99390
2010-03-24 08:27:58 +00:00
John McCall 816d75b701 Support friend function specializations.
llvm-svn: 99389
2010-03-24 07:46:06 +00:00
Douglas Gregor d6bc5e6bbc When a declaration of a function is missing an exception specification
that was present in a prior declaration, emit a warning rather than a
hard error (which we did before, and still do with mismatched
exception specifications). Moreover, provide a fix-it hint with the
throw() clause that should be added, e.g.,

t.C:10:7: warning: 'operator new' is missing exception specification
      'throw(std::bad_alloc)'
void *operator new(unsigned long sz)
      ^
                                     throw(std::bad_alloc)

As part of this, disable the warning when we're missing an exception
specification on operator new, operator new[], operator delete, or
operator delete[] when exceptions are turned off (-fno-exceptions).

Fixes PR5957.

llvm-svn: 99388
2010-03-24 07:14:45 +00:00
Anders Carlsson 67fbf9853f Use getNamedGlobal instead of getGlobalVariable. (Fixes self-host).
llvm-svn: 99385
2010-03-24 05:32:05 +00:00
Anders Carlsson 91e18c93c4 Make the license header in smmintrin.h match the other SSE headers.
llvm-svn: 99384
2010-03-24 05:31:31 +00:00
John McCall c62bb64c65 Implement a framework for the delay of arbitrary diagnostics within
templates.  So delay access-control diagnostics when (for example) the target
of a friend declaration is a specific specialization of a template.

I was surprised to find that this was required for an access-controlled selfhost.

llvm-svn: 99383
2010-03-24 05:22:00 +00:00
Douglas Gregor bcf0a47e7a When performing name lookup for the allocation or deallocation
operators, make sure that the implicitly-declared global new and
delete operators are always available. Fixes PR5904.

llvm-svn: 99382
2010-03-24 05:07:21 +00:00
Anders Carlsson b35ea55e2e More vtable work; preparations for moving over to the new vtable layout code (finally).
llvm-svn: 99381
2010-03-24 03:57:14 +00:00
Douglas Gregor 5112157958 Each non-local class instantiation is its own local instantiation
scope. Fixes PR6619.

llvm-svn: 99377
2010-03-24 01:33:17 +00:00
Anders Carlsson 95e0223baf Remove old thunks code.
llvm-svn: 99374
2010-03-24 00:57:54 +00:00
Douglas Gregor f9f54eab43 Make sure to properly track the anonymous namespace that lives inside
each namespace, even when the outer namespace has multiple
definitions. As part of this, collapsed two pointers worth of storage
(original namespace and inner anonymous namespace) into a single
pointer with a distinguishing bit, since the two are mutually
exclusive, saving a pointer per NamespaceDecl. Fixes PR6620.

llvm-svn: 99368
2010-03-24 00:46:35 +00:00
Anders Carlsson 68fdb871dc Flip the switch and use the new vtable layout code for thunks by default. Add a thunks.cpp test.
llvm-svn: 99367
2010-03-24 00:41:37 +00:00
Anders Carlsson bad991dbfd Add CodeGenFunction::GenerateThunk and implement it.
llvm-svn: 99365
2010-03-24 00:39:18 +00:00
Anders Carlsson 4a3cdf5ac7 Minor cleanup.
llvm-svn: 99364
2010-03-24 00:35:44 +00:00
Anders Carlsson 3537413c4a Remove parts of virt.cpp
llvm-svn: 99363
2010-03-24 00:32:03 +00:00
Douglas Gregor 4165bd6772 Implement computation of the final overriders for each virtual
function within a class hierarchy (C++ [class.virtual]p2).

We use the final-overrider computation to determine when a particular
class is ill-formed because it has multiple final overriders for a
given virtual function (e.g., because two virtual functions override
the same virtual function in the same virtual base class). Fixes
PR5973.

We also use the final-overrider computation to determine which virtual
member functions are pure when determining whether a class is
abstract or diagnosing the improper use of an abstract class. The
prior approach to determining whether there were any pure virtual
functions in a class didn't cope with virtual base class subobjects
properly, and could not easily be fixed to deal with the oddities of
subobject hiding. Fixes PR6631.

llvm-svn: 99351
2010-03-23 23:47:56 +00:00
Fariborz Jahanian 519675bbf5 Add some missing files to xcode project
llvm-svn: 99318
2010-03-23 20:23:06 +00:00
Rafael Espindola fa1708fdea revert 99311. Looks like it broke darwin bootstrap.
llvm-svn: 99317
2010-03-23 19:55:22 +00:00
Ted Kremenek 5921b83f54 Improve diagnostic for @property/ivar type mismatch by including the types of the
ivar and @property respectively.

llvm-svn: 99312
2010-03-23 19:02:22 +00:00
Rafael Espindola 4d3745ade6 Avoid producing implicit methods when we have a explicit template instantiation
declaration.

llvm-svn: 99311
2010-03-23 18:56:16 +00:00
Fariborz Jahanian 6c67b90752 Code gen for compound assignment of complex
types using property syntax to access setter/getters.
(also radar 7351147).

llvm-svn: 99307
2010-03-23 18:43:00 +00:00
Anders Carlsson 55e89f877c More work on thunks - don't assert if there's a variable with the same name as the thunk already.
llvm-svn: 99303
2010-03-23 18:18:41 +00:00
Fariborz Jahanian 3131496622 Patch to implement code gen. use of compound assignent on
properties of complex type. Radar 7351147.

llvm-svn: 99299
2010-03-23 18:08:50 +00:00
Anders Carlsson cd836f0b5f More thunks scaffolding.
llvm-svn: 99294
2010-03-23 17:17:29 +00:00
Anders Carlsson 5c5abad5d9 More work on thunks.
llvm-svn: 99287
2010-03-23 16:36:50 +00:00
Douglas Gregor b525ef87fc When recovering from a qualified typedef name, don't clear out the
DeclContext because we don't want a NULL DeclContext. Instead, use the
current context.

llvm-svn: 99281
2010-03-23 15:26:55 +00:00
Anders Carlsson 274fc82289 Move ThunkInfo as well.
llvm-svn: 99280
2010-03-23 15:17:13 +00:00
Anders Carlsson 67fd3a50dc Move ReturnAdjustment and ThisAdjustment out into CGVtable.h
llvm-svn: 99279
2010-03-23 15:13:06 +00:00
Duncan Sands de4fe3538a Ignore a more comprehensive set of gcc-special format attributes.
llvm-svn: 99277
2010-03-23 14:44:19 +00:00
Zhongxing Xu e248dca300 Bind the constructed object value to CXXConstructExpr.
llvm-svn: 99271
2010-03-23 09:13:17 +00:00
Zhongxing Xu b473f91498 update CMakeLists.txt
llvm-svn: 99269
2010-03-23 08:14:19 +00:00
Zhongxing Xu bf2f0d74a2 Clear the return expr GDM after using it.
llvm-svn: 99268
2010-03-23 08:09:29 +00:00
Zhongxing Xu 1ff3dcef1f Add a AggExprVisitor class. It contains lots of boiler
plate code for evaluating expressions of C++ class type.

llvm-svn: 99267
2010-03-23 07:32:14 +00:00
Anders Carlsson 995891667f Use the canonical destructor, which fixes the self-host build. Thanks to Eli for noticing.
llvm-svn: 99260
2010-03-23 05:15:24 +00:00
Zhongxing Xu 7fffbcc756 merge line.
llvm-svn: 99259
2010-03-23 05:13:26 +00:00
Daniel Dunbar 30b24e95fa Frontend: Don't free the CompilerInstance or FrontendActions when running under
-disable-free. Among other things, this fixes freeing of the LLVM module on
exit.
 - Note that this means we are disable-free'ing of a lot more stuff than we used to -- this should flush out bugs in anything left that is trying to do real work in its destructor. I did a mini-audit but '::~' is not totally uncommon.

llvm-svn: 99258
2010-03-23 05:09:16 +00:00
Daniel Dunbar cb9eaf59fb PPCallbacks: Add hook for reaching the end of the main file, and fix DependencyFile to not do work in its destructor.
llvm-svn: 99257
2010-03-23 05:09:10 +00:00
Zhongxing Xu 3c0c81a4d4 Since we now may have basicblocks with the same block is in different function,
change the block counter map from unsigned -> unsigned to 
<StackFrameContext*, unsigned> -> unsigned.

llvm-svn: 99255
2010-03-23 05:05:02 +00:00
Anders Carlsson 917229cf75 Baby steps towards making thunks be emitted from the new vtable layout code.
llvm-svn: 99254
2010-03-23 04:59:02 +00:00
Anders Carlsson 7cea12ff9b Some renames.
llvm-svn: 99253
2010-03-23 04:44:10 +00:00
Anders Carlsson af82f63b47 Always emit associated thunks when emitting the function itself. Remove getVtableAddressPoint, it's not used.
llvm-svn: 99252
2010-03-23 04:31:31 +00:00
Anders Carlsson 8841024a7c Rename MaybeEmitVtable to EmitVTableRelatedData in preparation for making it emit thunks as well.
llvm-svn: 99251
2010-03-23 04:15:00 +00:00
Anders Carlsson a864caff8c Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
llvm-svn: 99250
2010-03-23 04:11:45 +00:00
Ted Kremenek a3ab0d7666 For forward-declared static inline functions, delay CFG-based warnings until we
encounter a definition.

llvm-svn: 99243
2010-03-23 01:37:12 +00:00
Ted Kremenek bb6f5af4a4 Tweak null dereference diagnostics to give clearer diagnostics when
a null dereference results from a field access.

llvm-svn: 99236
2010-03-23 01:11:38 +00:00
Ted Kremenek 0b40532b5e Only perform CFG-based warnings on 'static inline' functions that
are called (transitively) by regular functions/blocks within a
translation untion.

llvm-svn: 99233
2010-03-23 00:13:23 +00:00
Fariborz Jahanian 00c291b012 Set the relevent attributes declared in class extension
and fix a missing diagnostics on assigning to a read-only
property. Fixes radar 7766184.

llvm-svn: 99230
2010-03-22 23:25:52 +00:00
Rafael Espindola 8d04f0604e A fixed version of r99174 which also includes a test that we emit vtables when
we see an specialization definition ever if we then see a extern template declaration.

llvm-svn: 99226
2010-03-22 23:12:48 +00:00
Ted Kremenek fe449a24a8 Disable the emission of frontend warnings (not errors) under --analyze.
Fixes <rdar://problem/7405601>.

llvm-svn: 99222
2010-03-22 22:32:05 +00:00
Ted Kremenek 28ec56d7dd Improve the diagnostics for the UndefinedAssignmentChecker when an
uninitialized value is used in the LHS of a compound assignment.

llvm-svn: 99221
2010-03-22 22:16:26 +00:00
Douglas Gregor 65f7a3f801 Comment the reasons for the strange little dance we do with the main file name for debug information
llvm-svn: 99215
2010-03-22 21:28:29 +00:00
Chris Lattner 12161d3d1a (re)implement PR6542, accepting and discarding the __gcc_tdiag__
format attribute specifier.

llvm-svn: 99213
2010-03-22 21:08:50 +00:00
Chris Lattner cb5a828a45 merge some tests.
llvm-svn: 99212
2010-03-22 21:05:15 +00:00
Chris Lattner 42ed9a6a2b rename test
llvm-svn: 99211
2010-03-22 21:02:58 +00:00
Fariborz Jahanian cf711fb353 Diagnose miuse of property dot-syntax instead of crashing.
(radar 7634653).

llvm-svn: 99210
2010-03-22 21:02:34 +00:00
Chris Lattner e783d10bc0 merge two tests.
llvm-svn: 99209
2010-03-22 21:02:14 +00:00
Chris Lattner bbd72654fb rename test.
llvm-svn: 99208
2010-03-22 21:01:10 +00:00
Chris Lattner 817b16fc40 revert r98661, gcc_tdiag is not an attribute (PR6542).
Will fix correctly now that I have a testcase

llvm-svn: 99207
2010-03-22 20:59:10 +00:00
Chris Lattner 05332cad33 move a test to a more appropriate directory
llvm-svn: 99200
2010-03-22 20:31:04 +00:00
Anders Carlsson 290c6ed7c7 More work on thunks; almost there now.
llvm-svn: 99199
2010-03-22 20:06:40 +00:00
Fariborz Jahanian a9effb55f3 Fixes access rues for ivars declared in class
implementations (radar 7547942).

llvm-svn: 99198
2010-03-22 19:04:14 +00:00
Chris Lattner c57c6792ee hopefully fix this on non-sse2 hosts. Shouldn't an apple-darwin10
triple imply sse2?

llvm-svn: 99197
2010-03-22 18:51:09 +00:00
Fariborz Jahanian 34f521ce9c Test for my last patch.
llvm-svn: 99194
2010-03-22 18:27:27 +00:00
Fariborz Jahanian d2ae2d0a2a More clean up of ivars which are either in class extensions and
implementation or synthesized into an implementation. Also,
fixes a code gen. bug when ivars are itroduced in interleaved
implementations. (related to radar 7547942).

llvm-svn: 99193
2010-03-22 18:25:57 +00:00
Kovarththanan Rajaratnam a6405f7a95 Sort calls to add_clang_library()
llvm-svn: 99191
2010-03-22 18:16:06 +00:00
Chris Lattner 7eac805bb0 fix PR6658: inline isn't a keyword in C89 mode, use __inline__ instead.
llvm-svn: 99190
2010-03-22 18:14:12 +00:00
Rafael Espindola 6f0a14f9ab revert r99174. It caused PR6677. Will try to debug why tonight.
llvm-svn: 99188
2010-03-22 18:10:25 +00:00
Anders Carlsson 7eb99a607d Add less than operators to ThisAdjustment, ReturnAdjustment and ThunkInfo. Sort the thunks before dumping them.
llvm-svn: 99184
2010-03-22 16:30:44 +00:00
Anders Carlsson 53a47bf901 Improve dumping of thunks.
llvm-svn: 99181
2010-03-22 16:10:59 +00:00
Douglas Gregor 7bf6b8a416 Use the cursor's ASTContext rather than the ASTContext computed from a
declaration, just in case invalid code makes the latter
incorrect. This may be the cause behind <rdar://problem/7777070>.

llvm-svn: 99179
2010-03-22 15:53:50 +00:00
Douglas Gregor 963809884f Fix a thinko and a typo in the delayed-diagnostic code.
llvm-svn: 99178
2010-03-22 15:47:45 +00:00
Anders Carlsson 64decd3586 We want to add all thunks, not just 'this' adjustment thunks.
llvm-svn: 99177
2010-03-22 15:47:01 +00:00
Kovarththanan Rajaratnam a0170209af Use DEFINE_SYMBOL property to control dllexport/dllimport
llvm-svn: 99176
2010-03-22 15:44:38 +00:00
Douglas Gregor 8579531684 Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.

llvm-svn: 99175
2010-03-22 15:10:57 +00:00
Rafael Espindola 4f22b4b1c7 When handling a TSK_ExplicitInstantiationDefinition after a
TSK_ExplicitInstantiationDeclaration make sure we call
MaybeMarkVirtualMembersReferenced with a method attached to the definition.

Remove the hack that forced vtable emition with declarations.

llvm-svn: 99174
2010-03-22 14:43:41 +00:00
John McCall df8b37c3f8 -Wshadow should only warn about parameter declarations when we're
entering a function or block definition, not on every single declaration.
Unfortunately we don't have previous-lookup results around when it's time
to make this decision, so we have to redo the lookup.  The alternative is
to use delayed diagnostics.

llvm-svn: 99172
2010-03-22 09:20:08 +00:00
Chandler Carruth 8455924303 Add very limited support for GCC's '-B' flag. This allows us to support unusual
toolchain configurations and is a small step toward FreeBSD support.

llvm-svn: 99159
2010-03-22 01:52:07 +00:00
Rafael Espindola 568586ff22 Fix PR6618.
If a struct has an invalid field, mark it as invalid. Also avoid producing
errors about incomplete types that are invalid.

llvm-svn: 99150
2010-03-21 22:56:43 +00:00
Douglas Gregor b41ca8f2ae Keep track of the size/modification time of each file source-location
entry in a precompiled header, so that we can detect modified files
even when we miss in the stat cache.

llvm-svn: 99149
2010-03-21 22:49:54 +00:00
Anders Carlsson 4b2411e9d2 AddThunk should take a const reference.
llvm-svn: 99140
2010-03-21 20:27:14 +00:00
Rafael Espindola 46b7987f85 Fix PR6648 by not creating a temporary with the type of a
CXXExprWithTemporaries.

Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.

llvm-svn: 99134
2010-03-21 17:11:05 +00:00
Ted Kremenek bf1dbf37e7 Delete the new visitor if an old one already exists.
llvm-svn: 99114
2010-03-21 04:38:40 +00:00
Daniel Dunbar 9b9a46c3f2 tests: Mangle '-vg' onto the end of the triple when running under valgrind, so
we can use the standard XFAIL and XTARGET to conditional tests based on
valgrind.

llvm-svn: 99089
2010-03-20 21:13:08 +00:00
Ted Kremenek b45ebee521 Don't bother running the analysis for CFG-based warnings if the
declaration is in a system header.

llvm-svn: 99087
2010-03-20 21:11:09 +00:00
Ted Kremenek 918fe8498d Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code
in Sema to selectively disable warnings as needed.

Centralizing the logic for analysis-based warnings allows us to optimize
when and how they are run.

Along the way, remove the redundant logic for the 'check fall-through' warning
for blocks; now the same logic is used for both blocks and functions.

llvm-svn: 99085
2010-03-20 21:06:02 +00:00
David Chisnall 12ae54d42f Fixed synthesizing properties declared in properties (GNU runtime).
llvm-svn: 99077
2010-03-20 19:53:29 +00:00
Ted Kremenek 3460b539df Reapply r99024 (but with the memory issue now fixed).
llvm-svn: 99064
2010-03-20 18:02:01 +00:00
Ted Kremenek 92713e7ec3 Check if a BugReporterVisitor has already been added to a BugReporterContext.
This avoids redundant diagnostics.

llvm-svn: 99063
2010-03-20 18:01:57 +00:00
Ted Kremenek c719277435 Fix use-of-invalid-memory found by Valgrind and Windows buildbots.
We were inserting a value into a std::vector<> while iterating over
it, which could cause the underlying memory to get deallocated
and reallocated.  While not the best solution, use an llvm::ImmutableList
for now as it is safely supports insertions during iteration.

llvm-svn: 99058
2010-03-20 15:45:06 +00:00
Daniel Dunbar e543a5e684 Driver: Fix thinkos that prevented Clang from picking the right deployment
target when both {MACOSX,IPHONEOS}_DEPLOYMENT_TARGET were set.

llvm-svn: 99055
2010-03-20 08:47:42 +00:00
Daniel Dunbar 6a8efa8a79 Driver: Support CC_PRINT_OPTIONS, used for logging the compile commands (in -v style) to a file.
llvm-svn: 99054
2010-03-20 08:01:59 +00:00
Daniel Dunbar 7c4de04c30 Driver: Fix -### to quote shell special characters, following gcc.
llvm-svn: 99053
2010-03-20 08:01:53 +00:00
Eric Christopher 595ecbe5c4 Add sse4.2 support to this test.
llvm-svn: 99052
2010-03-20 07:48:45 +00:00
Eric Christopher 08f135274d Add sse4.2 header and builtin support.
llvm-svn: 99051
2010-03-20 07:43:28 +00:00
Daniel Dunbar 4ff562d557 IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.

llvm-svn: 99050
2010-03-20 07:04:11 +00:00
Daniel Dunbar 4c43e31d21 Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
 - This showed up on Prolangs/cdecl.

llvm-svn: 99042
2010-03-20 05:53:45 +00:00
Daniel Dunbar e46b52a35f Driver: Fix a number of -fapple-kext issues:
- Disable RTTI.
 - Disable use of __cxa_atexit.
 - Disable unwind tables.
 - Enable freestanding mode.

Also, honor -fhosted correctly.

<rdar://problem/7515383> C++ support: -fapple-kext not honored

llvm-svn: 99041
2010-03-20 04:52:14 +00:00
Daniel Dunbar 4e3e0991e9 Revert r99024, "Augment path diagnostics to include displaying when a message
expression", statistical evidence indicates it has some kind of memory error.

llvm-svn: 99040
2010-03-20 04:28:39 +00:00
Daniel Dunbar fe06df4bf3 C++: Add support for -fno-use-cxa-atexit.
- So much typing, so little gain...

Also, rename the __cxx_global_initialization function just to match llvm-gcc.

llvm-svn: 99039
2010-03-20 04:15:41 +00:00
Daniel Dunbar 7572284f4f IRgen: Inline GenerateCXXGlobal[VarDecl]InitFunc into sole caller.
llvm-svn: 99038
2010-03-20 04:15:29 +00:00
John McCall 2d8c760df7 Implement -Wshadow for parameter declarations as well.
llvm-svn: 99037
2010-03-20 04:12:52 +00:00
Eric Christopher 86af0bae8a Add a newline at the end of the file.
llvm-svn: 99026
2010-03-20 01:19:04 +00:00
Eric Christopher 6ed351ab2d For legacy compatibility add a varargs.h header.
llvm-svn: 99025
2010-03-20 01:18:30 +00:00
Ted Kremenek 8a8e3e61aa Augment path diagnostics to include displaying when a message expression
is not evaluated because the receiver is nil.

llvm-svn: 99024
2010-03-20 01:17:30 +00:00
Daniel Dunbar ed45c3f2b9 Driver: Force joining of "-l" "foo", the linker doesn't eat that format.
<rdar://problem/7641151> clang must eat spaces after -l

llvm-svn: 99023
2010-03-20 01:12:03 +00:00
Daniel Dunbar 4ea3aea534 Driver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.
Also, simplify/fix SeparateArg::render with forced join.

llvm-svn: 99022
2010-03-20 01:12:00 +00:00
Daniel Dunbar aef1db1d71 Fix unused variable warning.
llvm-svn: 99021
2010-03-20 01:11:56 +00:00
Eric Christopher 33124e20c7 Migrate typedefs to the top level of xmmintrin.h and remove the same
one from emmintrin.h.

llvm-svn: 99020
2010-03-20 01:08:47 +00:00
Eric Christopher 576a9f2508 Add include for smmintrin.h to this test.
llvm-svn: 99019
2010-03-20 01:06:48 +00:00
Daniel Dunbar 47d25b18db Driver: Fix possible crash when targetting an unknown (unsupported) Darwin
platform, e.g. ppc.

llvm-svn: 99016
2010-03-20 00:50:21 +00:00
Douglas Gregor 3dc10b530e Optimize region-of-interest based cursor walks through the
preprocessed entities by grouping preprocessed entities by file
ID. This drastically improves performance of repeated
clang_getCursor() calls local tests, although it is a bit ugly.

llvm-svn: 99015
2010-03-20 00:41:21 +00:00
John McCall 7ec5043c2c Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap.  Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board.  We'll see how it plays out.

Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.

llvm-svn: 99012
2010-03-19 23:29:14 +00:00
Douglas Gregor 9507d46d62 Remove the capture, serialization, and deserialization of comment
ranges as part of the ASTContext. This code is not and was never used,
but contributes ~250k to the size of the Cocoa.h precompiled
header.

llvm-svn: 99007
2010-03-19 22:13:20 +00:00
Douglas Gregor 8aaca67b0a Robustify PreprocessingRecord slightly, by only creating macro
instantiations when we have the corresponding macro definition and by
removing macro definition information from our table when the macro is
undefined. 

llvm-svn: 99004
2010-03-19 21:58:23 +00:00
Douglas Gregor aae9224e49 Implement serialization and lazy deserialization of the preprocessing
record (which includes all macro instantiations and definitions). As
with all lay deserialization, this introduces a new external source
(here, an external preprocessing record source) that loads all of the
preprocessed entities prior to iterating over the entities.

The preprocessing record is an optional part of the precompiled header
that is disabled by default (enabled with
-detailed-preprocessing-record). When the preprocessor given to the
PCH writer has a preprocessing record, that record is written into the
PCH file. When the PCH reader is given a PCH file that contains a
preprocessing record, it will be lazily loaded (which, effectively,
implicitly adds -detailed-preprocessing-record). This is the first
case where we have sections of the precompiled header that are
added/removed based on a compilation flag, which is
unfortunate. However, this data consumes ~550k in the PCH file for
Cocoa.h (out of ~9.9MB), and there is a non-trivial cost to gathering
this detailed preprocessing information, so it's too expensive to turn
on by default. In the future, we should investigate a better encoding
of this information.

llvm-svn: 99002
2010-03-19 21:51:54 +00:00
Fariborz Jahanian 5140920a48 More coherent diagnostics when ivar is placed n categories.
(related to radar 7538989).

llvm-svn: 98993
2010-03-19 21:25:51 +00:00
Ted Kremenek 00da3b9a80 Teach clang_getCursorKindSpelling() about CXCursor_InvalidCode.
llvm-svn: 98982
2010-03-19 20:39:05 +00:00
Ted Kremenek e184ac5a66 Make the CIndex API more resilient to being used on invalid code.
llvm-svn: 98981
2010-03-19 20:39:03 +00:00
Ted Kremenek c517974e9e Add test case for <rdar://problem/7770737>.
llvm-svn: 98979
2010-03-19 19:45:03 +00:00
Daniel Dunbar 1c201fbf73 clang -cc1: Kill off -empty-input only, and replace with -init-only which is an
actual action.
 - This is easier to use, and more reliable for timing the thing this was
   actually meant to be useful for.

llvm-svn: 98978
2010-03-19 19:44:04 +00:00
John McCall ce5cbdc4ff Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.

llvm-svn: 98975
2010-03-19 18:53:26 +00:00
Fariborz Jahanian d5bb8cb348 Diagnose conversion of 'Class' to/from objective-c
object pointer types.
Fixes radar 7634850.

llvm-svn: 98970
2010-03-19 18:06:10 +00:00
Douglas Gregor 7dc8722bd3 Make the preprocessing record a PPCallbacks subclass itself,
eliminating the extra PopulatePreprocessingRecord object. This will
become useful once we start writing the preprocessing record to
precompiled headers.

llvm-svn: 98966
2010-03-19 17:12:43 +00:00
Douglas Gregor 7f6d60dcc2 Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record.

llvm-svn: 98963
2010-03-19 16:15:56 +00:00
Douglas Gregor fc7a4813ab Try to improve computation of the main file name for debug
information, to address recent gdb failures.

llvm-svn: 98959
2010-03-19 14:49:09 +00:00
John McCall ef01f71a5a Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643.  Patch by Mike M!

llvm-svn: 98946
2010-03-19 07:56:44 +00:00
John McCall a0296f7987 Remember the "found declaration" for an overload candidate, which is the
entity (if applicable) which was actually looked up.  If a candidate was found
via a using declaration, this is the UsingShadowDecl;  otherwise, if
the candidate is template specialization, this is the template;  otherwise,
this is the function.

The point of this exercise is that "found declarations" are the entities
we do access control for, not their underlying declarations.  Broadly speaking,
this patch fixes access control for using declarations.

There is a *lot* of redundant code calling into the overload-resolution APIs;
we really ought to clean that up.

llvm-svn: 98945
2010-03-19 07:35:19 +00:00
Douglas Gregor 51c2351d30 Fix a longstanding (but previously unknown) bug in the lazy
deserialization of precompiled headers, where the deserialization of
the source location entry for a buffer (e.g., macro instantiation
scratch space) would overwrite a one-element FileID cache in the
source manager. When tickled at the wrong time, we would return the
wrong decomposed source location and eventually cause c-index-test to
crash.

Found by dumb luck. It's amazing this hasn't shown up before.

llvm-svn: 98940
2010-03-19 06:12:06 +00:00
Douglas Gregor 5272e80ce5 Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.

llvm-svn: 98935
2010-03-19 05:22:59 +00:00
Bob Wilson 4f559a3042 Revert 98907 since it is breaking buildbots.
--- Reverse-merging r98907 into '.':
D    test/Index/c-index-getCursor-pp.c
U    tools/CIndex/CIndex.cpp

llvm-svn: 98929
2010-03-19 03:57:57 +00:00
Douglas Gregor 20004ee7d2 Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.

llvm-svn: 98907
2010-03-19 00:18:31 +00:00
John McCall a332b953e8 When elevating access along an inheritance path, initialize the computed
access to the (elevated) access of the accessed declaration, if applicable,
rather than plunking that access onto the end after we've calculated the
inheritance access.

Also, being a friend of a derived class gives you public access to its
members (subject to later modification by further inheritance);  it does
not simply ignore a single location of restricted inheritance.

Also, when computing the best unprivileged path to a subobject, preserve
the information that the worst path might be AS_none (forbidden) rather
than a minimum of AS_private.

llvm-svn: 98899
2010-03-18 23:49:19 +00:00
Douglas Gregor c6b5a3df1e For debug information, get the main file name from the source manager
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.

llvm-svn: 98898
2010-03-18 23:46:43 +00:00
Douglas Gregor e56c353eb1 Try to appease MSVC's standard library
llvm-svn: 98878
2010-03-18 21:28:30 +00:00
Douglas Gregor 5810ead358 Try to appease MSVC
llvm-svn: 98875
2010-03-18 21:25:12 +00:00
Ted Kremenek 361ffd947c Make PredefinedExpr::ComputeName() more robust to incorrect
code when we are printing the name of an Objective-C method
whose class has not been declared.  Fixes <rdar://problem/7495713>.

llvm-svn: 98874
2010-03-18 21:23:08 +00:00
Ted Kremenek abb1dddfcd Add bounds check in PCHReader. when reading source file entry record
llvm-svn: 98873
2010-03-18 21:23:05 +00:00
Fariborz Jahanian 8342e5776e Some cleanup, change diagnostic when assigning to
a property which is not lvalue.

llvm-svn: 98848
2010-03-18 18:50:41 +00:00
Douglas Gregor 78ae2481b6 Explicitly link macro instantiations to macro definitions in the
preprocessing record. Use that link with clang_getCursorReferenced()
and clang_getCursorDefinition() to match instantiations of a macro to
the definition of the macro.

llvm-svn: 98842
2010-03-18 18:23:03 +00:00
Douglas Gregor 06d6d32762 Expose macro definitions as CIndex cursors. These can still only be
generated by clang_annotateTokens().

llvm-svn: 98837
2010-03-18 18:04:21 +00:00
Douglas Gregor 065f8d11ca Introduce the notion of a "preprocessing record", which keeps track of
the macro definitions and macro instantiations that are found
during preprocessing. Preprocessing records are *not* generated by
default; rather, we provide a PPCallbacks subclass that hooks into the
existing callback mechanism to record this activity.

The only client of preprocessing records is CIndex, which keeps track
of macro definitions and instantations so that they can be exposed via
cursors. At present, only token annotation uses these facilities, and
only for macro instantiations; both will change in the near
future. However, with this change, token annotation properly annotates
macro instantiations that do not produce any tokens and instantiations
of macros that are later undef'd, improving our consistency.

Preprocessing directives that are not macro definitions are still
handled by clang_annotateTokens() via re-lexing, so that we don't have
to track every preprocessing directive in the preprocessing record.

Performance impact of preprocessing records is still TBD, although it
is limited to CIndex and therefore out of the path of the main compiler.

llvm-svn: 98836
2010-03-18 17:52:52 +00:00