Commit Graph

15841 Commits

Author SHA1 Message Date
Douglas Gregor 1262b0636e Fix an corner-case assertion introduced by the refactoring in r112258;
when we're taking the address of a unresolvable value, it might be an
implicit member access. Fixes some Boost.Spirit regressions.

llvm-svn: 112487
2010-08-30 16:00:47 +00:00
Douglas Gregor 3cc2648b47 Now that GCC will have #pragma push/pop (in GCC 4.6), allow the
#pragma without requiring it to be in the "clang" namespace, from
Louis Gerbarg!

llvm-svn: 112484
2010-08-30 15:15:34 +00:00
Douglas Gregor f62c5294c1 Emulate (some of) Microsoft's looser semantic checking of exception
specifications, from Martin Vejnar!

llvm-svn: 112482
2010-08-30 15:04:51 +00:00
Douglas Gregor 759ef23bb8 In Microsoft compatibility mode, don't parse the exponent as part of
the pp-number in a hexadecimal floating point literal, from Francois
Pichet! Fixes PR7968.

llvm-svn: 112481
2010-08-30 14:50:47 +00:00
Douglas Gregor 2b1bbecb6b Predeclare class type_info in Microsoft mode, from Francois Pichet!
llvm-svn: 112478
2010-08-30 14:44:26 +00:00
Douglas Gregor 2c7d9290ee Add redeclaration checking for static data members and fix a corner
case with redeclaration checking for fields, from Faisal Vali!
Fixes PR7970.

llvm-svn: 112476
2010-08-30 14:32:14 +00:00
Douglas Gregor 5209a0d850 Fix CMake dependencies
llvm-svn: 112475
2010-08-30 14:31:03 +00:00
Duncan Sands f610b5b622 Straighten out target triples provided on the command line
before using them.

llvm-svn: 112468
2010-08-30 09:42:39 +00:00
Alexis Hunt e3675ef0f3 Two minor fixes to user-defined literals:
- Zero-initialize UDLData so that crashes stop
 - Stop complaining that we can't emit them (we most certainly can)

llvm-svn: 112467
2010-08-30 09:27:16 +00:00
Chandler Carruth 9ed87ba797 Add some braces for sanity and GCC silence. These became unbalanced in r112122,
so please review echristo and let me know if the logic is wrong now.

llvm-svn: 112466
2010-08-30 07:36:24 +00:00
Alexis Hunt 79eb5469e0 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Douglas Gregor 981a0c4613 When providing a code completion for an Objective-C message send, drop
the parameter names from the completions, e.g., provide

  withString:(NSString *)

instead of

  withString:(NSString *)string

since the parameter name is, by convention, redundant with the
selector piece that precedes it and the completions can get
unnecessarily long.

llvm-svn: 112456
2010-08-29 19:47:46 +00:00
Douglas Gregor 99129efdd3 Improve code completion for initializer lists in constructors. Instead
of prioritizing just by initialization order, we bump the priority of
just the *next* initializer in the list, and leave everything else at
the normal priority. That way, if one intentionally skips the
initialization of a base or member (to get default initialization),
we'll still get ordered completion for the rest.

llvm-svn: 112454
2010-08-29 19:27:27 +00:00
Fariborz Jahanian 161848a030 ObjClang++: Allow declaration of block variable in a collection
statement header (fixes radar 8295106).

llvm-svn: 112443
2010-08-29 17:20:53 +00:00
Zhongxing Xu b0a6de9e8f Add comments.
llvm-svn: 112414
2010-08-29 05:16:31 +00:00
Bob Wilson 0e7a398936 Translate NEON vaddl, vaddw, vsubl, and vsubw builtins to llvm add/sub
with zext/sext operations, instead of to llvm intrinsics.  (We can also
get rid of the clang builtins and handle these entirely in the arm_neon.h
header if there is a way to express vector sext/zext in C.)

llvm-svn: 112413
2010-08-29 05:14:28 +00:00
John McCall 49039d4afb Complain if a __pragma isn't terminated.
llvm-svn: 112392
2010-08-29 01:09:54 +00:00
John McCall 89e925d78e Add support for Microsoft's __pragma in the preprocessor.
Patch by Francois Pichet!

llvm-svn: 112391
2010-08-28 22:34:47 +00:00
John McCall 0856906b1e When perform exact-qualifier-match template argument deduction,
properly account for the possibility that certain opaque types
might be more qualified than they appear.  Fixes PR7708.

llvm-svn: 112390
2010-08-28 22:14:41 +00:00
John McCall fb3f9ba969 If filtering a lookup result leaves it ambiguous, keep the ambiguity
kind.  Fixes PR7252.

llvm-svn: 112383
2010-08-28 20:17:00 +00:00
Ted Kremenek 52ac860d9c Delete the relaxedLiveness object in the dtor of AnalysisContext.
llvm-svn: 112380
2010-08-28 18:59:04 +00:00
Chris Lattner 0e7c68da96 improve comment, patch by Vladimir Kirillov!
llvm-svn: 112374
2010-08-28 16:26:18 +00:00
Gabor Greif ae849e4407 simplify by relying on cascading operator->
llvm-svn: 112373
2010-08-28 15:46:56 +00:00
Gabor Greif 122f1eb2b8 simplify
llvm-svn: 112372
2010-08-28 15:42:30 +00:00
Gabor Greif e6523ea915 suppress annoying textual repetition as 'aka'
llvm-svn: 112365
2010-08-28 10:40:52 +00:00
Argyrios Kyrtzidis 43b205796f Fix the memory leak of FloatingLiteral/IntegerLiteral.
For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers.
Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
the APFloat/APInt values will never get freed.
I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral.

Fixes rdar://7637185

llvm-svn: 112361
2010-08-28 09:06:06 +00:00
John McCall 1177ff1740 That's not the right direction to compute notional accessibility in at all.
llvm-svn: 112360
2010-08-28 08:47:21 +00:00
John McCall c6af8f4689 Fix build. Bad me, adding last-minute assertions.
llvm-svn: 112359
2010-08-28 08:10:32 +00:00
John McCall 96329678e4 When checking access control for an instance member access on
an object of type I, if the current access target is protected
when named in a class N, consider the friends of the classes P
where I <= P <= N and where a notional member of N would be
non-forbidden in P.

llvm-svn: 112358
2010-08-28 07:56:00 +00:00
Gabor Greif 34ecff269e perform cheap test first
llvm-svn: 112346
2010-08-28 01:58:12 +00:00
Ted Kremenek 82bfc86792 Explicitly handle CXXExprWithTemporaries during CFG construction by just visiting the subexpression. While we don't do anything intelligent right now, this obviates a bogus -Wunreahable-code warning reported in PR 6130.
llvm-svn: 112334
2010-08-28 00:19:02 +00:00
Gabor Greif b6aba3ef28 fix PR8007
reordering and redefinition issues still may linger,
I plan to nail them next

llvm-svn: 112333
2010-08-28 00:16:06 +00:00
Douglas Gregor eaeeca9afe Basic code completion support for the base and member initializers in
a constructor.

llvm-svn: 112330
2010-08-28 00:00:50 +00:00
Sebastian Redl 6766794c0b Parser support for inline namespaces
llvm-svn: 112320
2010-08-27 23:12:46 +00:00
Douglas Gregor fcee9460c6 Miscellaneous found by inspection with John and Sebastian
llvm-svn: 112315
2010-08-27 22:55:10 +00:00
Tom Care 71cc9d886a Added checking of (x == x) and (x != x) to IdempotentOperationChecker and updated test cases flagged by it.
llvm-svn: 112313
2010-08-27 22:50:47 +00:00
Tom Care 98e679508d Enabled relaxed LiveVariables analysis in the path-sensitive engine to increase the coverage of bugs. Primarily affects IdempotentOperationChecker.
- Migrated a temporarily separated test back to its original file (bug has been fixed, null-deref-ps-temp.c -> null-deref-ps.c)
- Changed SymbolManager to use relaxed LiveVariables
- Updated several test cases that the IdempotentOperationChecker class now flags
- Added test case to test relaxed LiveVariables use by the IdempotentOperationChecker

llvm-svn: 112312
2010-08-27 22:46:32 +00:00
Tom Care f7b7067c4d Remove an assertion in UnreachableCodeChecker that can be triggered by bugs in other checkers.
llvm-svn: 112310
2010-08-27 22:37:31 +00:00
Tom Care c29c91aaaa Fix bug in IdempotentOperationChecker where an assumption would not get updated properly.
llvm-svn: 112309
2010-08-27 22:35:28 +00:00
Chris Lattner 1ba644575d handle :: in selectors in objc++ mode, rdar://8366474
llvm-svn: 112307
2010-08-27 22:32:41 +00:00
Tom Care e5aa30c722 Add alternate version of LiveVariables analysis that does not kill liveness at assignments. This 'relaxed' liveness is useful in path sensitive analysis for situations where the resulting extended liveness allows us to find some bugs.
- Added killAtAssign flag to LiveVariables
- Added relaxed LiveVariables to AnalysisContext with an accessor

llvm-svn: 112306
2010-08-27 22:30:10 +00:00
Douglas Gregor ac322ec9b9 Implement the "call super" code completion for C++. If the virtual
member function you're typing in overrides another virtual function,
this fills in a (qualified!) call to that virtual function to make
such delegation easy.

llvm-svn: 112294
2010-08-27 21:18:54 +00:00
Chris Lattner 212a492063 fix incorrect MM_HINT_ definitions, PR8011
llvm-svn: 112283
2010-08-27 20:10:06 +00:00
John McCall 1ababa63de Continue to instantiate sub-statements in a CompoundStmt as long as
we don't see a DeclStmt (failure to instantiate which generally causes
panic).

llvm-svn: 112282
2010-08-27 19:56:05 +00:00
Devang Patel 96b7f55a03 Debug info for friends!
Patch originally by Alexander Herz.

llvm-svn: 112275
2010-08-27 17:47:47 +00:00
Douglas Gregor 28c7843ec4 Suggest "const" and "volatile" code completions after a function
declarator, the very definition of "low-hanging fruit".

llvm-svn: 112274
2010-08-27 17:35:51 +00:00
Bob Wilson 7b0d032d0c Add the new alignment arguments for NEON load/store intrinsics, based on the
types of the pointer address expressions used with those intrinsics.

llvm-svn: 112272
2010-08-27 17:14:29 +00:00
Dan Gohman 8b4c320778 createMainFileID doesn't need its IncludePos argument, since
the main file isn't an included file, and the IncludePos is
always SourceLocation().

llvm-svn: 112269
2010-08-27 15:44:11 +00:00
Douglas Gregor c2cb2e23bc When code-completing inside an Objective-C method, give a slight
priority boost to methods with the same selector. 

llvm-svn: 112268
2010-08-27 15:29:55 +00:00
Douglas Gregor 6fc0413e59 Add a super-cool code completion for send-to-super. When we're typing
a message send to "super" from a method that appears to be meant to
override a superclass method (same kind, same selector, same argument
types), provide a "super" completion that fills in the selector along
with forwarding the method's arguments (as placeholders).

llvm-svn: 112263
2010-08-27 15:10:57 +00:00
Douglas Gregor f0b38ebb53 Fix CMake dependencies, from Fernando Pelliccioni!
llvm-svn: 112261
2010-08-27 14:18:05 +00:00
John McCall 8d08b9b408 Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a        
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.

llvm-svn: 112258
2010-08-27 09:08:28 +00:00
Douglas Gregor f5bae22db7 Don't recurse twice when we can recurse once
llvm-svn: 112246
2010-08-27 00:11:28 +00:00
John McCall faf5fb4b78 One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.

llvm-svn: 112244
2010-08-26 23:41:50 +00:00
Ted Kremenek 036223bdcf Fix horrible GRExprEngine bug where switch statements with no 'case:' statements would cause the path to get prematurely aborted. Fixes <rdar://problem/8360854>.
llvm-svn: 112233
2010-08-26 22:19:33 +00:00
Ted Kremenek c8bd967430 Remove redundant cast<...>.
llvm-svn: 112229
2010-08-26 22:04:01 +00:00
Dan Gohman ce46f02a32 Fix a typo.
llvm-svn: 112219
2010-08-26 21:27:06 +00:00
Chris Lattner d7e54804ee improve comments.
llvm-svn: 112214
2010-08-26 20:08:43 +00:00
Chris Lattner d774ae9ed1 fix 2xi16 to pass as i32 instead of <2 x i16>. The former passes in
memory (as required) the later now passes in an xmm register.  This
fixes gcc.dg/compat/vector_1 on x86-32.

llvm-svn: 112211
2010-08-26 20:05:13 +00:00
Chris Lattner 69e683fb35 vector of long and ulong are also classified as INTEGER in x86-64 abi,
this fixes rdar://8358475 a failure of the gcc.dg/compat/vector_1 abi
test.

llvm-svn: 112205
2010-08-26 18:13:50 +00:00
Chris Lattner 46830f2fd6 1 x ulonglong needs to be classified as INTEGER, just like 1 x longlong,
this fixes a miscompilation on the included testcase, rdar://8359248

llvm-svn: 112201
2010-08-26 18:03:20 +00:00
John McCall a3707cc7e2 Make sure we clear TypeSpecOwned when setting TypeSpecType to something when
it might previously have been a tag TST.

llvm-svn: 112196
2010-08-26 17:22:34 +00:00
Douglas Gregor 9ac1ad141b Tweak the @selector completion to collapse multiple informative and
typed-text blocks into one of each.

llvm-svn: 112194
2010-08-26 16:46:39 +00:00
Douglas Gregor 9be0ed4f3f When code-completing a potential call to a C++ non-static member
function, take into account the qualifiers on the object argument
(e.g., what will become "this"), filtering around uncallable member
functions and giving a slight priority boost to those with
exactly-matching qualifiers.

llvm-svn: 112193
2010-08-26 16:36:48 +00:00
John McCall 7a1da89f11 Work around a gcc warning.
llvm-svn: 112192
2010-08-26 16:36:35 +00:00
Argyrios Kyrtzidis 7648fb464b Fix miscompilation. The cookie was not used when new'ing arrays with multiple dimensions.
llvm-svn: 112188
2010-08-26 15:23:38 +00:00
Douglas Gregor 67c692cc3d Implement code completion for @selector expressions
llvm-svn: 112186
2010-08-26 15:07:07 +00:00
Douglas Gregor 33551892fa Tweak wording in an assertion, from dawn@burble.org.
llvm-svn: 112182
2010-08-26 14:07:34 +00:00
Douglas Gregor 49f67ce4b3 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

3rd try. How embarrassing.

llvm-svn: 112180
2010-08-26 13:48:20 +00:00
John McCall b1be523752 Move things around so that Sema.h no longer depends on even DeclBase.h.
It still depends on Type because DeclarationName.h does.

llvm-svn: 112177
2010-08-26 09:15:37 +00:00
Chris Lattner 51e1cc2fe2 tame an assertion, fixing rdar://8357396
llvm-svn: 112174
2010-08-26 06:28:35 +00:00
Daniel Dunbar d2bc53e925 CGValue: Increase width of allowed alignment. We could switch to log2, but we
don't currently need the bits anyway.

llvm-svn: 112173
2010-08-26 06:02:12 +00:00
Daniel Dunbar bef185c835 Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests.

llvm-svn: 112161
2010-08-26 03:53:50 +00:00
John McCall 8e7d656a4a De-memberify the VarDecl and FunctionDecl StorageClass enums.
This lets us remove Sema.h's dependency on Expr.h and Decl.h.

llvm-svn: 112156
2010-08-26 03:08:43 +00:00
Douglas Gregor 78ecc499eb Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

llvm-svn: 112149
2010-08-26 02:23:45 +00:00
John McCall b45a1e735a Restore r112114 now that SmallVector<...,0> is safe.
llvm-svn: 112148
2010-08-26 02:13:20 +00:00
Eric Christopher 2a9898f0a2 Move some type defines from smmintrin.h to emmintrin.h to match where
gcc defines them.

llvm-svn: 112146
2010-08-26 02:09:25 +00:00
Daniel Dunbar f241019e24 Driver/Darwin: Switch back to old toolchain, looks like new one isn't quite
ready yet.

llvm-svn: 112138
2010-08-26 01:41:44 +00:00
Chris Lattner 8c3283857e zap dead ctor
llvm-svn: 112132
2010-08-26 01:17:33 +00:00
Daniel Dunbar e3d87d21f3 IRgen/NEON: Fix codegen of vzip and vzipq.
- Will be adding an executable test case to test-suite repo.

llvm-svn: 112126
2010-08-26 00:55:57 +00:00
Daniel Dunbar b8f7a14575 Driver: Fix thinko where I switched to always using the old toolchain, instead
of always using the new toolchain.

llvm-svn: 112125
2010-08-26 00:55:55 +00:00
Daniel Dunbar e9f7151485 Driver/Darwin: Pass the right arch specific dir for ARM, when linking.
llvm-svn: 112124
2010-08-26 00:55:52 +00:00
Daniel Dunbar b6ceacf623 Revert r112114, "Pull DelayedDiagnostic and AccessedEntity out into their own
header.", it is teh broken.

llvm-svn: 112123
2010-08-26 00:52:50 +00:00
Eric Christopher a613f56559 With lax vector conversions (the default) make sure we convert between two
vectors that are the same size. Fix up testcases accordingly and add a new one
to make sure we still error if lax vector conversions are disabled.

Fixes rdar://8328190

llvm-svn: 112122
2010-08-26 00:42:16 +00:00
Douglas Gregor 1099865124 Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?

llvm-svn: 112121
2010-08-26 00:30:24 +00:00
John McCall 6b48873d50 Pull DelayedDiagnostic and AccessedEntity out into their own header.
This works courtesy of the new SmallVector<..., 0> specialization that
doesn't require a complete type.  Note that you'll need to pull at least
SmallVector.h from LLVM to compile successfully.

llvm-svn: 112114
2010-08-25 23:44:00 +00:00
Argyrios Kyrtzidis 1f5cfb6446 Revert r112043, static volatiles are removed by the optimizer. Thanks Chris!
llvm-svn: 112112
2010-08-25 23:42:51 +00:00
Chris Lattner 9f8b451876 Finally pass "two floats in a 64-bit unit" as a <2 x float> instead of
as a double in the x86-64 ABI.  This allows us to generate much better
code for certain things, e.g.:

_Complex float f32(_Complex float A, _Complex float B) {
  return A+B;
}

Used to compile into (look at the integer silliness!):

_f32:                                   ## @f32
## BB#0:                                ## %entry
	movd	%xmm1, %rax
	movd	%eax, %xmm1
	movd	%xmm0, %rcx
	movd	%ecx, %xmm0
	addss	%xmm1, %xmm0
	movd	%xmm0, %edx
	shrq	$32, %rax
	movd	%eax, %xmm0
	shrq	$32, %rcx
	movd	%ecx, %xmm1
	addss	%xmm0, %xmm1
	movd	%xmm1, %eax
	shlq	$32, %rax
	addq	%rdx, %rax
	movd	%rax, %xmm0
	ret

Now we get:

_f32:                                   ## @f32
	movdqa	%xmm0, %xmm2
	addss	%xmm1, %xmm2
	pshufd	$16, %xmm2, %xmm2
	pshufd	$1, %xmm1, %xmm1
	pshufd	$1, %xmm0, %xmm0
	addss	%xmm1, %xmm0
	pshufd	$16, %xmm0, %xmm1
	movdqa	%xmm2, %xmm0
	unpcklps	%xmm1, %xmm0
	ret

and compile stuff like:

extern float _Complex ccoshf( float _Complex ) ;
float _Complex ccosf ( float _Complex z ) {
 float _Complex iz;
 (__real__ iz) = -(__imag__ z);
 (__imag__ iz) = (__real__ z);
 return ccoshf(iz);
}

into:

_ccosf:                                 ## @ccosf
## BB#0:                                ## %entry
	pshufd	$1, %xmm0, %xmm1
	xorps	LCPI4_0(%rip), %xmm1
	unpcklps	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	jmp	_ccoshf                 ## TAILCALL

instead of:

_ccosf:                                 ## @ccosf
## BB#0:                                ## %entry
	movd	%xmm0, %rax
	movq	%rax, %rcx
	shlq	$32, %rcx
	shrq	$32, %rax
	xorl	$-2147483648, %eax      ## imm = 0xFFFFFFFF80000000
	addq	%rcx, %rax
	movd	%rax, %xmm0
	jmp	_ccoshf                 ## TAILCALL


There is still "stuff to be done" here for the struct case,
but this resolves rdar://6379669 - [x86-64 ABI] Pass and return 
_Complex float / double efficiently

llvm-svn: 112111
2010-08-25 23:39:14 +00:00
Argyrios Kyrtzidis 1194d5e3d2 Fix miscompilation. The custom new[]/delete[] methods were not getting called for arrays with more than 1 dimension.
llvm-svn: 112107
2010-08-25 23:14:56 +00:00
Tom Care 9a68bccd0c Add missing null checks in PseudoConstantAnalysis
llvm-svn: 112100
2010-08-25 22:46:03 +00:00
Tom Care 82b2a1dada Improved the handling of blocks and block variables in PseudoConstantAnalysis
- Removed the assumption that __block vars are all non-constant
- Simplified some repetitive code in RunAnalysis
- Added block walking support
- Code/comments cleanup
- Separated out test for block pseudoconstants

llvm-svn: 112098
2010-08-25 22:37:26 +00:00
Douglas Gregor ebb7c84891 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

llvm-svn: 112095
2010-08-25 22:15:42 +00:00
John McCall 8302463dc6 Split out a header to hold APIs meant for the Sema implementation from Sema.h.
Clients of Sema don't need to know (for example) the list of diagnostics we
support.

llvm-svn: 112093
2010-08-25 22:03:47 +00:00
Douglas Gregor 0de55cecb2 When combining the code-completion results from Sema long with the
code-completion results cached by ASTUnit, sort the resulting result
set. This makes testing far, far easier, so this commit also includes
tests for the previous few fixes.

llvm-svn: 112070
2010-08-25 18:41:16 +00:00
Michael J. Spencer b2f376bdd0 Fix horrible white space errors.
llvm-svn: 112067
2010-08-25 18:17:27 +00:00
Douglas Gregor f11096c99c Initialize the translation-unit scope before lexing the first
token. The first token might be something that ends up triggering code
completion, which in turn requires a valid Scope. Test case forthcoming.

llvm-svn: 112066
2010-08-25 18:07:12 +00:00
Douglas Gregor ea14705c8c Add a missing case
llvm-svn: 112065
2010-08-25 18:04:30 +00:00
Douglas Gregor 8e817b6a3a Fix an off-by-one error when computing the precompiled preamble for
code completion. We were allowing the preamble to include the line
that we're code-completing on. Again, testcase is forthcoming.

llvm-svn: 112064
2010-08-25 18:04:15 +00:00
Douglas Gregor 8850aa3f67 Make the cursor kind of macro-name-only completions produced by
ASTUnit match those produced directly by code completion. Test case is
forthcoming.

llvm-svn: 112063
2010-08-25 18:03:13 +00:00
Douglas Gregor ea7363732a Add a code-completion context for "natural language" completions, so
that ASTUnit knows not to try to provide completions there.

llvm-svn: 112057
2010-08-25 17:10:00 +00:00
Douglas Gregor 115837041e Introduce a preprocessor code-completion hook for contexts where we
expect "natural" language and should not provide any completions,
e.g., comments, string literals, #error.

llvm-svn: 112054
2010-08-25 17:04:25 +00:00
John McCall e302792b61 GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.

llvm-svn: 112047
2010-08-25 11:45:40 +00:00
Argyrios Kyrtzidis dfffabd0e9 Recursive functions should be marked when used from another function. Fixes http://llvm.org/PR7923.
llvm-svn: 112045
2010-08-25 10:34:54 +00:00
John McCall 2536c6da0e More incremental progress towards not including Expr.h in Sema.h.
llvm-svn: 112044
2010-08-25 10:28:54 +00:00
Argyrios Kyrtzidis b50a088122 Make sure volatile variables are emitted even if static. Fixes rdar://8315219
llvm-svn: 112043
2010-08-25 10:15:24 +00:00
Chandler Carruth 5408017356 Rename *PendingImplicitInstantiations to *PendingInstantiations. No
functionality changed.

llvm-svn: 112040
2010-08-25 08:44:16 +00:00
John McCall aab3e41eb2 Split FunctionScopeInfo and BlockScopeInfo into their own header.
llvm-svn: 112038
2010-08-25 08:40:02 +00:00
Chandler Carruth cfe41db403 Support explicit instantiation of function templates and members of class
templates when only the declaration is in scope. This requires deferring the
instantiation to be lazy, and ensuring the definition is required for that
translation unit. We re-use the existing pending instantiation queue,
previously only used to track implicit instantiations which were required to be
lazy. Fixes PR7979.

A subsequent change will rename *PendingImplicitInstantiations to
*PendingInstatiations for clarity given its broader role.

llvm-svn: 112037
2010-08-25 08:27:02 +00:00
John McCall 28a0cf7825 Remove Sema.h's dependency on DeclCXX.h.
llvm-svn: 112032
2010-08-25 07:42:41 +00:00
John McCall a1e130be25 Remove the DenseSet dependency from Sema.h.
llvm-svn: 112030
2010-08-25 07:03:20 +00:00
John McCall 276321a9ec Teach Sema to live without CodeCompleteConsumer.h.
llvm-svn: 112028
2010-08-25 06:19:51 +00:00
John McCall 1d570a7e16 Remove AnalysisBasedWarnings.h's dependency on Type.h
llvm-svn: 112027
2010-08-25 05:56:39 +00:00
John McCall 19c1bfd1b0 Move more stuff out of Sema.h.
llvm-svn: 112026
2010-08-25 05:32:35 +00:00
Daniel Dunbar ead6824c3c IRgen: Fix a horrible bug in pointer to bool conversion, which we were treating
as a truncation not a comparison to null.

llvm-svn: 112021
2010-08-25 03:32:38 +00:00
John McCall 8d75243029 Expression statements undergo lvalue-to-rvalue conversion in C,
but not in C++, so don't emit aggregate loads of volatile references
in null context in C++.  Happens to have been caught by an assertion.
We do not get the scalar case right.  Volatiles are really broken.

llvm-svn: 112019
2010-08-25 02:50:31 +00:00
John McCall 6caebb15ed Reformatting.
llvm-svn: 112018
2010-08-25 02:45:51 +00:00
Douglas Gregor 416b575edc When performing completions involving Objective-C method declarations
(e.g., for message sends or method declaration/definition
completions), adjust methods that come from a base class.

llvm-svn: 112013
2010-08-25 01:08:01 +00:00
Argyrios Kyrtzidis 96dbfa2e65 Plug leak. The DenseMaps of CXXRecordLayoutInfo weren't freed.
llvm-svn: 112006
2010-08-25 00:32:19 +00:00
Argyrios Kyrtzidis 3c6cd17c8a Use a smart pointer instead of delete.
llvm-svn: 112005
2010-08-25 00:32:14 +00:00
Fariborz Jahanian 54d75f6925 No need to default synthesize property if implementation
has its own getter and setter methods declared.
Fixed 8349319 (nonfragile-abi2).

llvm-svn: 112003
2010-08-25 00:31:58 +00:00
Devang Patel 356e3e0c6a Fix 'for' loop variables' scope.
llvm-svn: 112002
2010-08-25 00:28:56 +00:00
Douglas Gregor 4d755e86b4 Give a slight preference to functions returning "void" when we're
performing code completion at the statement level (rather than in an
arbitrary expression).

llvm-svn: 112001
2010-08-24 23:58:17 +00:00
John McCall 3669c80de9 Preserve invalidity of typeof operands in C++.
llvm-svn: 111999
2010-08-24 23:41:43 +00:00
John McCall 7d46051eea Catch the case of trying to turn '&(X::a)' into a member pointer as well.
llvm-svn: 111997
2010-08-24 23:26:21 +00:00
John McCall 24d189484b When trying to resolve the address of an overloaded expression,
only form pointers-to-member if the expression has the appropriate
form.  This avoids assertions later on on invalid code, but also
allows us to properly resolve mixed-staticity overloads.

llvm-svn: 111987
2010-08-24 22:52:39 +00:00
Sebastian Redl 401b39a736 AST writer support for having specializations of templates from earlier in the chain. This ought to finish C++ chained PCH support.
llvm-svn: 111986
2010-08-24 22:50:24 +00:00
Sebastian Redl aba202b430 AST reader support for having specializations of templates from earlier in the chain.
llvm-svn: 111985
2010-08-24 22:50:19 +00:00
Daniel Dunbar d435275c59 Frontend: Add basic -H support.
- I didn't implement the GCC "multiple include guard" detection parts, because
   it doesn't seem useful or obvious.

llvm-svn: 111983
2010-08-24 22:44:13 +00:00
Dale Johannesen 46742a4771 Add some missing X86-specific asm constraint letters, and fix
some bugs in setting allowsRegister on the ones there.
8348447.

llvm-svn: 111980
2010-08-24 22:33:12 +00:00
Chris Lattner 576048657e correct the -isystem option to not add the -isysroot path. Only the weird
-iwithsysroot flag should do that.  This fixes rdar://8345942

llvm-svn: 111979
2010-08-24 22:27:37 +00:00
Ted Kremenek 5f0c066062 Fix printf format string checking for '%lc' (which expects a wint_t or compatible argument). Fixes PR 7981.
llvm-svn: 111978
2010-08-24 22:24:51 +00:00
Fariborz Jahanian e0fd5a9299 It is not error in c++ to take address of
register variable (c++03 7.1.1P3). radar 8108252.

llvm-svn: 111977
2010-08-24 22:21:48 +00:00
Douglas Gregor ec00a26855 Implement code completion for preprocessor expressions and in macro
arguments.

llvm-svn: 111976
2010-08-24 22:20:20 +00:00
Chris Lattner 4b2164cab8 Implement -iwithsysroot, an apple extension which is a close cousin of -isystem.
Instead of implementing -isystem, I accidentally implemented this cousin.  Next
up is to implement -isystem right.

llvm-svn: 111966
2010-08-24 21:09:16 +00:00
Tom Care a460311710 Improvements to IdempotentOperationChecker and its use of PseudoConstantAnalysis
- Added wasReferenced function to PseudoConstantAnalysis to determine if a variable was ever referenced in a function (outside of a self-assignment)
- BlockDeclRefExpr referenced variables are now explicitly added to the non-constant list
- Remove unnecessary ignore of implicit casts
- Generalized parameter self-assign detection to detect deliberate self-assigns of variables to avoid unused variable warnings
- Updated test cases with deliberate self-assignments
- Fixed bug with C++ references and pseudoconstants
- Added test case for C++ references and pseudoconstants

llvm-svn: 111965
2010-08-24 21:09:07 +00:00
John McCall 5c32be0053 Move some of SemaOverload's API to various places in Overload.h, and kill
some of it off completely.

llvm-svn: 111957
2010-08-24 20:38:10 +00:00
Douglas Gregor 127851084d Implement preprocessor code completion where a macro name is expected,
e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname>
expression in a preprocessor conditional.

llvm-svn: 111954
2010-08-24 20:21:13 +00:00
Douglas Gregor 3a7ad25eb6 Introduce basic code-completion support for preprocessor directives,
e.g., after a "#" we'll suggest #if, #ifdef, etc.

llvm-svn: 111943
2010-08-24 19:08:16 +00:00
Fariborz Jahanian 76b35379f5 Fix a bug in nonfragile-abi2 when attempting to diagnose
previous use of a synthesized 'ivar' with property of same name
declared as @dynamic. In this case, 'ivar' is in the
inherited class and no diagnostics should be issued.

llvm-svn: 111940
2010-08-24 18:48:05 +00:00
Devang Patel 22e99c2bad Fix enum size and align. Tested by setvar.exp in gdb testsuite.
llvm-svn: 111936
2010-08-24 18:14:06 +00:00
Daniel Dunbar 64c222a6bc Debug Info: Put full Clang version into the debug info, to make it easier to
identify what version of the compiler was used to build something.

llvm-svn: 111927
2010-08-24 17:41:09 +00:00
John McCall afad82e4d0 Sema doesn't need these STL headers.
llvm-svn: 111926
2010-08-24 17:40:45 +00:00
Daniel Dunbar fe6c97b443 Driver/Clang: Forward -Wa, and -Xassembler to clang -cc1 when using the
integrated assembler. For now this mostly just means that we will error out if
someone tries to use this mechanism to send an argument to the assembler.

llvm-svn: 111921
2010-08-24 16:47:49 +00:00
Douglas Gregor e90dd00c3c When providing completions for a function or method argument that
corresponds to a block pointer, provide the skeleton of a block
literal.

llvm-svn: 111918
2010-08-24 16:15:59 +00:00
Douglas Gregor 117db7e95a Parse all kinds of declarations as part of a linkage-specification,
from Francois Pichet! Fixes PR7754. 

llvm-svn: 111912
2010-08-24 14:14:45 +00:00
John McCall c5990644b0 It turns out that this template is only instantiated at one type.
llvm-svn: 111908
2010-08-24 09:05:15 +00:00
John McCall cc14d1fd23 More header elimination. The goal of all this is to allow Parser to
#include Sema.h while keeping all the AST declarations opaque.  That may
not be reasonably attainable, though.

llvm-svn: 111907
2010-08-24 08:50:51 +00:00
John McCall bfd822ce64 Remove a header dependency from Sema.h at the cost of some type safety.
If someone wants to fix this some other way....

llvm-svn: 111905
2010-08-24 07:32:53 +00:00
John McCall de6836a384 Struggle mightily against header inclusion in Sema.h.
llvm-svn: 111904
2010-08-24 07:21:54 +00:00
John McCall dadc575b1e OwningExprResult -> ExprResult. This patch brought to you by
M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result

llvm-svn: 111903
2010-08-24 06:29:42 +00:00
John McCall e172be555d Fold ASTOwningResult back into ActionResult.
llvm-svn: 111902
2010-08-24 06:09:16 +00:00
John McCall ba7bf59503 Abstract out passing around types and kill off ActionBase.
llvm-svn: 111901
2010-08-24 05:47:05 +00:00
Douglas Gregor f0f8369912 Diagnose the presence of multiple initializations of static data
members, from Faisal Vali! Fixes PR6904.

llvm-svn: 111900
2010-08-24 05:27:49 +00:00
Eli Friedman 7fd5544bc9 PR7971: Compute the correct type for an address-of expression containing an
UnresolvedMemberExpr.

llvm-svn: 111899
2010-08-24 05:23:20 +00:00
Douglas Gregor 56ccce0064 State explicitly that we are intentionally not providing macro completions for declarator name completions
llvm-svn: 111898
2010-08-24 04:59:56 +00:00
Zhongxing Xu 5b297da1de Improve comments.
llvm-svn: 111897
2010-08-24 04:26:55 +00:00
Douglas Gregor f02e5f3a2f Consistently switch on PCC_Type
llvm-svn: 111888
2010-08-24 01:11:00 +00:00
Douglas Gregor 99fa264a67 Provide code completion results for the context-sensitive Objective-C
keywords "in", "out", "inout", "byref", "bycopy", and "oneway".

llvm-svn: 111884
2010-08-24 01:06:58 +00:00
Sebastian Redl 9617e7e8c7 Add testcase for C++ chained PCH and fix the bugs it uncovered in name lookup.
llvm-svn: 111882
2010-08-24 00:50:16 +00:00
Sebastian Redl a4071b4fac Write visible update blocks. No regressions in normal PCH functionality, but no tests for the chain yet.
llvm-svn: 111881
2010-08-24 00:50:09 +00:00
Sebastian Redl d7dce0a44d Read the UPDATE_VISIBLE record, and add its visible decls to the lookup tables. Also, free the lookup tables when destructing the ASTReader.
llvm-svn: 111880
2010-08-24 00:50:04 +00:00
Sebastian Redl 9d8f58b5d7 Correctly initialize the visible decls pointer if there are no visible decls for a record.
llvm-svn: 111879
2010-08-24 00:50:00 +00:00
Sebastian Redl 471ac2f02e Baby step towards supporting namespaces in chained PCH.
llvm-svn: 111878
2010-08-24 00:49:55 +00:00
Peter Collingbourne 85dd0bd18d Move ExecuteCompilerInvocation to a new library FrontendTool
r110903 introduced a dependency from Frontend to every library that
declared an Action by introducing Action references that previously
resided in the driver in the file ExecuteCompilerInvocation.cpp.
This patch moves ExecuteCompilerInvocation to a new library named
FrontendTool which is intended to bear these dependencies.

llvm-svn: 111873
2010-08-24 00:31:22 +00:00
Douglas Gregor dbb71db4cc When calling a function or messaging a method marked "sentinel", add
the ", nil", ", NULL", or ", (void*)0" to the end of the code
completion, since it always has to be there anyway.

llvm-svn: 111867
2010-08-23 23:51:41 +00:00
Chris Lattner 8460224958 fix PR7953 - Windows filename are case insensitive:
#pragma once wasn't working on win32 if the header file was included
using a different case.
I tracked down  the problem to the fact that clang::FileManager was
caching files using case sensitive string (UniqueFiles) on Windows.

I changed FileManager to cache filename in lower case only.
Doesn't affect UNIX because UNIX uses Inode to uniquely identify files.

unix doesn't use this codepath.

Analysis and patch by Francois Pichet!

llvm-svn: 111866
2010-08-23 23:50:42 +00:00
John McCall b268a282a4 Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).
llvm-svn: 111863
2010-08-23 23:25:46 +00:00
Douglas Gregor f757a12dfc Introduce new libclang API functions that determine the availability
of a cursor or code-completion result, e.g., whether that result
refers to an unavailable, deleted, or deprecated declaration.

llvm-svn: 111858
2010-08-23 23:00:57 +00:00
Fariborz Jahanian 616d3e71c2 Handling remaining rule for synthesize bitfields in
class extensions (nonfragile-abi2).For every class @interface and class
extension @interface, if the last ivar is a bitfield of any type,
then add an implicit `char :0` ivar to the end of that interface.

llvm-svn: 111857
2010-08-23 22:46:52 +00:00
Daniel Dunbar 82eb4ce476 Driver: Move Clang "triple" computation routines to method on the
ToolChain. This fixes a potenial bad cast when running Clang on PPC code, since
the tool chain in effect is not a subclass of the Darwin one, but we were
treating it like it was.
 - This introduces some gross code duplication, but the right fix for it is to
   just move the Driver to start depending on the targets in libBasic, so I am
   not planning on fixing it immediately.

llvm-svn: 111856
2010-08-23 22:35:37 +00:00
Devang Patel 41c2097058 Emit debug info for enum constants.
llvm-svn: 111852
2010-08-23 22:07:25 +00:00
Douglas Gregor ce0e856809 Include __FUNCTION__, __PRETTY_FUNCTION_, __func__ in code-completion
results for expression contexts within a function.

llvm-svn: 111851
2010-08-23 21:54:33 +00:00
Douglas Gregor 68762e7852 Introduce a code-completion hook for the Objective-C collection
argument in a for-each statement (e.g., "for (id x in <blah>)"), which
restricts the expression completions provided to Objective-C types (or
class types in C++).

llvm-svn: 111843
2010-08-23 21:17:50 +00:00
Dan Gohman 66427b1fcf Reinstate the code for emitting an initial debug type for a struct,
to handle the case where the struct is only forward-declared. In
this case, a temporary MDNode is not needed and not desired.

llvm-svn: 111842
2010-08-23 21:15:56 +00:00
Daniel Dunbar e31e323c02 Driver/Darwin: Switch to using simplified tool chain by default -- what better
way to see what will break! :)

llvm-svn: 111840
2010-08-23 20:58:55 +00:00
Daniel Dunbar 09a4851ead Driver/Darwin: When using the simplified Clang toolchain, make sure to also pass
the arch specific gcc lib path.

llvm-svn: 111839
2010-08-23 20:58:52 +00:00
Daniel Dunbar 5d3b70a6fc Driver: Update -ccc-install-dir to also set the installed dir. Totally
non-obvious.

llvm-svn: 111838
2010-08-23 20:58:50 +00:00
Tom Care e332c3b762 Several small changes to PseudoConstantAnalysis and the way IdempotentOperationChecker uses it.
- Psuedo -> Pseudo (doh...)
- C++ reference support
- Added pseudoconstant test case for __block vars
- Separated out static local checking from pseudoconstant analysis and generalized to non-local checking
- Added missing test cases for storage false positives

llvm-svn: 111832
2010-08-23 19:51:57 +00:00
Douglas Gregor 2529b55b4d Don't include macro results when we're completing a declarator.
llvm-svn: 111830
2010-08-23 19:33:40 +00:00
Fariborz Jahanian bf9294fb65 Support for IRGen of synthesize bitfield ivars in
objc-nonfragile-abi2 (radar 7824380).

llvm-svn: 111823
2010-08-23 18:51:39 +00:00
Douglas Gregor c49f5b2f11 Introduce a new code-completion point when we're parsing a
declarator. Here, we can only see a few things (e.g., cvr-qualifiers,
nested name specifiers) and we do not want to provide other non-macro
completions. Previously, we would end up in recovery mode and would
provide a large number of non-relevant completions.

llvm-svn: 111818
2010-08-23 18:23:48 +00:00
Douglas Gregor f63e4c3334 Emit an error noting that Clang does not support code generation for
the ternary operator without a left-hand side in C++ (PR7726), from
Jean-Daniel Dupas!

llvm-svn: 111809
2010-08-23 14:50:27 +00:00
Douglas Gregor a05f5aba9a When complaining about a duplicate declspec, provide a Fix-It that
removes the copy. Patch from Eelis van der Weegen, tweaked/updated by
me.

llvm-svn: 111807
2010-08-23 14:34:43 +00:00
Chandler Carruth 76c0cb493f Add a virtual destructor to the base of another class hierarchy with virtual
methods.

llvm-svn: 111804
2010-08-23 08:37:21 +00:00
Chandler Carruth c926240172 Relax the construction of a definition for implicit, trivial default
constructors. We perform semantic checking when creating the definition, and
this isn't needed in certain contexts (value initialization) but is in others
(default initialization). This fixes PR7948.

We add explicit code to the default initialization path to ensure the
definition is both present and valid.

Doug, please review. I think this follows your latest suggestion, and it ended
up remarkably cleaner than I anticipated. Also let me know if similar logic
should be followed for destructors and copy-constructors.

llvm-svn: 111802
2010-08-23 07:55:51 +00:00
John McCall 3e56fd4d22 Push DeclGroupRefs and TemplateNames in an opaque but type-safe way
through the parser.

llvm-svn: 111800
2010-08-23 07:28:44 +00:00
Argyrios Kyrtzidis 421ad5e1e6 In Sema::AddBuiltinOperatorCandidates, candidate pointer types set can also contain a ObjCObjectPointerType since r111699.
Don't assume that they are only PointerTypes or we will crash.

llvm-svn: 111798
2010-08-23 07:12:16 +00:00
John McCall 61a148881f chandlerc pointed out that ending a line with /\ is not very friendly. :)
llvm-svn: 111797
2010-08-23 06:56:36 +00:00
John McCall 572ccbc2c2 Kill off Parser::TemplateParameterList to avoid misparses.
llvm-svn: 111796
2010-08-23 06:53:58 +00:00
John McCall 37ad551a25 Sundry incremental steps towards killing off Action.
llvm-svn: 111795
2010-08-23 06:44:23 +00:00
Chris Lattner 65526f0190 fix rdar://8340348, a miscompile of boost that was exposed by r109848.
That revision started classifying truly empty structs like "Y" and "X"
as being NoClass/NoClass and turning them into 'ignore'.  The call code
turns around and allocates space for the ignored argument with 
GetUndefRValue.  The bug is that GetUndefRValue would return the address
as undef, instead of returning an object with a defined address but 
undefined contents.

llvm-svn: 111794
2010-08-23 05:26:13 +00:00
Zhongxing Xu fee32dc783 Adjust code placement.
llvm-svn: 111790
2010-08-23 01:37:32 +00:00
John McCall 7a9aac2d9f Abstract out everything having to do with member pointers into the ABI
class;  they should just be completely opaque throughout IR gen now,
although I haven't really audited that.

Fix a bug apparently inherited from gcc-4.2 where we failed to null-check
member data pointers when performing derived-to-base or base-to-derived
conversions on them.

llvm-svn: 111789
2010-08-23 01:21:21 +00:00
John McCall aa4149a2aa Extract a method to check whether a function is the global placement
operator new[].

llvm-svn: 111788
2010-08-23 01:17:59 +00:00
John McCall 614dbdcd55 Go back to asking CodeGenTypes whether a type is zero-initializable.
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.

llvm-svn: 111786
2010-08-22 21:01:12 +00:00
Nick Lewycky 0b84914da0 Add x86intrin.h which is generic x86 intrinsics for more than just Intel. Thus
far, this just #include's immintrin.h for compatibility.

llvm-svn: 111785
2010-08-22 20:38:05 +00:00
Douglas Gregor ec3a3f5257 Do not elide copy construction when we're performing base-class initialization
llvm-svn: 111783
2010-08-22 18:27:02 +00:00
Douglas Gregor 932c19dc9f Eliminate a stale assertion. Fixes Clang self-host.
llvm-svn: 111782
2010-08-22 18:26:35 +00:00
Douglas Gregor b0a04fff51 Preserve the zero-initialization and construction-kind settings when
instantiating CXXConstructExpr expressions.

llvm-svn: 111780
2010-08-22 17:20:18 +00:00
Douglas Gregor 630c76efb0 When performing value-initialization for a class with a non-trivial,
implicitly-defined default constructor, zero-initialize the memory
before calling the default constructor. Previously, we would only
zero-initialize in the case of a trivial default constructor.

Also, simplify the hideous logic that determines when we have a
trivial default constructor and, therefore, don't need to emit any
call at all.

llvm-svn: 111779
2010-08-22 16:15:35 +00:00
John McCall c29eb8a9d1 Clean up a very silly use of first-class aggregates.
llvm-svn: 111777
2010-08-22 11:04:31 +00:00
John McCall a1dee5300b Experiment with using first-class aggregates to represent member function
pointers.  I find the resulting code to be substantially cleaner, and it
makes it very easy to use the same APIs for data member pointers (which I have
conscientiously avoided here), and it avoids a plethora of potential
inefficiencies due to excessive memory copying, but we'll have to see if it
actually works.

llvm-svn: 111776
2010-08-22 10:59:02 +00:00
John McCall 131d97d809 Extract member function pointer comparison and null comparison into
the ABI code.  Implement correct semantics for these on ARM.

I believe this completes the implementation of member function pointers
on ARM.

I think I'm going to switch member function pointers over to be
non-aggregates while I have all this in mind.

llvm-svn: 111774
2010-08-22 08:30:07 +00:00
Chandler Carruth 6f33bd9345 Add two new enumerations to the unsupported list for Windows so that all cases
are handled.

llvm-svn: 111773
2010-08-22 06:56:37 +00:00
John McCall 1c456c89dc Abstract out member-pointer creation. I'm really unhappy about the current
duplication between the constant and non-constant paths in all of this.

Implement ARM ABI semantics for member pointer constants and conversion.

llvm-svn: 111772
2010-08-22 06:43:33 +00:00
John McCall 84fa510aa9 Abstract more member-pointerness out.
llvm-svn: 111771
2010-08-22 04:16:24 +00:00
John McCall a8bbb82c55 Abstract out member-pointer conversions.
Pretty much everything having to do with member pointers is ABI-specific.

llvm-svn: 111770
2010-08-22 03:04:22 +00:00
Eli Friedman 04831926ec Detabify.
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
John McCall d9c6c0b583 Implement the call parts of the member-function-pointer ARM C++ ABI.
llvm-svn: 111766
2010-08-22 00:59:17 +00:00
John McCall 475999dcf9 Extract calls to method pointers out as an ABI routine.
No functionality change.

llvm-svn: 111752
2010-08-22 00:05:51 +00:00
John McCall 86353416a7 The ARM C++ ABI is sufficiently different from the Itanium C++ ABI that
it deserves its own enumerator.  Obviously the implementations should
closely follow the Itanium ABI except in cases of divergence.

llvm-svn: 111749
2010-08-21 22:46:04 +00:00
Michael J. Spencer b186bc3c4b Visual Studio tools used on win32 hosts when targeting win32.
llvm-svn: 111748
2010-08-21 21:55:07 +00:00
Fariborz Jahanian f2afc804c3 twik to my previous patch for pr7936.
Build qualified version of ObjC pointers (not pointers) when
doing overload resolution.

llvm-svn: 111740
2010-08-21 17:11:09 +00:00
Zhongxing Xu faf150bbc3 Place method near its class.
llvm-svn: 111737
2010-08-21 12:24:38 +00:00
Zhongxing Xu 7a1a8e25ea Remove dead code.
llvm-svn: 111736
2010-08-21 11:05:46 +00:00
Zhongxing Xu e11f17f5ed Improve comments.
llvm-svn: 111735
2010-08-21 11:03:37 +00:00
Zhongxing Xu 5cba6c85c9 Remove a special case for OSAtomic functions. We can already bind and retrieve
with the same binding key. The only trick here is that sometimes the Symbolic
region is stored in with an LocAsInteger wrapper. We unwrap that in 
SVal::getAsLocSymbol().

llvm-svn: 111734
2010-08-21 11:00:26 +00:00
John McCall 4887165193 DeclPtrTy -> Decl *
llvm-svn: 111733
2010-08-21 09:40:31 +00:00
Zhongxing Xu e70b6d17a4 Remove dead code. We no longer need it because now we treat the first element
region and its base region as the same binding key.

llvm-svn: 111732
2010-08-21 08:55:42 +00:00
Zhongxing Xu cdadf8d9b2 remove unused variable.
llvm-svn: 111731
2010-08-21 06:51:45 +00:00
Zhongxing Xu adc3ac7012 When invalidating a struct region, whether its type definition exists is not
relavant any more, because we set its default value to a symbol, and the type of
default symbolic value is irrelavant.

llvm-svn: 111730
2010-08-21 06:26:59 +00:00
Michael J. Spencer 1d9c76d637 Fix typo in comment.
llvm-svn: 111729
2010-08-21 06:05:06 +00:00
Daniel Dunbar 5c816378f8 IRgen: Set the alignment correctly when creating LValue for a decls.
- Fixes PR5598.
 - Review appreciated.

llvm-svn: 111726
2010-08-21 04:20:22 +00:00
Daniel Dunbar 49e5d12e59 CodeGenFunction: Eliminate unused MakeQualifiers() function.
llvm-svn: 111725
2010-08-21 04:13:07 +00:00
Daniel Dunbar 26d2c39b95 Simplify.
llvm-svn: 111724
2010-08-21 04:05:54 +00:00
Daniel Dunbar 226bddaff1 IRgen/CGValue: Give MakeAddrLValue() an alignment argument, and eliminate old form of MakeAddr().
llvm-svn: 111723
2010-08-21 03:58:45 +00:00
Daniel Dunbar 4bb04cee6a IRgen: Move remaining LValue::Set... methods to LValue::set... (non-static) methods.
llvm-svn: 111722
2010-08-21 03:51:29 +00:00
Daniel Dunbar f166a523f1 IRgen: Move remaining MakeAddr() calls to MakeAddrLValue().
llvm-svn: 111721
2010-08-21 03:44:13 +00:00
Daniel Dunbar e8b6cda15a IRgen: The CVR qualifiers in a subobject adjustment should just come from the
field (I think).
 - Doug, please check.

llvm-svn: 111720
2010-08-21 03:37:02 +00:00
Daniel Dunbar b657ac51cf IRgen/CGValue: Add getQuals(), so qualifiers can be modified on an LValue.
llvm-svn: 111719
2010-08-21 03:29:54 +00:00
Daniel Dunbar e50dda95ee IRgen/LValue: Add LValue::setNonGC instead of SetObjCNonGC, for consistency with isNonGC().
llvm-svn: 111718
2010-08-21 03:22:38 +00:00
Daniel Dunbar 2e442a00b3 IRgen: Switch more MakeAddr() users to MakeAddrLValue; this time for calls which were previously not computing the qualifier list. In most cases, I don't think it matters, but I believe this is conservatively more correct / consistent.
llvm-svn: 111717
2010-08-21 03:15:20 +00:00
Daniel Dunbar f6fb7e2b53 IRgen: Switch a bunch of trivial MakeAddr calls to use MakeAddrLValue.
llvm-svn: 111716
2010-08-21 03:08:16 +00:00
Daniel Dunbar b1d94a98dd IRgen: Eliminate EmitPredefinedFunctionName(), it doesn't need to be factored out.
llvm-svn: 111715
2010-08-21 03:01:12 +00:00
Daniel Dunbar 93b00a98a3 IRgen: Add an LValue::MakeAddr variant which takes a type and uses that to build
the qualifiers.

Also, add CodeGenFunction::MakeAddrLValue() helper function which passes in the
ASTContext.

llvm-svn: 111714
2010-08-21 02:53:44 +00:00
Dan Gohman 25f9aaedc6 Delete an obsolete comment.
llvm-svn: 111711
2010-08-21 02:41:29 +00:00
Daniel Dunbar e3b8dd433c IRgen/CGValue: Add alignment to LValue, and use that alignment when generating lvalue load/stores.
llvm-svn: 111710
2010-08-21 02:39:23 +00:00
Daniel Dunbar ab4dbea096 IRgen/LValue: Rename SetQualifiers() to Initialize().
llvm-svn: 111708
2010-08-21 02:31:58 +00:00
Daniel Dunbar 0381634a61 IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument and
update callers as best I can.
 - This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement.
 - Serious review appreciated.

llvm-svn: 111707
2010-08-21 02:24:36 +00:00
Daniel Dunbar a94e3d1124 IRgen: Use Ty consistently in this function.
llvm-svn: 111705
2010-08-21 02:17:08 +00:00
Chris Lattner 20a2b46ca2 fix PR7943, a corner case with the GNU __VA_ARGS__ comma
swallowing extension.

llvm-svn: 111701
2010-08-21 00:27:00 +00:00
Fariborz Jahanian e4151b590e patch to support comparison involving
objctive-c pointer conversions. Fixes pr7936.

llvm-svn: 111699
2010-08-21 00:10:36 +00:00
Argyrios Kyrtzidis d32ee89ea2 Fix an issue with writing to PCH another included PCH, introduced by the "using an AST on-disk hash table for name lookup" commit.
When including a PCH and later re-emitting to another PCH, the name lookup tables of DeclContexts
may be incomplete, since we now lazily deserialize the visible decls of a particular name.
Fix the issue by iterating over the un-deserialized visible decls and completing the lookup tables
of DeclContexts before writing them out.

llvm-svn: 111698
2010-08-20 23:35:55 +00:00
Fariborz Jahanian 45b31616bd Remove dead code.
llvm-svn: 111693
2010-08-20 23:02:01 +00:00
Benjamin Kramer 6f35f3cd80 Disallow direct inclusion of avxintrin.h. Users should include immintrin.h instead. This matches GCC's behavior.
llvm-svn: 111692
2010-08-20 23:00:03 +00:00
Dan Gohman b1aac3362c CreateTemporaryType doesn't needs its Context argument.
llvm-svn: 111688
2010-08-20 22:39:57 +00:00
Dan Gohman 196f71006e Introduce a new temporary MDNode concept. Temporary MDNodes are
not part of the IR, are not uniqued, and may be safely RAUW'd.
This replaces a variety of alternate mechanisms for achieving
the same effect.

llvm-svn: 111682
2010-08-20 22:02:57 +00:00
Fariborz Jahanian 662f05a035 Rmove dead code.
llvm-svn: 111680
2010-08-20 21:45:03 +00:00
Fariborz Jahanian a50b3a20f1 objective-c ivar refactoring patch. Iterations
over ivars for a varienty of puposes is now
consolidated into two small routines; DeepCollectObjCIvars
and ShallowCollectObjCIvars. 

llvm-svn: 111679
2010-08-20 21:21:08 +00:00
Nick Lewycky fe71238b8d Add a workaround for PR7947, a crash trying to recover from invalid C++ code.
llvm-svn: 111675
2010-08-20 20:54:15 +00:00