Commit Graph

17897 Commits

Author SHA1 Message Date
Mike Stump 8f5e6770e7 Add typeinfo support for T* and const T* for all builtin types T.
llvm-svn: 89030
2009-11-17 02:57:13 +00:00
Ted Kremenek 5b2592ed65 Add test to verify that the analyzer plist output is what we expect.
llvm-svn: 89029
2009-11-17 02:31:39 +00:00
Mike Stump 3f75d552a3 Add typeid for the builtin types. WIP.
llvm-svn: 89028
2009-11-17 02:16:21 +00:00
John McCall 27b18f8144 Carry lookup configuration throughout lookup on the LookupResult. Give
LookupResult RAII powers to diagnose ambiguity in the results.  Other diagnostics
(e.g. access control and deprecation) will be moved to automatically trigger
during lookup as part of this same mechanism.

This abstraction makes it much easier to encapsulate aliasing declarations
(e.g. using declarations) inside the lookup system:  eventually, lookup will
just produce the aliases in the LookupResult, and the standard access methods
will naturally strip the aliases off.

llvm-svn: 89027
2009-11-17 02:14:36 +00:00
Jakob Stoklund Olesen 4359796e52 Fix tests after enabling -split-phi-edges.
object-size.c aws simply too fragile.

constructor-default-arg.cpp triggers an issue when LiveVariables is run before RALocal.

llvm-svn: 89025
2009-11-17 01:47:01 +00:00
Eli Friedman b0bc559b19 PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
llvm-svn: 89023
2009-11-17 01:22:05 +00:00
Douglas Gregor 6c254bf522 When querying type qualifiers on QualType via one of the "non-local"
interfaces (which are used throughout the front end), combine the
qualifiers on the QualType instance with the qualifiers on the
canonical type to produce the set of qualifiers that, semantically,
apply to that type. This should design away a large category of
"qualifier-hidden-behind-a-typedef" buts like we saw in PR5383.

Performance-wise, this caused a regression of ~0.5% on Cocoa.h, but
it's totally worth it. We may actually be able to get a little more
performance back by using CanQualType more often.

llvm-svn: 89018
2009-11-17 00:55:50 +00:00
Mike Stump c2c03349f3 Ensure we peer through () when handling typeid(*p).
llvm-svn: 89015
2009-11-17 00:45:21 +00:00
Ted Kremenek c40943224d Remove extra space in warn_maynot_respond diagnostic. Fixes <rdar://problem/7364274>.
llvm-svn: 89013
2009-11-17 00:35:14 +00:00
Mike Stump 8a5acf1440 Note why this doesn't yet work.
llvm-svn: 89012
2009-11-17 00:30:31 +00:00
Mike Stump 61232fd252 Trim spacing.
llvm-svn: 89006
2009-11-17 00:14:04 +00:00
Mike Stump 4d0e9095e4 Since we always have 2 edges, we don't need to reserve 3 slot for the
PHI node.

llvm-svn: 89005
2009-11-17 00:10:05 +00:00
Mike Stump e8cdcc9ab0 Minor CFG refinements for typeid and dynamic_cast.
llvm-svn: 89004
2009-11-17 00:08:50 +00:00
Eli Friedman e85ef718d5 Fix up EmitMemberInitializer to handle many more cases.
llvm-svn: 88999
2009-11-16 23:53:01 +00:00
Mike Stump 82a1e6184a Testcase for dynamic_cast.
llvm-svn: 88996
2009-11-16 23:36:30 +00:00
Eli Friedman 5e7d969526 Reorganize EmitMemberInitializer to put anonymous unions on the common codepath.
llvm-svn: 88995
2009-11-16 23:34:11 +00:00
Eli Friedman 22683fef03 Simplify the AST a bit by skipping creating member initializers for members
with a trivial constructor.

llvm-svn: 88990
2009-11-16 23:07:59 +00:00
Eli Friedman c1daba3ec8 Make member initializers for union members work correctly.
llvm-svn: 88989
2009-11-16 22:58:01 +00:00
Mike Stump 6ca0e21de4 Implement dynamic_cast<void*>(E).
llvm-svn: 88988
2009-11-16 22:52:20 +00:00
Daniel Dunbar 5e1415156a Update test, I don't know why this changed but seems innocuous.
llvm-svn: 88983
2009-11-16 22:38:57 +00:00
Daniel Dunbar 2cbf4a7d6e Trim includes.
llvm-svn: 88982
2009-11-16 22:38:48 +00:00
Daniel Dunbar 24347f7cda Store more information in HeaderSearchOptions so that its initialization is not
language dependent.

llvm-svn: 88981
2009-11-16 22:38:40 +00:00
Daniel Dunbar 77a9d2b3ec clang-cc: Eliminate cyclic dependency in initializing CodeGenOptions.
llvm-svn: 88980
2009-11-16 22:38:14 +00:00
Eli Friedman c2ef215bda Implement a few more cases for copy constructor synthesis.
llvm-svn: 88971
2009-11-16 21:47:41 +00:00
Douglas Gregor 1b8fe5b716 First part of changes to eliminate problems with cv-qualifiers and
sugared types. The basic problem is that our qualifier accessors
(getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at
the current QualType and not at any qualifiers that come from sugared
types, meaning that we won't see these qualifiers through, e.g.,
typedefs:

  typedef const int CInt;
  typedef CInt Self;

Self.isConstQualified() currently returns false!

Various bugs (e.g., PR5383) have cropped up all over the front end due
to such problems. I'm addressing this problem by splitting each
qualifier accessor into two versions: 

  - the "local" version only returns qualifiers on this particular
    QualType instance
  - the "normal" version that will eventually combine qualifiers from this
    QualType instance with the qualifiers on the canonical type to
    produce the full set of qualifiers.

This commit adds the local versions and switches a few callers from
the "normal" version (e.g., isConstQualified) over to the "local"
version (e.g., isLocalConstQualified) when that is the right thing to
do, e.g., because we're printing or serializing the qualifiers. Also,
switch a bunch of
  
  Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType()

expressions over to 

  Context.hasSameUnqualifiedType(T1, T2)

llvm-svn: 88969
2009-11-16 21:35:15 +00:00
Eli Friedman c08bdea63d Clean up scalar cast kind handling; make cast kind handling explicitly handle
more cases.  No intended visible change.

llvm-svn: 88968
2009-11-16 21:33:53 +00:00
Mike Stump bf44533846 Audit done, all the required casts are already done.
llvm-svn: 88966
2009-11-16 21:22:19 +00:00
Devang Patel 37b4b8b1da revert r88963.
llvm-svn: 88965
2009-11-16 21:17:07 +00:00
Devang Patel b71c28db22 Use TrackingVH to hold forward decl. This one is for RecordType.
llvm-svn: 88963
2009-11-16 21:06:35 +00:00
Eli Friedman 00dbf4c3c6 Parallel fix to r88951: use TrackingVH to hold forward decl.
llvm-svn: 88962
2009-11-16 21:04:30 +00:00
Sebastian Redl 658262fd26 Repair broken FindCompositePointerType. Correct early termination condition. Get CVR qualifiers from canonical types. Traverse collected qualifiers in reverse order on rebuilding the pointer, so that we don't swap inner and outer qualifiers. That last one fixes PR5509.
llvm-svn: 88960
2009-11-16 21:03:45 +00:00
Eli Friedman b05d0824c6 Fix valgrind uninitialized error.
llvm-svn: 88952
2009-11-16 20:33:31 +00:00
Devang Patel 10909d5faf Use TrackingVH to hold forward decl.
llvm-svn: 88951
2009-11-16 20:09:38 +00:00
Ted Kremenek 9dc2d26fdc Fix condition in LocationCheck::classof(). Thanks to Marius Wachtler for pointing this out!
llvm-svn: 88949
2009-11-16 20:06:54 +00:00
Rafael Espindola abab87936e Use configure options for searching for libstdc++.
llvm-svn: 88945
2009-11-16 19:49:37 +00:00
Mike Stump 4cdedd9d44 Fix members to be public.
llvm-svn: 88944
2009-11-16 19:48:50 +00:00
Mike Stump 3d47c2b3c2 Make bots happy.
llvm-svn: 88941
2009-11-16 19:34:15 +00:00
Eli Friedman f2f534d12a Fix PR5488: special-case the overloaded arrow operator so that we don't try to
treat it as a unary operator.

llvm-svn: 88938
2009-11-16 19:13:03 +00:00
David Chisnall b3b44ce433 Fixed two minor differences between clang and GCC-generated runtime structures for the GNU runtime.
llvm-svn: 88937
2009-11-16 19:05:54 +00:00
Fariborz Jahanian 9290ede494 Handle case of missing '@end' in implementation context
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.

llvm-svn: 88934
2009-11-16 18:57:01 +00:00
Mike Stump 6fa768df29 Fix spelling for target triplet.
llvm-svn: 88928
2009-11-16 18:06:39 +00:00
Anders Carlsson 0d82fa66a5 The ssp and sspreq function attributes should only be applied to function definitions, not declarations or calls.
llvm-svn: 88915
2009-11-16 16:56:03 +00:00
Ken Dyck 2dc8d5fa3e Parameterize the constant-generating macros in stdint.h with new built-in
__INTn_C_SUFFIX__ macros that are defined for types with corresponding
constant suffixes (i.e. long and long long).

llvm-svn: 88914
2009-11-16 16:36:33 +00:00
Duncan Sands 7876dad8e7 Pass a value for the isSigned parameter of CreateIntCast, rather than
passing the name (an exotic way of specifying that the result is signed!).

llvm-svn: 88909
2009-11-16 13:11:21 +00:00
Mike Stump 65511704f7 Implement most of dynamic_cast. WIP.
llvm-svn: 88901
2009-11-16 06:50:58 +00:00
Mike Stump 266ee4a5b3 Try and fix buildbot issue.
llvm-svn: 88900
2009-11-16 06:49:10 +00:00
Eli Friedman 49ddc5fb94 Make GetAddrOfConstantStringFromLiteral return a constant of the correct type.
This doesn't have any visible effects at the moment because normally the
implicit cast code forces the type to the expected type.

llvm-svn: 88896
2009-11-16 05:55:46 +00:00
Eli Friedman 8c98dffd1f Some minor cleanup for EmitCastLValue.
llvm-svn: 88894
2009-11-16 05:48:01 +00:00
Eli Friedman 03bf60a704 Set the cast kind for a few more code paths.
llvm-svn: 88893
2009-11-16 05:44:20 +00:00
Eli Friedman e6ce354795 Fix a couple of cases where we weren't generating the right kind of call
for a call to a virtual function.

llvm-svn: 88891
2009-11-16 05:31:29 +00:00
Eli Friedman 011c4c341b Implement two-argument form of delete operator.
llvm-svn: 88890
2009-11-16 05:16:40 +00:00
Eli Friedman 794d4d8127 Fix test on Linux.
llvm-svn: 88889
2009-11-16 05:14:40 +00:00
Zhongxing Xu 731f46264f * Do the same thing to the basicstore as in r84163.
* Add a load type to GRExprEngine::EvalLoad().
* When retrieve from 'theValue' of OSAtomic funcitions, use the type of the 
  region instead of the argument expression as the load type.
* Then we can convert CastRetrievedSVal to a pure assertion. In the future
  we can let all Retrieve() methods simply return SVal.

llvm-svn: 88888
2009-11-16 04:49:44 +00:00
Eli Friedman 141fbf3f36 Add constant evaluation for comma operator with floating-point operand. Fixes
PR5449.

llvm-svn: 88885
2009-11-16 04:25:37 +00:00
Zhongxing Xu 223f5119e1 Remove an unused parameter.
llvm-svn: 88882
2009-11-16 02:52:18 +00:00
Chandler Carruth 2496fe14ec Fix a missing include from r88876.
llvm-svn: 88879
2009-11-15 23:10:57 +00:00
Anders Carlsson d787204e6d When generating the deleting ctor, emit a call to delete.
llvm-svn: 88878
2009-11-15 23:03:25 +00:00
Anders Carlsson 2a50e95da4 Make sure that virtual destructors have delete operators.
llvm-svn: 88877
2009-11-15 22:49:34 +00:00
Anders Carlsson 1b69be2a8f Add DeclarationName::dump().
llvm-svn: 88876
2009-11-15 22:30:43 +00:00
Mike Stump 4ac39ef6f9 Peer through refernces for typeid. WIP.
llvm-svn: 88871
2009-11-15 20:30:39 +00:00
Anders Carlsson 7ade203c6c Deallocation functions must also be static.
llvm-svn: 88859
2009-11-15 19:08:46 +00:00
Anders Carlsson 623e9798df allocation functions are always static.
llvm-svn: 88858
2009-11-15 18:59:32 +00:00
Anders Carlsson e1d34ba0e4 Factor finding a deallocation function for a record type out into a separate function.
llvm-svn: 88857
2009-11-15 18:45:20 +00:00
Mike Stump a46efbb857 Fix linux buildbots.
llvm-svn: 88856
2009-11-15 17:57:00 +00:00
Mike Stump 1bf924b121 Finish off zero check for typeid(*p) so that it will do a __cxa_bad_typeid.
llvm-svn: 88852
2009-11-15 16:52:53 +00:00
Anders Carlsson 2c9e274e57 If we find a deallocation function in the class scope, but it is a placement function we should not look for a deallocation function in the global scope.
llvm-svn: 88851
2009-11-15 16:43:15 +00:00
Edward O'Callaghan e9a58b10ad Add MIPS support to Triple for Linux and the PSP. Credit to Bruno Cardoso Lopes.
llvm-svn: 88850
2009-11-15 10:22:07 +00:00
Douglas Gregor 8f3952cda9 When performing a static downcast as part of a static_cast, make sure
that we're dealing with canonical types like the documentation say
(yay, CanQualType). Alas, this is another instance where using
getQualifiers() on a non-canonical QualType got us in trouble.

Good news: with this fix, Clang can now parse all of its own headers!

llvm-svn: 88848
2009-11-15 09:20:52 +00:00
Douglas Gregor 598caeee37 Don't gratuitously mark the default constructors of base or member initializers as used
llvm-svn: 88847
2009-11-15 08:51:10 +00:00
Douglas Gregor 54fdb417fe When adding the underlying declaration of a decl to a lookup-results
set, expand overloaded function declarations. Long-term, this should
actually be done by the name-lookup code rather than here, but this
part of the code (involving using declarations) is getting a makeover
now and the test-case is useful.

llvm-svn: 88846
2009-11-15 08:11:13 +00:00
Daniel Dunbar 5ad7e15698 Add two new C++ lit tests suites, for testing Clang .cpp files with
-fsyntax-only and with -c.

llvm-svn: 88845
2009-11-15 08:10:41 +00:00
Mike Stump c9b231c8d1 Implement typeid for class types.
llvm-svn: 88843
2009-11-15 08:09:41 +00:00
Douglas Gregor c473cbb3b2 When looking for operator() to type-check a call to an object of class
type, use full qualified name lookup rather than the poking the
declaration context directly. This makes sure that we see operator()'s
in superclasses. Also, move the complete-type check before this name
lookup.

llvm-svn: 88842
2009-11-15 07:48:03 +00:00
Douglas Gregor ffaacb14e3 Make a couple more headers standalone
llvm-svn: 88840
2009-11-15 07:26:58 +00:00
Daniel Dunbar 4de54f823b Add Clang-Syntax C++Tests; these don't run by default, use the lit arguments
'--param run_clang_syntax=1' to run them.

llvm-svn: 88839
2009-11-15 07:23:09 +00:00
Douglas Gregor 0331ecf818 Remove an obviously-broken header, which still tries to refer to ScopedDecl.
llvm-svn: 88837
2009-11-15 07:17:25 +00:00
Daniel Dunbar 1566a2257f Use the other excludes syntax.
llvm-svn: 88836
2009-11-15 07:11:12 +00:00
Douglas Gregor 1097a4fe17 Make some more headers standalone
llvm-svn: 88835
2009-11-15 07:10:50 +00:00
Douglas Gregor a7e3ea3f64 If any errors have occurred by the time we hit the end of a function body, clear out any remaining temporaries so they aren't seen later.
llvm-svn: 88834
2009-11-15 07:07:58 +00:00
Daniel Dunbar b9bbd54fdb Add TargetOptions and use it when constructing targets.
- This ended up being hard to factor, sorry for the large diff.

 - Some post-commit cleanup to come.

llvm-svn: 88833
2009-11-15 06:48:46 +00:00
Douglas Gregor c25ca41254 Make a few headers parse standalone
llvm-svn: 88832
2009-11-15 06:34:37 +00:00
Mike Stump 4c808dfc58 Finish off support for typeinfo generation for classes.
llvm-svn: 88828
2009-11-15 03:28:10 +00:00
Daniel Dunbar 6499e9c625 Add a trivial example plugin, which prints the names of the top-level decls.
- The build scriptage is about twice as long as the code, which is nice. :)

llvm-svn: 88826
2009-11-15 00:27:43 +00:00
Daniel Dunbar 9b30eb721f Add examples dir, built with BUILD_EXAMPLES=1 (Makefiles, no CMake equivalent yet).
Move tools/wpa to examples/wpa, and unbreak its build.

llvm-svn: 88825
2009-11-15 00:22:33 +00:00
Daniel Dunbar d392dd0709 Add pluggable action support to clang-cc, via -plugin command line option.
- Expects the plugin has been loaded with -load.

 - Using this may require disabling TOOL_NO_EXPORTS in the clang-cc Makefile, this breaks the llvm::Registry way of working (static constructors are bad, kids). This should be replaced with a "real" plugin model that has explicit plugin interfaces.

llvm-svn: 88824
2009-11-15 00:12:04 +00:00
Mike Stump f5b2869b75 Finisgh off rest of class_type_info rtti generation.
llvm-svn: 88823
2009-11-14 23:32:21 +00:00
Anders Carlsson 6601057f41 When dumping implicit cast exprs, print out whether the cast is an lvalue cast or not.
llvm-svn: 88821
2009-11-14 22:35:18 +00:00
Daniel Dunbar 7fbd42f08a Move the program action enum to FrontendOptions.
--
ddunbar@giles:clang-cc (master)$ grep llvm:🆑:opt clang-cc.cpp  # Woot
ddunbar@giles:clang-cc (master)$
--

llvm-svn: 88820
2009-11-14 22:32:38 +00:00
Daniel Dunbar e13ada6a3b Add clang -mcpu=native support, patch by Roman Divacky, varioustweaks by me.
- We still need support for detecting the target features, since the name
   doesn't actually do a good job of decribing what the CPU supports (for LLVM).

llvm-svn: 88819
2009-11-14 22:04:54 +00:00
Anders Carlsson 6d41727a95 Add an internal CreateRecordDecl that will create a CXXRecordDecl when compiling C++ and a RecordDecl otherwise.
llvm-svn: 88816
2009-11-14 21:45:58 +00:00
Anders Carlsson 461a2c0640 Always build a builtin operator expression for the __extension__ unary operator.
llvm-svn: 88811
2009-11-14 21:26:41 +00:00
Anders Carlsson 50cb321fdc Handle CK_BitCast in EmitCastLValue.
llvm-svn: 88810
2009-11-14 21:21:42 +00:00
Sebastian Redl 7c353685bc - Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.

llvm-svn: 88809
2009-11-14 21:15:49 +00:00
Anders Carlsson 0acee6e0d7 Canonicalize the type before trying to create a debug type.
llvm-svn: 88808
2009-11-14 21:08:12 +00:00
Anders Carlsson 6037e78149 Have CGDebugInfo::getOrCreateType cache the QualType instead of having every ConvertType overload do it.
llvm-svn: 88807
2009-11-14 20:52:05 +00:00
Daniel Dunbar cf5be70032 Improve test to make sure -fixit is really working.
llvm-svn: 88801
2009-11-14 19:25:21 +00:00
Benjamin Kramer 5e738284d7 Move DISABLE_INLINE to the front of the decl so MSVC can parse it. Patch by Amine Khaldi!
llvm-svn: 88797
2009-11-14 16:36:57 +00:00
Mike Stump 1acec6a41a Build up more of the rtti info for a class. WIP.
llvm-svn: 88795
2009-11-14 15:55:18 +00:00
Mike Stump 14718425fa Add the name to the rtti data structure.
llvm-svn: 88792
2009-11-14 14:25:18 +00:00
Benjamin Kramer f4c511b026 Change *BugReport constructors to take StringRefs.
- Eliminates many calls to std::string.c_str()
- Fixes an invalid read in ReturnStackAddressChecker due to an unsafe call to
  StringRef.data() which doesn't guarantee null-termination.

llvm-svn: 88779
2009-11-14 12:08:24 +00:00
Daniel Dunbar ea956ddf0b clang-cc: Switch to using FrontendAction. Whee.
Please report any discrepancies you see in clang-cc, I'm not confident that our regression tests cover all the fun ways one can use clang-cc.

llvm-svn: 88776
2009-11-14 10:53:49 +00:00
Daniel Dunbar 883578060f Add FrontendActions for all preprocessor based clang-cc actions.
llvm-svn: 88774
2009-11-14 10:42:57 +00:00
Daniel Dunbar 02bd2d7281 Add FrontendActions, which provides a FrontendAction interface to all the existing AST consumer based clang-cc actions.
llvm-svn: 88773
2009-11-14 10:42:46 +00:00
Daniel Dunbar a0ff58dadf Add FrontendAction interface, for encapsulating a "clang-cc" style action.
llvm-svn: 88772
2009-11-14 10:42:35 +00:00
Eli Friedman 274ab904d0 Avoid assert-crash in a case where the expression passed to EmitConstantExpr
legitimately has side-effects (and needs to be generated as a non-constant).

llvm-svn: 88767
2009-11-14 08:51:33 +00:00
Eli Friedman b210fc598f Make __func__ and friends work correctly within the initializer for a static
local variable.

llvm-svn: 88766
2009-11-14 08:37:13 +00:00
Daniel Dunbar 1b39a2edff Shuffle VerifyDiagnosticsClient API to be less fragile.
llvm-svn: 88765
2009-11-14 07:53:24 +00:00
Daniel Dunbar 409e890f8d Add CompilerInstance::InitializeSourceManager.
llvm-svn: 88764
2009-11-14 07:53:04 +00:00
Eli Friedman a9ea959d04 PR5462: Don't run off the edge of the argument array for vararg handling
when there are more parameters in the prototype than arguments to the call.

llvm-svn: 88759
2009-11-14 04:43:10 +00:00
Daniel Dunbar 6c39d457fa Update FixIt tests to make it more obvious they use a separate mode.
llvm-svn: 88758
2009-11-14 04:39:42 +00:00
Daniel Dunbar 10563ea92e Turn -fixit it back into a mode, but make -fixit-at imply that mode this time
(instead of running it with arbitrary consumers).
 - Also, turn any -fixit-at lookup failure into an error.

llvm-svn: 88757
2009-11-14 04:39:29 +00:00
Eli Friedman b774685c08 Fix a couple of tests.
llvm-svn: 88756
2009-11-14 04:23:25 +00:00
Eli Friedman b572c92674 PR5483: Generate missing form of destructor when it is virtual. (Someone
more familiar with this stuff should double-check that there isn't some more
general rule; this is purely from inspecting g++ output.)

llvm-svn: 88755
2009-11-14 04:19:37 +00:00
Eli Friedman c9827d1ad3 Fix for PR5489: don't skip the complete type requrirement for variable
definitions just because the type happens to be an array type.

llvm-svn: 88752
2009-11-14 03:40:14 +00:00
Douglas Gregor bf3f322034 When type-checking a static cast (or the static_cast part of a C-style
cast) that is converting to a class type, enumerate its constructors
as in any other direct initialization. This ensures that we get the
proper conversion sequence.

llvm-svn: 88751
2009-11-14 03:27:21 +00:00
Daniel Dunbar 50ec0da0e1 Switch -verify implementation to use VerifyDiagnosticClient.
- Not tested, but -verify with multiple inputs should work now.

llvm-svn: 88750
2009-11-14 03:24:39 +00:00
Daniel Dunbar 9d5118a69c Fix broken tests, exposed by improved -verify.
llvm-svn: 88749
2009-11-14 03:24:04 +00:00
Daniel Dunbar 348185548e Add VerifyDiagnosticsClient, to replace old -verify.
- This reimplements -verify as just another DiagnosticClient, which buffers the diagnostics and checks them when the source file is complete. There are some hacks to make this work, but they are all internal, and this exposes a better external interface.

 - This also tweaks a few things:
   o Errors are now just regular diagnostics.
   o Frontend diagnostics are now caught (for example, errors in command line arguments), although there isn't yet a way to specify that they are expected. That would be nice though.

 - Not yet used.

llvm-svn: 88748
2009-11-14 03:23:19 +00:00
Anders Carlsson 654e5c7cf8 Diagnose ambiguity of operator delete and operator delete[]. Sebastian, please review.
llvm-svn: 88747
2009-11-14 03:17:38 +00:00
Daniel Dunbar e598a56d30 Pass Preprocessor through DiagnosticClient::BeginSourceFile.
llvm-svn: 88744
2009-11-14 02:48:04 +00:00
Daniel Dunbar 56d9c293db Add ASTConsumer to CompilerInstance.
llvm-svn: 88743
2009-11-14 02:47:17 +00:00
Fariborz Jahanian da2efb091d Generate the old API when sending message to super
in a category implementation (objc 32bit api related).

llvm-svn: 88741
2009-11-14 02:18:31 +00:00
Anders Carlsson 52ce3bbf57 Handle CXXDefaultArgExprs in EmitLValue. Fixes PR5484.
llvm-svn: 88735
2009-11-14 01:51:50 +00:00
Douglas Gregor ffe14e3712 If we attempt to add a constructor template specialization that looks
like a copy constructor to the overload set, just ignore it. This
ensures that we don't try to use such a constructor as a copy
constructor *without* triggering diagnostics at the point of
declaration.

Note that we *do* diagnose such copy constructors when explicitly
written by the user (e.g., as an explicit specialization).

llvm-svn: 88733
2009-11-14 01:20:54 +00:00
Daniel Dunbar bf410c6fc2 Add static version of Preprocessor::getSpelling.
llvm-svn: 88732
2009-11-14 01:20:48 +00:00
Daniel Dunbar e01dc86d2a Move CompilerInstance::set* methods out-of-line.
llvm-svn: 88731
2009-11-14 01:20:40 +00:00
Ted Kremenek 1a0dd2e30b Move definition of GRExprEngine::ProcessEndPath() out-of-line.
llvm-svn: 88729
2009-11-14 01:05:20 +00:00
Mike Stump 2ec5dd7160 Mangling support for typeinfo names.
llvm-svn: 88726
2009-11-14 00:14:13 +00:00
Douglas Gregor ff7028a55e Revert r88718, which does NOT solve the constructor-template-as-copy-constructor issue. Big thanks to John for finding this
llvm-svn: 88724
2009-11-13 23:59:09 +00:00
Mike Stump c5a332cefb Handle descructor printing better.
llvm-svn: 88723
2009-11-13 23:45:53 +00:00
Douglas Gregor 2bb756a3be Template argument deduction of a non-type template parameter from a
template argument.

llvm-svn: 88722
2009-11-13 23:45:44 +00:00
Douglas Gregor 5f235a21eb A constructor template cannot be instantiated to a copy
constructor. Make sure that such declarations can never be formed.

llvm-svn: 88718
2009-11-13 23:14:53 +00:00
Mike Stump 559387fe8b Also track address points for primaries bases.
llvm-svn: 88717
2009-11-13 23:13:20 +00:00
Fariborz Jahanian ebea005812 Code gen. For virtual destructor call on array objects
(still part of pr5472).

llvm-svn: 88712
2009-11-13 22:29:45 +00:00
Mike Stump 2fb78c0250 More VTT and constructor vtable testcases from recent work.
llvm-svn: 88710
2009-11-13 22:12:05 +00:00
Mike Stump 3693652378 Add more testcase for construction vtables and VTTs.
llvm-svn: 88702
2009-11-13 21:55:26 +00:00
Mike Stump 464de23b72 Add some more VTT testcases.
llvm-svn: 88699
2009-11-13 21:40:38 +00:00
Eli Friedman 6f04b1e605 Obvious fix for PR5474.
llvm-svn: 88696
2009-11-13 21:23:46 +00:00
Fariborz Jahanian f75c1f7a73 Fixes a code gen. bug for array delete operator call
int 32bit abi (pr5472 related).

-This line, and those below, will be ignored--

M    lib/CodeGen/CGCXXExpr.cpp

llvm-svn: 88695
2009-11-13 21:20:14 +00:00
Anders Carlsson bdd124036d Clear temporaries in more places.
llvm-svn: 88687
2009-11-13 20:11:49 +00:00
Ted Kremenek 9430bf20ff Remove test case's dependency on header file.
llvm-svn: 88685
2009-11-13 20:03:22 +00:00
Ted Kremenek e5e977013c Add two new test cases for the Malloc/Free checker. Both have to do with
storing malloc'ed memory to global storage.

llvm-svn: 88684
2009-11-13 20:00:28 +00:00
Ted Kremenek c2675568a1 Add test case that shows a leak we don't catch.
llvm-svn: 88683
2009-11-13 19:53:32 +00:00
Mike Stump e56213fc1e Add a testcase for the recent VTT work.
llvm-svn: 88681
2009-11-13 19:36:46 +00:00
Fariborz Jahanian 6814eaa2cc Code gen for arrady delete operator. Fixes pr5472.
llvm-svn: 88680
2009-11-13 19:27:47 +00:00
Anders Carlsson 1fe64cb059 Fix bug Doug noticed.
llvm-svn: 88679
2009-11-13 19:21:49 +00:00
Daniel Dunbar dd6e6918e6 Add test for expr.delete p5, with a FIXME.
llvm-svn: 88678
2009-11-13 19:13:56 +00:00
Devang Patel b40f295037 Do not store DIDescriptor directly into a container. Store MDNode directly, through TrackingVH.
llvm-svn: 88677
2009-11-13 19:10:24 +00:00
Mike Stump 88fc7d4202 This falls into the category of stupid pet tricks. I hate to do this,
but this is necessary to continue work on virtual vtables.  We don't
want to penalize virtual table building testcases, just because
complex virtual conversions don't yet work.

llvm-svn: 88676
2009-11-13 18:53:35 +00:00
Ken Dyck 8d6d4b84e2 add missing slashes to separator line; also testing commit access
llvm-svn: 88675
2009-11-13 18:50:18 +00:00
Ted Kremenek 9f2ee2bb26 Use 'eq' operator, and enable regular experimental checks when --experimental-checks is passed to scan-build.
llvm-svn: 88673
2009-11-13 18:49:48 +00:00
Ted Kremenek 4ef13f8ac9 Add clang-cc option "--analyzer-experimental-internal-checks". This
option enables new "internal" checks that will eventually be turned on
by default but still require broader testing.

llvm-svn: 88671
2009-11-13 18:46:29 +00:00
Douglas Gregor 379d84b7ed When performing copy initialization (= "implicit conversion", here) to
a class type from itself or a derived class thereof, enumerate
constructors and permit user-defined conversions to the arguments of
those constructors. This fixes the wacky implicit conversion sequence
used in std::auto_ptr's lame emulation of move semantics.

llvm-svn: 88670
2009-11-13 18:44:21 +00:00
Douglas Gregor 07eae02fc7 When transforming an expression statement (e.g., for template
instantiation), be sure to finish the expression statement by
providing a FullExprArg, making sure that temporaries get
destroyed. Fixes an obscure failure when parsing
llvm/LinkAllPasses.h.

llvm-svn: 88668
2009-11-13 18:34:26 +00:00
Daniel Dunbar 420b0f1bd8 Add CompilerInstance utility functions for creating output files.
llvm-svn: 88667
2009-11-13 18:32:08 +00:00
Anders Carlsson fb4dda4fed Instead of storing CXXMethodDecls in the vtable builder, store GlobalDecls so we can represent both the complete and deleting destructors. Also, when encountering a destructor decl, emit entries for both the complete and deleting destructors. Mike, please review.
With this change, FileCheck builds and runs the clang test suite without failures!

llvm-svn: 88663
2009-11-13 17:08:56 +00:00
Anders Carlsson 97df0b40c3 Don't bind arguments to temporaries if the argument has a reference type.
llvm-svn: 88662
2009-11-13 17:04:35 +00:00
Daniel Dunbar 045f917edc Remove local splitLines reimplementation.
llvm-svn: 88661
2009-11-13 16:46:11 +00:00
Daniel Dunbar 566eeb2da5 Add output file list to CompilerInstance, so that it can track them instead of
forcing all clients to do it.

llvm-svn: 87103
2009-11-13 10:37:48 +00:00
Daniel Dunbar ac28c38737 clang-cc: Move output file initialization closer to use.
llvm-svn: 87102
2009-11-13 10:18:59 +00:00
Daniel Dunbar 39991862e1 Simplify, in anticipation of introducing explicit action instances.
llvm-svn: 87101
2009-11-13 09:57:06 +00:00
Daniel Dunbar f7093b5ae8 Add CodeCompletion consumer to CompilerInvocation.
llvm-svn: 87100
2009-11-13 09:36:05 +00:00
Daniel Dunbar 242ea9a05a Rework Sema code completion interface.
- Provide Sema in callbacks, instead of requiring it in constructor. This
   eliminates the need for a factory function. Clients now just pass the object
   to consume the results in directly.

 - CodeCompleteConsumer is cheap to construct, so building it whenever we are
   doing code completion is reasonable.

Doug, please review.

llvm-svn: 87099
2009-11-13 08:58:20 +00:00
Daniel Dunbar 599313ef94 Add CompilerInstance::createPCHExternalASTSource.
llvm-svn: 87097
2009-11-13 08:21:10 +00:00
Daniel Dunbar adf6c242a0 Add CompilerInstance::has* methods for testing if the instance has a particular
subobject.

llvm-svn: 87096
2009-11-13 08:20:57 +00:00
Daniel Dunbar df3e30c41c Add ASTContext to CompilerInstance.
llvm-svn: 87095
2009-11-13 08:20:47 +00:00
Zhongxing Xu c7460964ac Malloc checker basically works now.
llvm-svn: 87094
2009-11-13 07:48:11 +00:00
Zhongxing Xu c4902a52a0 Hook up Malloc checker.
llvm-svn: 87093
2009-11-13 07:25:27 +00:00
Zhongxing Xu a4276b091d Check in a new interface of Checker, which will soon be used.
llvm-svn: 87092
2009-11-13 06:53:04 +00:00
Zhongxing Xu 0320ad28c7 GRStateManager::CurrentStmt is not used. Remove it.
llvm-svn: 87091
2009-11-13 06:04:01 +00:00
Daniel Dunbar 7d75afc56a Add CompilerInstance::createDiagnostics, and move clang-cc to it.
clang-cc.cpp is now under 1k lines, if anyone is counting.

llvm-svn: 87090
2009-11-13 05:52:34 +00:00
Daniel Dunbar 210a80086b Add a FIXME.
llvm-svn: 87089
2009-11-13 05:52:19 +00:00
Daniel Dunbar aaa148fd36 Add Preprocessor to CompilerInstance, and move clang-cc CreatePreprocessor to
CompilerInstance::createPreprocessor.

llvm-svn: 87088
2009-11-13 05:52:11 +00:00
Daniel Dunbar 1b4441915a Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.
llvm-svn: 87087
2009-11-13 05:51:54 +00:00
Zhongxing Xu 1721ef7a53 Include header for printf.
llvm-svn: 87086
2009-11-13 05:46:16 +00:00
Rafael Espindola 46129b0934 Use StringRef::split instead of SplitString.
llvm-svn: 87085
2009-11-13 05:13:58 +00:00
Anders Carlsson e828c36933 Add a special BuildVirtualCall that's going to be used for building calls to destructors. This is needed because when compiling:
struct A {
	virtual ~A();
};

void f(A* a) {
	delete a;
}

A's deleting destructor should be called.

llvm-svn: 87083
2009-11-13 04:45:41 +00:00
Anders Carlsson 78cfaa9e56 Fix two bugs with temporaries:
1. For 

A f() {
	return A();
}

we were incorrectly calling the A destructor on the returned object.

2. For

void f(A);
void g() {
	A a;
	f(a);
}

we were incorrectly not calling the copy constructor.

llvm-svn: 87082
2009-11-13 04:34:45 +00:00
Anders Carlsson 87f84c1e72 Move GlobalDecl to its own file. Also add DenseMapInfo traits.
llvm-svn: 87081
2009-11-13 04:25:07 +00:00
Daniel Dunbar 546a676ae5 Add {File,Source}Manager to CompilerInstance.
llvm-svn: 87079
2009-11-13 04:12:06 +00:00
Daniel Dunbar 636404a330 Add CompilerInstance, and starting moving clang-cc to it.
- The design philosophy is in the CompilerInstance doxyment, if you don't agree
   with it now would be a good time to speak up.

llvm-svn: 87078
2009-11-13 03:51:44 +00:00
Ted Kremenek 2466e0d92f Only flush plist diagnostics once.
llvm-svn: 87073
2009-11-13 03:14:14 +00:00
Ted Kremenek da00234109 Fix recently introduced use-after-free error reported in <rdar://problem/7387478>.
llvm-svn: 87072
2009-11-13 03:02:57 +00:00
Mike Stump fa81808a11 Refine construction vtables; they don't include bits that don't have
virtual bases unless they are morally virtual.

llvm-svn: 87071
2009-11-13 02:35:38 +00:00
Mike Stump 653d0b99df Refine the construction vtables with respect to offsets. WIP.
llvm-svn: 87067
2009-11-13 02:13:54 +00:00
Daniel Dunbar 27b19dc1b5 Move input kind identification (-x) into FrontendOptions.
llvm-svn: 87066
2009-11-13 02:06:12 +00:00
Ted Kremenek 3c55718016 Pull static variable within function (for slightly faster startup time).
llvm-svn: 87065
2009-11-13 01:58:01 +00:00
Mike Stump 83066c8dee Allow the tracking of address points for construction vtables as well.
llvm-svn: 87063
2009-11-13 01:54:23 +00:00
Ted Kremenek a2968e59e3 retain/release checker: refactor some of the summary lookup logic for instance method summaries. No real functionality change, but it paves the way for new enhancements.
llvm-svn: 87062
2009-11-13 01:54:21 +00:00
Ted Kremenek aedb7434c8 Add clang-cc option "-analyzer-experimental-checks" to enable experimental path-sensitive checks. The idea is to separate "barely working" or "skunkworks" checks from ones that should always run. Later we need more fine-grain checker control.
llvm-svn: 87053
2009-11-13 01:15:47 +00:00
Daniel Dunbar 1e886ebe8c Move -target-{triple,abi} options into FrontendOptions.
llvm-svn: 87051
2009-11-13 01:02:19 +00:00
Daniel Dunbar 4a1f60f777 Move code completion options to clang-cc
llvm-svn: 87050
2009-11-13 01:02:10 +00:00
Chris Lattner 956d71a63a add a fixme, inheriting from PointerIntPair is gross :)
llvm-svn: 87048
2009-11-13 00:57:01 +00:00
Daniel Dunbar a5c3d989fb Move FixItAtLocations into FrontendOptions
llvm-svn: 87046
2009-11-12 23:52:56 +00:00
Daniel Dunbar eb51586a85 clang-cc: Keep Verbose option with HeaderSearchOptions, for now.
llvm-svn: 87045
2009-11-12 23:52:46 +00:00
Daniel Dunbar f996c05d74 Add FrontendOptions, and starting moving clang-cc to it.
llvm-svn: 87044
2009-11-12 23:52:32 +00:00
Mike Stump 2b34bc5a96 Refine which vtbl is refernced in VTTs.
llvm-svn: 87043
2009-11-12 23:36:21 +00:00
Mike Stump ca0de33113 Refine offsets into vtables for the VTT.
llvm-svn: 87041
2009-11-12 23:14:15 +00:00
Mike Stump 8677bc27bf Refine vtable pointers for secondary vtables inside VTTs to point to
the right base vtable.  WIP.

llvm-svn: 87039
2009-11-12 22:56:32 +00:00
Douglas Gregor 9533e2803f We need the definition of NamedDecl in DeclContextInternals.h, since Clang is type-checking the template definition more thoroughly
llvm-svn: 87037
2009-11-12 22:12:17 +00:00