Commit Graph

20706 Commits

Author SHA1 Message Date
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
John McCall 81472e34b2 Make this test not rely on the system <limits.h>. Hopefully fixes the
MSVC build.

llvm-svn: 95932
2010-02-11 22:45:16 +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
Eli Friedman f5d476efb2 Add builtins from PR5255. Implementations coming soon.
llvm-svn: 95894
2010-02-11 19:02:42 +00:00
John McCall 739908faf6 Test case for warnings with carets inside macro instantiations.
llvm-svn: 95893
2010-02-11 18:52:49 +00:00
Anders Carlsson 48ea217fbf Add virtual operator= example.
llvm-svn: 95888
2010-02-11 18:21:49 +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
Douglas Gregor 69837bed2f Add missing test cases for AST merging of structures.
llvm-svn: 95886
2010-02-11 18:18:11 +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
Benjamin Kramer 15d8225b59 Remove noisy semicolon.
llvm-svn: 95872
2010-02-11 11:33:47 +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 50228be0f3 Attempt to always dispose of the CXIndex object in c-index-test.
llvm-svn: 95864
2010-02-11 07:41:25 +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
Daniel Dunbar d64ce7b611 c-index-test: Add "none" filter, useful for performance testing.
llvm-svn: 95800
2010-02-10 20:42:40 +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 00d1c5996b Don't display border around images (in Firefox).
llvm-svn: 95772
2010-02-10 06:43:43 +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
Douglas Gregor 0f058c83a7 Add missing header file
llvm-svn: 95751
2010-02-10 01:35:04 +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
Ted Kremenek 096807e77e Pull header into side column.
llvm-svn: 95726
2010-02-09 23:42:00 +00:00
Ted Kremenek 118667c4b9 Increase page width for more modern displays.
llvm-svn: 95725
2010-02-09 23:40:10 +00:00
Ted Kremenek f33109b452 Tweak CSS for options table.
llvm-svn: 95724
2010-02-09 23:32:46 +00:00
Ted Kremenek d4d6abe512 Even more menu tweaking...
llvm-svn: 95722
2010-02-09 23:21:49 +00:00
Ted Kremenek 758f6acc95 More menu tweaking.
llvm-svn: 95721
2010-02-09 23:21:00 +00:00
Ted Kremenek a362afe55f Adjust height of main content.
llvm-svn: 95720
2010-02-09 23:18:43 +00:00
Ted Kremenek 1b24918fb2 Fix grammar.
llvm-svn: 95719
2010-02-09 23:18:00 +00:00
Ted Kremenek 7b461607f5 Change text alignment in menus.
llvm-svn: 95718
2010-02-09 23:16:24 +00:00
Ted Kremenek 390dd25d0f Move file-specific styling to after the menu.
llvm-svn: 95717
2010-02-09 23:10:47 +00:00
Ted Kremenek 5c98bf55ac Invert css inclusion order.
llvm-svn: 95716
2010-02-09 23:09:48 +00:00
Ted Kremenek c6ee376692 More analyzer website tweaking in preparation for additional content.
llvm-svn: 95714
2010-02-09 23:05:59 +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 44e16a3f4c Add in the LIT magic to avoid running AST merge test inputs as
separate tests. Thanks, Daniel!

llvm-svn: 95705
2010-02-09 22:40:03 +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
Ted Kremenek 1b018ab712 Fix javascript link.
llvm-svn: 95696
2010-02-09 21:49:53 +00:00
Fariborz Jahanian 5db5281db8 Finish implementing property synthesis by default.
(radar 7381956).

llvm-svn: 95695
2010-02-09 21:49:50 +00:00
Ted Kremenek c319f5c044 Fix javascript file link.
llvm-svn: 95694
2010-02-09 21:48:04 +00:00
Ted Kremenek 02f2a0c279 Update checker build.
llvm-svn: 95692
2010-02-09 21:42:12 +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
Ted Kremenek 74cc62e161 Tweak output.
llvm-svn: 95676
2010-02-09 18:51:44 +00:00
Ted Kremenek 8de7a0efd1 Add a check for a running Xcode before modifying its configuration files.
llvm-svn: 95675
2010-02-09 18:46:58 +00:00
Devang Patel cce7e85165 Mark implicit "this" argument as an artificial argument.
llvm-svn: 95673
2010-02-09 17:57:50 +00:00
Anton Korobeynikov c5c905e772 Fix typo
llvm-svn: 95664
2010-02-09 16:50:54 +00:00
Anton Korobeynikov 55496d736b Clearify Qt status a bit
llvm-svn: 95663
2010-02-09 16:46:25 +00:00
Douglas Gregor fa186e9e19 Add Qt, CMake projects to the list of C++ projects we're working on compiling
llvm-svn: 95662
2010-02-09 16:36:17 +00:00
Daniel Dunbar 5140d1b75e Update tests in -Asserts mode. These tests really need to be rewritten...
llvm-svn: 95658
2010-02-09 08:22:03 +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
Douglas Gregor 1f53e803cd Fix PR number in test case
llvm-svn: 95640
2010-02-09 01:02:53 +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
Ted Kremenek 3f91c4b289 Fix grammar.
llvm-svn: 95618
2010-02-08 23:57:20 +00:00
Ted Kremenek 53c60c9a0a Tweak menu.
llvm-svn: 95617
2010-02-08 23:56:51 +00:00
Ted Kremenek 156a8f92e6 Really increase menu width...
llvm-svn: 95615
2010-02-08 23:55:36 +00:00
Ted Kremenek fcf4904144 Increase width of nav bar.
llvm-svn: 95612
2010-02-08 23:54:46 +00:00
Ted Kremenek 2960ec1c95 Add inclusion links for external JavaScript file.
llvm-svn: 95611
2010-02-08 23:52:41 +00:00
Ted Kremenek d578ca93d6 Switch to drop-down menu style.
llvm-svn: 95610
2010-02-08 23:50:54 +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
Douglas Gregor 4b8fd6d3d3 Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!
llvm-svn: 95602
2010-02-08 23:11:56 +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 408bb74ae6 Note that a CXIndex cannot be destroyed until after all of its translation units have been destroyed
llvm-svn: 95598
2010-02-08 23:03:06 +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
Ted Kremenek 73fd7e3bee Remove table (for now). Doesn't look so hot.
llvm-svn: 95590
2010-02-08 22:16:08 +00:00
Ted Kremenek 9f25dd587c Add images showing the results in a web browser and Xcode respectively.
llvm-svn: 95589
2010-02-08 22:12:48 +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
Ted Kremenek d0450d90b3 Remove link to Developer Meeting and tighten menu.
llvm-svn: 95576
2010-02-08 21:39:53 +00:00
Ted Kremenek 8eacbe5559 Add link to the current status of analysis support for C++.
llvm-svn: 95573
2010-02-08 21:36:47 +00:00
Ted Kremenek e52f932f5f Add some diagnostics for when we cannot update the original spec file.
llvm-svn: 95572
2010-02-08 21:19:27 +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
Ted Kremenek 94c5349ef2 Add a Python script to change what version of Clang is used by Xcode for static analysis (and ONLY static analysis).
llvm-svn: 95569
2010-02-08 20:54:01 +00:00
Daniel Dunbar ddf1445134 Fix -Asserts warning.
llvm-svn: 95563
2010-02-08 20:24:21 +00:00
Sebastian Redl c1b139dba0 Add a test case for r95555.
llvm-svn: 95562
2010-02-08 19:58:40 +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
Ted Kremenek 83fdeb5855 Update checker build.
llvm-svn: 95490
2010-02-06 06:08:09 +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 bb26a92239 Update Clang C++ status, with a more project-centric focus.
llvm-svn: 95455
2010-02-05 23:51:14 +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 c90dedbda0 Oops, thanks Clang
llvm-svn: 95429
2010-02-05 21:07:53 +00:00
Charles Davis 2b2864c436 Convert this test to FileCheck instead of grepping LLVM IR.
llvm-svn: 95428
2010-02-05 20:45:48 +00:00
Douglas Gregor a16b0cae9a Implement name mangling for template template parameters
llvm-svn: 95427
2010-02-05 20:45:00 +00:00
Ted Kremenek 6a93195783 Fix how scan-build finds c++-analyzer to work with checker builds.
llvm-svn: 95425
2010-02-05 20:34:14 +00:00
Daniel Dunbar 9c4e4651d5 IRgen: A few more ConvertType cleanups.
llvm-svn: 95423
2010-02-05 20:02:42 +00:00
Douglas Gregor b9397108c5 Fix two issues with the substitution of template template parameters
when instantiating the declaration of a member template:
  - Only check if the have a template template argument at a specific position
  when we already know that we have template arguments at that level;
  otherwise, we're substituting for a level-reduced template template
  parameter. 
  - When trying to find an instantiated declaration for a template
  template parameter, look into the instantiated scope. This was a
  typo, where we had two checks for TemplateTypeParmDecl, one of
  which should have been a TemplateTemplateParmDecl.

With these changes, tramp3d-v4 passes -fsyntax-only.

llvm-svn: 95421
2010-02-05 19:54:12 +00:00
Daniel Dunbar d0bc7b9d13 IRgen: Factor out EmitAggExprToLValue.
llvm-svn: 95416
2010-02-05 19:38:31 +00:00
Fariborz Jahanian df506b934e Fix a code gen bug accessing 'isa' field via a message call
(Fixes radar 7609722).

llvm-svn: 95406
2010-02-05 19:18:30 +00:00
Douglas Gregor 7df89f5d18 When we're parsing an expression that may have looked like a
declaration, we can end up with template-id annotation tokens for
types that have not been converted into type annotation tokens. When
this is the case, translate the template-id into a type and parse as
an expression.

llvm-svn: 95404
2010-02-05 19:11:37 +00:00
Daniel Dunbar 8848175547 IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
conceptually correct. Review appreciated (Chris, Eli, Anders).

llvm-svn: 95401
2010-02-05 18:56:49 +00:00
Anders Carlsson cb86e1088a Fix the bug that was breaking self-host, and re-land the static ctor fixes.
llvm-svn: 95400
2010-02-05 18:38:45 +00:00
Charles Davis 5a5473f0f8 Now that we store calling conventions in the types, use them instead of
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.

llvm-svn: 95399
2010-02-05 18:13:10 +00:00
Fariborz Jahanian 73587761e2 Removed non-essential header file from test.
llvm-svn: 95396
2010-02-05 18:04:36 +00:00
Douglas Gregor 96e578d29d Initial skeleton of an AST "importer", which will take AST elements from
one context and import them into another context, merging them
according to language-specific rules. This is a skeleton. It doesn't
work, it isn't testable, but I want it in version control.

llvm-svn: 95395
2010-02-05 17:54:41 +00:00
Charles Davis e4e604b5d6 Testing, 1, 2, 3...
Also make the comments I added in r95291 consistent.

llvm-svn: 95394
2010-02-05 17:53:51 +00:00
Daniel Dunbar 363589bded IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
need to deal with aggregates specially; this is consistent with the rest of IRgen.

Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.

llvm-svn: 95393
2010-02-05 17:51:33 +00:00
Fariborz Jahanian 314333847e Fixes a minor rewriter bug messaging inside a function call.
Fixes radar 7617047.

llvm-svn: 95392
2010-02-05 17:48:10 +00:00
Fariborz Jahanian a7e1dcdc0e Some clean up of replacement text API no longer needed by
my recent changes.

llvm-svn: 95391
2010-02-05 16:43:40 +00:00
Douglas Gregor af77cd220a Revert r95363 and r95375, which broke self-host.
llvm-svn: 95389
2010-02-05 16:18:08 +00:00
Douglas Gregor 0ab7af6c28 A dependent initializer with zero arguments should return a NULL
initializer (for no initialization) rather than a ParenListExpr with
zero arguments in it.

llvm-svn: 95382
2010-02-05 07:56:11 +00:00
Chandler Carruth bc50da6360 Revert the unused TST_pixel entry from r95335 as it is not listed in the Sema
switch, triggering warnings.

llvm-svn: 95381
2010-02-05 07:38:55 +00:00
Douglas Gregor 8c702534cb Default function arguments for function template specializations
always come from the primary template, so gather the instantiation
template arguments from the primary template.

llvm-svn: 95380
2010-02-05 07:33:43 +00:00
Daniel Dunbar 4e9083260b Tweak inliner thresholds to match llvm-gcc, see r95321.
llvm-svn: 95379
2010-02-05 07:32:37 +00:00
Anders Carlsson c6eec40189 Check in a mangle checker that's turned off by default.
llvm-svn: 95377
2010-02-05 07:31:37 +00:00
Douglas Gregor 3ce7493c35 Teach C++ name lookup that it's okay to look in a scope without a
context. This happens fairly rarely (which is why we got away with
this bug). Fixes PR6184, where we skipped over the template parameter
scope while tentatively parsing.

llvm-svn: 95376
2010-02-05 07:07:10 +00:00
Anders Carlsson 893555ce66 Fix array initialization test.
llvm-svn: 95375
2010-02-05 07:00:11 +00:00
Anders Carlsson ff338dbf9c Fix a test case.
llvm-svn: 95374
2010-02-05 06:58:06 +00:00
Douglas Gregor 1aa3edbb99 A function declarator with a non-identifier name in an anonymous class
is a constructor for that class, right? Fixes PR6238. 

llvm-svn: 95367
2010-02-05 06:12:42 +00:00
Ted Kremenek 94e6d98cae Add test case showing the analyzer invalidates '__block' variables when the block is passed as an argument to an ObjC method.
llvm-svn: 95366
2010-02-05 06:10:46 +00:00
Zhongxing Xu ad0ef84040 More GRState* -> Store changes.
llvm-svn: 95365
2010-02-05 05:34:29 +00:00
Zhongxing Xu 0d081f373a Remove unused parameter.
llvm-svn: 95364
2010-02-05 05:24:20 +00:00
Anders Carlsson ecac409cb0 If a global initializer has a non-trivial destructor it can't be emitted as a constant (even if it has a trivial constructor).
llvm-svn: 95363
2010-02-05 05:19:42 +00:00
Zhongxing Xu f668204a6a More GRState* -> Store changes.
llvm-svn: 95362
2010-02-05 05:18:47 +00:00
Douglas Gregor 6ec89d4953 When adding ADL candidates for overloaded
post-increment/post-decrement operators, be sure to consider both
arguments. Fixes PR6237.

llvm-svn: 95361
2010-02-05 05:15:43 +00:00
Zhongxing Xu 7fcd8acbf8 More GRState* -> Store changes.
llvm-svn: 95360
2010-02-05 05:06:13 +00:00
Douglas Gregor 8a6d15d5ed When determining whether a scope specifier is complete, consider a
dependent DeclContext to be "complete". Fixes PR6236.

llvm-svn: 95359
2010-02-05 04:39:02 +00:00
Zhongxing Xu c7b9f950d7 More GRState* -> Store changes.
llvm-svn: 95357
2010-02-05 03:01:53 +00:00
Zhongxing Xu bd96bf1e78 Change LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need to
spread GRState* everywhere.

llvm-svn: 95354
2010-02-05 02:26:30 +00:00
Ted Kremenek 01a83104a2 Now that the -cc1 options for analyzer checks have a structured naming, add back scanning for analyzer checks to scan-build.
llvm-svn: 95349
2010-02-05 02:18:39 +00:00
Ted Kremenek 2f2692f8ca Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
llvm-svn: 95348
2010-02-05 02:06:54 +00:00
Ted Kremenek b6e400c87c Rename -cc1 option '-warn-objc-missing-dealloc' to '-analyzer-check-objc-missing-dealloc'.
llvm-svn: 95347
2010-02-05 01:59:21 +00:00
Ted Kremenek 61b506aa8f Rename -cc1 option '-warn-objc-methodsigs' to '-analyzer-check-objc-methodsigs'.
llvm-svn: 95346
2010-02-05 01:57:44 +00:00
Ted Kremenek 2d8ef71ae6 Rename -cc1 option '-warn-objc-unused-ivars' to '-analyzer-check-objc-unused-ivars'.
llvm-svn: 95345
2010-02-05 01:55:01 +00:00
Ted Kremenek d519b83757 Rename -cc1 option '-warn-dead-stores' to '-analyzer-check-dead-stores'.
llvm-svn: 95343
2010-02-05 01:52:40 +00:00
Ted Kremenek ec5b3d45c1 Rename -cc1 option '-warn-security-syntactic' to '-analyzer-check-security-syntactic'.
llvm-svn: 95342
2010-02-05 01:50:36 +00:00
Fariborz Jahanian 80fadb5069 Fix a nested ivar reference rewriting bug.
(Fixes radar 7607605).

llvm-svn: 95341
2010-02-05 01:35:00 +00:00
John McCall ae580fede3 Always start tag definitions before completing them. Assert same.
Fixes latent and not-so-latent objc++ and blocks++ bugs.

llvm-svn: 95340
2010-02-05 01:33:36 +00:00
John Thompson 2233460de6 First stage of adding AltiVec support
llvm-svn: 95335
2010-02-05 00:12:22 +00:00
Douglas Gregor 0c8a172911 Fix a crash with ill-formed code within a method in an ill-formed
category implementation, which showed up during (attempted) typo
correction. Fixes <rdar://problem/7605289>.

llvm-svn: 95334
2010-02-04 23:42:48 +00:00
John McCall 67da35c832 Extract a common structure for holding information about the definition
of a C++ record.  Exposed a lot of problems where various routines were
silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order)
when presented with a non-definition.  Also cuts down on memory usage.

llvm-svn: 95330
2010-02-04 22:26:26 +00:00
Ted Kremenek 1de1707bfc Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.
llvm-svn: 95324
2010-02-04 20:46:58 +00:00
Douglas Gregor c42075a164 Fix an obscure crash found in the Boost.MPL test suite, along with a
ton of potential crashes of the same kind. The fundamental problem is
that type creation was following a dangerous pattern when using its
FoldingSets:
  1) Use FindNodeOrInsertPos to see if the type is available
  2) If not, and we aren't looking at a canonical type, build the
  canonical type
  3) Build and insert the new node into the FoldingSet

The problem here is that building the canonical type can, in very rare
circumstances, force the hash table inside the FoldingSet to
reallocate. That invalidates the insertion position we computed in
step 1, and in step 3 we end up inserting the new node into the wrong
place. BOOM!

I've audited all of ASTContext, fixing this problem everywhere I found
it. The vast majority of wrong code was C++-specific (and *ahem*
written by me), so I also audited other major folding sets in the C++
code (e.g., template specializations), but found no other instances of
this problem.

llvm-svn: 95315
2010-02-04 18:10:26 +00:00
Anders Carlsson 824e0613de When binding an lvalue to a reference, we always need to pop temporaries.
With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:

Expected Passes    : 6933
Expected Failures  : 46
Unsupported Tests  : 40
Unexpected Failures: 27

which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.

llvm-svn: 95313
2010-02-04 17:32:58 +00:00
Anders Carlsson 3460aa1079 Update test.
llvm-svn: 95312
2010-02-04 17:29:32 +00:00
Anders Carlsson 9b942c65a5 Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.
llvm-svn: 95311
2010-02-04 17:26:01 +00:00
Anders Carlsson e5dfc26850 Improve conditional temporaries test.
llvm-svn: 95310
2010-02-04 17:23:15 +00:00
Douglas Gregor eca8f5a49c When substituting the template argument for a pointer non-type
template parameter, perform array/function decay (if needed), take the
address of the argument (if needed), perform qualification conversions
(if needed), and remove any top-level cv-qualifiers from the resulting
expression. Fixes PR6226.

llvm-svn: 95309
2010-02-04 17:21:48 +00:00
Anders Carlsson ae612d22ac Rename StartConditionalBranch/FinishConditionalBranch to BeginConditionalBranch/EndConditionalBranch.
llvm-svn: 95308
2010-02-04 17:18:07 +00:00
Anders Carlsson c4325486b9 Fix another pointer-to-member function miscompile, this time when trying to call a virtual member function.
llvm-svn: 95307
2010-02-04 17:08:48 +00:00
Anders Carlsson 674cf89301 Improve test.
llvm-svn: 95306
2010-02-04 17:06:52 +00:00
Anders Carlsson 7914dad72d Calculate offset correctly when taking the address of a virtual member function.
llvm-svn: 95305
2010-02-04 16:38:05 +00:00
Ted Kremenek a0032da389 Convert flags in FormatSpecifier to be bitfields instead of doing
direct bit manipulation.  This is is less error prone, and fixes a bug
in the handling of the LeadingZeroes flag as pointed out by Cristian
Draghici.

llvm-svn: 95298
2010-02-04 07:27:39 +00:00
Ted Kremenek fc8dbdf3c7 Add assorted test cases from PR 4172.
llvm-svn: 95297
2010-02-04 07:25:56 +00:00
John McCall cddbad000d Allow calling convention attributes to apply to types. Patch by Chip Davis!
llvm-svn: 95291
2010-02-04 05:44:44 +00:00
Zhongxing Xu 319deb83d2 Cast evaluation no longer touch GRState.
llvm-svn: 95290
2010-02-04 04:56:43 +00:00
Ted Kremenek 49f878524c Specially handle casts to 'void' in AdjustedReturnValueChecker.
llvm-svn: 95287
2010-02-04 04:18:55 +00:00
Ted Kremenek 33617e055a Remove stray typo.
llvm-svn: 95286
2010-02-04 04:14:49 +00:00
John McCall d061b4429e Mangle member expressions. Also invented.
llvm-svn: 95284
2010-02-04 02:56:29 +00:00
Zhongxing Xu 4f8b9899bb Now that CastRetrievedVal returns SVal, there is no need to use CastResult.
llvm-svn: 95279
2010-02-04 02:39:47 +00:00
John McCall 11ef09f8b5 Add a cautionary note about the mangling I just invented.
llvm-svn: 95275
2010-02-04 01:48:38 +00:00
John McCall 09de8ecd88 Add mangling support for calls, sizeof/alignof, constructor calls,
float literals, and unresolved lookups (which required hand-wavey extensions).

llvm-svn: 95273
2010-02-04 01:42:13 +00:00
Ted Kremenek 1e3b95580c static analyzer: handle casts of a function to a function pointer with
a different return type.  While we don't emit any errors (yet), at
least we avoid cases where we might crash because of an assertion
failure later on (when the return type differs from what is expected).

llvm-svn: 95268
2010-02-04 00:47:48 +00:00