Commit Graph

21953 Commits

Author SHA1 Message Date
Daniel Dunbar dc406b8e92 IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
- Unfortunately, this requires some horrible code in CGObjCMac which always
   allocats a CGBitFieldInfo because we don't currently build a proper layout
   for Objective-C classes. It needs to be cleaned up, but I don't want the
   bit-field cleanups to be blocked on that.

llvm-svn: 100474
2010-04-05 21:36:35 +00:00
Douglas Gregor cf04b02d1d Extend the type printing policy to allow one to turn off the printing
of file locations for anonymous tag types (e.g., "enum <anonymous at
t.h:15:6>"), which can get rather long.

llvm-svn: 100470
2010-04-05 21:25:31 +00:00
Jeffrey Yasskin 6e085c1efe Print the errors when a clang test fails instead of just listing the
failing test files.

llvm-svn: 100469
2010-04-05 21:20:38 +00:00
Douglas Gregor d03e823fb4 Clarify the ownership semantics of the Diagnostic object used by
ASTUnit. Previously, we would end up with use-after-free errors
because the Diagnostic object would be creating in one place (say,
CIndex) and its ownership would not be transferred into the
ASTUnit. Fixes <rdar://problem/7818608>.

llvm-svn: 100464
2010-04-05 21:10:19 +00:00
Devang Patel a2c048eaf8 Emit debug info for objc getters and setters.
llvm-svn: 100462
2010-04-05 21:09:15 +00:00
Chris Lattner da081a8e1f fix PR6780, properly handling the IR {|} escapes in inline asm strings.
llvm-svn: 100449
2010-04-05 18:44:00 +00:00
Douglas Gregor a0bc68b647 Make the ASTUnit constructor private; all ASTUnit clients should be using the static factory functions
llvm-svn: 100444
2010-04-05 18:20:14 +00:00
Chris Lattner 005fc1bbcf fix PR6782, an accept invalid. We weren't emitting the diagnostic
returned by SetTypeSpecType.

llvm-svn: 100443
2010-04-05 18:18:31 +00:00
Douglas Gregor a2433154c8 Minor ASTUnit cleanups:
- Rename "Diagnostics" and related to "StoredDiagnostics", to better
  capture what we're actually storing.
  - Move SourceManager and FileManager to the heap.

llvm-svn: 100441
2010-04-05 18:10:21 +00:00
Daniel Dunbar cd3d5e76ce IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
llvm-svn: 100433
2010-04-05 16:20:44 +00:00
Daniel Dunbar b76c4cd5ec Add a FIXME and reduce nesting.
llvm-svn: 100432
2010-04-05 16:20:33 +00:00
Douglas Gregor f3df985ba7 Code completion results that refer to macros now get the cursor kind
of macro definitions when passed to CIndex. Add test for code
completion of macros via CIndex.

llvm-svn: 100431
2010-04-05 16:10:30 +00:00
Zhongxing Xu faa4905e0c Always assume block-level expressions in the caller are alive when analyzing
the callee.

llvm-svn: 100429
2010-04-05 13:16:29 +00:00
Zhongxing Xu 973b5f55f8 Since now we process regions in clusters when removing dead bindings, this
code can be removed.

llvm-svn: 100428
2010-04-05 13:00:12 +00:00
Mon P Wang cc2ab0cdc9 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Rafael Espindola 8e7ca8e0b1 Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.
Fixes PR6748

llvm-svn: 100266
2010-04-03 04:26:42 +00:00
Eric Christopher e1ddaf911b Add option and macro definition for AES instructions. Now produces real
assembly for testcases.

llvm-svn: 100253
2010-04-02 23:50:19 +00:00
Fariborz Jahanian d077f719be Improve diagnosing when a method type does not start with '-'|'+'
when parsing. Fixes radar 7822196.

llvm-svn: 100248
2010-04-02 23:15:40 +00:00
Daniel Dunbar 7e5aba433d IRgen/NeXT: Remove my refactoring-enabling asserts, and add a FIXME.
llvm-svn: 100237
2010-04-02 22:29:40 +00:00
Daniel Dunbar 8f0be43669 Avoid unneeded calls to opt/llvm-dis.
llvm-svn: 100236
2010-04-02 22:29:38 +00:00
Daniel Dunbar 87c1991bb4 Merge several tests into switch.c.
llvm-svn: 100235
2010-04-02 22:29:35 +00:00
Daniel Dunbar 8c7f981833 IRgen/Obj-C: Eliminate FindIvarInterface, now that ivar's are in the right DeclContexts (-2 FIXMEs). We still have an annoying linear scan + hidden dependency on how Obj-C layout is done.
- This is also an algorithmic improvement in IRgen for Obj-C, although it probably doesn't matter in practice.

llvm-svn: 100228
2010-04-02 21:14:02 +00:00
Daniel Dunbar 89947ea894 AST: Add ObjCIvarDecl::getContainingInterface().
llvm-svn: 100227
2010-04-02 21:13:59 +00:00
Fariborz Jahanian e16cdb407a diagnose declaring class extension after its implementation
(radar 7822210).

llvm-svn: 100226
2010-04-02 20:53:05 +00:00
Chris Lattner 18a584b56c NewDebugLoc got renamed to DebugLoc.
llvm-svn: 100219
2010-04-02 20:21:43 +00:00
Daniel Dunbar fe3ead7c48 Sema/Obj-C: Narrow type of ObjCIvarDecl::Create, and check additional invariants on the provided DeclContext.
- Doug, please see the FIXME in DeclObjC.cpp -- I am not sure what the right fix is.

llvm-svn: 100213
2010-04-02 20:10:03 +00:00
Fariborz Jahanian a9f8675e02 Diagnose invalid code with -fobjc-nonfragile-abi2 when
property is being accessed without the dot-syntax notation.
(radar 7822344).

llvm-svn: 100212
2010-04-02 20:09:24 +00:00
Daniel Dunbar ab5d7aef72 Sema/Obj-C: Narrow type, and simplify.
llvm-svn: 100210
2010-04-02 19:44:54 +00:00
Douglas Gregor ce6c2748f7 We seem to get an inconsistent alignment value in the generated
assembly for the global "d7". We were previously testing for alignment
3, which seems to happen for some builders and not for others. I've
eliminated the alignment check and added a FIXME to unbreak the
buildbots.

llvm-svn: 100205
2010-04-02 19:02:06 +00:00
Mon P Wang f7f3bff646 Revert r100193 since it causes failures in objc in clang
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Daniel Dunbar 229385cd68 Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow type.
llvm-svn: 100197
2010-04-02 18:29:09 +00:00
Douglas Gregor 45cf7e3d2a Rework our handling of copy construction of temporaries, which was a
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.

The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.

This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.

Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.

llvm-svn: 100196
2010-04-02 18:24:57 +00:00
Mon P Wang 4b82a88764 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Daniel Dunbar 031d4d40d0 CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
llvm-svn: 100188
2010-04-02 15:43:29 +00:00
Anders Carlsson db0a965eca If a constructor is a dependent context, just set the base and member initializers as they are written. Fixes a bug where we wouldn't show initialization order warnings when instantiating.
llvm-svn: 100180
2010-04-02 06:26:44 +00:00
Anders Carlsson 7b3f2788a1 Diagnose multiple base and member initializers in class templates.
llvm-svn: 100179
2010-04-02 05:42:15 +00:00
Anders Carlsson 4c8cb01b5a More cleanup.
llvm-svn: 100175
2010-04-02 03:43:34 +00:00
Anders Carlsson 96b8fc664a Constify.
llvm-svn: 100174
2010-04-02 03:38:04 +00:00
Anders Carlsson e857b29e0c Minor cleanup.
llvm-svn: 100173
2010-04-02 03:37:03 +00:00
Chandler Carruth 4a70ae54b4 Resolve a layering violation by making AddTaggedVal public for
PartialDiagnostic objects, and hoisting the stream operator for QualType into
Type.h with the operator for the normal DiagnosticBuilder. Also remove the no
longer needed friend declaration for the DeclarationName stream operator.

llvm-svn: 100169
2010-04-02 01:39:03 +00:00
John McCall cdf40bed1b Check in a motivating test for the revised access semantics.
llvm-svn: 100159
2010-04-02 00:11:49 +00:00
John McCall d79b4d8173 Correct the calculation of access to more closely model the wording in
the standard.

llvm-svn: 100155
2010-04-02 00:03:43 +00:00
Ted Kremenek cbcb692133 Update analyzer build.
llvm-svn: 100153
2010-04-01 23:25:38 +00:00
Douglas Gregor 697a39110f Minor cleanup with the ternary operator
llvm-svn: 100144
2010-04-01 22:47:07 +00:00
Fariborz Jahanian d603b54c55 Relax the typesafty rules of block pointers types which
take'id' or return 'id' in their type. Fixes radar 7814131.

llvm-svn: 100129
2010-04-01 19:50:22 +00:00
Douglas Gregor b242683d99 Overhaul checking of non-type template arguments that should refer to
an object or function. Our previous checking was too lax, and ended up
allowing missing or extraneous address-of operators, among other
evils. The new checking provides better diagnostics and adheres more
closely to the standard.

Fixes PR6563 and PR6749.

llvm-svn: 100125
2010-04-01 18:32:35 +00:00
Daniel Dunbar e43887bd2b Driver: Add support for a CLANGXX_IS_PRODUCTION build variable, which enable
Clang++ support, even in "Production" mode (for testing purposes).

llvm-svn: 100119
2010-04-01 18:21:41 +00:00
Daniel Dunbar f4b37e1926 Fix -Asserts warning, and protect against missing case.
llvm-svn: 100115
2010-04-01 16:50:48 +00:00
Kovarththanan Rajaratnam 8841e86d11 Include *.inc in install target
Fixes PR6755.

llvm-svn: 100105
2010-04-01 14:24:41 +00:00
Zhongxing Xu 640aad7667 Use the element type to compute the array size when the base region is a VarRegion.
Patch by Jordy Rose.

llvm-svn: 100099
2010-04-01 08:20:27 +00:00
Zhongxing Xu 920070cfe7 Initial support for visiting CXXMemberCallExpr.
llvm-svn: 100098
2010-04-01 07:58:50 +00:00
Chris Lattner e675d0f924 adjust to IRBuilder change and use faster DebugLoc apis.
llvm-svn: 100093
2010-04-01 06:31:43 +00:00
Zhongxing Xu 8cea7f6f70 Improve C++ constructor handling.
llvm-svn: 100080
2010-04-01 03:47:27 +00:00
Eric Christopher 2fbd4050e9 Fix typo.
llvm-svn: 100079
2010-04-01 03:07:20 +00:00
Eric Christopher 5464e5ae00 First start at wmmintrin.h file with Intel AES-NI instructions.
llvm-svn: 100077
2010-04-01 03:03:35 +00:00
Ted Kremenek c3e1f2f9ba Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() where
array values with a non-zero offset would get prematurely pruned from the store.

llvm-svn: 100067
2010-04-01 00:15:55 +00:00
Douglas Gregor f5af3584ca Improve diagnostics when an elaborated-type-specifer containing a
nested-name-specifier (e.g., "class T::foo") fails to find a tag
member in the scope nominated by the
nested-name-specifier. Previously, we gave a bland

  error: 'Nested' does not name a tag member in the specified scope

which didn't actually say where we were looking, which was rather
horrible when the nested-name-specifier was instantiated. Now, we give
something a bit better:

  error: no class named 'Nested' in 'NoDepBase<T>'

llvm-svn: 100060
2010-03-31 23:17:41 +00:00
Douglas Gregor e677dafce1 Change the representation of dependent elaborated-type-specifiers
(such as "class T::foo") from an ElaboratedType of a TypenameType to a
DependentNameType, which more accurately models the underlying
concept.

Improve template instantiation for DependentNameType nodes that
represent nested-name-specifiers, by performing tag name lookup and
checking the resulting tag appropriately. Fixes PR5681.

There is still much testing and cleanup to do in this area.

llvm-svn: 100054
2010-03-31 22:19:08 +00:00
Fariborz Jahanian 083712fbb7 Issue better syntax error when objc's messaging
ares are not separated by ':' (radar 7030268).

llvm-svn: 100040
2010-03-31 20:22:35 +00:00
Douglas Gregor 0208535fda Extend DependentNameType with a keyword enum that specifies whether
this was parsed as a typename-specifier, elaborated-type-specifier
(including the kind), or just a dependent qualified type name.

llvm-svn: 100039
2010-03-31 20:19:30 +00:00
Ted Kremenek b43e06fa56 For reverse data flow analyses, enqueue the blocks in reverse order.
This more likely matches with the ideal order the blocks should be visited.
This shaves another 1% off the -fsyntax-only time for compare.c (403.gcc).

llvm-svn: 100030
2010-03-31 18:45:04 +00:00
Chandler Carruth b32b344c8f Re-bind non-dependent CXXTemporaryObjectExpr nodes as temporaries when
instantiating a template, which ensures the destructor is called. This fixes
PR6671.

llvm-svn: 100029
2010-03-31 18:34:58 +00:00
Fariborz Jahanian c1fb862fda Patch implements gcc's -Wno-protocol option to suppress warning
on unimplemented methods in protocols adopted by a class.
(radar 7056600).

llvm-svn: 100028
2010-03-31 18:23:33 +00:00
Douglas Gregor d7d70e4788 Remove the AST statistics tracking I added yesterday; it didn't pan out.
llvm-svn: 100027
2010-03-31 18:21:31 +00:00
Ted Kremenek 8a47a38b3f Tweak DataFlowSolver's worklist data structure to have an ordered worklist
and a DenseSet for caching instead of using a single SmallPtrSet.
This makes the behavior of the DataFlowSolver more deterministic, and
reduces the -fsyntax-only time on compare.c (403.gcc) by 1%.

llvm-svn: 100026
2010-03-31 18:16:59 +00:00
Douglas Gregor a771f46c82 Reinstate my CodeModificationHint -> FixItHint renaming patch, without
the C-only "optimization".

llvm-svn: 100022
2010-03-31 17:46:05 +00:00
Douglas Gregor c1d2d8a014 Rename TypenameType to DependentNameType in anticipation of some
refactoring work in this area.

llvm-svn: 100019
2010-03-31 17:34:00 +00:00
Douglas Gregor 30e631862f Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder
llvm-svn: 100018
2010-03-31 17:25:35 +00:00
Douglas Gregor 3baad0d4f7 Rename CodeModificationHint to FixItHint, since we've been using the
term "fix-it" everywhere and even *I* get tired of long names
sometimes. No functionality change.

llvm-svn: 100008
2010-03-31 15:31:50 +00:00
Benjamin Kramer 9e2e1c9024 Minor include pruning.
llvm-svn: 100007
2010-03-31 15:04:05 +00:00
Jeffrey Yasskin cd028b14ea Define "exploded graph" by reference to a paper.
llvm-svn: 99990
2010-03-31 05:26:20 +00:00
Chris Lattner be49c03ff4 use the new optimized debug info metadata accessors. In
addition to the inherent win, this eliminates the pointless
cost of going through the name -> mdkind stringmap that we
were paying.

llvm-svn: 99983
2010-03-31 03:36:01 +00:00
John McCall cef1582923 Support __attribute__((unused)) on types. This suddenly started firing
a lot for me on selfhosts, I dunno why.

llvm-svn: 99981
2010-03-31 02:47:45 +00:00
John McCall eae5acbbd0 Fix PR6327: restore invariants when there's a parse error in an initializer.
llvm-svn: 99980
2010-03-31 02:13:20 +00:00
John McCall da4458e98f Regularize support for naming conversion functions in using decls.
llvm-svn: 99979
2010-03-31 01:36:47 +00:00
Daniel Dunbar 034299ef25 IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
- I did a cursory check that this was perf neutral, FWIW.

llvm-svn: 99978
2010-03-31 01:09:11 +00:00
Daniel Dunbar e75a64f2d3 CGRecordLayoutBuilder: Switch unions to use same mechanism for tracking field and bit-field info as structs.
- Anders, please check.

llvm-svn: 99977
2010-03-31 00:55:13 +00:00
Argyrios Kyrtzidis 0204197d53 Add a few asserts to be on the safe side.
llvm-svn: 99973
2010-03-31 00:38:09 +00:00
Argyrios Kyrtzidis 90ab3b7779 Don't skip past the '}' if an expression has error and is not followed by ';'.
llvm-svn: 99972
2010-03-31 00:37:59 +00:00
Douglas Gregor d7f18dd750 Drastically simplify the computation of linkage for typeinfo by using
the existing (and already well-tested) linkage computation for types,
with minor tweaks for dynamic classes and (pointers to) incomplete
types. Fixes PR6597.

llvm-svn: 99968
2010-03-31 00:15:35 +00:00
Daniel Dunbar 23ee4b7710 IRGen: Hide CGRecordLayoutBuilder class, because I can.
llvm-svn: 99967
2010-03-31 00:11:27 +00:00
John McCall 539f22474b Remove silly temporary comment.
llvm-svn: 99964
2010-03-30 23:58:36 +00:00
John McCall d9c7c6568e Introduce a new kind of derived-to-base cast which bypasses the need for
null checks, and make sure we elide null checks when accessing base class
members.

llvm-svn: 99963
2010-03-30 23:58:03 +00:00
Jakob Stoklund Olesen 4d2972d793 Slightly relax test case. An upcoming LLVM commit will change the xor instruction.
llvm-svn: 99962
2010-03-30 23:57:49 +00:00
Daniel Dunbar c4d551b6ff Fix test in -Asserts build.
llvm-svn: 99960
2010-03-30 23:50:00 +00:00
Fariborz Jahanian df58603c26 Recognize __attribute__((NSObject)) directly applied
on retain properties. (radar 7809468).

llvm-svn: 99951
2010-03-30 22:40:11 +00:00
Bob Wilson adb58e32cc Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Daniel Dunbar 76dc2e677c Formatting tweaks.
llvm-svn: 99947
2010-03-30 22:26:15 +00:00
Daniel Dunbar 6915cbe7a2 IRGen: Narrow getCGRecordLayout type.
llvm-svn: 99946
2010-03-30 22:26:12 +00:00
Daniel Dunbar 072d0bb247 IRgen: Move CGRecordLayout to its own happy little file.
llvm-svn: 99945
2010-03-30 22:26:10 +00:00
Daniel Dunbar f4ffa0dabf Minor formatting/FIXME cleanups.
llvm-svn: 99944
2010-03-30 22:26:07 +00:00
John McCall b493d53424 Fix an oversight with access control for address-of-function.
llvm-svn: 99942
2010-03-30 22:20:00 +00:00
Rafael Espindola 49b85ab6e6 Remember the regparm attribute in FunctionType::ExtInfo.
Fixes PR3782.

llvm-svn: 99940
2010-03-30 22:15:11 +00:00
Argyrios Kyrtzidis 998d51b98f When "delayed parsing" C++ default arguments, if there is an error, there may be tokens left in the token stream
that will interfere (they will be parsed as if they are after the class' '}') and a crash will occur because
the CachedTokens that holds them will be deleted while the lexer is still using them.

Make sure that the tokens of default args are removed from the token stream.
Fixes PR6647.

llvm-svn: 99939
2010-03-30 22:14:32 +00:00
Douglas Gregor 504662f28f Add a test for C++ [stmt.select]p3, which specifies that redeclaring a
name in the outermost block of a if/else that declares the same name
is ill-formed. Turns out that Clang and MSVC were right about PR6739;
GCC is too lax.

llvm-svn: 99937
2010-03-30 22:07:46 +00:00
John McCall 16df1e59f2 Propagate the "found declaration" (i.e. the using declaration instead of
the underlying/instantiated decl) through a lot of API, including "intermediate"
MemberExprs required for (e.g.) template instantiation.  This is necessary
because of the access semantics of member accesses to using declarations:
only the base class *containing the using decl* need be accessible from the
naming class.

This allows us to complete an access-controlled selfhost, if there are no
recent regressions.

llvm-svn: 99936
2010-03-30 21:47:33 +00:00
Rafael Espindola 5c61cbeb58 Fix this test on windows. When running on windows we print
double 0.000000e+000
instead of
double 0.000000e+00

llvm-svn: 99932
2010-03-30 21:19:02 +00:00
Mon P Wang 231e99743a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
Douglas Gregor 607f14168a Improve diagnostics when printing a template instantiation backtrace
involving substitution of deduced template arguments into a class
template partial specialization or function template, or when
substituting explicitly-specific template arguments into a function
template. We now print the actual deduced argument bindings so the
user can see what got deduced.

llvm-svn: 99923
2010-03-30 20:35:20 +00:00
Ted Kremenek 2d107f9d1d RegionStore: specially handle loads from integer global variables declared 'const'.
Fixes a false positive reported in PR 6288.

llvm-svn: 99922
2010-03-30 20:31:04 +00:00
Ted Kremenek f7c226da00 Use 'const Optional<SVal>&' to avoid an extra copy.
llvm-svn: 99921
2010-03-30 20:30:52 +00:00
Rafael Espindola c50c27cca8 the big refactoring bits of PR3782.
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.

llvm-svn: 99920
2010-03-30 20:24:48 +00:00
Douglas Gregor ad2c6988a2 Introduce new AST statistics that keep track of the number of isa (or
dyn_cast) invocations for C++ and Objective-C types, declarations,
expressions, and statements. The statistics will be printed when
-print-stats is provided to Clang -cc1, with results such as:

277073 clang - Number of checks for C++ declaration nodes
 13311 clang - Number of checks for C++ expression nodes
    18 clang - Number of checks for C++ statement nodes
174182 clang - Number of checks for C++ type nodes
 92300 clang - Number of checks for Objective-C declaration nodes
  9800 clang - Number of checks for Objective-C expression nodes
     7 clang - Number of checks for Objective-C statement nodes
 65733 clang - Number of checks for Objective-C type nodes

The statistics are only gathered when NDEBUG is not defined, since
they introduce potentially-expensive operations into very low-level
routines (isa).

llvm-svn: 99912
2010-03-30 18:56:13 +00:00
Ted Kremenek 4be6a75884 Change the analyzer to recognize (but ignore) assignments to isa. Fixes PR 6302.
llvm-svn: 99904
2010-03-30 18:24:54 +00:00
Fariborz Jahanian 5cab26d058 Add Support for 'warn_unused_result" attribute on
objective-c methods. (radar 7418262).

llvm-svn: 99903
2010-03-30 18:22:15 +00:00
Rafael Espindola ff6a1fc1f3 Don't produce a vtable if we are just instantiating a method and the
class has no key function.

Fix PR6738.

llvm-svn: 99900
2010-03-30 18:07:27 +00:00
Daniel Dunbar 642c02d257 Fix FileEntry declaration.
llvm-svn: 99896
2010-03-30 17:57:47 +00:00
Douglas Gregor 171b780c91 Teach Clang's -cc1 option -print-stats to print LLVM statistics.
llvm-svn: 99894
2010-03-30 17:33:59 +00:00
Anders Carlsson 83ac312965 Fix a bug where we would incorrectly report an error about initializing two fields in an anonymous struct.
llvm-svn: 99891
2010-03-30 16:19:37 +00:00
Anders Carlsson a942dcd92b Reduce nesting.
llvm-svn: 99889
2010-03-30 15:39:27 +00:00
Benjamin Kramer 9e649c3cfe Replace some constant-sized SmallVectors.
llvm-svn: 99884
2010-03-30 11:36:44 +00:00
Chris Lattner 09f8cc8c70 make -ftime-report work even in -disable-free mode. Woo, finally.
rdar://7781603

llvm-svn: 99878
2010-03-30 05:39:52 +00:00
Anders Carlsson f141dd1b95 Remove the old vtable layout code.
llvm-svn: 99869
2010-03-30 03:43:47 +00:00
Anders Carlsson a086edc0e6 Remove UseNewVTableCode checks.
llvm-svn: 99868
2010-03-30 03:35:35 +00:00
Anders Carlsson 9d08fc1cd2 Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.
llvm-svn: 99867
2010-03-30 03:30:08 +00:00
Anders Carlsson 093bdff0c5 Factor emitting a call to a copy constructor out into a separate function.
llvm-svn: 99866
2010-03-30 03:27:09 +00:00
Anders Carlsson b9fd57f198 Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the temporaries code.
llvm-svn: 99865
2010-03-30 03:14:41 +00:00
Anders Carlsson 10834b8d56 Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.
llvm-svn: 99864
2010-03-30 02:57:48 +00:00
Anders Carlsson c3a4b12c82 Change a test to FileCheck bitcode instead of assembler.
llvm-svn: 99863
2010-03-30 02:53:30 +00:00
Anders Carlsson 85e64359df Flip the switch and use the new vtable layout code for everything. I've verified that this passes a self-host but I'll let the bots self host as well before removing the now dead code.
llvm-svn: 99861
2010-03-30 02:21:54 +00:00
Anders Carlsson 9fcfc3a32e Update xcode project
llvm-svn: 99860
2010-03-30 02:08:20 +00:00
Ted Kremenek dbb8cd1d34 Cache results computed by CGDebugInfo::getOrCreateFile() in a DenseMap.
This reduces '-c -g' time on one file in 403.gcc by 12%.

llvm-svn: 99857
2010-03-30 00:27:51 +00:00
Douglas Gregor a55530e591 When copying a partial diagnostic into a DependentDiagnostic, allocate
storage for that partial diagnostic via the ASTContext's
BumpPtrAllocator rather than using up slots in the ASTContext's
cache. Now that we do this, we don't have to worry about destroying
dependent diagnostics when destroying a DependentStoredDeclsMap.

llvm-svn: 99854
2010-03-29 23:56:53 +00:00
Douglas Gregor 8933623b91 Optimize PartialDiagnostic's memory-allocation behavior by placing a
cache of PartialDiagnostic::Storage objects into an allocator within
the ASTContext. This eliminates a significant amount of malloc
traffic, for a 10% performance improvement in -fsyntax-only wall-clock
time with 403.gcc's combine.c.

Also, eliminate the RequireNonAbstractType hack I put in earlier,
which was but a symptom of this larger problem.

Fixes <rdar://problem/7806091>.

llvm-svn: 99849
2010-03-29 23:34:08 +00:00
Gabor Greif bf82f94d35 provide a simpler way to get to the headers
llvm-svn: 99843
2010-03-29 21:36:06 +00:00
Douglas Gregor 7ec3d11d16 Exit early from the simple form of Sema::RequireNonAbstractType(), for
a 2.47% speedup in 403.gcc.

llvm-svn: 99830
2010-03-29 20:28:52 +00:00
Anders Carlsson e47380fb19 When collecting virtual bases it's very important to use the canonical type of the base class. Otherwise, we might add the same virtual base class twice if the virtual base is an instantiated template. Fixes PR6251.
llvm-svn: 99829
2010-03-29 19:49:09 +00:00
Ted Kremenek ac031880af Remove FIXME comment.
llvm-svn: 99828
2010-03-29 19:10:41 +00:00
Ted Kremenek 23c29f0cbe Change 'TypeCache' from being an std::map to a llvm::DenseMap. This reduces codegen time
on one .i file from 403.gcc by 0.5%.

llvm-svn: 99823
2010-03-29 18:29:57 +00:00
Chris Lattner bf2803fb20 add support for -MQ flag to quote targets in dependency file,
PR6661, patch by Ori Avtalion!

llvm-svn: 99821
2010-03-29 17:55:58 +00:00
Chris Lattner 5902e7bb22 emit signed integer subtractions as 'sub nsw', patch by
Anton Yartsev!

llvm-svn: 99817
2010-03-29 17:28:16 +00:00
Anders Carlsson eba1a60ef0 Another vtable layout fix, making us match gcc better.
llvm-svn: 99812
2010-03-29 15:08:41 +00:00
Douglas Gregor c48a10d652 Support __attribute__((packed)) (along with other attributes) at the
end of a struct/class/union in C++, from Justin Bogner!

llvm-svn: 99811
2010-03-29 14:42:08 +00:00
Anders Carlsson cb6207f723 Handle pure virtual member functions.
llvm-svn: 99807
2010-03-29 05:40:50 +00:00
Anders Carlsson abb20e6249 Fix a nasty bug in the virtual base computation which would lead to us initializing virtual bases in the wrong order.
llvm-svn: 99806
2010-03-29 05:13:12 +00:00
Rafael Espindola 8756268ee5 Be a bit more consistent in using operator->
This patch moves some methods from QualType to Type and changes the users to
use -> instead of .

llvm-svn: 99805
2010-03-29 03:39:46 +00:00
Anders Carlsson a627ac7ee6 More vtable work - it's not possible to use the new vtable code for everything by setting a flag inside CGVtable.cpp. My plan is to run some tests and bootstrap and once that's done flip the bit.
llvm-svn: 99804
2010-03-29 03:38:52 +00:00
Anders Carlsson 5a9754187d More magic.
llvm-svn: 99803
2010-03-29 03:26:49 +00:00
Anders Carlsson 473444e05c Sprinkle some sed dust over check-ztt to make it work with newer clang asm output. (I am not a sed expert so this might be terribly inefficient :)
llvm-svn: 99802
2010-03-29 03:21:40 +00:00
Anders Carlsson 800ded68b5 Only add thunks for the most derived class. This fixes some link errors I was seeing in files generated by the vtable tester utility.
llvm-svn: 99801
2010-03-29 02:53:58 +00:00
Anders Carlsson 383f4cc8b9 Flip the switch to always get vtables from the VTT when necessary, I've verified that clang bootstraps with this.
llvm-svn: 99800
2010-03-29 02:38:51 +00:00
Anders Carlsson 2d016af623 Use the newly added function in the VTT builder.
llvm-svn: 99799
2010-03-29 02:14:35 +00:00
Anders Carlsson f6f24c609b Cleanup, no functionality change.
llvm-svn: 99798
2010-03-29 02:08:26 +00:00
Anders Carlsson 9a97e2ef95 Add the thunks needed by this vtable.
llvm-svn: 99793
2010-03-29 01:38:05 +00:00
Anders Carlsson 848d86e5c4 Make sure to sort the vtable thunks by their vtable index :) With this we now pass the test from http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor successfully.
llvm-svn: 99792
2010-03-29 01:28:05 +00:00
Anders Carlsson 948d3f4ec6 Fix another thinko, so that flags don't depend on previous bases.
llvm-svn: 99791
2010-03-29 01:16:41 +00:00
Anders Carlsson 74d7dfcf8e When generating base ctors/dtors, we need to lookup virtual bases using the vtable.
llvm-svn: 99790
2010-03-29 01:14:25 +00:00
Anders Carlsson 27d86bddfe Fix thinko.
llvm-svn: 99788
2010-03-29 01:12:13 +00:00
Anders Carlsson 5889027ccc Use construction vtables when needed. This is currently guarded by -fdump-vtable-layouts since it doesn't work 100% yet :)
llvm-svn: 99787
2010-03-29 01:08:49 +00:00
Anders Carlsson 8baeaf0a26 Two bug fixes, we weren't updating the thunk index when creating the vtable initializer and we weren't storing the secondary virtual pointer indices.
llvm-svn: 99786
2010-03-29 01:04:16 +00:00
Rafael Espindola 3e69c3ed31 Make default arguments to getFunctionNoProtoType an all or nothing option (as they already are in practise).
llvm-svn: 99785
2010-03-28 22:48:23 +00:00
Rafael Espindola 2ac0582419 Drop default arguments no one is using.
llvm-svn: 99783
2010-03-28 22:19:17 +00:00
Anders Carlsson d589593c93 Reapply r99775 with a fix for a silly bug - we were setting the vtable pointer for all bases, even those without a vtable pointer :)
llvm-svn: 99777
2010-03-28 21:07:49 +00:00
Anders Carlsson fcc9f91287 Looks like I broke self-host again :(.
llvm-svn: 99776
2010-03-28 20:55:21 +00:00
Anders Carlsson 74eab715ae More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.
llvm-svn: 99775
2010-03-28 20:34:31 +00:00
Anders Carlsson e87fae9afa Factor vtable pointer setting code out into a separate function.
llvm-svn: 99773
2010-03-28 19:40:00 +00:00
Douglas Gregor d5cb1ddb2c After performing template argument deduction for a function template,
check deduced non-type template arguments and template template
arguments against the template parameters for which they were deduced,
performing conversions as appropriate so that deduced template
arguments get the same treatment as explicitly-specified template
arguments. This is the bulk of PR6723.

Also keep track of whether deduction of a non-type template argument
came from an array bound (vs. anywhere else). With this information,
we enforce C++ [temp.deduct.type]p17, which requires exact type
matches when deduction deduces a non-type template argument from
something that is not an array bound.

Finally, when in a SFINAE context, translate the "zero sized
arrays are an extension" extension diagnostic into a hard error (for
better standard conformance), which was a minor part of PR6723.

llvm-svn: 99734
2010-03-28 02:42:43 +00:00
Benjamin Kramer c048322523 Checker: random include cleanup.
llvm-svn: 99731
2010-03-27 21:19:47 +00:00
Fariborz Jahanian 2e8074bfc3 Further improvement to point to category
whose protocolls methods needs implementation.

llvm-svn: 99730
2010-03-27 21:10:05 +00:00
Anders Carlsson 174376629a Give thunks the same linkage as their original methods.
llvm-svn: 99729
2010-03-27 20:50:27 +00:00
Fariborz Jahanian 97752f7c95 Improve diagnostics on incomplete implementation
of objc classes; including which methods
need be implemented and where they come from.
WIP.

llvm-svn: 99724
2010-03-27 19:02:17 +00:00
Ted Kremenek 344242f1e4 Remove VS information for analyzer until we have more real support.
llvm-svn: 99720
2010-03-27 16:56:20 +00:00
Kovarththanan Rajaratnam bfc61ea0a7 s/Clangify2010.py/clangify2010.py
llvm-svn: 99712
2010-03-27 08:21:15 +00:00
John McCall 3dc81f77f6 Accumulate all functions and classes that the effective context is
nested within, and suddenly local classes start working.  Wouldn't be
necessary if I hadn't used local classes in Clang in the first place.
Or, well, wouldn't be necessary yet. :)

llvm-svn: 99709
2010-03-27 06:55:49 +00:00
John McCall 2f88d7d72c Implement method friends in class templates and fix a few related problems.
llvm-svn: 99708
2010-03-27 05:57:59 +00:00
Rafael Espindola 6e281ffdc0 Test for the previous commit.
llvm-svn: 99702
2010-03-27 02:52:40 +00:00
Rafael Espindola adcc1d18e2 When given the magic class __cxxabiv1::__fundamental_type_info, produce
the typeinfo for the fundamental types.

Fixes PR6685.

llvm-svn: 99701
2010-03-27 02:52:14 +00:00
Ted Kremenek c59230a7d7 Add initial draft of web page on 'clangifty2010.py' script for analyzing VS projects.
llvm-svn: 99691
2010-03-27 01:06:58 +00:00
John McCall 39ec71f2e9 When mapping restrict to noalias, look for 'restrict' on the parameter variable
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers).  Fixes PR6695.

llvm-svn: 99688
2010-03-27 00:47:27 +00:00
Ted Kremenek d76197a271 scan-build: set environment variable LDPLUSPLUS to 'c++-analyzer' to correctly link projects
with c++ code.

llvm-svn: 99684
2010-03-27 00:20:01 +00:00
Ted Kremenek 0785d92cae Fix comparison in isDiagnosticInFlight().
llvm-svn: 99667
2010-03-26 23:36:48 +00:00
Douglas Gregor 78d315f646 Remove unused static function
llvm-svn: 99666
2010-03-26 23:25:35 +00:00
John McCall 30837102a2 Put function templates instantiated from friend declarations in the correct
lexical context.  This is required for ADL to work properly;  fixes PR6716.

llvm-svn: 99665
2010-03-26 23:10:15 +00:00
Douglas Gregor 4667effa8b Compare namespaces properly when looking for redeclarations of
namespace aliases. Fixes PR6341.

llvm-svn: 99664
2010-03-26 22:59:39 +00:00
Ted Kremenek 0f250e4c5b Fix NoReturnFunctionChecker to properly look at a function's type
when determining if it returns.  Fixes <rdar://problem/7796563>.

llvm-svn: 99663
2010-03-26 22:57:13 +00:00
Ted Kremenek ee0934e05d Add comment indicating that we intentionally don't add the noreturn
attribute to a FunctionDecl.

llvm-svn: 99662
2010-03-26 22:57:10 +00:00
Douglas Gregor c14922f14a When adding initializers to a constructor, be sure that we are looking
through the bases and fields of the definition of the class in which
the constructor is declared, rather than some other declaration of
that class.

llvm-svn: 99661
2010-03-26 22:43:07 +00:00
Daniel Dunbar 9abbebedc8 Driver/Darwin: Support CCC_ENABLE_NEW_DARWIN_TOOLCHAIN as an environment
override to enable use of the DarwinClang tool chain on all platforms (not just
ARM).

llvm-svn: 99660
2010-03-26 22:41:03 +00:00
John McCall 93cc732ffc Properly account for redeclarations when explicitly instantiating class templates.
What happens here is that we actually turn the first declaration into a
definition, regardless of whether it was actually originally a definition,
and furthermore we do this all after we've instantiated all the declarations.
This exposes a bug in my DefinitionData patch where it was only setting the
DefinitionData for previous declarations, not future declarations.
Fortunately, there's an iterator for that.

llvm-svn: 99657
2010-03-26 21:56:38 +00:00
Douglas Gregor f9edf80c39 When trying to determine whether one operand of a conditional
expression can be converted to the type of another, only apply the
lvalue-to-rvalue conversion to the type of the expression we're
converting, *not* the array-to-pointer or function-to-pointer
conversions. Fixes PR6595.

llvm-svn: 99652
2010-03-26 20:59:55 +00:00
Douglas Gregor 34147278ea Eliminate the non-InitializedEntity PerformCopyInitialization() and
re-route its only caller to the newer
PerformCopyInitialization(). We're down to one remaining caller of
Sema::CheckReferenceInit.

llvm-svn: 99650
2010-03-26 20:35:59 +00:00
Daniel Dunbar e17606d513 Make sure we don't include mm_malloc.h in this test, it includes errno.h which
we aren't always able to find on Win32.

llvm-svn: 99649
2010-03-26 20:17:23 +00:00
Daniel Dunbar 6a6199de67 Fix 80 col violations.
llvm-svn: 99648
2010-03-26 20:17:17 +00:00
Douglas Gregor 838fcc318a Switch semantic analysis of the conditional operator from using
CheckReferenceInit to using the new initialization sequence code.

llvm-svn: 99647
2010-03-26 20:14:36 +00:00
Daniel Dunbar b9e176b0ec Runtime: Install the new libcc_kext.a produced by the clang_darwin compiler-rt
configuration.

llvm-svn: 99641
2010-03-26 19:37:38 +00:00
Daniel Dunbar 16204101df Spell -triple correctly for %clang, not %clang_cc1.
llvm-svn: 99634
2010-03-26 19:02:07 +00:00
Chris Lattner 445a2c7b5c i386-apple-darwin10 implies sse2, this option shouldn't be needed.
llvm-svn: 99627
2010-03-26 17:51:13 +00:00
Chris Lattner 8c5d05a299 fix a case where macro expansion should be disabled, patch by
Abramo Bagnara!

llvm-svn: 99626
2010-03-26 17:49:16 +00:00
Chris Lattner cebeab9f8c merge all the macro disable tests by using filecheck.
llvm-svn: 99625
2010-03-26 17:46:33 +00:00
Chris Lattner 80dbccd1bf fix a bug in paste avoidance which would cause us to accidentally
form a >>=.  Patch by Abramo Bagnara, testcase by me.

llvm-svn: 99624
2010-03-26 17:10:02 +00:00
Chris Lattner 6efe46cced xmmintrin just requires sse2, not sse3.
llvm-svn: 99623
2010-03-26 17:05:16 +00:00
Kovarththanan Rajaratnam bbdaa62fe5 No need to specify ${CMAKE_CURRENT_BINARY_DIR}
llvm-svn: 99622
2010-03-26 16:46:16 +00:00
Gabor Greif 7da63a36f1 add a slight variation of test3, where
argument list seems to be different, but in fact
is semantically equivalent; check that we do not error here

llvm-svn: 99617
2010-03-26 08:26:30 +00:00
Nick Lewycky 3cfe6af8b5 Implement new mangling for vectors.
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Douglas Gregor f956b35f98 Do not mark the destructor of a function parameter's type. Fixes PR6709.
llvm-svn: 99615
2010-03-26 06:57:13 +00:00
Anders Carlsson aaf8acfea1 Revert r99612 and see if it fixes self-host.
llvm-svn: 99614
2010-03-26 06:35:42 +00:00
Douglas Gregor d829eab92b Add tests for PR6707.
llvm-svn: 99613
2010-03-26 05:57:46 +00:00
Anders Carlsson 6fffc64dd2 Don't initialize virtual pointers for primary bases, they've already been initialized.
llvm-svn: 99612
2010-03-26 05:53:12 +00:00
Douglas Gregor 0a29a05f02 When deducing an integral template argument for a non-type template
parameter, keep the integral value exactly as it was in the source
code rather than trying to convert it to the type of the non-type
template parameter (which may still be dependent!). The value will
then be converted to the appropriate type once we check the resulting
template arguments. Fixes PR6707.

llvm-svn: 99611
2010-03-26 05:50:28 +00:00
John McCall e0b2ddb492 Reapply r99596 with a fix: link an instantiated friend function to its
pattern if it has a body.

llvm-svn: 99610
2010-03-26 04:53:08 +00:00