Commit Graph

15283 Commits

Author SHA1 Message Date
Mike Stump 6f3793b406 Refine primary vbase selection ordering. WIP.
llvm-svn: 78844
2009-08-12 21:50:08 +00:00
Fariborz Jahanian de7d4c264a Patch for synthesizing copy assignment operator.
WIP.

llvm-svn: 78841
2009-08-12 21:14:35 +00:00
Mike Stump 9deb22b850 Improve the secondary vtables to not include vbase offsets. WIP.
llvm-svn: 78831
2009-08-12 18:50:26 +00:00
Fariborz Jahanian 887cd6a8eb error on property of objc interface type instead of crashing
llvm-svn: 78826
2009-08-12 18:17:53 +00:00
Chris Lattner 91f5ff6bce improve path handling, patch by Baptiste Lepilleur!
llvm-svn: 78824
2009-08-12 17:50:39 +00:00
Mike Stump cecfe61cd1 Refine vtable building for the secondary vtables to exclude yet more
cases where a virtual base was already used as a primary base class.
WIP.

llvm-svn: 78820
2009-08-12 17:42:21 +00:00
Chris Lattner 859c37a5d9 use the new llvm::Triple parsing stuffola for handling darwin version #'s.
llvm-svn: 78794
2009-08-12 06:24:27 +00:00
Nate Begeman 4874592208 Transition the PCH support for ShuffleVectorExpr over to ASTContext allocation
llvm-svn: 78783
2009-08-12 02:28:50 +00:00
Zhongxing Xu 0d375cdcb1 More cleanups.
llvm-svn: 78782
2009-08-12 02:28:32 +00:00
Zhongxing Xu ccffe0953e Remove redundant forward declarations.
llvm-svn: 78781
2009-08-12 02:23:28 +00:00
Nate Begeman f485fb55d8 Fix a fixme by allocating ShuffleVectorExprs in the Context
llvm-svn: 78780
2009-08-12 02:10:25 +00:00
Dan Gohman b321039271 Use the new nsw form of add for signed integer addition.
llvm-svn: 78765
2009-08-12 01:16:29 +00:00
Fariborz Jahanian 853d21a18a Warn on use of property dot syntax when unused.
llvm-svn: 78760
2009-08-12 00:45:33 +00:00
Dan Gohman 43b4484f87 Use the inbounds variant of getelementptr for common pointer arithmetic.
llvm-svn: 78756
2009-08-12 00:33:55 +00:00
Anders Carlsson 0738468322 Add some information about temporaries to the statement dumper.
llvm-svn: 78754
2009-08-12 00:21:52 +00:00
Benjamin Kramer b3788a24c6 Rename macro to avoid a name clash on FreeBSD.
llvm-svn: 78741
2009-08-11 22:46:25 +00:00
Dan Gohman 1cebe56735 Remove the hack that turns sdiv by a power of 2 to ashr, and
use the new "exact" sdiv to allow LLVM optimization to perform
this transformation.

llvm-svn: 78739
2009-08-11 22:40:09 +00:00
Benjamin Kramer 854d7dec5a Add newline at end of file.
llvm-svn: 78735
2009-08-11 22:33:06 +00:00
Fariborz Jahanian 3f8917abf6 Patch to warn if a property which is 'assign' by default
may not implement NSCopying protocol in -fobjc-gc[-only] mode.

llvm-svn: 78726
2009-08-11 22:02:25 +00:00
John McCall 2658c4e2d9 Add a FriendClassDecl type for holding declarations of friend types in
the AST, and create such declarations.

llvm-svn: 78719
2009-08-11 21:13:21 +00:00
Chris Lattner 66a388b859 merge two tests.
llvm-svn: 78705
2009-08-11 20:08:52 +00:00
Chris Lattner f1c9797ffa Fix rdar://7126285: don't warn on unused ObjC property access
that uses "dot syntax" since it might have a side effect.

llvm-svn: 78704
2009-08-11 20:08:03 +00:00
Fariborz Jahanian b2197042b8 ir-gen support for anonymous union data member
copying in copy constructors and used in
default constructor's initializer list.

llvm-svn: 78700
2009-08-11 18:49:54 +00:00
Daniel Dunbar d362857f4c Update test case.
llvm-svn: 78699
2009-08-11 18:37:40 +00:00
Benjamin Kramer 9cd050ab07 LLVMContext is a class now.
llvm-svn: 78691
2009-08-11 17:46:57 +00:00
Douglas Gregor 2168a9f25f Fix DISABLE_SMART_POINTERS build
llvm-svn: 78674
2009-08-11 15:56:57 +00:00
John McCall d1e9d835f3 Argument-dependent lookup for friend declarations. Add a new decl type,
FriendFunctionDecl, and create instances as appropriate.

The design of FriendFunctionDecl is still somewhat up in the air;  you can
befriend arbitrary types of functions --- methods, constructors, etc. ---
and it's not clear that this representation captures that very well.
We'll have a better picture when we start consuming this data in access
control.

llvm-svn: 78653
2009-08-11 06:59:38 +00:00
Douglas Gregor a16548e301 Refactor the template-instantiation logic for expressions into a
generic tree transformation (also used for recanonicalization) and a
small amount of template-instantiation-specific logic.

llvm-svn: 78645
2009-08-11 05:31:07 +00:00
Argyrios Kyrtzidis ae438f8c03 Check whether a tag was defined in a C++ condition declaration using GetTypeForDeclarator.
llvm-svn: 78644
2009-08-11 05:20:41 +00:00
Mike Stump 78696a70bf Implement more of the inductive case for vtable layout involving
virtual base primaries and improve the layout of classes with virtual
bases.  WIP.

Hey, I've decided I want a change to FileCheck, I need to ensure that
the group is together, nothing in between.  Can we change it to check
the match line is from the line immediately following the last matched
line, if the source for the matched line is immediately after the
source for the previously matched line?

// CHECK: 1
// CHECK: 2
// CHECK: 3

// CHECK: 4
// CHECK: 5
// CHECK: 6

would require 1 2 and 3 to be continuous in the output, and 4 5 and 6
to be continuous.

llvm-svn: 78638
2009-08-11 04:03:59 +00:00
Fariborz Jahanian 4898990524 Fix an indentation.
llvm-svn: 78624
2009-08-10 23:59:59 +00:00
Fariborz Jahanian 296584b2a9 Support for anonymous union in ctor's initializer and
bunch of FIXMEs for their is-gen.

llvm-svn: 78623
2009-08-10 23:56:17 +00:00
Nate Begeman 5ec4b318e3 Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.

llvm-svn: 78621
2009-08-10 23:49:36 +00:00
Anders Carlsson ed1674d971 Add a CastInfo struct that will be used for cast information when constructing cast expressions. Right now it only stores the cast kind, but in the future it might store conversion functions and constructors.
llvm-svn: 78599
2009-08-10 21:30:22 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Chris Lattner 2375952a47 these tests include section specifiers that aren't valid on the
mac, use an explicit triple.

llvm-svn: 78583
2009-08-10 18:56:44 +00:00
Fariborz Jahanian 9d3405ceab minor refactoring. No change otherwise.
llvm-svn: 78582
2009-08-10 18:46:38 +00:00
Fariborz Jahanian 7cc52cf09f ir-gen for generating copying of scalar data members in
a synthesized copy constructor.

llvm-svn: 78580
2009-08-10 18:34:26 +00:00
Mike Stump 68f0d31f25 Add walking bases in reverse order.
llvm-svn: 78578
2009-08-10 18:21:22 +00:00
Fariborz Jahanian 2a26e351fc Fixed a ir-gen bug in synthesizing copy constructors.
llvm-svn: 78570
2009-08-10 17:20:45 +00:00
Daniel Dunbar 71f22e738a Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
      'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--

Yay!

I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.

llvm-svn: 78554
2009-08-10 03:40:28 +00:00
Daniel Dunbar 481fe50903 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp

llvm-svn: 78551
2009-08-10 03:01:36 +00:00
Ryan Flynn e64ffc277c warn, as gcc does, if __attribute__((malloc)) applied to function returning non-pointer type
llvm-svn: 78542
2009-08-09 22:36:29 +00:00
Ryan Flynn 1f1fdc070e map previously ignored __attribute((malloc)) to noalias attribute of llvm function's return
llvm-svn: 78541
2009-08-09 20:07:29 +00:00
Anders Carlsson f48123b413 Improve handling of member pointers.
llvm-svn: 78536
2009-08-09 18:26:27 +00:00
Nate Begeman a96114ed08 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.

llvm-svn: 78535
2009-08-09 17:55:44 +00:00
Benjamin Kramer b57e5d2f4f Older GCCs don't have vector::data().
llvm-svn: 78519
2009-08-08 23:43:26 +00:00
Fariborz Jahanian 24f38969d5 ir-gen for initialization, in synthesize copy constructor,
of base/field which have trivial copy constructor.

llvm-svn: 78516
2009-08-08 23:32:22 +00:00
Anders Carlsson b8be93fc92 Add support for global initializers.
llvm-svn: 78515
2009-08-08 23:24:23 +00:00
Anders Carlsson f40886acca Refactor some code and implement support for global destructors for static variables.
llvm-svn: 78507
2009-08-08 21:45:14 +00:00
Anders Carlsson 2c101b3cd1 Use CastExpr::CK_ArrayToPointerDecay and fix an assert.
llvm-svn: 78502
2009-08-08 21:04:35 +00:00
Anders Carlsson e139f868b7 Add tests.
llvm-svn: 78491
2009-08-08 19:43:14 +00:00
Anders Carlsson 28a5fa29f3 Take #pragma pack into account when laying out structs. Fixes rdar://problem/7095436.
llvm-svn: 78490
2009-08-08 19:38:24 +00:00
Fariborz Jahanian f6bda5d61e Refactoring of copy ctor ir-gen. No change in functionality.
llvm-svn: 78489
2009-08-08 19:31:03 +00:00
Ryan Flynn 2f08571e4d PR4700 - remove shift by 0 warning
llvm-svn: 78488
2009-08-08 19:18:23 +00:00
Anders Carlsson 68e0b68289 Introduce a new PragmaPack attribute, and use it for #pragma pack. The PackedAttr now only represents __attribute__((packed)).
This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug.

llvm-svn: 78483
2009-08-08 18:23:56 +00:00
Anders Carlsson 453878bed4 Assert that the LLVM type has the same size as the RecordDecl size.
llvm-svn: 78481
2009-08-08 18:01:57 +00:00
Anders Carlsson 5fd7dad784 getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review)
llvm-svn: 78480
2009-08-08 17:48:49 +00:00
Anders Carlsson b26ab816a2 Factor some code to get the "function level" DeclContext out into a separate function.
llvm-svn: 78478
2009-08-08 17:45:02 +00:00
Anders Carlsson 21776b75ce Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.
llvm-svn: 78474
2009-08-08 16:55:18 +00:00
Daniel Dunbar d3a114fe2d Update test case; I don't really understand why packed enums changed this, but
the new havior is better so...

llvm-svn: 78473
2009-08-08 15:47:00 +00:00
Edward O'Callaghan c69169d175 Patch should implement packed enums - PR4098. Credit to Anders Johnsen.
llvm-svn: 78471
2009-08-08 14:36:57 +00:00
Anders Carlsson c5c57c3b86 Get rid of Stmt::Clone now that we can reference count statements instead.
llvm-svn: 78452
2009-08-08 02:50:17 +00:00
Douglas Gregor 2c742024ff Introduce reference counting for statements and expressions, using it
to allow sharing of nodes. Simplifies some aspects of template
instantiation, and fixes both PR3444 and <rdar://problem/6757457>.

llvm-svn: 78450
2009-08-08 01:41:12 +00:00
Fariborz Jahanian 7c3d7f6c59 Remove use of uninitized variable.
llvm-svn: 78448
2009-08-08 00:59:58 +00:00
Fariborz Jahanian 59b3259284 Synthesize copying of non-static data members with
non-trivial copy constructors.

llvm-svn: 78445
2009-08-08 00:15:41 +00:00
Fariborz Jahanian b68df0bc42 Synthesized copy constructor now generates code for
copying non-virtual base classes which have non-trivial
constructor. Work in progress.

llvm-svn: 78436
2009-08-07 23:51:33 +00:00
Anders Carlsson 8fc489da2a Add a CK_ArrayToPointerDecay cast kind.
llvm-svn: 78434
2009-08-07 23:48:20 +00:00
Anders Carlsson ec143777ba Add CK_ToUnion and use it for aggregate expression codegen.
llvm-svn: 78429
2009-08-07 23:22:37 +00:00
Anders Carlsson f10e414e4e More CastKind work.
llvm-svn: 78415
2009-08-07 22:21:05 +00:00
John McCall c7e8e795fa Just add global scope to the associated namespaces set instead of tracking it
separately.  Add the framework (currently unfed) for finding friend declarations
during argument-dependent lookup.

llvm-svn: 78414
2009-08-07 22:18:02 +00:00
Mike Stump 16644668cd Add vbase offsets to the vtable. Wow, having an rbegin was so
fortuitous.  WIP.

llvm-svn: 78413
2009-08-07 21:54:03 +00:00
Mike Stump d9687fded6 Add rbegin and rend for virtual bases, might come in handy some day.
llvm-svn: 78412
2009-08-07 21:44:39 +00:00
Ted Kremenek 0e8e1fde25 Fix: <rdar://problem/7075531> static analyzer wrongly detects unused ivars used in blocks
llvm-svn: 78409
2009-08-07 21:13:23 +00:00
Ted Kremenek d99f2866ac Constify some pointers. No functionality change.
llvm-svn: 78407
2009-08-07 20:55:20 +00:00
Fariborz Jahanian 40134e71be More synthesis of copy constructors. Work in progress.
llvm-svn: 78402
2009-08-07 20:22:40 +00:00
Mike Stump a4d94b1a95 Fix typo.
llvm-svn: 78401
2009-08-07 20:14:05 +00:00
Mike Stump c266c6d797 Add ability to generate vcall offsets for primary virtual base.
llvm-svn: 78396
2009-08-07 19:00:50 +00:00
Anders Carlsson 4f4aab2aeb Use the correct cast kind as suggested by Doug.
llvm-svn: 78395
2009-08-07 18:45:49 +00:00
Mike Stump b93185d05a Fix some const_cast issues. This is the beginning of the rabbit hole.
llvm-svn: 78393
2009-08-07 18:05:12 +00:00
Ryan Flynn f53fab87d8 PR3333: warn when shifting by invalid amount
llvm-svn: 78385
2009-08-07 16:20:20 +00:00
Douglas Gregor e26a285c8f Separate Stmt::Destroy into the entrypoint for destroying a statement
or expression (Destroy) from the virtual function used to actually
destroy a given expression (DoDestroy). 

llvm-svn: 78375
2009-08-07 06:08:38 +00:00
Chris Lattner b57430d698 add support for opensuse 11.1/11.2 search paths, patch by Stefan Reinauer
and Carl-Daniel Hailfinger!

llvm-svn: 78368
2009-08-07 05:28:24 +00:00
Mike Stump 7c32eab164 Add support for vcall generation for vtables for virtual bases. WIP.
llvm-svn: 78357
2009-08-06 23:48:32 +00:00
Fariborz Jahanian 9301b24c0a Patch toward synthesizing copy constructors.
Work in progress.

llvm-svn: 78355
2009-08-06 23:38:16 +00:00
Ted Kremenek 040e3b91da Fix a few more false positives involving RegionStore and unions, but this time
with array accesses. In the process, refactor some common logic in
RetrieveElement() and RetrieveField() into RetrieveFieldOrElementCommon().

llvm-svn: 78349
2009-08-06 22:33:36 +00:00
Douglas Gregor 766b0bbe61 Minor refactoring to introduce a new transformation function,
TransformStmt, into the tree transformer.

llvm-svn: 78347
2009-08-06 22:17:10 +00:00
Mike Stump e6b39f5ca3 Almost forgot to turn on 32-bit test.
llvm-svn: 78346
2009-08-06 22:02:55 +00:00
Mike Stump 52aee0f3d9 Testcase for recent checkin.
llvm-svn: 78344
2009-08-06 21:53:24 +00:00
Mike Stump 3e62d00271 Also generate the rtti field for virtual bases for vtables. Turn on
rtti so we can properly test it.  Refactor code a little.  Still a
work in progress.

llvm-svn: 78343
2009-08-06 21:49:36 +00:00
Ted Kremenek 2f6eb14af4 Fix a couple false positive "uninitialized value" warnings with RegionStore
involving reasoning about unions (which we don't handle yet).

llvm-svn: 78342
2009-08-06 21:43:54 +00:00
John McCall 2c5206d22e Drop the friend-inner-class diagnostic from an extwarn to an ext and don't
guard its report on GNUMode.

llvm-svn: 78338
2009-08-06 21:21:21 +00:00
Daniel Dunbar 1a9db99932 Add a simple tool for comparing two static analyzer runs, primarily for use from
buildbot.

llvm-svn: 78336
2009-08-06 21:15:33 +00:00
John McCall 93343b9466 Permit a class to friend its members in C++0x, without restriction.
Permit a class to friend its class members in C++ 98, as long as extensions
are enabled (and even when they aren't, only give an extwarn about it).

llvm-svn: 78332
2009-08-06 20:49:32 +00:00
Fariborz Jahanian 001309371e Set and use Elidable in elimination of copy ctors.
llvm-svn: 78331
2009-08-06 19:12:38 +00:00
Mike Stump 2d8d655922 Layout the primary base first in the vtable.
llvm-svn: 78327
2009-08-06 18:05:22 +00:00
Fariborz Jahanian 11a8e95a1a After reporting ill-formed copy constructor(12.8.p3)
don't recurs and crash.

llvm-svn: 78323
2009-08-06 17:22:51 +00:00
Daniel Dunbar 0c4a959b28 s/ccc/clang/
llvm-svn: 78320
2009-08-06 16:47:53 +00:00
Douglas Gregor 15acfb9f50 When we encounter a dependent type that was parsed before we know that
we were going to enter into the scope of a class template or class
template partial specialization, rebuild that type so that it can
refer to members of the current instantiation, as in code like

  template<typename T>
  struct X {
    typedef T* pointer;
    pointer data();
  };

  template<typename T>
  typename X<T>::pointer X<T>::data() { ... }

Without rebuilding the return type of this out-of-line definition, the
canonical return type of the out-of-line definition (a TypenameType)
will not match the canonical return type of the declaration (the
canonical type of T*).

llvm-svn: 78316
2009-08-06 16:20:37 +00:00
Mike Stump c255f3581a More layout for virtual tables for virtual bases. Still in progress.
llvm-svn: 78314
2009-08-06 15:50:11 +00:00
Mike Stump a60f1fc54b Let's remember we want better codegen for these.
llvm-svn: 78310
2009-08-06 14:16:19 +00:00
Mike Stump 04df9b1d5e Testcase for a recent checkin for vbase layout ordering. I hate to
optimize and check for non-optimal code, but until the frontend is as
powerful as fold...

llvm-svn: 78309
2009-08-06 14:12:47 +00:00
Mike Stump 6b2556f829 Layout virtual bases. Work in progress.
llvm-svn: 78308
2009-08-06 13:41:24 +00:00
Anton Korobeynikov 3ebc08b5bd Add link to LLVM's Getting Started page.
Patch by John Thompson!

llvm-svn: 78307
2009-08-06 13:00:08 +00:00
Benjamin Kramer bd7d13fb70 Silence gcc warning about non-virtual destructors.
llvm-svn: 78306
2009-08-06 12:59:58 +00:00
Mike Stump c700b362c7 I have a dream, one day, we won't need to do this.
llvm-svn: 78305
2009-08-06 12:56:50 +00:00
Mike Stump e9c85a7f58 Fix spell-o.
llvm-svn: 78303
2009-08-06 12:52:13 +00:00
Zhongxing Xu 99e49073bc I forgot adding this header for r78298.
llvm-svn: 78302
2009-08-06 12:49:15 +00:00
Zhongxing Xu 107f75989c Last step of template cleanup: merge *BuilderImpl to *Builder.
Some Builders need further cleanup.

llvm-svn: 78301
2009-08-06 12:48:26 +00:00
Zhongxing Xu 82003da8d3 Core analysis engine template cleanup step 2:
merge GRCoreEngineImpl and GRCoreEngine.

Introduce a new interface class GRSubEngine as the subengine of GRCoreEngine.
GRExprEngine subclasses GRSubEngine now.

llvm-svn: 78298
2009-08-06 10:00:15 +00:00
Zhongxing Xu c5ce335f81 Fix comment.
llvm-svn: 78296
2009-08-06 09:22:08 +00:00
Douglas Gregor 71dc50915a Implement transformation of template names within the generic tree
transform, then use the result for template instantiation. The generic
transformation fixes a few issues:

  - It copes better with template template parameters and member
  templates (when they're implemented). 
  - The logic used to replace template template parameters with their
  arguments is now centralized in TransformDecl, so that it will apply
  for other declaration-instantiation steps.
  - The error-recovery strategy is normalized now, so that any error
  results in a NULL TemplateName.

llvm-svn: 78292
2009-08-06 06:41:21 +00:00
Zhongxing Xu c90a0c2e81 Core analysis engine template cleanup step 2:
merge ExplodedGraphImpl and ExplodedGraph.

llvm-svn: 78291
2009-08-06 06:28:40 +00:00
Ted Kremenek f368fa6728 Update test case.
llvm-svn: 78290
2009-08-06 06:26:40 +00:00
Douglas Gregor 1135c35c7c Implement transformation of nested-name-specifiers within the general
tree transformation. Template instantiation uses this general
transformation rather than implementing its own transformation.

llvm-svn: 78286
2009-08-06 05:28:30 +00:00
Ted Kremenek 54bd637f40 Fix typo reported in <rdar://problem/7121409>.
llvm-svn: 78285
2009-08-06 05:01:36 +00:00
Ted Kremenek 2c85f17922 Refactor RegionStoreManager::RemoveDeadBindings to also scan the bindings of LazyCompoundSVals.
llvm-svn: 78284
2009-08-06 04:50:20 +00:00
Douglas Gregor 3f4d51bb04 Predefine __cplusplus to the right value (199711L), except when in GNU mode.
llvm-svn: 78283
2009-08-06 04:09:28 +00:00
Ted Kremenek e587ca6f25 Remove unimplemented methods 'AddRegionView' and 'RemoveRegionView'. They are no longer needed.
llvm-svn: 78280
2009-08-06 03:41:56 +00:00
Ted Kremenek ed31f99efb When profiling an ExplodedNode, don't re-profile the state: they have
already been uniqued.

llvm-svn: 78279
2009-08-06 03:39:20 +00:00
Douglas Gregor d806156d54 Support nested-name-specifiers for C++ member access expressions, e.g.,
this->Base::foo

from James Porter!

llvm-svn: 78278
2009-08-06 03:17:00 +00:00
Ryan Flynn aa5e5fd2f4 add support for FreeBSD's format(printf0,x,y) attribute; allows null format string.
llvm-svn: 78276
2009-08-06 03:00:50 +00:00
John McCall 07e91c04ba First pass at friend semantics.
llvm-svn: 78274
2009-08-06 02:15:43 +00:00
Zhongxing Xu 51eeb36c8c Completely remove the code using region cast.
llvm-svn: 78273
2009-08-06 02:14:29 +00:00
Daniel Dunbar b46b5bbaa8 Add additional library paths for Linux distros on mixed 32/64-bit systems.
- Patch by Carl-Daniel Hailfinger.

llvm-svn: 78272
2009-08-06 01:47:11 +00:00
Daniel Dunbar 4728100e8d Fix locating the 'lit.cfg' file when running on only a single file in the
current directory.

llvm-svn: 78271
2009-08-06 01:41:03 +00:00
Zhongxing Xu 20227f71d7 As GRState seems general enough, it is time to merge some template classes
and their impl base classes. This can greatly simply some code of the core 
analysis engine. This patch merges ExplodedNodeImpl into ExplodedNode.

llvm-svn: 78270
2009-08-06 01:32:16 +00:00
Daniel Dunbar f1ad6b7064 Fix clang breakage, CGF can be null in this context.
llvm-svn: 78269
2009-08-06 01:24:27 +00:00
Ted Kremenek fa41714d8d Implement lazy "copying" of structures and arrays in RegionStore. While
RegionStore already lazily abstracted the contents of arrays and structs, when
doing an assignment from one array/struct to another we did an explicit
element-wise copy, which resulted in a loss of laziness and huge performance
problem when analyzing many code bases.

Now RegionStoreManager handles such assignments using a new SVal could
'LazyCompoundSVal', which basically means the value of a given struct or array
(a MemRegion*) in a specific state (GRState). When we do a load from a field
whose encompassing struct binds to a LazyCompoundSVal, we essentially do a field
lookup in the original structure. This means we have essentially zero copying of
data for structs/arrays and everything stays lazy.

llvm-svn: 78268
2009-08-06 01:20:57 +00:00
Fariborz Jahanian eb869768f9 Patch to optimize away copy constructor call when
appropriate.

llvm-svn: 78267
2009-08-06 01:02:49 +00:00
John McCall 9de556c8b6 AlisdairM pointed out that this will likely be relaxed in C++0x, so let's
make a note of it in the test case.

llvm-svn: 78266
2009-08-06 00:50:46 +00:00
Mike Stump 2509480813 Fixup object layout when we have a primary base (it goes first). Start preping for
virtual base layout.

llvm-svn: 78265
2009-08-06 00:38:46 +00:00
John McCall 13c5a27c9a Add a test for invalid uses of non-static members from nested classes, just
because I was thinking about it.

llvm-svn: 78262
2009-08-05 23:56:26 +00:00
Owen Anderson 758428f4e3 Update for LLVM API change.
llvm-svn: 78259
2009-08-05 23:18:46 +00:00
Mike Stump a19718af5a Refactor some bits.
llvm-svn: 78254
2009-08-05 22:59:44 +00:00
Mike Stump 6d368129c5 Add another test for a recent checkin.
llvm-svn: 78253
2009-08-05 22:48:36 +00:00
Mike Stump d8fe7b2792 Calculate the primary base class better and use that when laying down
the vtable.  Still a work in progress.

llvm-svn: 78252
2009-08-05 22:37:18 +00:00
Fariborz Jahanian 01aabafee0 A blank line to separate the two blocks(per Mike comment).
llvm-svn: 78248
2009-08-05 21:52:02 +00:00
Benjamin Kramer 70231c99c4 Fix -fno-omit-frame-pointer bug Eli noticed.
llvm-svn: 78233
2009-08-05 19:47:38 +00:00
Fariborz Jahanian daeb7d51d4 Modified test case to use FileCheck.
llvm-svn: 78231
2009-08-05 19:24:33 +00:00
Eli Friedman 44b83eea30 Get rid of "smart" quotes. Per report on cfe-dev.
llvm-svn: 78230
2009-08-05 19:21:58 +00:00
Ted Kremenek 844a729d97 Use feedback from RegionStoreSubRegionMap::add() to prune off adding a super
region to the worklist used to create the subregion map.

llvm-svn: 78228
2009-08-05 19:09:24 +00:00
Douglas Gregor f9bd4ecea2 Fix canonical type construction for function types with the noreturn
attribute. Fixes PR4865.

llvm-svn: 78224
2009-08-05 19:03:35 +00:00
Fariborz Jahanian d460cb4356 Handle destruction of temporaries used in default argument
construction of constructor calls.

llvm-svn: 78222
2009-08-05 18:17:32 +00:00
Fariborz Jahanian aa890bf2f3 Patch to improve ir-gen for constructors with default argument
expressions and a test case.

llvm-svn: 78213
2009-08-05 17:03:54 +00:00
Benjamin Kramer cf4371a689 Translate -mcmodel=X to -code-model X and pass it to clang-cc. Patch by Pawel Worach!
llvm-svn: 78190
2009-08-05 14:30:52 +00:00
Benjamin Kramer 72e211a47a Add support for the -fno-omit-frame-pointer option. Patch by Roman Divacky!
llvm-svn: 78188
2009-08-05 12:11:11 +00:00
Douglas Gregor 99709de6ae Fix a comment that trailed off
llvm-svn: 78167
2009-08-05 05:39:53 +00:00
Douglas Gregor 2211d345d2 Introduce the canonical type smart pointers, and use them in a few places to
tighten up the static type system.

llvm-svn: 78164
2009-08-05 05:36:45 +00:00
Ted Kremenek 68c1f010d2 Fix a bug in RegionStoreSubRegionManager::add() where multiple subregions wouldn't correctly get registered in the SubRegion map.
llvm-svn: 78162
2009-08-05 05:31:02 +00:00
Chris Lattner c58e5699be cgobjcgnu was making invalid common globals.
llvm-svn: 78161
2009-08-05 05:25:18 +00:00
Chris Lattner f49573d1ee weak globals that are const should get weak_odr linkage.
add a fixme about C++ const.

llvm-svn: 78159
2009-08-05 05:20:29 +00:00
Chris Lattner c0693bc2ea rdar://7119244 - globals with an explicit section specified don't get
common linkage.

llvm-svn: 78158
2009-08-05 04:56:58 +00:00
Zhongxing Xu 13ee441874 Add test case.
llvm-svn: 78150
2009-08-05 03:45:09 +00:00
Zhongxing Xu fe97165587 If the UnaryOperator has non-location type, use its type to create the
constant value. If the UnaryOperator has location type, create the
constant with int type and pointer width.

This fixes the bug that all pointer increments 'p++' evaluated to Unknown.

llvm-svn: 78147
2009-08-05 02:51:59 +00:00
Mike Stump 1a90e38471 Remove an unused header.
llvm-svn: 78140
2009-08-05 01:22:47 +00:00
Fariborz Jahanian 800f37262c Support for use of default argument in constructors.
work in progress.

llvm-svn: 78132
2009-08-05 00:26:10 +00:00
Douglas Gregor e922c77ddd Move the template instantiation logic for template arguments into the
general tree transformation. Also, implement template instantiation
for parameter packs.

In addition, introduce logic to enter the appropriate context for
subexpressions that are not potentially evaluated.

llvm-svn: 78114
2009-08-04 22:27:00 +00:00
Mike Stump 9beac787c1 vtable building for simple inheritance. Still in progress.
llvm-svn: 78110
2009-08-04 21:58:42 +00:00
Mike Stump 12b8ce168d Canonicalize else.
llvm-svn: 78102
2009-08-04 21:02:39 +00:00
Mike Stump f5fc72eea9 Test cases for some recent work.
llvm-svn: 78100
2009-08-04 20:37:29 +00:00
Mike Stump 7551d05358 Will I ever get used to CamelCase? Will I ever like capitols for
random variables?
  --This line, and those below, will be ignored--

M    lib/CodeGen/CGCXX.cpp

llvm-svn: 78094
2009-08-04 20:06:48 +00:00
Mike Stump b0dd95d6d3 Add armv7 support.
llvm-svn: 78092
2009-08-04 19:48:52 +00:00
Anders Carlsson 5638895b2a Revert the fix for PR3800, it broke things.
llvm-svn: 78084
2009-08-04 18:18:36 +00:00
Ted Kremenek 36c14a0f1a Renable "html" indexing by default.
llvm-svn: 78077
2009-08-04 17:05:18 +00:00
Fariborz Jahanian b61af4c566 Some code refactoring. Be more generous in issuance of warning
on method type mismatches per Chris's comment.

llvm-svn: 78075
2009-08-04 17:01:09 +00:00
Douglas Gregor d6ff33294a Refactor template instantiation for types into a generic tree
transformation template (TreeTransform) that handles the
transformation and reconstruction of AST nodes. Template instantiation
for types is a (relatively small) customization of the generic tree
transformation.

llvm-svn: 78071
2009-08-04 16:50:30 +00:00
Anders Carlsson 19702bb054 Simplify alignment handling in the record builder.
llvm-svn: 78069
2009-08-04 16:29:15 +00:00
Daniel Dunbar 83142021fb lit: Some sample tests, for testing the tester
llvm-svn: 78050
2009-08-04 04:40:15 +00:00
Daniel Dunbar e9863976b3 Fix test case for Darwin10 (which sets ssp), and move to CodeGen/
llvm-svn: 78049
2009-08-04 04:38:31 +00:00
Daniel Dunbar 4a2cdc3302 Update for LLVM API change
llvm-svn: 78044
2009-08-04 04:02:57 +00:00
Fariborz Jahanian 10ff786e1e Compare matching selectors in current and
super class(s) and warn on any parameter
type mismatch if potentially unsafe. 

llvm-svn: 78029
2009-08-04 01:07:16 +00:00
Ted Kremenek 1624df626d Adjust test case.
llvm-svn: 78028
2009-08-04 00:58:45 +00:00
Ted Kremenek ba8d7fc6bf Recognize '-M' and '-MM' options.
llvm-svn: 78027
2009-08-04 00:57:12 +00:00
Ted Kremenek 90fc8a492e 'unlink' file directly instead of invoking system shell.
llvm-svn: 78026
2009-08-04 00:55:59 +00:00
Ted Kremenek 90e2e07bd5 Have scan-build clue off of 'BUGMETAEND' to know when to stop processing an HTML file.
llvm-svn: 78022
2009-08-03 23:45:27 +00:00
Ted Kremenek 3724cdef3f Emit a special 'BUGMETAEND' comment to aid in the postprocessing of HTML bug reports.
llvm-svn: 78021
2009-08-03 23:44:55 +00:00
Ted Kremenek fb50bf5a6f Per advice that Doug Gregor gave me several months ago, clean up the
implementation of '#pragma unused' by not constructing intermediate
DeclRefExprs, but instead do the name lookup directly.  The
implementation is greatly simplified.

Along the way, degrade '#pragma unused(undeclaredvariable)' to a
warning instead of being a hard error.  This implements:

<rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning)

llvm-svn: 78019
2009-08-03 23:24:57 +00:00
Ted Kremenek d673098480 Add a pass-by-value test for the analyzer.
llvm-svn: 78018
2009-08-03 23:22:53 +00:00
Ryan Flynn e1ca39456b PR3679: add #pragma weak test file
llvm-svn: 78016
2009-08-03 23:16:15 +00:00
Ted Kremenek d7e467f39c Add test case testing field sensitivity. Reduced from <rdar://problem/7114618>.
llvm-svn: 78008
2009-08-03 22:23:24 +00:00
Daniel Dunbar 4d93a4f9d4 Make sure UTF-16 strings end with a 16-bit null (as opposed to 8-bit).
llvm-svn: 78001
2009-08-03 21:47:08 +00:00
Ted Kremenek 0bb32e3e5d Handle disgusting corner case where a byte is loaded from the address of a function.
llvm-svn: 78000
2009-08-03 21:41:46 +00:00
Daniel Dunbar a1d8bcd33e When generating cleanup blocks for Obj-C @finally, mark them as catch all blocks
from the perspective of LLVM exception handling. Otherwise the C++ personality
function may decide not to run them, if it only detects cleanup handlers.
 - Test case for this is exceptions.m in llvm-test.

llvm-svn: 77999
2009-08-03 21:20:07 +00:00
Ted Kremenek 72ddac6cb8 Regression fix: reset 'DisplayedFunction' when a new function/method decl gets analyzed.
llvm-svn: 77996
2009-08-03 21:01:21 +00:00
Fariborz Jahanian d44bdb2926 assert(nyi) on attempt to destruct an array of objects.
llvm-svn: 77993
2009-08-03 20:51:29 +00:00
Fariborz Jahanian 18c062361d ir-gen for destructor calls.
llvm-svn: 77991
2009-08-03 20:20:07 +00:00
John McCall 49bfce4227 Refactor methods on DeclSpec to take a diagnostic& parameter, and reflect this
elsewhere.  Very slightly decouples DeclSpec users from knowing the exact
diagnostics to report, and makes it easier to provide different diagnostics in
some places.

llvm-svn: 77990
2009-08-03 20:12:06 +00:00
Eli Friedman 0519492cb6 Website updates for working with Visual Studio and making patches.
Patch by John Thompson!

llvm-svn: 77988
2009-08-03 19:42:28 +00:00
Fariborz Jahanian 6782844874 Minor renaming/refactoring. No change in functionality.
llvm-svn: 77985
2009-08-03 19:13:25 +00:00
John McCall 898cd0fced Templatize BadSpecifier and introduce DeclSpec::getSpecifier(T) for the
remaining specifier enums T.

llvm-svn: 77981
2009-08-03 18:47:27 +00:00
Daniel Dunbar 59e476b1b9 Formatting fixes (trailing whitespace, 80-cols, indentation).
llvm-svn: 77972
2009-08-03 17:06:42 +00:00
Eli Friedman 76df43c08b Fix assertion crash. I don't have a testcase, but the fix is pretty
obviously correct.

llvm-svn: 77969
2009-08-03 09:07:06 +00:00
Zhongxing Xu 9ad0b46a80 add a bunch of routine methods to AnalysisContext.
llvm-svn: 77961
2009-08-03 07:23:22 +00:00
Daniel Dunbar f0e2ea2869 lit: Don't treat '\' as an escape in unquoted strings, on Win32. This turns out
to not be a very good idea.

llvm-svn: 77957
2009-08-03 05:29:22 +00:00
Eli Friedman 5032139548 Tweak diagnostic wording; patch by Sean Hunt.
llvm-svn: 77955
2009-08-03 05:14:16 +00:00
Daniel Dunbar 07360b2099 Update for LLVM API change.
llvm-svn: 77952
2009-08-03 04:21:41 +00:00
Daniel Dunbar 7779bd1726 Update for LLVM API change.
llvm-svn: 77947
2009-08-03 04:04:27 +00:00
Zhongxing Xu b9a45a46f1 now we can let AnalysisManager to own the PathDiagnosticClient.
llvm-svn: 77945
2009-08-03 03:27:37 +00:00
Zhongxing Xu bcbe44fa90 Create only one AnalysisManager for each translation unit. In HandleCode(),
reset the current analysis context of the AnalysisManager.

llvm-svn: 77943
2009-08-03 03:13:46 +00:00