Commit Graph

16654 Commits

Author SHA1 Message Date
Daniel Dunbar cda8eb7a21 Revert r117678, "Qualified 'id' should implement all of static class type's", it breaks things.
llvm-svn: 117829
2010-10-30 19:22:48 +00:00
John McCall c273f24196 Better solution: calculate the visibility of functions and variables
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations.  Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.

More of rdar://problem/8613093

llvm-svn: 117781
2010-10-30 11:50:40 +00:00
John McCall 36cd5cc150 GCC faithfully calculates visibility for variables independently of
whether it's a declaration or not, then ignores that information for
declarations unless it was explicitly given.  It's not totally clear
how that should be mapped into a sane system, but make an effort.

llvm-svn: 117780
2010-10-30 09:18:49 +00:00
Benjamin Kramer 7d11382b8c Use the expanded form of S_ISREG. Hopefully this unbreaks the MSVC build.
llvm-svn: 117779
2010-10-30 08:28:42 +00:00
Nick Lewycky b9b3927356 Preserve the template type parameter name when instantiating a templace.
Fixes PR8489.

llvm-svn: 117776
2010-10-30 06:48:20 +00:00
Chris Lattner 5c0b40528d Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423

llvm-svn: 117775
2010-10-30 05:14:06 +00:00
Douglas Gregor d58530422f Flush statements after writing each DECL_CXX_BASE_SPECIFIERS node
llvm-svn: 117770
2010-10-30 04:28:16 +00:00
Argyrios Kyrtzidis 93513155e7 Don't remove the init expression from the initializer list if it had a semantic error.
We already flag the error with InitListChecker's hadError and we mess up the AST unnecessarily.
Fixes rdar://8605381.

llvm-svn: 117760
2010-10-30 01:06:26 +00:00
Douglas Gregor 5ef9e33137 Make the deserialization of macro definitions lazy, so that we can
load identifiers without loading their corresponding macro
definitions. This is likely to improve PCH performance slightly, and
reduces deserialization stack depth considerably when using
preprocessor metaprogramming.

llvm-svn: 117750
2010-10-30 00:23:06 +00:00
John McCall 6a16b2f10c When list-initializing a vector, try to copy-initialize from vectors instead
of descending into the subelements.

rdar://problem/8345836

llvm-svn: 117749
2010-10-30 00:11:39 +00:00
Dan Gohman e89c04e518 Don't test isRegularFile before calling eraseFromDisk, since
eraseFromDisk does the same check. This avoids a stat call
in the common case.

llvm-svn: 117744
2010-10-29 23:26:14 +00:00
Dale Johannesen 182addf159 Handle Type.h a better way.
llvm-svn: 117743
2010-10-29 23:24:33 +00:00
Fariborz Jahanian e5c1bda4d1 Improve diagnostics reporting of un-implemented
methods in protocols when protocols are in system
headers and thus ignored. //rdar: //8227199

llvm-svn: 117739
2010-10-29 23:20:05 +00:00
Dale Johannesen 7d3dfc0622 Generate bitcasts going in and out of MMX parameters
in asm's.  PR 8501, 8602988.
I don't like including Type.h where it is; the idea was
to get references to X86_MMXTy out of the common code.
Maybe there's a better way?

llvm-svn: 117736
2010-10-29 23:12:32 +00:00
Dan Gohman e9e32dcb48 Use CodeGenFunction's getContext(), for consistency.
llvm-svn: 117734
2010-10-29 22:47:07 +00:00
Douglas Gregor d4c5ed038c Make the deserialization of C++ base class specifiers lazy, improving
the performance of C++ PCH and reducing stack depth in the reader.

llvm-svn: 117732
2010-10-29 22:39:52 +00:00
John McCall 37bb6c9832 Restore r117644, this time properly ignoring -fvisibility and type visibility
for namespace-scope variable declarations.

Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117729
2010-10-29 22:22:43 +00:00
Rafael Espindola acc8709850 Switch to using the integrated assembler by default on x86 and x86-64 ELF
systems.

llvm-svn: 117697
2010-10-29 20:14:02 +00:00
Fariborz Jahanian 2129ccf512 If Consumer object failed to create due to some
user error, fail gracefully. Fixes
pr8508.

llvm-svn: 117692
2010-10-29 19:49:13 +00:00
Fariborz Jahanian 531a3707a9 Qualified 'id' should implement all of static class type's
protocols, including those added to class, super class
and categories; otherewise issue a warning. This fixes
pr8453.

llvm-svn: 117678
2010-10-29 18:26:21 +00:00
Devang Patel 31d1e2153f After processing named unions do not fall through to handle anonymous unions.
This is tested by funcargs.exp in gdb testsuite.

llvm-svn: 117659
2010-10-29 16:21:19 +00:00
Argyrios Kyrtzidis 706bbf84d8 When doing name lookup for members don't look into global/namespace scope.
Better performance and fixes rdar://8603569.

llvm-svn: 117656
2010-10-29 16:12:50 +00:00
Daniel Dunbar df8792128f Revert r117644, "Apply visibility in IR gen to variables that are merely
declared", it breaks things.

llvm-svn: 117653
2010-10-29 15:19:36 +00:00
John McCall 077dc60540 Don't assert on attempts to throw 'bool'. I wonder if in the history of C++
anyone has ever intentionally done this outside of a compiler test case.

llvm-svn: 117645
2010-10-29 08:14:02 +00:00
John McCall 4af6bf1fdc Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.

llvm-svn: 117644
2010-10-29 07:49:41 +00:00
Marcin Swiderski a7d84a7615 Added CFGTerminator class, that holds information about CFGBlock terminator statement.
llvm-svn: 117642
2010-10-29 05:21:47 +00:00
Charles Davis 31575f758c Add a hook to the CXXABI object to get the default method calling convention.
This isn't used yet, because someone more experienced than I needs to look
at the type system about gutting getCanonicalCallConv().

llvm-svn: 117638
2010-10-29 03:25:11 +00:00
Ted Kremenek 310c5a8e31 Don't flag idempotent '+' or '-' warnings for pointer arithmetic (typically false positives).
Fixes <rdar://problem/8601243>.

llvm-svn: 117635
2010-10-29 01:06:54 +00:00
John McCall 033caa5895 When computing the visibility of a class member, calculate the visibility
of its context without considering global settings like -fvisibility=hidden.
Fixes PR8492.

llvm-svn: 117628
2010-10-29 00:29:13 +00:00
Devang Patel ed23f18d7e Basic types are language defined builtins. They are always defined at top most level.
llvm-svn: 117613
2010-10-28 22:03:20 +00:00
John McCall 565141612f When emitting l-values for bool non-__block decl references, make a pointer
using the memory type;  fixes an assert.

Fixes rdar://problem/8605032

llvm-svn: 117610
2010-10-28 21:37:57 +00:00
Daniel Dunbar a78e589b08 Driver/IA: Ignore -L for now, which users shouldn't be using for semantic effect.
llvm-svn: 117600
2010-10-28 20:36:23 +00:00
Devang Patel faadd7b72d Directly use NamespaceDecl->getLocation() to find the source file.
llvm-svn: 117576
2010-10-28 19:12:46 +00:00
John McCall 62b6862c5e Don't apply -fvisibility-inlines-hidden to extern templates.
Part 2 of rdar://problem/8595231

llvm-svn: 117567
2010-10-28 18:10:36 +00:00
Devang Patel 8e0073008a Stay within 80 columns.
llvm-svn: 117561
2010-10-28 17:27:32 +00:00
Douglas Gregor 16896c45f3 Simplify ASTUnit's internal timers, by not trying to keep a pile of
timers to be dumped whenever the ASTUnit is destroyed. Instead, just
print the time elapsed for each operation after we perform the
operation.

llvm-svn: 117550
2010-10-28 15:44:59 +00:00
Argyrios Kyrtzidis 440ea32773 Initialize the ASTMutationListener. Thanks goes to Abramo Bagnara!
llvm-svn: 117541
2010-10-28 09:29:35 +00:00
Argyrios Kyrtzidis d9f526fc2e Switch case IDs conflict between chained PCHs; since there is no need to be global, make them local to a decl.
llvm-svn: 117540
2010-10-28 09:29:32 +00:00
John McCall 9de9160d55 Implement an indirect-goto optimization for goto *&&lbl and respect this
in the scope checker.  With that done, turn an indirect goto into a
protected scope into a hard error;  otherwise IR generation has to start
worrying about declarations not dominating their scopes, as exemplified
in PR8473.

If this really affects anyone, I can probably adjust this to only hard-error
on possible indirect gotos into VLA scopes rather than arbitrary scopes.
But we'll see how people cope with the aggressive change on the marginal
feature.

llvm-svn: 117539
2010-10-28 08:53:48 +00:00
Argyrios Kyrtzidis 47102d885d Remove an assertion that hit on legitimate cases. A redeclaration may have location before the
first one if the redeclaration comes from a friend decl.

llvm-svn: 117537
2010-10-28 07:38:53 +00:00
Argyrios Kyrtzidis 01c2df45ff Use the ASTMutationListener to track when a named decl gets added to a DeclContext,
meaning we need to rewrite its name lookup table in a chained PCH.

llvm-svn: 117536
2010-10-28 07:38:51 +00:00
Argyrios Kyrtzidis ef80a01d04 Properly add chained template specializations.
llvm-svn: 117535
2010-10-28 07:38:47 +00:00
Argyrios Kyrtzidis 4729972c0f Fix the re-serializing decls in a chained PCH mechanism.
llvm-svn: 117534
2010-10-28 07:38:45 +00:00
Argyrios Kyrtzidis 402dbbbd66 Use the ASTMutationListener to track added template specializations in a chained PCH.
llvm-svn: 117533
2010-10-28 07:38:42 +00:00
John McCall 2efaf11695 Abandon the type-visibility optimization for functions. GCC doesn't do it,
and it's too much trouble to push for.  Fixes PR8478.

llvm-svn: 117532
2010-10-28 07:07:52 +00:00
John McCall b7139c43ae When computing visibility, use the latest declaration's explicit visibility
attribute.

Part of rdar://problem/8595231

llvm-svn: 117526
2010-10-28 04:18:25 +00:00
John McCall 071df46743 Implement the newest status quo for method override checking. The idea now
is that we need more information to decide the exact conditions for whether
one ObjCObjectPointer is an acceptable return/parameter override for another,
so we're going to disable that entire class of warning for now.  The
"forward developement" warning category, -Wmethod-signatures, can receive
unrestricted feature work, and when we're happy with how it acts, we'll
turn it on by default.

This is a pretty conservative change, and nobody's totally content with it.

llvm-svn: 117524
2010-10-28 02:34:38 +00:00
Ted Kremenek 0abd85c7ae Don't warn about unamed bitfield ivars in the ObjCUnusedIvarsChecker. Fixes <rdar://problem/8481311>.
llvm-svn: 117521
2010-10-28 02:16:22 +00:00
Dale Johannesen d2b2ad093c Ahem. Add rest of D and Q registers to ARM inline asm handling.
llvm-svn: 117517
2010-10-28 01:05:37 +00:00
Dale Johannesen 7fd51bc1e6 Add D and Q register names to ARM inline asm handling.
No aliasing is needed, these work as given in the BE.

llvm-svn: 117508
2010-10-27 23:34:42 +00:00
Devang Patel 1bee63f325 Fix context info for enums.
Radar 8595129

llvm-svn: 117507
2010-10-27 23:23:58 +00:00
John McCall ff78c8a3ef Don't override explicit visibility attributes on class members with
type-based visibility.

llvm-svn: 117500
2010-10-27 22:31:22 +00:00
Douglas Gregor 7e8c4e061b Make AST deserialization for class template specializations lazier, by
not loading the specializations of a class template until some AST
consumer needs them.

llvm-svn: 117498
2010-10-27 22:21:36 +00:00
John McCall 3a7f6926d1 Restore r117403 (fixing IR gen for bool atomics), this time being less
aggressive about the form we expect bools to be in.  I don't really have
time to fix all the sources right now.

llvm-svn: 117486
2010-10-27 20:58:56 +00:00
Fariborz Jahanian dd6907bd77 Decay array/function types of a statement-expression.
// rdar: // 8600553.

llvm-svn: 117484
2010-10-27 20:44:00 +00:00
Douglas Gregor e0fb32c261 Lazily load the next friend in the chain of FriendDecls, to eliminate
some excessive recursion and deserialization.

llvm-svn: 117480
2010-10-27 20:23:41 +00:00
Fariborz Jahanian 5701585780 patch to do array-to-pointer conversion in a
statement-expression. // rdar: //8600553

llvm-svn: 117479
2010-10-27 20:10:28 +00:00
Douglas Gregor 417e87cb96 Lazily load the "next" namespace in the chain of NamespaceDecls, to
eliminate some excessive recursion and deserialization.

llvm-svn: 117476
2010-10-27 19:49:05 +00:00
Douglas Gregor f5a1854655 Introduce libclang-level options for C++ precompiled preambles,
separating out chaining precompiled preambles from non-chaining ones.

llvm-svn: 117457
2010-10-27 17:24:53 +00:00
Rafael Espindola 9d798a07e4 Revert r117403 as it caused PR8480.
llvm-svn: 117456
2010-10-27 17:13:49 +00:00
Fariborz Jahanian 1518a5eca7 Do the guarding of instantiated static data members
on if its linkage is weak. Currently this is the
case but may change in the future. (part of radar 
8562966).

llvm-svn: 117452
2010-10-27 16:21:54 +00:00
Douglas Gregor af1daa9854 Remove redundant test
llvm-svn: 117446
2010-10-27 14:20:34 +00:00
Anders Carlsson b00c2144b3 Also devirtualize calls to a member functions where the containing class has been marked final.
llvm-svn: 117445
2010-10-27 13:34:43 +00:00
Anders Carlsson a7911fa3d7 If a virtual member function has the 'final' attribute, we can devirtualize calls to it.
llvm-svn: 117444
2010-10-27 13:28:46 +00:00
Chandler Carruth 00426b4876 Add helper for extracting the CXXRecordDecl for the implicit argument to
a member call expression. This has proved to be a common pattern for users of
RecursiveASTVisitor.

llvm-svn: 117439
2010-10-27 06:55:41 +00:00
Zhongxing Xu d95ccd58a9 If visiting RHS causes us to finish 'Block', e.g. the RHS is a StmtExpr
containing a DoStmt, and the LHS doesn't create a new block, then we should
return RBlock.  Otherwise we'll incorrectly return NULL.

Also relax an assertion in VisitWhileStmt(). Reset 'Block' when it is finished.

llvm-svn: 117436
2010-10-27 03:23:10 +00:00
John McCall d37d35b571 Avoid calculating linkage until the more obvious checks have run when
deciding whether to queue a decl for unused-declaration warnings.

llvm-svn: 117431
2010-10-27 01:41:35 +00:00
John McCall 6fe024052b Don't compute linkage for a declaration as part of the #pragma weak
forward-declaration support unless there's really a mapping for that
name.

llvm-svn: 117426
2010-10-27 00:59:00 +00:00
Dan Gohman 2f76cd756a Add support for code completion on stdin.
llvm-svn: 117414
2010-10-26 23:21:25 +00:00
Fariborz Jahanian 67ca8c4c7b Patch to provide guard when initializing instances
of static data member of a class template.
Fixes //rdar :// 8562966 and pr8409.

llvm-svn: 117410
2010-10-26 22:47:47 +00:00
John McCall 6bde954f47 Extract procedures to do scalar-to-memory and memory-to-scalar conversions
in IR gen, and use those to fix a correctness issue with bool atomic
intrinsics.  rdar://problem/8461234

llvm-svn: 117403
2010-10-26 22:09:15 +00:00
Dan Gohman 52765215d0 Simplify this code: don't check for the same error two
different ways. Check once, and use an assert to handle
consistency checking.

llvm-svn: 117397
2010-10-26 21:13:51 +00:00
Dan Gohman 5d223dcb2f getOrCreateContentCache never returns null, so overrideFileContents
doesn't need its return value.

llvm-svn: 117393
2010-10-26 20:47:28 +00:00
Dan Gohman 8fc50c296a Factor out the code for emitting code to load vtable pointer members
so that it's done in one place.

llvm-svn: 117386
2010-10-26 18:44:08 +00:00
Douglas Gregor 2a1d72d078 Teach typo correction not to return the same keyword that matches a
typo. This can happen with context-sensitive keywords like "super",
when typo correction didn't know that "super" wasn't permitted in this
context.

llvm-svn: 117372
2010-10-26 17:18:00 +00:00
John McCall 925b16629d Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.
There's probably still significant padding waste on x86-64 UNIXen, but
the difference in 32-bit compiles should be significant.

There are a lot of Expr nodes left that could lose a word this way.

llvm-svn: 117359
2010-10-26 08:39:16 +00:00
John McCall c3007a2145 No really, we don't have a retain/release system for statements/expressions
anymore.

llvm-svn: 117357
2010-10-26 07:05:15 +00:00
John McCall 75851b1a7f Actually, that doesn't really work, and anyway we should choose
conversion to id over conversion to void*.

llvm-svn: 117355
2010-10-26 06:40:27 +00:00
John McCall f28e83a73a Consider conversions of Objective-C pointers to 'id' to be basically of
the same rank as conversions of normal pointers to 'void*'.

Also, resurrect a test case.

Fixes rdar://problem/8592139

llvm-svn: 117354
2010-10-26 06:23:29 +00:00
Douglas Gregor 8302541401 Delay complete-type checking for arguments to no-prototype functions
until after we've checked/promoted the argument. Hopefully fixes the
Emacs regression due to my recent change that expanded type-checking
in the presence of K&R function definitions.

llvm-svn: 117353
2010-10-26 05:45:40 +00:00
John McCall 5fe84129e2 A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden
  - functions and variables with explicit visibility attributes should
    ignore the linkage of their types
Either of these should be sufficient to fix PR8457.

Also, FileCheck-ize a test case.

llvm-svn: 117351
2010-10-26 04:59:26 +00:00
John McCall 710d2a831c Pending further discussion, re-enable warnings for Objective C
covariant/contravariant overrides and implementations, but do so under
control of a new flag (-Wno-objc-covariant-overrides, which yes does cover
contravariance too).

*At least* the covariance cases will probably be enabled by default shortly,
but that's not totally uncontroversial.

llvm-svn: 117346
2010-10-26 00:53:53 +00:00
Douglas Gregor f86c939bff When de-serializing a type that is supposed to be canonical, call
getCanonicalType() to make sure that the type we got back is actually
canonical. This is the case for most types, which always build a
canonical type when given canonical components. However, some types that
involve expressions in their canonicalization (e.g., array types with
dependent sizes) don't always build canonical types from canonical
components, because there is no such thing as a "canonical"
expression. Therefore, we do this extra mapping to ensure that the
canonical types we store are actually canonical.

llvm-svn: 117344
2010-10-26 00:51:02 +00:00
Ted Kremenek 6348dac7a0 Fix lazy symbolication bug in RegionStore involving fields of global variables. When invalidated, the entire
globals memory space gets assigned a symbolic value, but that value was not being used for lazy symbolication
of fields of globals.  This could result in cases where bogus null dereferences were being reported.

Fixes PR 8440.

llvm-svn: 117336
2010-10-26 00:06:17 +00:00
Ted Kremenek f59449e790 Move 'includeGlobals' as a field into ClusterAnalysis.
llvm-svn: 117335
2010-10-26 00:06:15 +00:00
Ted Kremenek 731310e13e Tweak null dereference checker to give better diagnostics for null dereferences resulting from array accesses.
llvm-svn: 117334
2010-10-26 00:06:13 +00:00
Dan Gohman dc2c4db598 Add infrastructure for emitting TBAA metadata with the "constant" flag.
llvm-svn: 117328
2010-10-25 23:51:23 +00:00
Fariborz Jahanian 56143ae715 Patch for mis-compile of statement expressions with
non-trivial copy constructors. // rdar: //8540501.
A test will be added to llvm nightly tests.

llvm-svn: 117324
2010-10-25 23:27:26 +00:00
Dan Gohman d831356635 Trim an unnecessary #include.
llvm-svn: 117321
2010-10-25 21:59:29 +00:00
Dan Gohman 7dfd13c167 Factor out the code for creating the Root and Char nodes, so that
they can be used outside of the main getTBAAInfo function.

llvm-svn: 117320
2010-10-25 21:48:30 +00:00
Douglas Gregor 59f16ed082 Look through the address-of operator to find the function being
called. Fixes another aspect of PR8314.

llvm-svn: 117308
2010-10-25 20:48:33 +00:00
Douglas Gregor 8e09a72f13 When we're calling a function that we know based on its K&R-style
function definition, we should still use a prototype to type-check and
convert the function arguments, if such a prototype exists. Fixes
PR8314.

llvm-svn: 117305
2010-10-25 20:39:23 +00:00
Ted Kremenek c07d8353e1 Add check for UnknownVals for mutexes in ObjCAtSyncChecker. Fixes crash reported in PR 8458.
llvm-svn: 117300
2010-10-25 20:20:56 +00:00
David Chisnall b62d15c24e Only warn for mismatched types in Objective-C methods when they are incompatible, not when they are simply different. Now we test whether the difference in types breaks the principle of substitutability, rather than whether they are different.
A common idiom in Objective-C is to provide a definition of a method in a subclass that returns a more-specified version of an object than the superclass.  This does not violate the principle of substitutability, because you can always use the object returned by the subclass anywhere that you could use the type returned by the superclass.  It was, however, generating warnings with clang, leading people to believe that semantically correct code was incorrect and requiring less accurate type specification and explicit down-casts (neither of which is a good thing to encourage).

This change ensures that any method definition has parameter and return types that make it accept anything that something conforming to the declaration may pass and return something that the caller will expect, but allows stricter definitions.  

llvm-svn: 117271
2010-10-25 17:23:52 +00:00
Chandler Carruth 0171815ae1 Improve the tracking of source locations for parentheses in constructor calls.
This adds them where missing, and traces them through PCH. We fix at least one
bug in the extents found by the Index library, and make a lot of refactoring
tools which care about the exact formulation of a constructor call easier to
write. Also some minor cleanups to more consistently follow the friend pattern
instead of the setter pattern when rebuilding a serialized AST.

Patch originally by Samuel Benzaquen.

llvm-svn: 117254
2010-10-25 08:47:36 +00:00
Marcin Swiderski 01769904d3 Added generation of destructors for member constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

llvm-svn: 117252
2010-10-25 07:05:54 +00:00
Marcin Swiderski 52e4bc1fed Added generation of destructors for constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

llvm-svn: 117251
2010-10-25 07:00:40 +00:00
Peter Collingbourne a99fdcf93e Implement GNU C extension: two types are compatible if they appear
as a function argument, one of the types is a transparent union type
and the other type is compatible with a union member

llvm-svn: 117243
2010-10-24 18:30:18 +00:00
Argyrios Kyrtzidis e16a5300ba Keep track in chained PCH of implicit members that were added after the definition was completed.
llvm-svn: 117240
2010-10-24 17:26:54 +00:00
Argyrios Kyrtzidis d170d844c4 Start fleshing out ASTMutationListener; notify when a tag definition is completed.
In that case a chained PCH will record the updates to the DefinitionData pointer of forward references.
If a forward reference mutated into a definition re-write it into the chained PCH, this is too big of a change.

llvm-svn: 117239
2010-10-24 17:26:50 +00:00
Argyrios Kyrtzidis 3ba70b89cf Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that will be replaced in the chained PCH.
llvm-svn: 117238
2010-10-24 17:26:46 +00:00
Argyrios Kyrtzidis 97bfda9b9b Some method renaming, no functionality change.
llvm-svn: 117237
2010-10-24 17:26:43 +00:00
Argyrios Kyrtzidis eb39d9a9ec Refactoring.
- Pass around RecordDataImpl instead of the concrete RecordData so that any SmallVector can be used.
- Move ASTDeclWriter::WriteCXXDefinitionData to ASTWriter::AddCXXDefinitionData.

llvm-svn: 117236
2010-10-24 17:26:40 +00:00
Argyrios Kyrtzidis 65ad5691fd Put the mechanism in place to track modifications in an AST entity that were committed after
its initial creation/deserialization and store the changes in a chained PCH.

The idea is that the AST entities call methods on the ASTMutationListener to give notifications
of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes
of the updated entity. WIP

llvm-svn: 117235
2010-10-24 17:26:36 +00:00
Argyrios Kyrtzidis ad5f95cc4b Simplify and "robust-ify" the way that CXXRecord references point to the definition data when loaded from PCH.
Temporary disable 'test/PCH/chain-cxx.cpp' until a better way to fix it is in place.

llvm-svn: 117234
2010-10-24 17:26:31 +00:00
Argyrios Kyrtzidis 8b200a5ef1 Minor refactoring; Pull reading/writing DefinitionData out into a function.
llvm-svn: 117233
2010-10-24 17:26:27 +00:00
Marcin Swiderski 772324971d - Fixed subexpressions evaluation order for binary operators to match order in code generated with the compiler,
- Fixed test cases for unreachable code warnings produced by Sema.

llvm-svn: 117220
2010-10-24 08:21:40 +00:00
Douglas Gregor e63d087bcb C++ [basic.scope.hiding] allows an ordinary name to hide a non-tag
name *in the same scope*, but not across scopes. Implement the
highlighted condition.

llvm-svn: 117212
2010-10-23 16:06:17 +00:00
Chandler Carruth c3ce5840af Update remaining attribute macros to new style.
llvm-svn: 117204
2010-10-23 08:44:57 +00:00
Chandler Carruth b7967b91c9 Update to use 'LLVM_*' macro names for attributes.
llvm-svn: 117201
2010-10-23 08:21:37 +00:00
Anders Carlsson 73067a02db Warn if a variable marked with the "unused" attribute is used. Patch by Darin Adler!
llvm-svn: 117184
2010-10-22 23:37:08 +00:00
John McCall 811a0f5578 Parse attributes on enumerators and instantiate attributes on enum decls.
llvm-svn: 117182
2010-10-22 23:36:17 +00:00
Douglas Gregor c0d2490ac4 In the presence of using declarations, we can find the same class
members in class subobjects of different types. So long as the
underlying declaration sets are the same, and the declaration sets
involve non-instance members, this is not an ambiguity.

llvm-svn: 117163
2010-10-22 22:08:47 +00:00
Ted Kremenek 7043fba7fa Fix '-analyzer-display-progress' for Objective-C methods. Also remove obsolete code.
llvm-svn: 117161
2010-10-22 22:08:29 +00:00
Fariborz Jahanian c123623d28 After discussion with Doug and John, I am reverting
the patch. 

llvm-svn: 117159
2010-10-22 22:05:03 +00:00
Dale Johannesen 70f564e0e8 Change handling of inline asm 'p' constraint to match llvm-gcc.
llvm-svn: 117149
2010-10-22 21:07:10 +00:00
John McCall 457a04e3ce Substantially revise how clang computes the visibility of a declaration to
more closely parallel the computation of linkage.  This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.

llvm-svn: 117147
2010-10-22 21:05:15 +00:00
Fariborz Jahanian 0196aa28ec Patch fixes miscompile with non-trivial copy constructors and
statement expressions, //rdar: //8540501

llvm-svn: 117146
2010-10-22 21:01:02 +00:00
Devang Patel 401c916c8a Delay record type's debug info emission, in -flimit-debug-info mode, if member expression's base is call expr.
llvm-svn: 117127
2010-10-22 18:56:27 +00:00
Devang Patel db3910000a Revert unintentional check-in.
llvm-svn: 117120
2010-10-22 18:31:12 +00:00
Oscar Fuentes ac1a614079 Don't try to guess svn version when current path is a symlink.
See PR 8473.

llvm-svn: 117110
2010-10-22 17:16:39 +00:00
Devang Patel f79199d140 Tidy up MIPS_linkage name. Provide it only if it does not match regular name, otherwise it confuses debugger.
This is tested by local.C in llvmgcc testsuite.

llvm-svn: 117107
2010-10-22 17:11:50 +00:00
Benjamin Kramer fb5e584151 More class anonymization.
llvm-svn: 117106
2010-10-22 16:48:22 +00:00
Benjamin Kramer 2fc373e155 Move classes into anonymous namespaces.
llvm-svn: 117104
2010-10-22 16:33:16 +00:00
Douglas Gregor 412c362d9e When performing name lookup for a namespace definition, only look into
the current context's redeclaration context, ignoring using
directives. Fixes PR8430.

llvm-svn: 117097
2010-10-22 15:24:46 +00:00
Douglas Gregor 06e41ae5c7 Teach the C++ simple-type-specifier parser and tentative parses about
protocol-qualified types such as id<Protocol>.

llvm-svn: 117081
2010-10-21 23:17:00 +00:00
Dan Gohman 2bb62c3d2b Rename clang's TBAA tree root from "experimental" to "simple".
llvm-svn: 117046
2010-10-21 18:50:04 +00:00
Ted Kremenek 5ef9ad9907 Tweak diagnostics for redeclaration of a @property in a class extension where the redelcaration and original
declaration have the 'readwrite' attribute.  This is a common case, and we can issue a more lucid diagnostic.

Fixes <rdar://problem/7629420>.

llvm-svn: 117045
2010-10-21 18:49:42 +00:00
Ted Kremenek 22813f4077 Tidy up comment (remove extraneous text).
llvm-svn: 117044
2010-10-21 18:49:36 +00:00
Dan Gohman 5419ce6827 Add some more comments.
llvm-svn: 117043
2010-10-21 18:49:12 +00:00
Douglas Gregor cd1d0b4f98 Implement the integral promotion rules for the C++0x char16_t and
char32_t character types and enable built-in overloaded operator
candidates for these types. Fixes PR8432.

llvm-svn: 117038
2010-10-21 18:04:08 +00:00
Douglas Gregor a02bb37a8c Diagnose the declaration of template template parameters that
themselves have no template parameters. This is actually a restriction
due to the grammar of template template parameters, but we choose to
diagnose it in Sema to provide better recovery.

llvm-svn: 117032
2010-10-21 17:26:49 +00:00
Douglas Gregor bff6203152 Always treat 'main' as an extern "C" function, so that we detect
redeclarations of main appropriately rather than allowing it to be
overloaded. Also, disallowing declaring main as a template.

Fixes GCC DejaGNU g++.old-deja/g++.other/main1.C.

llvm-svn: 117029
2010-10-21 16:57:46 +00:00
Douglas Gregor 270b2ef0e7 When checking whether a return statement returns a stack-local
variable, handle conditional operators involving a
throw-expression. Fixes GCC DejaGNU's g++.dg/template/cond4.C.

llvm-svn: 117027
2010-10-21 16:21:08 +00:00
Francois Pichet ebdb43d54d Revert r117005, WIN32 is not predefined after all.
llvm-svn: 117026
2010-10-21 16:14:56 +00:00
Ted Kremenek c5644e1b97 Tweak the ObjCAtSyncChecker to assume that a mutex is non-nil after checking that it is
nil.  Otherwise we can get false paths where a second @synchronized using the mutex
can have a bogus warning.  Fixes <rdar://problem/8578650>.

llvm-svn: 117016
2010-10-21 15:38:55 +00:00
Francois Pichet 1ef4eb196d MSVC defines WIN32 as a predefined macro.
llvm-svn: 117005
2010-10-21 09:39:28 +00:00
Michael J. Spencer 54bf3c3cfb Targets: Fix MinGW and VisualStudio predefined macros.
llvm-svn: 117003
2010-10-21 08:22:51 +00:00
Michael J. Spencer 4992ca4b17 Reorganize predefined macros for all Windows targets.
This adds an option to set the _MSC_VER macro without
recompiling. This is very useful when testing compatibility
with the Windows SDK and c++stdlib headers.

-fmsc-version=<version> (defaults to VS2003 (1300))

llvm-svn: 116999
2010-10-21 05:21:48 +00:00
Ted Kremenek 12a37de003 Previously, the printf warnings would say your arguments type was 'int' when it was really a 'char'
or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints.

Patch by Justin Bogner!

llvm-svn: 116996
2010-10-21 04:00:58 +00:00
Ted Kremenek 6377965efb Remove unused variable.
llvm-svn: 116995
2010-10-21 04:00:51 +00:00
Michael J. Spencer 4c0ffa823f Fix Whitespace.
llvm-svn: 116990
2010-10-21 03:16:25 +00:00
Michael J. Spencer 7b726c3fc8 Revert "Cleanup and fix predefined macros for windows."
Didn't realize this was on my branch ;/.

llvm-svn: 116989
2010-10-21 03:14:35 +00:00
Michael J. Spencer 2fb548cc05 Cleanup and fix predefined macros for windows.
llvm-svn: 116988
2010-10-21 03:13:04 +00:00
Craig Silverstein af8808dd28 Pass TInfo to CXXDestructorDecl::Create(), just like we do for other
function decls.

Reviewed by rjmccall and nlewycky.

llvm-svn: 116979
2010-10-21 00:44:50 +00:00
Argyrios Kyrtzidis 00f5266dbf When implicit members are added to a C++ record, notify the serializer so that a chained PCH writes the definition again.
Thanks to Doug for the hint!

llvm-svn: 116975
2010-10-20 23:48:42 +00:00
Argyrios Kyrtzidis 54b88e72d0 Modify the assumptions of an assert; the updated latest redeclaration can have the same location
if it's a template specialization pointing at the template.

llvm-svn: 116974
2010-10-20 23:48:40 +00:00
Ted Kremenek 982b32b1b6 Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely subsumed by the Checker interface.
llvm-svn: 116973
2010-10-20 23:48:34 +00:00
Ted Kremenek bd2c800882 Convert GRSimpleAPIChecks in BasicObjCFoundationChecks to be Checkers.
llvm-svn: 116971
2010-10-20 23:38:56 +00:00
Douglas Gregor 796d76a663 Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.

llvm-svn: 116952
2010-10-20 22:00:55 +00:00