Commit Graph

11962 Commits

Author SHA1 Message Date
Douglas Gregor 56521c5e8c Simplify incomplete-array merging code in the AST importer, thanks to
Daniel's suggestion.

llvm-svn: 95987
2010-02-12 17:23:39 +00:00
Douglas Gregor 8870a49310 Fix a latent bug found by Ahmed Charles, where we were calling
ASTContext::getFunctionType with the wrong set of arguments.

llvm-svn: 95986
2010-02-12 17:17:28 +00:00
Anders Carlsson 8e661e15f2 Keep track of whether a final overrider needs a return type adjustment.
llvm-svn: 95985
2010-02-12 17:13:23 +00:00
Anders Carlsson 136bd19224 Move overrider out into a separate struct.
llvm-svn: 95984
2010-02-12 16:55:34 +00:00
Chris Lattner aa1cccbbef Fix PR6282: the include guard optimization cannot happen if the
guard macro is already defined for the first occurrence of the
header.  If it is, the body will be skipped and not be properly
analyzed for the include guard optimization.

llvm-svn: 95972
2010-02-12 08:03:27 +00:00
Anders Carlsson e8a9756e63 Keep track of the address points for all primary bases, and add the ability to dump multiple address points for a single offset.
llvm-svn: 95970
2010-02-12 07:43:48 +00:00
Douglas Gregor f40863caff Work around an annoying, non-standard optimization in the glibc
headers, where malloc (and many other libc functions) are declared
with empty throw specifications, e.g.,  

  extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__
  ((__malloc__)) ;

The C++ standard doesn't seem to allow this, and redeclaring malloc as
the standard permits (as follows) resulted in Clang (rightfully!)
complaining about mis-matched exception specifications.

  void *malloc(size_t size);

We work around this by silently propagating an empty throw
specification "throw()" from a function with C linkage declared in a
system header to a redeclaration that has no throw specifier.

Ick.

llvm-svn: 95969
2010-02-12 07:32:17 +00:00
John McCall 84c416b9f6 Fix a bug causing an assertion when a covariant return type differed from
an overriden type only by reduced qualification.

llvm-svn: 95968
2010-02-12 06:15:07 +00:00
Douglas Gregor d3a5918742 In C++, allow builtins to be referred to via qualified name lookup, e.g.,
::__builtin_va_copy

Fixes one of the Firefox issues in PR5511.

llvm-svn: 95966
2010-02-12 05:48:04 +00:00
Anders Carlsson 65b4978f7f More work on vtable layout. We can now layout vtables with primary bases.
llvm-svn: 95965
2010-02-12 05:25:12 +00:00
John McCall 62d5d64ce9 Waste two bits in every clang::Type so that the type class can be read
in a single byte-load rather than some crazy bitmunging operation.

llvm-svn: 95964
2010-02-12 03:41:30 +00:00
Anders Carlsson 09da3372b6 When dumping vtables, dump whether a virtual member function is pure or not.
llvm-svn: 95963
2010-02-12 02:38:13 +00:00
Anders Carlsson 9fbf6d95f6 More work on the final overriders.
llvm-svn: 95954
2010-02-12 01:40:03 +00:00
Devang Patel f4df65cf60 Do not ignore anonymous records.
llvm-svn: 95953
2010-02-12 01:31:06 +00:00
Devang Patel e003dd1721 Cache new compile unit.
llvm-svn: 95952
2010-02-12 01:30:31 +00:00
Douglas Gregor 2579105c4e Handle AST merges of incomplete class types.
llvm-svn: 95941
2010-02-12 00:09:27 +00:00
Tanya Lattner 90073804fb Implementing unused function warning.
llvm-svn: 95940
2010-02-12 00:07:30 +00:00
Charles Davis a90f7ca591 Warn about using the new force_align_arg_pointer attribute on a function
pointer. If you don't like the new warning, you can turn it off with
-Wno-force-align-arg-pointer.

llvm-svn: 95939
2010-02-11 23:57:08 +00:00
Fariborz Jahanian 4c4ca5a9d3 Fixes a rewriting bug where order of constructor expression arguments did not match
order of constructor arguments (all block API specific). This was exposed only in 
a large block literal expression in a large file where PtrSet container size 
execceded its limit and required reallocation.  Fixes radar 7638294

llvm-svn: 95936
2010-02-11 23:35:57 +00:00
Douglas Gregor 50dc219e8b When we have a dependent direct initializer but not a dependent
variable type, we can (and should) still check for completeness of the
variable's type. Do so, to work around an assertion that shows up in
Boost's shared_ptr.

llvm-svn: 95934
2010-02-11 22:55:30 +00:00
Ted Kremenek 9d6eb40ce7 Fix leak in CXXNewExpr where the SubExprs array would get allocated directly using 'new[]' instead of the allocator associated with ASTContext.
llvm-svn: 95933
2010-02-11 22:51:03 +00:00
Ted Kremenek 9c8a6f5a8e Fix re-allocation in AttrWithString::ReplaceString() to use the allocator assosciated with ASTContext.
llvm-svn: 95931
2010-02-11 22:44:22 +00:00
Ted Kremenek 2c809308ca Allocate the SubExprs array in ObjCMessageExpr using the allocator associated with ASTContext. This fixes yet another leak (<rdar://problem/7639260>).
llvm-svn: 95930
2010-02-11 22:41:21 +00:00
Anders Carlsson e8ac42ad5c Stub out the final overriders class.
llvm-svn: 95922
2010-02-11 21:24:32 +00:00
Anders Carlsson dd27b5d7bb Use getAs instead of cast/dyn_cast on types. (I'm sure Doug will appreciate this).
llvm-svn: 95911
2010-02-11 19:45:15 +00:00
Anders Carlsson 727ffb14a1 Move two functions to the top. No functionality change.
llvm-svn: 95908
2010-02-11 19:39:49 +00:00
Ted Kremenek 23a26d244d Uncomment lines I never meant to have left commented in a commit.
llvm-svn: 95906
2010-02-11 19:37:25 +00:00
Douglas Gregor 7eeb59752a When AST merging for record declarations fails, warn about the
incompatibility and show where the structural differences are. For
example:

struct1.c:36:8: warning: type 'struct S7' has incompatible definitions
in different translation units
struct S7 { int i : 8; unsigned j : 8; } x7;
       ^
struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
struct S7 { int i : 8; unsigned j : 8; } x7;
                                ^
struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here
struct S7 { int i : 8; unsigned j : 16; } x7;
                                ^

There are a few changes to make this work:
  - ASTImporter now has only a single Diagnostic object, not multiple
  diagnostic objects. Otherwise, having a warning/error printed via
  one Diagnostic and its note printed on the other Diagnostic could
  cause the note to be suppressed.
  - Implemented import functionality for IntegerLiteral (along with
  general support for statements and expressions)

llvm-svn: 95900
2010-02-11 19:21:55 +00:00
Anders Carlsson 5bd8d19291 More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.
llvm-svn: 95887
2010-02-11 18:20:28 +00:00
Daniel Dunbar bcd554f908 Driver: Fix clang -ccc-no-clang -x c++-header foo.h on Darwin.
llvm-svn: 95876
2010-02-11 17:33:45 +00:00
Anders Carlsson 932c2f2a9a Keep track of, and dump, vtable address points.
llvm-svn: 95874
2010-02-11 17:18:51 +00:00
John McCall be089fa86b Suppress warnings if their instantiation location is in a system header, not
their spelling location.  This prevents warnings from being swallowed just
because the caret is on the first parenthesis in, say, NULL.

This is an experiment;  the risk is that there might be a substantial number
of system headers which #define symbols to expressions which inherently cause
warnings.  My theory is that that's rare enough that it can be worked
around case-by-case, and that producing useful warnings around NULL is worth 
it.  But I'm willing to accept that I might be empirically wrong.

llvm-svn: 95870
2010-02-11 10:04:29 +00:00
Ted Kremenek d31b2637ab Patch by Cristian Draghici:
Enhance the printf format string checking when using the format
specifier flags ' ', '0', '+' with the 'p' or 's' conversions (since
they are nonsensical and undefined).  This is similar to GCC's
checking.

Also warning when a precision is used with the 'p' conversin
specifier, since it has no meaning.

llvm-svn: 95869
2010-02-11 09:27:41 +00:00
Anders Carlsson 5d40c6f658 Check in the beginnings of my new vtable layout builder idea.
Right now, it's off by default but can be tested by passing -fdump-vtable-layouts to clang -cc1. This option will cause all vtables that will normally be emitted as part of codegen to also be dumped using the new layout code.

I've also added a very simple new vtable layout test case.

llvm-svn: 95865
2010-02-11 08:02:13 +00:00
Ted Kremenek 510ee2594e Use the allocator associated with ASTContext to allocate the args
array associated with NonNullAttr.  This fixes yet another leak when
ASTContext uses a BumpPtrAllocator.

Fixes: <rdar://problem/7637150>
llvm-svn: 95863
2010-02-11 07:31:47 +00:00
Ted Kremenek da4e0d350c Have ~ASTContext() delete StoredDeclsMap (internal to DeclContext) by
storing the set of StoredDeclsMaps in an internal vector of void*.
This isn't an ideal solution, but for the time being this fixes a
major memory leak with these DenseMaps not being freed.

Fixes: <rdar://problem/7634755>
llvm-svn: 95861
2010-02-11 07:12:28 +00:00
Ted Kremenek 7f4945aa9c Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>
llvm-svn: 95853
2010-02-11 05:28:37 +00:00
Daniel Dunbar aeea8ac3d8 Driver: Add -rewrite-objc, which is an interface to clang -cc1 -rewrite-objc.
llvm-svn: 95849
2010-02-11 03:16:21 +00:00
Daniel Dunbar 84f22f9da1 Driver: Fix infinite loop and wrong message on invalid -ccc-clang-arch argument.
llvm-svn: 95848
2010-02-11 03:16:07 +00:00
Ted Kremenek c162e8e193 Clean up ownership of 'AttributeList' objects in Parser. Apparently
we would just leak them all over the place, with no clear ownership of
these objects at all.  AttributeList objects would get leaked on both
error and non-error paths.

Note: I introduced the usage of llvm::OwningPtr<AttributeList> to
manage these objects, which is particularly useful for methods with
multiple return sites.  In at least one method I used them even when
they weren't strictly necessary because it clarified the ownership
semantics and made the code easier to read.  Should the excessive
'take()' and 'reset()' calls become a performance issue we can always
re-evaluate.

Note+1: I believe I have not introduced any double-frees, but it would
be nice for someone to review this.

This fixes <rdar://problem/7635046>.

llvm-svn: 95847
2010-02-11 02:19:13 +00:00
John McCall 4f7ced69ff Strip attributes and 'inline' off the "previous declaration" of a
template explicit specialization.  Complete an apparently stalled refactor
towards using CheckSpecializationInstantiationRedecl().

llvm-svn: 95845
2010-02-11 01:33:53 +00:00
Douglas Gregor 4a62bdfb2a Remove another redundant ASTContext parameter
llvm-svn: 95843
2010-02-11 01:30:34 +00:00
Douglas Gregor d505812422 Eliminate a bunch of unnecessary ASTContexts from members functions of
Decl subclasses. No functionality change.

llvm-svn: 95841
2010-02-11 01:19:42 +00:00
Fariborz Jahanian 13b9782cc0 Diagnose when user provided getter is being used as lvalue
using property dot-syntax. Fixes radar 7628953.

llvm-svn: 95838
2010-02-11 01:11:34 +00:00
Douglas Gregor 0a5a2216e2 Eliminate the ASTContext parameter from RecordDecl::getDefinition()
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.

llvm-svn: 95836
2010-02-11 01:04:33 +00:00
Ted Kremenek da4abf11bf Allocate 'ObjCMethodList' objects (owned by Sema) using Sema's BumpPtrAllocator. Previously they were not getting freed. Fixes <rdar://problem/7635663>.
llvm-svn: 95834
2010-02-11 00:53:01 +00:00
Douglas Gregor 5c73e918c5 Implement basic AST merging for classes, structs, and unions in C.
llvm-svn: 95833
2010-02-11 00:48:18 +00:00
Fariborz Jahanian 989908fbac Generate the objc_read_weak API when calling
a __weak block. Fixes radar 7628591.

llvm-svn: 95822
2010-02-10 23:34:57 +00:00
Charles Davis 42b3842429 Fix a potential null-pointer use, and fix the style of my new function.
Thanks, Anton!

llvm-svn: 95821
2010-02-10 23:26:12 +00:00
Charles Davis bbc0aa5166 Add support for the force_align_arg_pointer attribute. This is an x86-specific
attribute, so it uses Anton's new target-specific attribute support. It's
supposed to ensure that the stack is 16-byte aligned, but since necessary
support is lacking from LLVM, this is a no-op for now.

llvm-svn: 95820
2010-02-10 23:06:52 +00:00
Chris Lattner c55042c20f hopefully silence a warning on the clang-i386-darwin9 tester.
llvm-svn: 95812
2010-02-10 21:41:43 +00:00
Douglas Gregor 5fa74c3b1d Move TypedefDecl importer to match the ordering in DeclNodes. No functionality change.
llvm-svn: 95805
2010-02-10 21:10:29 +00:00
Fariborz Jahanian c3bdefa08d Patch to rewrite blocks into unique api names.
Fixes radar 7630551

llvm-svn: 95796
2010-02-10 20:18:25 +00:00
Douglas Gregor bb7930c17e Implement basic support for merging function declarations across
translation units.

llvm-svn: 95794
2010-02-10 19:54:31 +00:00
Fariborz Jahanian bbf4320390 Provide rewriting suppport for use of __typeof__
in a declaration statement. Fixes radar 7628153.

llvm-svn: 95788
2010-02-10 18:54:22 +00:00
Daniel Dunbar 3241d400c8 Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

llvm-svn: 95787
2010-02-10 18:49:11 +00:00
Devang Patel 535fdaf020 Refactor code that generates debug info for variables that has BlocksAttr.
llvm-svn: 95786
2010-02-10 18:49:08 +00:00
Daniel Dunbar 925152c2d0 clang -cc1: Add -fsjlj-exceptions, which requires far too much button pushing.
llvm-svn: 95785
2010-02-10 18:48:44 +00:00
Douglas Gregor fa7a0e5198 Implement AST importing and merging for typedefs. As part of this, provide a lame implementation for importing TypeSourceInfos.
llvm-svn: 95783
2010-02-10 17:47:19 +00:00
Douglas Gregor 2fbe558cfe Teach AST merging that variables with incomplete array types can be
merged with variables of constant array types. Also, make sure that we
call DiagnosticClient's BeginSourceFile/EndSourceFile, so that it has
a LangOptions to work with.

llvm-svn: 95782
2010-02-10 17:16:49 +00:00
John McCall 5b0829a321 Improve access control diagnostics. Perform access control on member-pointer
conversions.  Fix an access-control bug where privileges were not considered
at intermediate points along the inheritance path.  Prepare for friends.

llvm-svn: 95775
2010-02-10 09:31:12 +00:00
Ted Kremenek fb45d35108 Convert tabs to spaces.
llvm-svn: 95756
2010-02-10 02:16:30 +00:00
Zhongxing Xu bc1d4ae206 Add comment.
llvm-svn: 95755
2010-02-10 02:02:10 +00:00
Fariborz Jahanian 68ebe63865 Comment out category's property decls. in rewrite.
Fixes radar 7630636.

llvm-svn: 95744
2010-02-10 01:15:09 +00:00
Devang Patel 1b5330afe9 Use current location as the location of compiler generated arguments, e.g. self, _cmd etc.
llvm-svn: 95743
2010-02-10 01:09:50 +00:00
Fariborz Jahanian 113b8ad7cf Reverse a partial fix patch for radar 7214820. It broke some code and
I don't have time to refix it for now.

llvm-svn: 95733
2010-02-10 00:32:12 +00:00
Douglas Gregor 811663eb11 Implement basic support for importing source locations from one AST
into another AST, including their include history. Here's an example
error that involves a conflict merging a variable with different types
in two translation units (diagnosed in the third AST context into
which everything is merged).

/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var2.c:3:5:
error: external variable 'x2' declared with incompatible types in
different translation units ('int' vs. 'double')
int x2;
    ^
In file included from
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.c:3:
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.h:1:8:
note: declared here with type 'double'
double x2;
       ^

Although we maintain include history, we do not maintain macro
instantiation history across a merge. Instead, we map down to the
spelling location (for now!).

llvm-svn: 95732
2010-02-10 00:15:17 +00:00
Douglas Gregor e4c83e4e2e Complain about types and declarations that we don't know how to import.
llvm-svn: 95706
2010-02-09 22:48:33 +00:00
Douglas Gregor 6b2a474531 Hook up the diagnostics-argument printer when merging AST files, so
that we get readable diagnostics such as:

error: external variable 'x1' declared with incompatible types in
different translation units ('double *' vs. 'float **')

However, there is no translation of source locations, yet.

llvm-svn: 95704
2010-02-09 22:37:58 +00:00
Douglas Gregor 639cccc4c0 Move the diagnostic argument formatting function out of Sema and make
it available within the AST library, of which Sema is one client. No
functionality change.

llvm-svn: 95701
2010-02-09 22:26:47 +00:00
Fariborz Jahanian 5db5281db8 Finish implementing property synthesis by default.
(radar 7381956).

llvm-svn: 95695
2010-02-09 21:49:50 +00:00
Fariborz Jahanian 4587803919 Implement synthesizing properties by default.
This is a non-fragile-abi feature only. Since it
breaks existing code, it is currently placed under
-fobjc-nonfragile-abi2 option for test purposes only
until further notice. WIP.

llvm-svn: 95685
2010-02-09 19:31:38 +00:00
Benjamin Kramer f3a499ad88 StringRefize two random methods, remove a dead variable and a weird constructor call.
This maybe fixes some of the errors GCC 4.5 gives on this code.

llvm-svn: 95684
2010-02-09 19:31:24 +00:00
Douglas Gregor 62d311fdf4 Introduce a testbed for merging multiple ASTs into a single AST
context with the AST importer. WIP, still useless but at least it has
a test.

llvm-svn: 95683
2010-02-09 19:21:46 +00:00
Ted Kremenek 499b4e3387 Fix lookup of fields from lazy bindings to check if the region is
NULL, not the store, to determine if a lookup succeeded.  The store
can be null if it contained no bindings.  This fixes a false positive
reported to me by a user of the analyzer.

llvm-svn: 95679
2010-02-09 19:11:53 +00:00
Devang Patel 0ae70d16b8 Fix virtual bases' debug info.
llvm-svn: 95678
2010-02-09 19:09:28 +00:00
Devang Patel cce7e85165 Mark implicit "this" argument as an artificial argument.
llvm-svn: 95673
2010-02-09 17:57:50 +00:00
Douglas Gregor e6565625f4 Migrate the mish-mash of declaration checks in
Sema::ActOnUninitializedDecl over to InitializationSequence (with
default initialization), eliminating redundancy. More importantly, we
now check that a const definition in C++ has an initilizer, which was
an #if 0'd code for many, many months. A few other tweaks were needed
to get everything working again:

  - Fix all of the places in the testsuite where we defined const
    objects without initializers (now that we diagnose this issue)
  - Teach instantiation of static data members to find the previous
    declaration, so that we build proper redeclaration
    chains. Previously, we had the redeclaration chain but built it
    too late to be useful, because...
  - Teach instantiation of static data member definitions not to try
    to check an initializer if a previous declaration already had an
    initializer. This makes sure that we don't complain about static
    const data members with in-class initializers and out-of-line
    definitions.
  - Move all of the incomplete-type checking logic out of
    Sema::FinalizeDeclaratorGroup; it makes more sense in
    ActOnUnitializedDecl.

There may still be a few places where we can improve these
diagnostics. I'll address that as a separate commit.

llvm-svn: 95657
2010-02-09 07:26:29 +00:00
Daniel Dunbar a7566f163a IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!

PR6240.

llvm-svn: 95648
2010-02-09 02:48:28 +00:00
John McCall 6f891400c2 Reset the found-virtual-base state unless the *current* base produces a path,
not *any* base up to now has produced a path.  Fixes PR 6254.

I'll do the access-control part of this patch RSN.

llvm-svn: 95638
2010-02-09 00:57:12 +00:00
Douglas Gregor 34c0a90265 Be more careful when checking initializer lists that involve reference
types; we don't want to give an expression reference type. Fixes PR6177.

llvm-svn: 95635
2010-02-09 00:50:06 +00:00
Douglas Gregor 92354b6b55 Implement a specific diagnostic when a class template partial
specialization does not use any of its template parameters, then
recover far more gracefully. Fixes PR6181.

llvm-svn: 95629
2010-02-09 00:37:32 +00:00
Jakob Stoklund Olesen 819e54b65c Pass inline keyword to optimizer as the new InlineHint function attribute.
At the moment the inlinehint attribute is ignored by the Inliner unless you
pass a -respect-inlinehint option.  This will soon be the default.

The inlinehint attribute is set if the inline keyword is explicitly specified
on any declaration.

llvm-svn: 95623
2010-02-09 00:10:00 +00:00
Ted Kremenek 2a0cd59f8e Convert tabs to spaces.
llvm-svn: 95621
2010-02-09 00:04:09 +00:00
Douglas Gregor 6c379e2aa6 When substituting a declaration non-type template argument for a
non-type template parameter that has reference type, augment the
qualifiers of the non-type template argument with those of the
referenced type. Fixes PR6250.

llvm-svn: 95607
2010-02-08 23:41:45 +00:00
John McCall bc077cf589 Thread a source location into the template-argument deduction routines. There
may be some other places that could take advantage of this new information,
but I haven't really looked yet.

llvm-svn: 95600
2010-02-08 23:07:23 +00:00
Douglas Gregor f85bee621b Eliminate a pointer of storage in each ObjCInterfaceType and
ObjCObjectPointerType AST node by allocating the list of protocols
after the type node itself. No functionality change.

llvm-svn: 95597
2010-02-08 22:59:26 +00:00
Daniel Dunbar 3d33fab7fc Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
element type always matched the converted LLVM type for ExprType.

llvm-svn: 95596
2010-02-08 22:53:07 +00:00
Douglas Gregor bd683973c1 Warn when cases are missing from a switch on a value of enumeration
type (-Wswitch), from Michal! 

llvm-svn: 95592
2010-02-08 22:24:16 +00:00
Douglas Gregor 586d0f926c Keep track of whether a tag was defined in a declarator vs. being
defined by itself, from Enea Zaffanella!

llvm-svn: 95586
2010-02-08 22:07:33 +00:00
John McCall 340aafaac6 Emit global references with constant initializers as constants. Fixes PR5585.
The standard actually says that such references should have internal linkage,
but gcc doesn't do that, so we probably can't get away with it.

llvm-svn: 95577
2010-02-08 21:46:50 +00:00
Fariborz Jahanian 04477f3de9 Merge block/function pointer types with objc's __weak
attribute properly and avoid bogus warning. This is
an objective-c fix only. objective-c++ follows different code
pass and requires separate fix (which will come at a later time).
Fixes radar 7214820.

llvm-svn: 95571
2010-02-08 21:09:39 +00:00
Douglas Gregor 3aed6cdd5e Implement basic importing and merging of variable declarations within
the AST importer. This doesn't actually do anything (yet), because we
don't have driver logic for merging ASTs.

llvm-svn: 95570
2010-02-08 21:09:39 +00:00
Daniel Dunbar ddf1445134 Fix -Asserts warning.
llvm-svn: 95563
2010-02-08 20:24:21 +00:00
Benjamin Kramer 16fe0bcb26 Simplify another switch/strcmp construct. No functionality/performance change.
llvm-svn: 95561
2010-02-08 19:51:59 +00:00
Sebastian Redl b0e3e1bf67 When placing an annotation token over an existing annotation token, make sure that the new token's range extends to the end of the old token. Assert that in AnnotateCachedTokens. Fixes PR6248.
llvm-svn: 95555
2010-02-08 19:35:18 +00:00
John McCall 69f9dbc3e4 Fix the crash-on-invalid from PR6259.
llvm-svn: 95554
2010-02-08 19:26:07 +00:00
Chandler Carruth 75cc359fdc Ensure that a operator delete overload is rocognized regardless of cv-quals.
llvm-svn: 95553
2010-02-08 18:54:05 +00:00
Benjamin Kramer eaabbd8b46 Reapply r95546, no intended change in performance or functionality.
llvm-svn: 95552
2010-02-08 18:38:55 +00:00
Ted Kremenek ac5ab79555 Revert 95546 since it changed the algorithmic characteristics of the convention lookup.
llvm-svn: 95547
2010-02-08 16:45:01 +00:00
Benjamin Kramer 30949dd9f9 Simplify code with StringRef.
3 files changed, 76 insertions(+), 153 deletions(-)

llvm-svn: 95546
2010-02-08 16:39:00 +00:00
Ted Kremenek 57f0989c16 Revert 95541.
llvm-svn: 95545
2010-02-08 16:18:51 +00:00
Douglas Gregor f65bbb31e8 Cache imported types
llvm-svn: 95543
2010-02-08 15:18:58 +00:00
Zhongxing Xu 500f49fe25 Rename: GRState::getSVal(Stmt*) => getExprVal(),
GRState::getSVal(MemRegion*) => Load().

llvm-svn: 95541
2010-02-08 09:30:02 +00:00
Zhongxing Xu c5f825eacd BindInternal is redundant. Remove it.
llvm-svn: 95540
2010-02-08 08:48:05 +00:00
Zhongxing Xu 8ca2dc05a3 Like for symbolic region, automatically create a element zero region for
alloca region.

llvm-svn: 95539
2010-02-08 08:43:02 +00:00
Zhongxing Xu b02d4a0d11 Unify the implementation of getLValueElement of store managers.
It's more sophisticated than the original one of BasicStore. But it does
matter. 

llvm-svn: 95536
2010-02-08 08:17:02 +00:00
Zhongxing Xu f7f0cdc517 Unify the implementation of getLValueIvar and getLValueField of store managers.
llvm-svn: 95535
2010-02-08 07:58:06 +00:00
Zhongxing Xu 08515a5242 Move common methods to the base StoreManager class.
llvm-svn: 95534
2010-02-08 07:10:35 +00:00
Chandler Carruth 794da4c236 This doesn't seem to be used code as it didn't break any tests, but fix the
glaring logic bug anyways. =D

llvm-svn: 95533
2010-02-08 06:42:49 +00:00
Zhongxing Xu 8ffee4d5f8 ASTContext is now a reference member of StoreManager.
llvm-svn: 95531
2010-02-08 06:00:22 +00:00
Zhongxing Xu 000a859f05 Add support for binding and retrieving VarRegions in flat store.
llvm-svn: 95529
2010-02-08 05:40:07 +00:00
Chandler Carruth c126311d3e Require a complete type before examining base classes during template argument
deduction. This requires refactoring the deduction to have access to the Sema
object instead of merely the ASTContext. Still leaves something to be desired
due to poor source location.

Fixes PR6257 and half of PR6259.

llvm-svn: 95528
2010-02-07 21:33:28 +00:00
Anders Carlsson ff8cce4395 Make sure to set vtable pointers in the destructors as well.
llvm-svn: 95525
2010-02-07 19:45:40 +00:00
Anders Carlsson 6d0e5bd8f3 Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
llvm-svn: 95524
2010-02-07 17:37:13 +00:00
Douglas Gregor 0e027fb32b Workaround for friend template instantiation crash in PR5848, from Keir Mierle!
llvm-svn: 95517
2010-02-07 10:31:35 +00:00
Douglas Gregor b65a913c35 Fix assertion failure when parsing linkage specifications (PR5921),
from Keir Mierle!

llvm-svn: 95516
2010-02-07 08:38:28 +00:00
Sam Weinig e83b3aca0b Roll r95513 back in.
llvm-svn: 95515
2010-02-07 06:32:43 +00:00
Sam Weinig e911058bb5 Roll out r95513, it seems to have broken self hosting.
llvm-svn: 95514
2010-02-07 05:26:25 +00:00
Sam Weinig db3758c40d Add PCH support for CXXBoolLiteralExpr and CXXNullPtrLiteralExpr.
llvm-svn: 95513
2010-02-07 04:44:10 +00:00
Anders Carlsson cee2d2f016 Use the right linkage for static variables inside C++ inline functions.
llvm-svn: 95512
2010-02-07 02:03:08 +00:00
Anders Carlsson 10d369d1a2 Improved handling of the visibility attribute. Declarations now inherit their parent's visibility.
(This is kind of a risky change, but I did a self-host build and everything appears to work fine!)

llvm-svn: 95511
2010-02-07 01:44:36 +00:00
Anders Carlsson a7bcade229 Add attributes to namespace decls.
llvm-svn: 95510
2010-02-07 01:09:23 +00:00
Anders Carlsson 9878f9f73b Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
llvm-svn: 95509
2010-02-06 23:59:05 +00:00
Anders Carlsson fcd764a168 Add support for threadsafe statics, and make them the default (matching gcc).
Daniel, I'd appreciate a review of the driver/cc1 parts.

llvm-svn: 95508
2010-02-06 23:23:06 +00:00
Anders Carlsson 5ade5d39b4 Call destructors for constructed bases as well.
llvm-svn: 95502
2010-02-06 20:00:21 +00:00
Anders Carlsson ba63167b64 If a constructor throws an exception we need to execute the destructors for all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite.
llvm-svn: 95501
2010-02-06 19:50:17 +00:00
John McCall 15dda3701a Use a substituted type when determining how to substitute in non-type template
params.  Don't insert addrof operations when matching against a pointer;
array/function conversions should take care of this for us, assuming the
argument type-checked in the first place.  Add a fixme where we seem to be
using a less-restrictive reference type than we should.

Fixes PR 6249.

llvm-svn: 95495
2010-02-06 10:23:53 +00:00
Benjamin Kramer 4692faa7a4 Silence GCC warning and stay in 80 cols.
llvm-svn: 95494
2010-02-06 09:59:24 +00:00
John McCall 13481c56c3 Extract a function to instantiate references to value template parameters.
llvm-svn: 95491
2010-02-06 08:42:39 +00:00
Anders Carlsson 96c15b1816 Don't diagnose missing noreturns for uninstantiated templates. Fixes PR6247.
llvm-svn: 95487
2010-02-06 05:31:15 +00:00
Douglas Gregor 61f6db54e1 Switch CodeGen's "is this variable declaration a definition?" logic
over to VarDecl::isThisDeclarationADefinition(), which handles
variables declared with linkage specifications better (among other
things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat
functional.

llvm-svn: 95486
2010-02-06 05:15:45 +00:00
Anders Carlsson 2c4de4c31e Only append 'L' for internal variable declarations, not all declarations. (Found by the mangle checker, yay)
llvm-svn: 95485
2010-02-06 04:52:27 +00:00
Ted Kremenek bdfcacbe8f Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are implicitly initialized to NULL.
llvm-svn: 95479
2010-02-06 04:04:46 +00:00
Ted Kremenek 30fe9ecac2 Fix regression in RegionStore (from BasicStore) where static variables were not treated as being implicitly initialized to 0 (and instead were getting symbolicated).
llvm-svn: 95478
2010-02-06 03:57:59 +00:00
Ted Kremenek 9c193965ba Remove unused variable.
llvm-svn: 95476
2010-02-06 03:29:18 +00:00
Anders Carlsson 6710c5351e Use the correct function info for constructors when applying function attributes. Fixes PR6245.
llvm-svn: 95474
2010-02-06 02:44:09 +00:00
Anders Carlsson 0da714a3e2 Implement a warning diagnostic for weak vtables. Fixes PR6116.
llvm-svn: 95472
2010-02-06 02:27:10 +00:00
John McCall ce410662ce Teach Sema how to instantiate a local function declaration properly. Fixes
PR 5517.

llvm-svn: 95470
2010-02-06 01:50:47 +00:00
Douglas Gregor cae03b1e6d Assert when we try to mangle a dependent template name, rather than
crashing unceremoniously.

llvm-svn: 95464
2010-02-06 01:09:36 +00:00
John McCall 52cc0897f3 Per discussion, remove the explicit restriction on static const data members with
out-of-line initializers as integer constant expressions.  Fixes PR6206.

llvm-svn: 95463
2010-02-06 01:07:37 +00:00
Ted Kremenek 5abd69d946 Teach RegionStore::InvalidateRegions() to also invalidate static variables referenced by blocks.
llvm-svn: 95459
2010-02-06 00:30:00 +00:00
John McCall ca972cd1f1 Rearrange some checks to avoid call to isCopyConstructor() and clarify path
taken for non-trivial constructors.

llvm-svn: 95457
2010-02-06 00:25:16 +00:00
Douglas Gregor d320e03eed Fix a bogus assertion after adjusting the type of a substituted
non-type template argument for a non-type template parameter of
pointer type. Fixes PR6244.

llvm-svn: 95447
2010-02-05 22:49:09 +00:00
Douglas Gregor d225fa05bd Cope with finding the "instantiated" declaration when we are
type-checking within a template definition. In this case, the
"instantiated" declaration is just the declaration itself, found
within the current instantiation. Fixes PR6239.

llvm-svn: 95442
2010-02-05 22:40:03 +00:00
John McCall ab26cfa58d Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior:  attributes
written on return types that don't apply there are applied to the function
instead, etc.  Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks).  Consistently consume CC/noreturn
information throughout codegen;  enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Ted Kremenek 31e7f0f293 Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do
anything when Sema has issued an error.  This matches the behavior in
RewriteObjC::HandleTranslationUnit().

llvm-svn: 95434
2010-02-05 21:28:51 +00:00
Douglas Gregor a643780483 Revert r95393, which broke Clang's self-host.
llvm-svn: 95430
2010-02-05 21:10:36 +00:00
Douglas Gregor a16b0cae9a Implement name mangling for template template parameters
llvm-svn: 95427
2010-02-05 20:45:00 +00:00
Daniel Dunbar 9c4e4651d5 IRgen: A few more ConvertType cleanups.
llvm-svn: 95423
2010-02-05 20:02:42 +00:00