Commit Graph

24355 Commits

Author SHA1 Message Date
Jim Grosbach 71d963e954 Re-apply fixed version of 108749, correctly conditionalizing the new sections on
ObjC ABI version 2 this time.

llvm-svn: 108847
2010-07-20 16:20:26 +00:00
Douglas Gregor 73a18fdd39 Slip up long string literal
llvm-svn: 108838
2010-07-20 14:34:35 +00:00
Douglas Gregor b37b46e488 Complain when string literals are too long for the active language
standard's minimum requirements.

llvm-svn: 108837
2010-07-20 14:33:20 +00:00
Argyrios Kyrtzidis dde5790562 Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
FunctionTemplateDecl::findSpecialization.

Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.

llvm-svn: 108834
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis c1624e9eda Whether the specialization should be added to template's folding set when read from PCH,
is determined by a isCanonicalDecl check.

llvm-svn: 108833
2010-07-20 13:59:40 +00:00
Argyrios Kyrtzidis 47470f2f3f Hide the specializations folding sets of ClassTemplateDecl as an implementation detail (InsertPos
leaks though) and add methods to its interface for adding/finding specializations.

Simplifies its users a bit and we no longer need to replace specializations in the folding set with
their redeclarations. We just return the most recent redeclarations.

As a bonus, it fixes http://llvm.org/PR7670.

llvm-svn: 108832
2010-07-20 13:59:28 +00:00
Rafael Espindola 38360b3ff7 Add -lstdc++ to DragonFly tools.
Patch by Sascha Wildner.

llvm-svn: 108830
2010-07-20 12:59:03 +00:00
Zhongxing Xu edb77fe8b4 Constify all references to Stmt* and CFGBlock* in libChecker.
llvm-svn: 108811
2010-07-20 06:22:24 +00:00
Zhongxing Xu 09a95d7448 Add const iterator to InitListExpr.
llvm-svn: 108810
2010-07-20 06:15:27 +00:00
Sebastian Redl c57d34bc35 Update ImplicitCastExpr to be able to represent an XValue.
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Daniel Dunbar 08d047666a Fix test for Win32.
llvm-svn: 108806
2010-07-20 04:06:54 +00:00
Zhongxing Xu 6694255306 Constify.
llvm-svn: 108804
2010-07-20 02:56:49 +00:00
Zhongxing Xu 70856f7986 remove const_cast.
llvm-svn: 108803
2010-07-20 02:53:15 +00:00
Daniel Dunbar 9d8416b799 Driver: Switch to using a SmallVector instead of std::vector, and stop
accessing outside the range of the vector (which always asserts on Win32).

llvm-svn: 108802
2010-07-20 02:47:40 +00:00
Zhongxing Xu 3e02548d22 constify.
llvm-svn: 108801
2010-07-20 02:46:11 +00:00
Zhongxing Xu c2acbe0f45 Constify.
llvm-svn: 108800
2010-07-20 02:41:28 +00:00
Zhongxing Xu 08ce5dd0f0 Add comments.
llvm-svn: 108795
2010-07-20 02:14:22 +00:00
Stuart Hastings 7d7bc561bf Correct line info for declarations/definitions. Radar 8063111.
llvm-svn: 108785
2010-07-19 23:56:31 +00:00
Jim Grosbach 428a7103d9 and revert the related tests, too
llvm-svn: 108766
2010-07-19 22:53:57 +00:00
Jim Grosbach 50c63168ed Temporarily revert. Some odd internal breakage is likely related.
llvm-svn: 108764
2010-07-19 22:43:34 +00:00
Sebastian Redl 3d3f0b1039 Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation.
llvm-svn: 108763
2010-07-19 22:38:35 +00:00
Sebastian Redl bd1b5befee Promote IdentifierOffsets to per-file data.
llvm-svn: 108762
2010-07-19 22:28:42 +00:00
Sebastian Redl 9e687994f3 Promote DeclOffsets and TypeOffsets to per-file data.
llvm-svn: 108760
2010-07-19 22:06:55 +00:00
Fariborz Jahanian 3c7ebc3a5e Patch to type match comparing Objective-C Classes which implement
protocols (Radar 8191774).

llvm-svn: 108758
2010-07-19 22:02:22 +00:00
Ted Kremenek 6cd694233d Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
these don't actually consume an argument.

llvm-svn: 108757
2010-07-19 22:01:06 +00:00
Douglas Gregor aa21cc401b Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.

llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Jim Grosbach 6331d9781c Update tests for r108749
llvm-svn: 108754
2010-07-19 21:39:14 +00:00
Ted Kremenek ce81542d61 Hook up 'invalid conversion' warning for scanf format strings.
llvm-svn: 108750
2010-07-19 21:25:57 +00:00
Jim Grosbach f699594de8 Put ObjC method names, method types and class names in separate string literal
sections. rdar://8207705

llvm-svn: 108749
2010-07-19 20:54:43 +00:00
Sebastian Redl 393f8b76c0 Promote the identifier table to per-file data. Also, if a CHAINED_METADATA record exists, it has to be the first thing in the PCH file.
llvm-svn: 108748
2010-07-19 20:52:06 +00:00
Ted Kremenek f34f346dac Put warnings in the 'Deprecated' group into a 'Deprecations' DiagCategory. Fixes <rdar://problem/8203182>.
llvm-svn: 108743
2010-07-19 20:20:06 +00:00
Ted Kremenek 5c3e1b9a54 Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes <rdar://problem/8204052>.
llvm-svn: 108742
2010-07-19 19:47:40 +00:00
Daniel Dunbar 99b5524324 Driver: Make -fnext-runtime the default when rewriting Objective-C.
llvm-svn: 108741
2010-07-19 19:44:22 +00:00
Daniel Dunbar 2c91be4261 IRgen: Add a test case I forgot to commit at some point.
llvm-svn: 108713
2010-07-19 17:11:38 +00:00
Daniel Dunbar 354e96df95 Driver/Darwin: Add deployment target after doing argument translation, so that
-mmacosx-version-min works inside a -Xarch_ flag.

llvm-svn: 108712
2010-07-19 17:11:36 +00:00
Daniel Dunbar b2b8a91aa4 Driver: Factor out Darwin::AddDeploymentTarget.
llvm-svn: 108711
2010-07-19 17:11:33 +00:00
Douglas Gregor 549c1cd2c5 Remove unused location-to-AST-node resolver. libclang's implementation supercedes it
llvm-svn: 108708
2010-07-19 16:18:30 +00:00
Fariborz Jahanian 2a36089eef Categories cannot synthesize property ivars,
and a minor cleanup.

llvm-svn: 108707
2010-07-19 16:14:33 +00:00
Rafael Espindola 77a067a653 Implement support for reading arguments specified in a file with @file. If
there is no file named "file", keep the @file option unchanged.

llvm-svn: 108697
2010-07-19 15:20:12 +00:00
Zhongxing Xu eb2528104a Fix construction of AnalysisContext. Thanks Daniel.
llvm-svn: 108694
2010-07-19 13:16:50 +00:00
Benjamin Kramer 1b925d5717 Adjust test for float printing differences. Windows uses three digits for the exponent, everyone else two.
llvm-svn: 108693
2010-07-19 11:48:10 +00:00
Argyrios Kyrtzidis 3816ed4d58 Fix http://llvm.org/PR7660
A ParmVarDecl instantiated from a FunctionProtoType may have Record as DeclContext,
in which case isStaticDataMember() will erroneously return true.

llvm-svn: 108692
2010-07-19 10:14:41 +00:00
Daniel Dunbar 00c57967da Revert r108672, "Implement support for reading arguments specified in a file
with @file.", it doesn't correctly handle cases where arguments starting with
'@' are passed to other command line arguments.

llvm-svn: 108686
2010-07-19 07:21:12 +00:00
Chris Lattner 8d72f2aa3a tidy up comment.
llvm-svn: 108676
2010-07-19 05:07:24 +00:00
Rafael Espindola 129e43d29b Implement support for reading arguments specified in a file with @file.
llvm-svn: 108672
2010-07-19 03:08:01 +00:00
Zhongxing Xu cf144c6322 fix test case.
llvm-svn: 108671
2010-07-19 02:06:14 +00:00
Zhongxing Xu a74af93eaf remove CallInliner.cpp.
llvm-svn: 108670
2010-07-19 01:55:38 +00:00
Zhongxing Xu ec5623570e Add double close check to StreamChecker. Patch by Lei Zhang.
llvm-svn: 108669
2010-07-19 01:52:29 +00:00
Zhongxing Xu 84f65e0692 Reapply r108617.
llvm-svn: 108668
2010-07-19 01:31:21 +00:00
Daniel Dunbar e38764c66c Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
 - Fixes a problem where the Clang executable path was not initialized properly
   on Win32, because sys::Path::getBasename() doesn't do what I always think it
   does. Imagine that, a sys::Path interface that is confusing!

llvm-svn: 108667
2010-07-19 00:44:04 +00:00
Daniel Dunbar deaff5d792 Update for LLVM API change.
llvm-svn: 108665
2010-07-19 00:33:53 +00:00
Rafael Espindola 7661436220 Refactor the code a bit so that there is only one call to BuildCompilation. The
StringPointers vector will also be used in the normal case to handle @file
arguments.

llvm-svn: 108660
2010-07-18 22:03:55 +00:00
Daniel Dunbar b31b76f1eb Driver: Fix a possible use after free.
llvm-svn: 108659
2010-07-18 21:16:15 +00:00
Chandler Carruth 3973af797a Fix a goof in my previous patch -- not all of the builtins return a value, some
fixed return types.

llvm-svn: 108657
2010-07-18 20:54:12 +00:00
Eli Friedman f8340deacd Fix mangling for static member variables of classes inside an extern "C"
linkage specification.  Not sure if this is the ideal fix, but I'm reasonably
sure it's correct vs. gcc.

llvm-svn: 108656
2010-07-18 20:49:59 +00:00
Chris Lattner e03a5745b1 daniel doesn't hate me, he hates macpython 2.5, which
is a very reasonable position on life!

llvm-svn: 108651
2010-07-18 18:42:35 +00:00
Peter Collingbourne 9e73cae25e When instantiating function definitions set parameter names to those used in template
The rationale is that we are copying the entire definition including
parameter names which may differ between the declaration and the
definition.

This is particularly important if any parameters are unnamed in the
declaration, as a DeclRef to an unnamed ParmVarDecl would cause the
pretty printer to produce invalid output.

llvm-svn: 108643
2010-07-18 16:45:46 +00:00
Douglas Gregor 3efffd05d5 Revert -Wdiscard-qual typo
llvm-svn: 108641
2010-07-18 11:27:38 +00:00
Chandler Carruth bc8cab16c5 Improve the representation of the atomic builtins in a few ways. First, we make
their call expressions synthetically have the "deduced" types based on their
first argument. We only insert conversions in the AST for arguments whose
values require conversion to match the value type expected. This keeps PR7600
closed by maintaining the return type, but avoids assertions due to unexpected
implicit casts making the type unsigned (test case added from Daniel).

The magic is moved into the codegen for the atomic builtin which inserts the
casts as needed at the IR level to raise the type to an integer suitable for
the LLVM intrinsic. This shouldn't cause any real change in functionality, but
now we can make the builtin be more truly polymorphic.

llvm-svn: 108638
2010-07-18 07:23:17 +00:00
Chris Lattner ad4f38b1a9 BUILD_ARCHIVE is the default for libraries, no need to set it.
llvm-svn: 108633
2010-07-18 00:14:47 +00:00
Eli Friedman 3ee1022f37 Fix crash initializing a bit-field with a non-constant in a place where we
try to evaluate the initializer as a constant.

llvm-svn: 108632
2010-07-17 23:55:01 +00:00
Eli Friedman e98194d9e8 Check for casts to an incomplete type in C. Improves diagnostics for cast to
incomplete union (PR5692) and incomplete enum, and fixes obscure
accepts-invalid on cast to incomplete struct.

llvm-svn: 108630
2010-07-17 20:43:49 +00:00
Fariborz Jahanian aea8e1e3d2 Added PCH/ASTImporter code for ObjCIvarDecl's field.
llvm-svn: 108627
2010-07-17 18:35:47 +00:00
Chris Lattner 52c00bdd5b Add another terrible VC++ compatibility hack: allow users to
allow invalid token pastes (when in -fms-extensions mode)
with -Wno-invalid-token-paste

llvm-svn: 108624
2010-07-17 16:24:30 +00:00
Chris Lattner b2c4937ee4 rename test
llvm-svn: 108623
2010-07-17 16:18:46 +00:00
Chris Lattner 3e40dd34c4 rename test
llvm-svn: 108622
2010-07-17 16:17:41 +00:00
Benjamin Kramer e2e031ed6f Revert r108617, it broke the build.
llvm-svn: 108621
2010-07-17 13:51:58 +00:00
Zhongxing Xu 8de7966fd5 Fix cmake build.
llvm-svn: 108619
2010-07-17 11:59:16 +00:00
Zhongxing Xu 4ca4a999b1 Prepare the analyzer for the callee in another translation unit:
Let AnalysisContext contain a TranslationUnit.
  Let CallEnter refer to an AnalysisContext instead of a FunctionDecl.

llvm-svn: 108617
2010-07-17 11:12:42 +00:00
Daniel Dunbar 05474285aa clang -cc1as: Switch to using AsmParser constructor function.
llvm-svn: 108605
2010-07-17 02:26:21 +00:00
Ted Kremenek b32964d02d Fix '<rdar://problem/8202272> __imag passed non-complex should not crash' by removing a bogus assertion.
llvm-svn: 108602
2010-07-17 01:28:55 +00:00
Fariborz Jahanian 6a06144021 Another test case for on demand synthesis of ivars.
llvm-svn: 108600
2010-07-17 01:16:59 +00:00
Fariborz Jahanian 18722981e2 Patch to synthesize property ivars on demand as
part of the new property synthesis by default.
wip.

llvm-svn: 108599
2010-07-17 00:59:30 +00:00
John McCall 36ea3723c0 The GNU-runtime ObjC personality function doesn't let us rethrow with URR for
multiple reasons.  Rethrow with _objc_exception_throw instead.  Fixes PR7656.

llvm-svn: 108595
2010-07-17 00:43:08 +00:00
Ted Kremenek 8b9fd890e3 Fix APFloat assertion failure in IdempotentOperationChecker resulting in having
an APFloat with different "float semantics" than the compared float literal.

llvm-svn: 108590
2010-07-17 00:40:32 +00:00
Sebastian Redl c2e6dbfa19 Teach the PCH reader to load the dependency when encountering a chain metadata record. WIP
llvm-svn: 108578
2010-07-17 00:12:06 +00:00
Anders Carlsson bb4cfdff7e When checking whether to bind an expression to a temporary, don't bind Obj-C message send expressions who call methods that return references.
llvm-svn: 108559
2010-07-16 21:18:37 +00:00
Craig Silverstein e1c6749665 Fix typeid the same way I fixed sizeof. Sad I had missed it before.
Reviewed by chandlerc

llvm-svn: 108557
2010-07-16 21:15:34 +00:00
Ted Kremenek 0030be81f5 Remove unicode quotes characters that somehow made it into a recent commit of mine.
llvm-svn: 108552
2010-07-16 20:49:01 +00:00
Sebastian Redl 2abc0383ce Separate out the initial loading of a PCH so that loading chained PCHs can reuse it.
llvm-svn: 108551
2010-07-16 20:41:52 +00:00
Tom Care 826e6b4023 Improved false positive rate for the idempotent operations checker and moved it into the default path-sensitive analysis options.
- Added checks for static local variables, self assigned parameters, and truncating/extending self assignments
- Removed command line option (now default with --analyze)
- Updated test cases to pass with idempotent operation warnings

llvm-svn: 108550
2010-07-16 20:41:41 +00:00
Nick Lewycky 725b4e7533 Give the 'self/array-comparison is always true/false' warning a new flag,
"-Wtautological-compare".

llvm-svn: 108546
2010-07-16 18:42:10 +00:00
Ted Kremenek d7b31cc60d Hook up warning for an incomplete scanlist in scanf format strings.
llvm-svn: 108542
2010-07-16 18:28:03 +00:00
Ted Kremenek c618728e8d Tweak zero-field width in scanf format string diagnostic.
llvm-svn: 108541
2010-07-16 18:27:56 +00:00
Sebastian Redl 34522813e7 First baby steps towards PCHReader being able to keep track of multiple PCH files. WIP
llvm-svn: 108537
2010-07-16 17:50:48 +00:00
Chandler Carruth 34833372d1 Make this destructor virtual to placate GCC's warnings.
llvm-svn: 108534
2010-07-16 17:27:32 +00:00
Craig Silverstein 16b7d86ef7 Fix up some of the visiting for array types -- we weren't good about
getting array indices before -- and for some of the builtin operators:
sizeof, offsetof, unaryops like __is_enum.

Also fix the function visitor to visit exception types in function
parameters.

Reviewed by wan and chandlerc.

llvm-svn: 108533
2010-07-16 17:06:12 +00:00
John McCall 934069464e Initialize a couple of fields inherited for our private use.
llvm-svn: 108532
2010-07-16 17:02:45 +00:00
Douglas Gregor fc6c3e73cd When performing template name lookup for a dependent member access
expression such as the "foo" in "this->blah.foo<1, 2>", and we can't
look into the type of "this->blah" (e.g., because it is dependent),
look into the local scope of a template of the same name. Fixes
<rdar://problem/8198511>.

llvm-svn: 108531
2010-07-16 16:54:17 +00:00
Sebastian Redl 1ea025bef9 Add a little more data to chained PCHs. WIP
llvm-svn: 108528
2010-07-16 16:36:56 +00:00
Douglas Gregor 3a8e0d7d57 Revert Microsoft-specific override of the "typedef requires a name"
diagnostic. Instead, put it and the "declaration does not declare
anything" warning into -Wmissing-declarations.

llvm-svn: 108527
2010-07-16 15:40:40 +00:00
Douglas Gregor 5692680e0e Suppress the "typedef requires a name" warning in Microsoft-extensions mode
llvm-svn: 108526
2010-07-16 15:18:19 +00:00
John McCall 796c2a52a9 Treat template parameters as part of the declaration-specifiers for the
purpose of access control.  Fixes PR7644.

I can't actually find anything directly justifying this, but it seems obvious.

llvm-svn: 108521
2010-07-16 08:13:16 +00:00
Chandler Carruth eeb3c8419f Make this grossness default to the error it should always be.
llvm-svn: 108511
2010-07-16 05:46:45 +00:00
Daniel Dunbar 84336ba3f8 Sema: Fix a bug with #pragma options align=reset, reset against an empty stack
is well defined, it resets to the default alignment.

llvm-svn: 108508
2010-07-16 04:54:16 +00:00
Chandler Carruth 9339605c35 Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.
llvm-svn: 108505
2010-07-16 04:32:28 +00:00
Ted Kremenek 5530131bb7 Add initial test cases for scanf format string checking.
llvm-svn: 108503
2010-07-16 02:11:34 +00:00
Ted Kremenek a1ef09407d Add the main scanf-parsing logic that I meant to include in my previous commit.
llvm-svn: 108502
2010-07-16 02:11:31 +00:00
Ted Kremenek 575e89dda1 Add missing header file.
llvm-svn: 108501
2010-07-16 02:11:26 +00:00
Ted Kremenek 0208793e41 Add most of the boilerplate support for scanf format string checking. This includes
handling the parsing of scanf format strings and hooking the checking into Sema.
Most of this checking logic piggybacks on what was already there for checking printf format
strings, but the checking logic has been refactored to support both.

What is left to be done is to support argument type checking in format strings and of course
fix the usual tail of bugs that will follow.

llvm-svn: 108500
2010-07-16 02:11:22 +00:00
Ted Kremenek 5932c35138 Add builtin definition for scanf, including extending the builtin encoding to
represent builtins that have the "scanf" attribution (via the format attribute) just
like we do with printf functions.  Follow-up work is needed to add similar support
for fscanf et al.

This is to support format-string checking for scanf functions.

llvm-svn: 108499
2010-07-16 02:11:15 +00:00
Eli Friedman eca55afea3 Fix for PR3800: make sure not to evaluate the expression for a read-write
asm operand twice.

llvm-svn: 108489
2010-07-16 00:55:21 +00:00
Daniel Dunbar 999daa57c7 Builtins/ARM: __clear_cache doesn't seem to have a consistent prototype, declare
the builtin as void __clear_cache(...) to workaround this, which appears to
match what GCC does.

llvm-svn: 108487
2010-07-16 00:31:23 +00:00
Daniel Dunbar 3348e2d175 IRgen: Support user defined attributes on block runtime functions.
- This issue here is that /usr/include/Blocks.h wants to define some of the
   block runtime globals as weak, depending on the target. This doesn't work in
   Clang because we aren't using the AST decl for these globals.

 - The fix is a pretty gross hack which just watches all the decls for the
   specific blocks globals we need to know about; if we see one we use it,
   otherwise we use the hand coded type.

   In time, I would like to clean this up by changing IRgen to ask Sema/AST for
   the decl, which would then be lazily loaded from the builtin table if
   necessary. This could be used in a whole host of places in IRgen and would
   get rid of a lot of grotty hand coding of LLVM IR; however, we need some
   extra Sema support for this as well as support for builtin global variables.

llvm-svn: 108482
2010-07-16 00:00:19 +00:00
Daniel Dunbar 900546d2e3 IRgen: Move blocks runtime interfaces to CodeGenModule.
llvm-svn: 108481
2010-07-16 00:00:15 +00:00
Daniel Dunbar 01ad0a78d0 Suppress !+Asserts warning.
llvm-svn: 108480
2010-07-16 00:00:11 +00:00
John McCall 70013b640f When deferring the emission of declarations with initializers in C++, remember
the order they appeared in the translation unit.  If they get emitted, put them
in their proper order.  Fixes rdar://problem/7458115

llvm-svn: 108477
2010-07-15 23:40:35 +00:00
Devang Patel 8fd6499a97 Set "optimization is ON" and supply other optional parameters. This helps codegenerator preserve info in case the symbol is deleted.
llvm-svn: 108471
2010-07-15 23:09:46 +00:00
Douglas Gregor c5dded5f99 Improve test case. Thanks Eli
llvm-svn: 108470
2010-07-15 23:04:05 +00:00
Douglas Gregor 8997690ff1 Don't suppress the emission of available_externally functions marked
with always_inline attribute. Thanks to Howard for the tip.

llvm-svn: 108469
2010-07-15 22:58:18 +00:00
Devang Patel b3026df9fa Mark implementation generated methods as artificial.
Tested by namespace.exp and virtfunc.exp from gdb testsuite.

llvm-svn: 108468
2010-07-15 22:57:00 +00:00
John McCall ec624b2d19 After some discussion, the ABI list settled on a much more sensible mangling
for string literals.

llvm-svn: 108464
2010-07-15 21:53:03 +00:00
Douglas Gregor dc9361876c When we're performing tentative parsing to determine whether the
parser is looking at a declaration or an expression, use a '=' to
conclude that we are parsing a declaration.

This is wrong. However, our previous approach of finding a comma after
the '=' is also wrong, because the ',' could be part of a
template-argument-list. So, for now we're going to use the same wrong
heuristic as GCC and Visual C++, because less real-world code is
likely to be broken this way. I've opened PR7655 to keep track of our
wrongness; note also the XFAIL'd test.

Fixes <rdar://problem/8193163>.

llvm-svn: 108459
2010-07-15 21:05:01 +00:00
Daniel Dunbar 758f87cb97 build/Darwin: Add missing Info.plist template.
llvm-svn: 108457
2010-07-15 20:26:56 +00:00
Daniel Dunbar 20267fefa2 build/Darwin: Enable version information for clang executable.
llvm-svn: 108445
2010-07-15 19:33:44 +00:00
Douglas Gregor cdb466e58f Reinstate the scalar-cast-to-const-reference improvements, this time
with the proper spelling of "non-class prvalue". Silly me, I think
class rvalues were xvalues rather than prvalues!

Hah hah hah.

llvm-svn: 108443
2010-07-15 18:58:16 +00:00
Douglas Gregor cb2b662283 Make the "unused result" warning a warning about run-time behavior, so
that we don't warn when there isn't going to be any computation anyway.

llvm-svn: 108442
2010-07-15 18:47:04 +00:00
Douglas Gregor 31e225cc90 Revert r108431 and r108433 (the cast-to-const-reference fixes), which
broke nightlytest.

llvm-svn: 108439
2010-07-15 18:41:54 +00:00
Douglas Gregor d9d45838e0 Add test case for PR5290; this bug was fixed with the non-class rvalue
de-cv-qualification fixes.

llvm-svn: 108437
2010-07-15 18:35:15 +00:00
Devang Patel 99c372134d Revert 108220 and subsequent patch.
This is not required (I am not 100% sure why) but method.exp from gdb testsuite flagged regression due to this patch.

llvm-svn: 108434
2010-07-15 18:16:09 +00:00
Douglas Gregor 6744cbda03 Spell isPRValue() properly.
llvm-svn: 108433
2010-07-15 18:12:28 +00:00
Douglas Gregor 1bae6a1be9 Teach CodeGenFunction::EmitCastLValue() to handle casts to an lvalue
that involve binding a reference to a pure rvalue temporary (e.g., not
a class temporary), by creating a new temporary and copying the result
there. Fixes PR6024.

llvm-svn: 108431
2010-07-15 18:04:13 +00:00
Douglas Gregor cee039093a CK_BitCast is not an lvalue bitcast any longer
llvm-svn: 108428
2010-07-15 16:39:55 +00:00
Daniel Dunbar b2447154e0 Driver/Darwin: Resolve deployment target defaulting to be more predictable;
assume we are targetting OS X unless an explicit option is given.

llvm-svn: 108426
2010-07-15 16:18:06 +00:00
Daniel Dunbar 736406d0dc Driver/Darwin: Allow -m{ios,macosx}-version-min= to be passed with -Xarch.
- This should be safe, because the driver itself shouldn't need to make
   decisions that depend on the deployment target.

llvm-svn: 108425
2010-07-15 15:26:14 +00:00
Daniel Dunbar 1d14dd1dc6 CodeGen: Tweak ABI handling for Minix, patch by Kees van Reeuwijk!
llvm-svn: 108423
2010-07-15 15:02:28 +00:00
Chris Lattner ceefcf0143 see comment.
llvm-svn: 108410
2010-07-15 05:22:46 +00:00
Daniel Dunbar 487a796d50 Driver: Support 'clang -x ir ...'.
llvm-svn: 108391
2010-07-15 00:49:21 +00:00
Chris Lattner deee7a3c0b restrict the && -> & warning to cover a case daniel noted.
Don't warn about "logically bool" expressions on the RHS,
even if they fold to a constant.

llvm-svn: 108388
2010-07-15 00:26:43 +00:00
Sebastian Redl 85b2a6a430 Add a callback interface that allows interested parties to get notified whenever PCHReader deserializes a type or decl (and possibly other things in the future). Have PCHWriter implement these callbacks as noops and register to receive them if we're chaining PCHs. This will allow PCHWriter to track the IDs of these things, which it needs to write the dependent files. WIP
llvm-svn: 108383
2010-07-14 23:45:08 +00:00
Daniel Dunbar 6f2e839693 CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosing
whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI
dependent.
 - <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug

llvm-svn: 108379
2010-07-14 23:39:36 +00:00
Sebastian Redl 8b41f30064 There is another implementation of PCHReaderListener around. Update it to the new interface.
llvm-svn: 108377
2010-07-14 23:29:55 +00:00
Douglas Gregor eebe72199e When determining whether an overload set with explicit template
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.

llvm-svn: 108376
2010-07-14 23:20:53 +00:00
Benjamin Kramer 8d5609b604 Pass StringRefs by value.
llvm-svn: 108375
2010-07-14 23:19:41 +00:00
Douglas Gregor 5f0e252f63 When there are extra or missing template parameter lists in a template
definition, we're likely going to end up breaking the invariants of
the template system, e.g., that the depths of template parameter lists
match up with the nesting template of the template. So, make sure we
mark such ill-formed declarations as invalid or don't even build them
at all.

llvm-svn: 108372
2010-07-14 23:14:12 +00:00
Douglas Gregor c357f4121e Add lvalue-bitcast support for complex numbers.
llvm-svn: 108363
2010-07-14 21:35:45 +00:00
Sebastian Redl 409183ff7c Increase the max PCH level for declarations to 7. Add a FromPCH flag to types.
llvm-svn: 108354
2010-07-14 20:26:45 +00:00
Daniel Dunbar 9765b9817d Driver: When re'execing clang, use path to the main executable instead of
looking up Clang in the normal search paths (which may end up finding the wrong
clang).

llvm-svn: 108346
2010-07-14 18:46:27 +00:00
Daniel Dunbar 9c3ed5f4d0 Driver: Remove some unused arguments.
llvm-svn: 108345
2010-07-14 18:46:23 +00:00
Fariborz Jahanian 56a9d54de8 Don't error when doing default property synthesis
and some are already synthesized by user declaration.

llvm-svn: 108341
2010-07-14 18:11:52 +00:00
Sebastian Redl 75fbb3b5e5 Make PCHReader cope with PCH files containing more than one predefines buffer.
llvm-svn: 108340
2010-07-14 17:49:11 +00:00
Douglas Gregor 9f1570d993 Only filter out names reserved for the implementation (e.g., __blah or
_Foo) from code-completion results when they come from a system
header.

llvm-svn: 108338
2010-07-14 17:44:04 +00:00
Fariborz Jahanian c0b0ced477 Consider obective-c pointer arguments as valid sentinel args
as well. Fixes radar 7975788.

llvm-svn: 108333
2010-07-14 16:37:51 +00:00
John McCall 4f3b5f302c Fix the mangling of template template arguments, which do not always
follow <name>;  instead they follow <type>, which has <name> as a subset.

Fixes PR7446.

llvm-svn: 108326
2010-07-14 06:43:17 +00:00
Chandler Carruth cb3b5a483f Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.
This flag and warning match GCC semantics. Also, move it to -Wextra as this is
a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to
the tests which no longer by default emit the warning. Added explicit test
cases for both C and C++ behavior with the warning turned on.

llvm-svn: 108325
2010-07-14 06:36:18 +00:00
Douglas Gregor 261793bb73 Add test case that was causing an infinite loop when reading PCH files. The test works with ToT Clang already
llvm-svn: 108318
2010-07-14 04:45:33 +00:00
John McCall afe20780ee Remove a few mangling FIXMEs:
- TSTs whose template is a template template parameter already work
 - we don't provide an imaginary type, so we can't mangle one
 - we don't need a generic FIXME for vendor type qualifiers

llvm-svn: 108317
2010-07-14 04:38:21 +00:00
John McCall 05ddbb80d2 Implement the standard mangling for array-subscript expressions, and implement
the current proposals from David Vandervoorde for new, delete, throw, typeid,
imaginary literals, string literals, and null literals.

llvm-svn: 108315
2010-07-14 04:20:34 +00:00
Douglas Gregor c3d6cb6543 Fix typo in test program
llvm-svn: 108298
2010-07-14 00:09:17 +00:00
Daniel Dunbar af68a88e68 Driver/Darwin: Pass -pie/-no_pie to the linker when -fpie/-fno-pie and friends
are explicitly given.

llvm-svn: 108297
2010-07-13 23:31:40 +00:00
Douglas Gregor c95a41b510 Add missing testcases for lvalue bitcasts
llvm-svn: 108296
2010-07-13 23:27:15 +00:00
John McCall 11e577b99a Work around an obnoxious GCC warning by changing semantics in a hopefully-
harmless way.

llvm-svn: 108295
2010-07-13 23:19:49 +00:00
Douglas Gregor 51954276cc Introduce a new cast kind for an "lvalue bitcast", which handles
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g., 

  int i;
  reinterpret_cast<short&>(i);

The IR generated for this is essentially the same as for

  *reinterpret_cast<short*>(&i).

Fixes PR6437, PR7593, and PR7344. 

llvm-svn: 108294
2010-07-13 23:17:26 +00:00
Nick Lewycky cb89a2a150 Add __builtin_snprintf.
llvm-svn: 108290
2010-07-13 22:35:05 +00:00
John McCall 5c0e69ef0e Switch the __cxa_rethrow cleanup to be lazy.
llvm-svn: 108288
2010-07-13 22:24:23 +00:00
John McCall 5c08ab956b Allow for the possibility that __cxa_end_catch might throw for a catch-all block
or a catch of a record type by value or reference.  Also convert this to a
lazy cleanup.

llvm-svn: 108287
2010-07-13 22:12:14 +00:00
Fariborz Jahanian 5848d333b4 Check on property attributes which are declared
in class extensions (radar 8171968).

llvm-svn: 108283
2010-07-13 22:04:56 +00:00
John McCall bb0260139a Switch the __cxa_free_exception cleanup to be lazy.
llvm-svn: 108276
2010-07-13 21:17:51 +00:00
Fariborz Jahanian 714447b2ed Set DeclContext of ParamVarDecl only. No need
to set that of VarDecl for block variables
(they are already set). Per Doug's comment.

llvm-svn: 108273
2010-07-13 21:05:02 +00:00
John McCall 2b7fc3828e Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.

Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this;  for now we have some awkward code
duplication.

Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.

llvm-svn: 108270
2010-07-13 20:32:21 +00:00
Sebastian Redl 117b01b2da Add two small utility functions to PCHReader that the writer will use. WIP.
llvm-svn: 108267
2010-07-13 20:12:07 +00:00
Fariborz Jahanian a6c7efec2b More block instantiation stuff. Set variable/param DeclContext
to block context when first instantiating them.

llvm-svn: 108266
2010-07-13 20:05:58 +00:00
Chris Lattner 8406c5197b Add a warning to catch a bug recently caught by code review, like this:
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
      or remove constant [-Wlogical-bitwise-confusion]
  return x && 4;
           ^  ~

wording improvement suggestions are welcome.

llvm-svn: 108260
2010-07-13 19:41:32 +00:00
Chris Lattner ca9f2a025c 80 column issues.
llvm-svn: 108257
2010-07-13 19:22:31 +00:00
Douglas Gregor a8a089bfd5 Whenever we're creating an expression that is typically an rvalue
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary. 

Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.

llvm-svn: 108253
2010-07-13 18:40:04 +00:00
Chandler Carruth 46e8978c69 Silence Doug's favorite GCC warning.
llvm-svn: 108247
2010-07-13 17:07:17 +00:00
Devang Patel 01c8c100c2 Add volatile qualifiers for "this".
llvm-svn: 108245
2010-07-13 16:23:13 +00:00
Douglas Gregor f39cf26cb5 Properly add to 32
llvm-svn: 108243
2010-07-13 15:57:00 +00:00
Douglas Gregor f2753b3b4e Downgrade the "when type is in parentheses, array cannot have dynamic
size" error for code like 

  new (int [size])

to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.

llvm-svn: 108242
2010-07-13 15:54:32 +00:00
Argyrios Kyrtzidis 36745fda34 Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.

As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.

llvm-svn: 108237
2010-07-13 09:07:17 +00:00
Douglas Gregor e82f087378 Improve diagnostics for the "type qualifier on return type has no
effect warning" by printing the qualifiers we saw and correctly
pluralizing the message, e.g.,

test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type
      qualifiers on return type have no effect
  const volatile Enum g2() {
  ^~~~~ ~~~~~~~~

llvm-svn: 108236
2010-07-13 08:50:30 +00:00
Douglas Gregor f5b160f89c When computing the canonical profile of a DeclRefExpr or MemberExpr,
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.

llvm-svn: 108235
2010-07-13 08:37:11 +00:00
Douglas Gregor 603d81bf8d When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types. 

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).

llvm-svn: 108234
2010-07-13 08:18:22 +00:00
Douglas Gregor d8f446f1b2 Diagnose typedef of an operator name. Fixes PR7462
llvm-svn: 108233
2010-07-13 06:37:01 +00:00
John McCall a15eb737e4 Check in this -Wconversion C++ test case that's been sitting on my machine
for awhile.

llvm-svn: 108232
2010-07-13 06:26:23 +00:00
Douglas Gregor aa8c97262a Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466.

llvm-svn: 108231
2010-07-13 06:24:26 +00:00
Douglas Gregor a700f68828 Reinstate the optimization suppressing available_externally functions
at -O0. The only change from the previous patch is that we don't try
to generate virtual method thunks for an available_externally
function.

llvm-svn: 108230
2010-07-13 06:02:28 +00:00
Devang Patel 0a34e31d81 const qualify debug info for "this" for const methods.
llvm-svn: 108220
2010-07-13 00:24:30 +00:00
Fariborz Jahanian f8681a2a3f Instantiate attributes when first building an instantiated
VarDecl.

llvm-svn: 108218
2010-07-13 00:16:40 +00:00
Douglas Gregor 6cc1df5d3d Provide a special diagnostic for attempts to explicitly specialize
class templates within class scope (which is ill-formed), and recover
by dropping the explicit specialization entirely. Fixes the infinite
loop in PR7622.

llvm-svn: 108217
2010-07-13 00:10:04 +00:00
Douglas Gregor 11cfd9441d Fix a documentation paste-o and eliminate a useless function parameter, both found by Sebastian
llvm-svn: 108214
2010-07-12 23:48:14 +00:00
Craig Silverstein 811d1f8ba1 We should not be recursing over the shadow definitions in UsingDecl --
they're not something the user typed (at least, not here).

llvm-svn: 108212
2010-07-12 23:30:43 +00:00
Sebastian Redl 5467c9fac5 Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.
llvm-svn: 108209
2010-07-12 23:11:43 +00:00
Devang Patel 0aabb1200f While collecting members for a class, always create delcaration entry for methods. Debug info for method definition will be generated while generating code for method body.
Tested by classes.exp in gdb testsuite.

llvm-svn: 108205
2010-07-12 22:54:41 +00:00
Sebastian Redl 143413f8fb Split the normal and chained PCH writing paths and add a tiny bit of implementation to the latter. WIP.
llvm-svn: 108200
2010-07-12 22:02:52 +00:00
Argyrios Kyrtzidis d1d239f35c Remove the check for repeated tok::eofs, we are not supposed to go past eof so this code is
totally unnecessary.

llvm-svn: 108199
2010-07-12 21:41:41 +00:00
Argyrios Kyrtzidis f4cc7dcf9b Simplify code using the new FoldingSetImpl::InsertNode() overload.
llvm-svn: 108198
2010-07-12 21:41:31 +00:00
Fariborz Jahanian 8308585a1e Copy over attributes to instantiated variable.
llvm-svn: 108195
2010-07-12 21:12:19 +00:00
Douglas Gregor 553f3a9b30 Speculatively revert r108156; it appears to be breaking self-host.
llvm-svn: 108194
2010-07-12 21:08:32 +00:00
Argyrios Kyrtzidis c2924de667 If we are past tok::eof and in caching lex mode, avoid caching repeated tok::eofs.
llvm-svn: 108175
2010-07-12 18:49:30 +00:00
Douglas Gregor 47815d5b8c Add a -code-completion-timing= mode to c-index-test, so that we can
test the performance of code-completion without testing the
performance of printf().

llvm-svn: 108172
2010-07-12 18:38:41 +00:00
Fariborz Jahanian c289bce1f5 Compute Type dependent-ness of BlockDeclRefExpr
on the fly when constructing it.

llvm-svn: 108166
2010-07-12 18:12:03 +00:00
Ted Kremenek 424ce75f8d Add test case for <rdar://problem/8177927> (which triggered an assertion failure in SemaChecking).
llvm-svn: 108159
2010-07-12 17:35:39 +00:00
Fariborz Jahanian 70c0b08022 Move setting of Dependent Type to BlockDeclRefExpr's
constructor.

llvm-svn: 108157
2010-07-12 17:26:57 +00:00
Douglas Gregor dbb2806a7b Do not generate LLVM IR for available_externally function bodies at
-O0, since we won't be using the definitions for anything anyway. For
lib/System/Path.o when built in Debug+Asserts mode, this leads to a 4%
improvement in compile time (and suppresses 440 function bodies).

<rdar://problem/7987644>

llvm-svn: 108156
2010-07-12 17:24:55 +00:00
Chandler Carruth 65a38183f0 Fix another aspect of PR7047, macro expansions. Previously, this was hacked
around by exempting enums from the check, but this doesn't handle a lot of
cases. A better approach is to directly check if the operator comes from
a macro expansion.

I've removed a reference to the rdar that originally led to the enum
suppression when removing it's overly contrived test case. Let me know if that
number or a more reasilistic test case involving enums is still needed.

llvm-svn: 108128
2010-07-12 06:23:38 +00:00
Chris Lattner 5a503e9f70 we do in fact have to cache the EOF token returned by the preprocessor.
In the case of backtracking, the cached token lexer will be the only 
lexer on the stack, without this the token stack will be empty and EOF
won't be returned.

This fixes PR7072.

llvm-svn: 108124
2010-07-12 04:25:32 +00:00
Chris Lattner 0931644922 revert a hunk of code that Argiris added in r106213, which is the
root cause of PR7481 and probably more, and has no apparent 
testcases.  I don't understand the logic here so I can't repair it.

llvm-svn: 108119
2010-07-12 01:48:28 +00:00
Chris Lattner 33919e7450 fix PR7280 by making the warning on code like this:
int test1() {
  return;
}

default to an error.

llvm-svn: 108108
2010-07-11 23:34:02 +00:00
Chris Lattner ef74e2b2a8 change the 'invalid token after top level declarator' message to be
'expected ';' after top level declarator' which is much less vague.

llvm-svn: 108106
2010-07-11 22:46:04 +00:00
Chris Lattner 1390134c18 Fix PR7617 by not entering ParseFunctionDefinition when
a function prototype is followed by a declarator if we
aren't parsing a K&R style identifier list.

Also, avoid skipping randomly after a declaration if a
semicolon is missing.  Before we'd get:

t.c:3:1: error: expected function body after function declarator
void bar();
^

Now we get:

t.c:1:11: error: invalid token after top level declarator
void foo()
          ^
          ;

llvm-svn: 108105
2010-07-11 22:42:07 +00:00
Chris Lattner dbb1e93a9f add a const qualifier, refactor some code.
llvm-svn: 108104
2010-07-11 22:24:20 +00:00
Chandler Carruth 62e5e56dad Switch to void-cast for this. Chris prefers that over the attribute, I'll
probably try and switch more of these if I can.

llvm-svn: 108085
2010-07-11 07:42:13 +00:00
Chandler Carruth 32652f3400 Mark assert-only variables as unused.
llvm-svn: 108068
2010-07-11 03:24:05 +00:00
John Thompson 311de2e188 Rename clang.dll to libclang.dll, to fix Windows build.
llvm-svn: 108067
2010-07-11 03:23:30 +00:00
Nick Lewycky d54e2aba6c PrintFunctionNames is a plugin, it should pull in symbols from the clang binary
that loads it, not by linking against them directly.

llvm-svn: 108055
2010-07-10 20:24:23 +00:00
Nick Lewycky 32a168c5f8 Clang do so have plugins, we can't prune exports. Fixes plugin support.
llvm-svn: 108054
2010-07-10 20:19:47 +00:00
Dale Johannesen bde8ee26d0 Fix compile error. Per Fariborz.
llvm-svn: 108051
2010-07-10 19:53:56 +00:00
Chandler Carruth 17773fcd83 Lay the ground work for resoving PR7047. This doesn't actually fix it because
default arguments to template parameters don't have a DeclContext when
instantiated, and so we can't detect that we're in an instantiation context as
opposed to the definition context. However, it fixes the more commonly-occuring
cases in TMP code that use devolve to this type of tautology after
substitution.

llvm-svn: 108044
2010-07-10 12:30:03 +00:00
Argyrios Kyrtzidis b8d77eb300 Add PCH support for the remaining C++ exprs.
llvm-svn: 108042
2010-07-10 11:46:15 +00:00
Peter Collingbourne 9701743b1a Fix CMake build
llvm-svn: 108031
2010-07-09 23:06:34 +00:00
John Thompson c438947242 Hack for dealing with commas until we support multiple alternative constraints, per pr7338.
llvm-svn: 108028
2010-07-09 22:49:34 +00:00
Fariborz Jahanian 4239aa104b BlockDeclRefExpr of a dependent type must
be a dependent expression when its is built.

llvm-svn: 108026
2010-07-09 22:21:32 +00:00
Fariborz Jahanian 2f8bd36bcf Instantiation of byref variable in
block literal expression.

llvm-svn: 108019
2010-07-09 21:27:28 +00:00
Sebastian Redl 3e39272fed Slightly improve the diagnostic when using a qualified function typedef to declare nonmember or static member functions.
llvm-svn: 108018
2010-07-09 21:26:08 +00:00
Argyrios Kyrtzidis 8704057ce9 Reorganize how ClassTemplate[Partial]SpecializationDecls are read/written to avoid the
possibility of adding an unitialized one into the folding set.

llvm-svn: 108016
2010-07-09 21:11:43 +00:00
Argyrios Kyrtzidis dd2061b2cd isMemberSpecialization -> setMemberSpecialization.
llvm-svn: 108015
2010-07-09 21:11:35 +00:00
Sebastian Redl 4d3af3e192 When given the -chained-pch option and a previous PCH file, have the PCHWriter emit a CHAINED_METADATA record instead of METADATA, and write a link to the previous file there.
llvm-svn: 108014
2010-07-09 21:00:24 +00:00
Craig Silverstein 4a5d086b50 Fix a crashing but trying to print a TemplateTemplateParmDecl
for code like this:
   template<template<typename T> class U> class V {};

The problem is that the DeclPrinter assumed all TemplateDecls
have a getTemplatedClass(), but template template params don't
(so we got a NULL dereference).  The solution is to detect if
we're a template template param, and construct the template
class name ('class U') specially in this case.

OKed by dgregor and chandlerc

llvm-svn: 108007
2010-07-09 20:25:10 +00:00
Eli Friedman d8c60e34da Ignore -Wno-main, per PR7269.
llvm-svn: 108006
2010-07-09 20:03:13 +00:00
Chandler Carruth 0b73ccfe20 Rip out the floating point return type handling from the atomic builtin. It's
wrong, and we don't handle floating point value type arguments yet anyways.
Will add correct logic for both when I finish the patch.

llvm-svn: 108004
2010-07-09 19:19:40 +00:00
Chandler Carruth 741e5cea77 Fix PR7600, and correctly convert the result of an atomic builtin to the
expected value type. This is necessary as the builtin is internally represented
as only operating on integral types.

Also, add a FIXME to add support for floating point value types.

llvm-svn: 108002
2010-07-09 18:59:35 +00:00
Fariborz Jahanian 1babe7778d Instantiation of block literal expressions. wip.
llvm-svn: 108000
2010-07-09 18:44:02 +00:00
Douglas Gregor 79edde88ed Document my otherwise-inexplicable change
llvm-svn: 107998
2010-07-09 18:39:07 +00:00
Douglas Gregor 8014df4c21 Refer to implicit "conversions" rather than implicit "casts", which
don't technically exist in the language. <rdar://problem/8085982>

llvm-svn: 107995
2010-07-09 18:18:35 +00:00
Sebastian Redl 60876431b1 Correctly initialize Reader to null.
llvm-svn: 107994
2010-07-09 17:53:32 +00:00
Sebastian Redl f525a30d19 Really respect -chained-pch.
llvm-svn: 107993
2010-07-09 17:40:12 +00:00
Douglas Gregor 8ed0c0b99d Introduce -f{no-}spell-checking options to enable/disable
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.

llvm-svn: 107992
2010-07-09 17:35:33 +00:00
Douglas Gregor 137b27da2e Document -f{no-}color-diagnostics
llvm-svn: 107985
2010-07-09 16:31:58 +00:00
Craig Silverstein 60f8b286ad Move traverseunqualifiedtypeloc over to the 'main' typeloc tree.
Note that this is a move -- we pretend that we were really looking
at the unqualified typeloc all along -- rather than a recursion, so
we don't follow the normal CRTP plan of going through
getDerived().TraverseTypeLoc.  If we did, we'd be traversing twice
for the same type (once as a QualifiedTypeLoc version of the type,
once as an UnqualifiedTypeLoc version of the type), which in effect
means we'd call VisitTypeLoc twice with the 'same' type.  This
solves that problem, at the cost of never seeing the qualified
version of the type (unless the client subclasses
TraverseQualifiedTypeLoc themselves).  It's not a perfect solution.
A perfect solution probably requires making QualifiedTypeLoc a
wrapper around TypeLoc -- like QualType is a wrapper around Type*
-- rather than being its own class in the type hierarchy.

Reviewed by wan.

llvm-svn: 107973
2010-07-09 15:19:34 +00:00
John Thompson ab71ead011 Revert 107953, remove comma ignoring from PPC constraints.
llvm-svn: 107956
2010-07-09 04:53:08 +00:00
John Thompson 7099f0c0d5 Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.
llvm-svn: 107953
2010-07-09 02:01:40 +00:00
Sebastian Redl f4b0c4b946 Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change.
llvm-svn: 107936
2010-07-09 00:00:58 +00:00
Jordy Rose d5d2e50f3e Cleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.
llvm-svn: 107935
2010-07-08 23:57:29 +00:00
Douglas Gregor 4587969555 Support code completion for parameter names in Objective-C method
declarations.

llvm-svn: 107933
2010-07-08 23:37:41 +00:00
Douglas Gregor 95887f9c5b Introduce a new code-completion point prior to an identifier in the
selector of an Objective-C method declaration, e.g., given

  - (int)first:(int)x second:(int)y;

this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.

llvm-svn: 107929
2010-07-08 23:20:03 +00:00
Sebastian Redl caef9ab03c When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.
llvm-svn: 107927
2010-07-08 23:07:34 +00:00
Sebastian Redl 595c51342c Some preparatory work for chained PCH. No functionality change.
llvm-svn: 107915
2010-07-08 22:01:51 +00:00
Zhanyong Wan 9870460c84 Makes RecursiveASTVisitor traverse the type of a temporary object
created via T() where T is a class type.  Reviewed by chandlerc and
csilvers.

llvm-svn: 107911
2010-07-08 21:01:29 +00:00
Douglas Gregor 55b037b9f3 During code completion, give the "nil" and "NULL" macros the same
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.

llvm-svn: 107910
2010-07-08 20:55:51 +00:00
Douglas Gregor eaff2cbbab Allow C-style casts and reinterpret_casts between block pointers and
either integer values or other pointers. Fixes <rdar://problem/8134521>.

llvm-svn: 107905
2010-07-08 20:27:32 +00:00
Eli Friedman 07c89c6b3e PR7588: Fix the _mm_shufflehi_epi16 macro. (The issue was an oversight
involving operator precedence.)

llvm-svn: 107902
2010-07-08 20:09:45 +00:00
Devang Patel 8f3f76f991 Handle forward declarations properly in debug info.
Patch by Alexander Kabaev.
PR 7595.

llvm-svn: 107900
2010-07-08 19:56:29 +00:00
Ted Kremenek 3245003251 Add missing whitespace.
llvm-svn: 107897
2010-07-08 19:43:08 +00:00
Douglas Gregor 9961ce9428 When performing substitution of template arguments within the body of
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.

llvm-svn: 107895
2010-07-08 18:37:38 +00:00
Ted Kremenek 30ae68bd17 Update checker build.
llvm-svn: 107893
2010-07-08 18:08:18 +00:00
Argyrios Kyrtzidis 7e8996c7e6 Introduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord when initializing.
ReadDeclRecord would hit assertion if the translation unit declaration was already loaded during
IdentifierInfo initialization.

llvm-svn: 107885
2010-07-08 17:13:02 +00:00
Argyrios Kyrtzidis 9f2d24a808 Support TemplateTemplateParmDecl for PCH.
llvm-svn: 107884
2010-07-08 17:12:57 +00:00
Douglas Gregor f609386058 Bowing to popular demand, reduce the "comma at end of enumerator list"
ExtWarn to an Extension. Let the broken code propagate!

llvm-svn: 107875
2010-07-08 14:54:42 +00:00
John McCall b5081aff68 Apparently the {{$}} hack doesn't work on Windows; I am saddened but not
surprised.

llvm-svn: 107874
2010-07-08 13:17:29 +00:00