Commit Graph

15335 Commits

Author SHA1 Message Date
John McCall 12d53da8cb Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor.

llvm-svn: 110891
2010-08-12 00:57:17 +00:00
Daniel Dunbar 628fcf4e3b Driver: Use the compile time linker version as the default for -mlinker-version,
if detected.
 - This is a hack, we really want the linker version at execution time, but we
   don't have any infrastructure for getting that. Yet.

llvm-svn: 110886
2010-08-12 00:05:12 +00:00
Devang Patel caa23f0708 Emit debug info for static const class member.
llvm-svn: 110885
2010-08-12 00:02:44 +00:00
John McCall 2ded5d25a9 Don't try to implicitly declare special members of an invalid class.
Fixes a crash in a rather large and difficult-to-reduce test case.

llvm-svn: 110882
2010-08-11 23:52:36 +00:00
Tom Care ec389da6f2 Fix a bug where child statements could not be identified as being in a CFGBlock in CFGStmtMap::getBlock.
llvm-svn: 110881
2010-08-11 23:36:58 +00:00
Argyrios Kyrtzidis 90bdfbbdf7 Switch on PCH for C++. C++ fans all over the world rejoice.
llvm-svn: 110879
2010-08-11 23:27:58 +00:00
Daniel Dunbar cacb0e2d45 Driver/Darwin: Pass -demangle when linking, if the linker supports it.
llvm-svn: 110873
2010-08-11 23:07:50 +00:00
Daniel Dunbar 976a2f54fa Driver: Add -mlinker-version=, which forwards to -target-linker-version.
llvm-svn: 110872
2010-08-11 23:07:47 +00:00
Daniel Dunbar a1d107cb46 Frontend: Add -target-linker-version, for specifying the version string of the
linker in use.

llvm-svn: 110871
2010-08-11 23:07:42 +00:00
Eli Friedman 854f110834 Fix oversight with symbolic names in TargetInfo::validateInputConstraint.
llvm-svn: 110870
2010-08-11 23:03:37 +00:00
Argyrios Kyrtzidis 3084a61e98 -Make TokenID of IdentifierInfo read-only, remove setTokenID().
-There are 2 instances that change the TokenID for GNU libstdc++ 4.2 compatibility.
  To handler those cases introduce a RevertedTokenID bitfield, RevertTokenIDToIdentifier() and hasRevertedTokenIDToIdentifier() methods.
  Store the bitfield in PCH.

llvm-svn: 110868
2010-08-11 22:55:12 +00:00
John McCall 5996699834 Revise r110163: don't mark weak functions nounwind, because the optimizer
treats that as a contract to be fulfilled by any replacements.

llvm-svn: 110864
2010-08-11 22:38:33 +00:00
Abramo Bagnara d6d2f18905 Added locations and type source info for DeclarationName.
llvm-svn: 110860
2010-08-11 22:01:17 +00:00
Douglas Gregor 00c37ef021 Once code completion has completed, pass a "completion context" on to
the code-completion consumer. The consumer can use this information to
augument, filter, or display the code-completion results.

llvm-svn: 110858
2010-08-11 21:23:17 +00:00
Devang Patel d76c1dbe39 Emit a stop point for delegate constructor call. This gives user a chance to step into constructor body.
llvm-svn: 110853
2010-08-11 21:04:37 +00:00
John McCall ffe4630f3d When re-raising an exception after a cleanup, we need to call _Unwind_Resume_or_Rethrow
instead of _Unwind_Resume.  With SJLJ exceptions, this is spelled
"_Unwind_SjLj_Resume_or_Rethrow", not "_Unwind_SjLj_Resume", which has
significantly different semantics.

We should actually never be generating a call to _Unwind_SjLj_Resume directly;
even if we were generating true cleanups (which we aren't because of the
horrible hack), we should be calling __cxa_end_cleanup() on ARM.  I
haven't implemented this because there's little point as long as the HH is
present.

I believe this fixes <rdar://problem/8281377>.

llvm-svn: 110851
2010-08-11 20:59:53 +00:00
Eli Friedman 961fc05418 Work in progress for PR7864. Someone more familiar with ObjC++ needs to fill
in the code after the "FIXME: Needs to be written".

llvm-svn: 110849
2010-08-11 20:41:51 +00:00
Sebastian Redl eaa4ade80e Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the breakage.
llvm-svn: 110840
2010-08-11 18:52:41 +00:00
Bruno Cardoso Lopes 8c333153e0 Fix define inserting a comma :)
llvm-svn: 110839
2010-08-11 18:45:43 +00:00
Fariborz Jahanian d539d098a4 IRGen support for functions returning objc object
types. Fixes PR7865.

llvm-svn: 110832
2010-08-11 17:37:35 +00:00
Benjamin Kramer e8394df11b Random temporary string cleanup.
llvm-svn: 110807
2010-08-11 14:47:12 +00:00
Douglas Gregor 13e6587313 If name lookup finds different type declarations in different scopes
that actually refer to the same underlying type, it is not an
ambiguity; add uniquing support based on the canonical type of type
declarations. Fixes <rdar://problem/8296180>.

llvm-svn: 110806
2010-08-11 14:45:53 +00:00
Douglas Gregor 20975b25c3 Fix a thinko in the creation of temporary files for the precompiled preamble
llvm-svn: 110804
2010-08-11 13:06:56 +00:00
Douglas Gregor 1c28331b57 Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C
breakage.

llvm-svn: 110803
2010-08-11 12:19:30 +00:00
Zhongxing Xu 8de0a3d8c3 MemRegion can refer to ASTContext without external help.
llvm-svn: 110784
2010-08-11 06:10:55 +00:00
Daniel Dunbar 9034aa36c7 ARM: Recognize single precision float register names.
- We don't recognize double or NEON register names yet -- we don't have the
   infrastructure to generate the right clobbers for them.

llvm-svn: 110775
2010-08-11 02:17:20 +00:00
Daniel Dunbar 256e1f3ad0 ARM: Swap which registers we consider real / aliases to match LLVM and llvm-gcc.
llvm-svn: 110774
2010-08-11 02:17:11 +00:00
Douglas Gregor 836a7e8468 Improve our handling of user-defined conversions when computing
implicit conversion sequences. In particular, model the "standard
conversion" from a class to its own type (or a base type) directly as
a standard conversion in the normal path *without* trying to determine
if there is a valid copy constructor. This appears to match the intent
of C++ [over.best.ics]p6 and more closely matches GCC and EDG.

As part of this, model non-lvalue reference initialization via
user-defined conversion in overloading the same way we handle it in
InitializationSequence, separating the "general user-defined
conversion" and "conversion to compatible class type" cases.

The churn in the overload-call-copycon.cpp test case is because the
test case was originally wrong; it assumed that we should do more
checking for copy constructors that we actually should, which affected
overload resolution.

Fixes PR7055. Bootstrapped okay.

llvm-svn: 110773
2010-08-11 02:15:33 +00:00
Bruno Cardoso Lopes 65954ffc69 Remove 256-bit cast built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
llvm-svn: 110771
2010-08-11 02:14:38 +00:00
Bruno Cardoso Lopes a4f1930b75 Remove 256-bit unpack built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
llvm-svn: 110768
2010-08-11 01:43:24 +00:00
Bruno Cardoso Lopes e712a135b7 Remove 256-bit shuffle built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
llvm-svn: 110766
2010-08-11 01:17:34 +00:00
John Thompson 46667afccd Fix for pr7869, inline asm mult-alt constraints.
llvm-svn: 110764
2010-08-11 00:58:20 +00:00
John McCall cebe0ca75e Fix a bug in @finally emission in both the fragile and non-fragile EH schemes
where we weren't accounting for the possibility that a @finally block might
have internal cleanups and therefore might write to the cleanup destination slot.

Fixes <rdar://problem/8293901>.

llvm-svn: 110760
2010-08-11 00:16:14 +00:00
Ted Kremenek 2b4adffa16 Have GRCoreEngine record the blocks where analysis was aborted because we visited a block too many times along a given path. This is to support the unreachable code analysis.
llvm-svn: 110755
2010-08-11 00:03:02 +00:00
Devang Patel 8166571a25 Simplify
llvm-svn: 110716
2010-08-10 20:16:57 +00:00
John Thompson a5c7d706b8 Slightly revised handling of mult-alt constraints, to avoid an assert, until we have the full fix.
llvm-svn: 110706
2010-08-10 19:20:14 +00:00
John McCall 62eb9a8e84 When initializing a static local, pop the guard-abort EH cleanup after
the variable is fully initialized.

llvm-svn: 110704
2010-08-10 18:51:44 +00:00
Devang Patel 76e3b53541 Do not use DIGlobalVariable to emit debugging information for enums.
llvm-svn: 110697
2010-08-10 18:27:15 +00:00
Fariborz Jahanian 32e59ba01d Fix a spurious warning when message sent to qualified-id
type receiver (pr7861).

llvm-svn: 110696
2010-08-10 18:10:50 +00:00
Ted Kremenek 0476899b20 Turn on idempotent operations checker when using --analyze.
llvm-svn: 110695
2010-08-10 18:03:13 +00:00
Devang Patel dc866e119c Simplify code and add comments, in code that generate debug info for constant integer globals, based on Chris's feedback.
llvm-svn: 110694
2010-08-10 17:53:33 +00:00
Daniel Dunbar ce25f33e2a Driver/FreeBSD: Infer the right arch name in the presence of -m32,-m64, for the
cases we care about.
 - This is eventually going to be unified outside the host specific code.

llvm-svn: 110693
2010-08-10 17:39:05 +00:00
Douglas Gregor 7058c265f5 Eliminate unnecessary uses of TemporaryBase in TreeTransform;
transforming TypeSourceInfos already gives us proper (and better)
source-location information.

llvm-svn: 110678
2010-08-10 14:27:00 +00:00
Abramo Bagnara f9985b4560 Fixed redundant NNS loading.
llvm-svn: 110677
2010-08-10 13:46:45 +00:00
Abramo Bagnara 27db23948c Added TypeLocs to VAArgExpr node.
llvm-svn: 110666
2010-08-10 10:06:15 +00:00
Abramo Bagnara 092990ac68 Added TypeLocs to TypesCompatibleExpr node.
llvm-svn: 110663
2010-08-10 08:50:03 +00:00
Devang Patel e03edfd3e7 Even if a constant's evaluated value is used, emit debug info for the constant variable.
llvm-svn: 110660
2010-08-10 07:24:25 +00:00
Eli Friedman 88f4ed9011 Fix redefinition of typedefs of fixable variably-modified array types; should
fix an issue compiling <windows.h>.

llvm-svn: 110651
2010-08-10 03:13:15 +00:00
Bruno Cardoso Lopes 3d3fc1d075 Make replicate intrinsics use shufflevector instead of dup builtins, also remove the dup builtins
llvm-svn: 110646
2010-08-10 02:23:54 +00:00
Rafael Espindola 92b0093112 Run the assembler instead of gcc on Linux.
llvm-svn: 110635
2010-08-10 00:25:48 +00:00
Fariborz Jahanian 3337b2e8dd Implements gcc's -Wstrict-selector-match.
(radar 8127244).

llvm-svn: 110622
2010-08-09 23:27:58 +00:00
Douglas Gregor 86b8d9ff87 When attempting to recover from a failed unqualified name lookup, make
sure to clear out the LookupResult structure after looking into each class.

llvm-svn: 110615
2010-08-09 22:38:14 +00:00
Douglas Gregor 4a47bca47d Instead of having a specific CXTranslationUnit_* option flag for
"editing" mode, introduce a separate function
clang_defaultEditingTranslationUnitOptions() that retrieves the set of
options. No functionality change.

llvm-svn: 110613
2010-08-09 22:28:58 +00:00
Sebastian Redl ab6a088314 - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for forward declarations and the definition.
- Eagerly create ObjCInterfaceTypes for declarations.
- The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another.
- Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated.

llvm-svn: 110610
2010-08-09 21:55:28 +00:00
John Thompson cdb847ba16 Added vecreturn attribute parsing.
llvm-svn: 110609
2010-08-09 21:53:52 +00:00
Argyrios Kyrtzidis c0dc36b213 Change warning about incomplete parsing of C++ default arg to error and provide a test case; thanks Doug!
llvm-svn: 110603
2010-08-09 21:08:13 +00:00
Douglas Gregor 028d3e4d0f Use precompiled preambles for in-process code completion.
llvm-svn: 110596
2010-08-09 20:45:32 +00:00
Jordy Rose c6c0fc9164 Allow EvalBinOpNN to handle expressions of the form $a+$b if $b can be reduced to a constant.
llvm-svn: 110592
2010-08-09 20:31:57 +00:00
Fariborz Jahanian ec43022b99 Warn if class object does not implement qualified
id's protocols. Fixes radar 8154220.

llvm-svn: 110583
2010-08-09 18:21:43 +00:00
Argyrios Kyrtzidis a8607779a4 Complete PCH support for ObjCPropertyImplDecl.
llvm-svn: 110570
2010-08-09 10:54:37 +00:00
Argyrios Kyrtzidis c049f7547b Revert the dump functions to send output to llvm::errs(), matching the LLVM convention; suggestion by Daniel.
'-ast-print' / '-ast-dump' command line options still send output to llvm::outs().

llvm-svn: 110569
2010-08-09 10:54:31 +00:00
Argyrios Kyrtzidis 773894ccec Replace a parser assertion with a warning, suggestion by Doug.
llvm-svn: 110568
2010-08-09 10:54:26 +00:00
Argyrios Kyrtzidis 13257c5527 Support ObjC implementation decls for PCH.
Strictly speaking, implementations don't go in headers but there's no law against it.

llvm-svn: 110567
2010-08-09 10:54:20 +00:00
Argyrios Kyrtzidis 5b6a03f490 Refactor into functions PCH reading/writing the CXXBaseOrMemberInitializers. No functionality change.
llvm-svn: 110566
2010-08-09 10:54:12 +00:00
Chandler Carruth 42cf818be1 Fix a few more typos. Amusingly, GCC made the same mistake around version 3.2.
llvm-svn: 110546
2010-08-08 08:44:32 +00:00
Chandler Carruth 7579c008ec Fix some typos I made when adding alternate intrinsic names.
llvm-svn: 110545
2010-08-08 08:30:05 +00:00
Douglas Gregor 618e64a23b Revert r110440, the fix for PR4897. Chris claims to have a better way.
llvm-svn: 110544
2010-08-08 07:49:23 +00:00
Chandler Carruth 9b41823177 Fix a crash on template delete operators.
llvm-svn: 110542
2010-08-08 07:04:00 +00:00
Chandler Carruth 9c524c1d53 Silence GCC warning about && and || without explicit grouping.
llvm-svn: 110537
2010-08-08 05:02:51 +00:00
Eric Christopher 6ff7161d51 Thread local variables aren't considered common linkage.
llvm-svn: 110530
2010-08-08 01:37:14 +00:00
Eli Friedman aab1fda91f PR7800: both virtual and non-virtual bases must be marked as used for VTTs.
llvm-svn: 110526
2010-08-07 23:11:44 +00:00
Eric Christopher f387dbde81 Make -funroll-loops turn on loop unrolling in the optimizer instead
of just ignoring it.

llvm-svn: 110525
2010-08-07 23:08:14 +00:00
Benjamin Kramer d05f31d059 Push location through the MacroUndefined PPCallback and use it to print #undefs in -dD mode. (PR7818)
llvm-svn: 110523
2010-08-07 22:27:00 +00:00
Douglas Gregor f58ff32c16 Integral-to-pointer conversions are not always null -> member pointer
conversions. Fixes PR7443.

llvm-svn: 110519
2010-08-07 13:36:37 +00:00
Douglas Gregor 114e55df5b Fix an Objective-C crasher, PR7839.
llvm-svn: 110515
2010-08-07 12:29:18 +00:00
Douglas Gregor 8b2d2fe234 Allow reference binding of a reference of Objective-C object type to
an lvalue of another, compatible Objective-C object type (e.g., a
subclass). Introduce a new initialization sequence step kind to
describe this binding, along with a new cast kind. Fixes PR7741.

llvm-svn: 110513
2010-08-07 11:51:51 +00:00
John McCall 7cd1d97e33 Inline a special case of EmitAggregateCopy into EmitNullInitialization
to avoid the awesome-but-wrong-in-this-case assertion in the canon EAC.
Fixes PR7834.

Also fix a subtle address-space bug in the memset path.

llvm-svn: 110511
2010-08-07 08:21:30 +00:00
John McCall 853700437b Note that a CXXConstructExpr is zeroing when dumping it.
llvm-svn: 110510
2010-08-07 06:38:55 +00:00
John McCall cf14216509 Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths.  Avoids a separate allocation and
another word of overhead in cases needing inheritance paths.  Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.

llvm-svn: 110507
2010-08-07 06:22:56 +00:00
Chris Lattner 8139c98cf9 Correct -ftrapv to trap on errors, instead of calling the
__overflow_handler entrypoint that David Chisnall made up.
Calling __overflow_handler is not part of the contract of
-ftrapv provided by GCC, and should never have been checked
in in the first place.

According to:
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/8699

David is using this for some of arbitrary precision integer stuff
or something, which is not an appropriate thing to implement on
this.

llvm-svn: 110490
2010-08-07 00:20:46 +00:00
Eli Friedman 964dbda0e9 PR7837: For qualified id's, make sure the decl context is complete if not
dependent in ActOnIdExpression.  (This issue only shows up with member
operators because an operator is never a type.)

llvm-svn: 110486
2010-08-06 23:41:47 +00:00
Tom Care 925501c548 Removed IdempotentOperationChecker from default analysis and returned back to a flag (-analyzer-check-idempotent-operations)
- Added IdempotentOperationChecker to experimental analyses for testing purposes
- Updated test cases to explictly call the checker

llvm-svn: 110482
2010-08-06 22:23:07 +00:00
Ted Kremenek 0bbf24d579 Fix 80 col. violations.
llvm-svn: 110473
2010-08-06 21:12:55 +00:00
Ted Kremenek 63dc1f4694 Nest variable declaration into into 'if' condition, thus restricting the scope of the variable and condensing the code.
llvm-svn: 110472
2010-08-06 21:12:53 +00:00
Ted Kremenek b0c67c85db Use 'GenerateNode()' instead of 'GenerateSink()' when reporting a leak. A leak is not a hard enough bug to stop analyzing a path.
llvm-svn: 110471
2010-08-06 21:12:49 +00:00
Eli Friedman 165301d38d Initialize variable to work around warning; unfortunately, there isn't any
way to tell gcc "really, values outside the enum aren't valid".

llvm-svn: 110450
2010-08-06 16:37:05 +00:00
Fariborz Jahanian f95e358004 Finishing up block variable layout API by supporting
union type variables and their nesting inside other
aggregate types.

llvm-svn: 110448
2010-08-06 16:28:55 +00:00
Douglas Gregor a49ccfeeb2 The pre-increment/pre-decrement grammar in C++ differs from that in C,
but we were parsing the C grammar. Handle the C++ grammar
appropriately. Fixes PR7794.

llvm-svn: 110445
2010-08-06 14:50:36 +00:00
Douglas Gregor 229c281d37 Remove some incorrect assertions when deduction template arguments in
a template-argument-list. When template template parameters are
involved, we won't already have checked the template-argument-list (it
may not be known yet!). Fixes PR7807.

llvm-svn: 110444
2010-08-06 14:15:26 +00:00
Douglas Gregor 7260905918 Make sure that we diagnose attribute((overloadable)) functions without
prototypes. Fixes PR7738.

llvm-svn: 110443
2010-08-06 13:50:58 +00:00
Douglas Gregor 7617cb8440 Define _INTEGRAL_MAX_BITS for the win32 and win64 targets, from Per Lindén!
llvm-svn: 110442
2010-08-06 12:37:52 +00:00
Abramo Bagnara 7c5dee4280 Template keyword should not be ignored building a QualifiedTemplateName.
llvm-svn: 110441
2010-08-06 12:11:11 +00:00
Douglas Gregor d26129a98a Fix the #include search path when reading from stdin, from Jon Simons!
Fixes PR4897.

llvm-svn: 110440
2010-08-06 12:06:13 +00:00
Douglas Gregor 2588691a69 Diagnose the use of "inline" on block-scope function declarations in
C++, from Andrea Nall!

llvm-svn: 110439
2010-08-06 11:44:10 +00:00
Douglas Gregor 59e8b3bd7b Introduce implicit conversions between AltiVec vectors and GCC
vectors, from Anton Yartsev!

llvm-svn: 110437
2010-08-06 10:14:59 +00:00
Argyrios Kyrtzidis 249179cd73 Introduce a new token kind 'cxx_defaultarg_end' to mark the end of C++ default arguments that were part of
lexed method declarations.

This avoid interference with tokens coming after the point where the default arg tokens were 'injected', e.g. for

typedef struct Inst {
  void m(int x=0);
} *InstPtr;

when parsing '0' the next token would be '*' and things would be messed up.

llvm-svn: 110436
2010-08-06 09:47:24 +00:00
Nick Lewycky 2667f1d409 Remove ElseScope which is also dead code now.
llvm-svn: 110433
2010-08-06 06:50:17 +00:00
Nick Lewycky 60ecc522e0 Remove the DeclaredInCondition bit now that it's no longer used.
llvm-svn: 110432
2010-08-06 05:43:55 +00:00
Zhongxing Xu 44207a9e9f If all nodes are sunk, bail out early. This make the later check for checkersEvaluated really meaningful.
llvm-svn: 110430
2010-08-06 04:20:59 +00:00
Nate Begeman ad5dd42817 vdup_lane was missing
<rdar://problem/8278732>

llvm-svn: 110420
2010-08-06 01:24:57 +00:00
Eli Friedman e83d2b7649 Attempt to fix uninitialized value warning reported on cfe-commits.
llvm-svn: 110418
2010-08-06 01:17:25 +00:00
John McCall dc9796e23a Properly pop out of Objective-C method declarations when they are (ill-formedly)
found within contexts other than the translation unit.

llvm-svn: 110417
2010-08-06 00:46:05 +00:00
Sebastian Redl e98428d7bd Add an environment variable that makes libclang use chaining for PCH.
llvm-svn: 110414
2010-08-06 00:35:11 +00:00
Zhongxing Xu cf61a0639d Don't assert on a file stream if its state is not tracked. Fix pr7831.
llvm-svn: 110392
2010-08-05 23:24:13 +00:00
Jordy Rose afdb053618 When checking if a buffer access is valid, first make sure the buffer has a valid Loc. Fixes PR7830.
llvm-svn: 110390
2010-08-05 23:11:30 +00:00
Bruno Cardoso Lopes 3d19889ca8 Fix AVX 256-bit intrinsics headers by using the right cast type while dealing with logical ops
llvm-svn: 110389
2010-08-05 23:04:58 +00:00
John McCall 491462425a Don't crash when mangling empty anonymous unions. We never actually *need*
these, but it's convenient to mangle them when deferring them (in the 99.99%
case where it's not an anonymous union, of course).

llvm-svn: 110381
2010-08-05 22:02:13 +00:00
Sebastian Redl f03cdc5d27 Collect namespaces that need updating in a PCH chain. WIP
llvm-svn: 110378
2010-08-05 21:22:19 +00:00
Fariborz Jahanian 903aba39ee Add support for block imported struct variable layout info.
(objc gc and blocks in NeXt runtime).

llvm-svn: 110377
2010-08-05 21:00:25 +00:00
John McCall 5513fce96b It turns out that linkers (at least, the Darwin linker) don't necessarily
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere).  447.dealII actually does this.

I've put the code under an option that's currently not hooked up to anything.

llvm-svn: 110374
2010-08-05 20:39:18 +00:00
Chris Lattner dc7ee3cd6b fix the va_list definition for vc++64, patch by Cameron Esfahani!
llvm-svn: 110370
2010-08-05 20:04:20 +00:00
Sebastian Redl 08aca90253 Write various C++-specific records to chained PCHs. Tests will come later.
llvm-svn: 110357
2010-08-05 18:21:25 +00:00
John McCall 95bde46bbb Argument evaluation order is not guaranteed. Split these out to force an order.
llvm-svn: 110354
2010-08-05 18:11:10 +00:00
Tom Care 16ba7c652e Fixed logic error in UnreachableCodeChecker's marking algorithm that would sometimes allow for multiple sequential statements to be flagged.
llvm-svn: 110353
2010-08-05 17:53:44 +00:00
John McCall a9731a4179 Fix a major bug with -ftrapv and ++/--. Patch by David Keaton!
llvm-svn: 110347
2010-08-05 17:39:44 +00:00
John McCall 0f8ccc4938 Allow multiple __declspec attributes after a class-key.
Patch by Francois Pichet!

llvm-svn: 110344
2010-08-05 17:13:11 +00:00
Fariborz Jahanian d652ac82b0 For now skip over aggregate non-byref block variables.
(objc gc specific).

llvm-svn: 110340
2010-08-05 16:13:18 +00:00
Fariborz Jahanian 89f3721dee Trying to unbreak buildbot.
llvm-svn: 110339
2010-08-05 15:52:12 +00:00
Ted Kremenek 9c22219d9c Revert r110317, and add a comment why the assertion is not an invariant.
llvm-svn: 110330
2010-08-05 15:03:30 +00:00
Eli Friedman 06dcfd94c8 Flip the switch to use OffsetOfExpr unconditionally; feel free to revert if
this breaks something.

I'll wait a few days before cleaning out UnaryOperator::OffsetOf.

llvm-svn: 110328
2010-08-05 10:15:45 +00:00
Eli Friedman 74ef7cf144 PR7769: Fix references to anonymous structs/unions in base classes in
offsetof expressions.

llvm-svn: 110327
2010-08-05 10:11:36 +00:00
Eli Friedman d7c7232a1d Add IRGen support for non-constant OffsetOfExpr.
llvm-svn: 110326
2010-08-05 09:58:49 +00:00
Argyrios Kyrtzidis 7f76d11dcc Store the pending implicit instantiations in the PCH and perform them at the end of the translation unit that
included the PCH, as God intended.

llvm-svn: 110324
2010-08-05 09:48:16 +00:00
Argyrios Kyrtzidis ee1afa3082 Support #pragma weak for PCH.
llvm-svn: 110323
2010-08-05 09:48:08 +00:00
Argyrios Kyrtzidis 4ba81b2ee4 Make sure C++ variable definitions are actually passed to the consumer when loaded from PCH.
llvm-svn: 110322
2010-08-05 09:47:59 +00:00
Eli Friedman 0cdda02f44 Make checker recognize OffsetOfExpr as a form of __builtin_offsetof.
llvm-svn: 110320
2010-08-05 09:43:11 +00:00
Douglas Gregor b68bc59a2d Give clang_codeCompleteAt() an "options" parameter, and add a new
flags enumeration + default-generating function that allows
code-completion to be customized via the libclang API.

Plus, turn on spell-checking when performing code completion.

llvm-svn: 110319
2010-08-05 09:09:23 +00:00
John McCall 42d7d19710 TDK_InconsistentQuals is really totally different from TDK_Inconsistent.
Rename it to TDK_Underqualified to avoid this sort of confusion and give it
its own diagnostic.

llvm-svn: 110318
2010-08-05 09:05:08 +00:00
Zhongxing Xu 478fdb16db Turn the predicate into an assertion. When could the unequal case happen?
llvm-svn: 110317
2010-08-05 07:38:23 +00:00
Eli Friedman 570024a8d9 Implement #pragma GCC visibility.
llvm-svn: 110315
2010-08-05 06:57:20 +00:00
Nick Lewycky ef7c0ffe40 Remove the warning for variables declared in the if-expression being used in
the else clause. The problem is that it's overly zealous and will respond to
uses in assignments, or after assignments. We should bring this back once we
can do it right. Fixes PR7100.

llvm-svn: 110314
2010-08-05 06:27:49 +00:00
John McCall da518417fa Permit template argument deduction to add qualifiers within ObjC object
pointers like it can with normal and member pointers.

llvm-svn: 110313
2010-08-05 05:30:45 +00:00
John McCall 3b3a5ed72d operator<< on a DiagnosticBuilder should *always* output exactly one thing.
Null template arguments are bad, but they're better than crashing with an
argument mismatch.

llvm-svn: 110312
2010-08-05 04:58:04 +00:00
Jordy Rose 28041c29af Tweak GRState::unbindLoc to use makeWithStore, and make sure it's only called for non-region locations.
llvm-svn: 110310
2010-08-05 03:33:56 +00:00
Jordy Rose c88c74cb2f Remove InvalidateRegion from stores, since it's no longer called from outside.
llvm-svn: 110309
2010-08-05 03:28:45 +00:00
Eli Friedman d8725a9602 Preserve calling convention etc. across template instantiations.
llvm-svn: 110304
2010-08-05 02:54:05 +00:00
Eli Friedman a170cd6257 Get rid of isObjectType; when C++ says "object type", it generally
just means "not a function type", not "not a function type or void". This
changes behavior slightly, but generally in a way which accepts more code.

llvm-svn: 110303
2010-08-05 02:49:48 +00:00
Sebastian Redl 29ce472c17 Drop an unjustified limitation from Type::isObjectType(). Fixes PR7801 and doesn't seem to break anything.
llvm-svn: 110295
2010-08-05 01:21:19 +00:00
Sebastian Redl e0351b970d Remove a redundant and broken check. Fixes PR7810.
llvm-svn: 110294
2010-08-05 00:45:34 +00:00
Fariborz Jahanian 1f78a9ad56 Clean up of my last patch.
llvm-svn: 110290
2010-08-05 00:19:48 +00:00
Ted Kremenek 1d08fd9b79 Correctly handle 'Class<...>' when examining Cocoa conventions in the static analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason!
llvm-svn: 110289
2010-08-05 00:19:24 +00:00
Ted Kremenek 8a297e9f27 Remove bonehead redeclaration.
llvm-svn: 110288
2010-08-05 00:03:46 +00:00
Fariborz Jahanian 9659f6b540 Block variable layout bitmap API generation.
llvm-svn: 110287
2010-08-04 23:55:24 +00:00
Ted Kremenek 60fa657aa2 Fix CFGBuilder to not blow out the stack when processing deeply nested CaseStmts. Fixes <rdar://problem/8268753>.
llvm-svn: 110286
2010-08-04 23:54:30 +00:00
John McCall c8bd9c277b Extend the visibility-hidden optimization to linkonce_odr thunks for
functions with in-line definitions, since such thunks will be emitted at any
use of the function.

Completes the feature work for rdar://problem/7523229.

llvm-svn: 110285
2010-08-04 23:46:35 +00:00
Bruno Cardoso Lopes fc2320fd73 Logical AVX instrinsics can be matched directly, no need to use builtins here.
llvm-svn: 110271
2010-08-04 22:56:42 +00:00
Bruno Cardoso Lopes d81ef1c85c Add -mavx and -mno-avx command line support
llvm-svn: 110265
2010-08-04 22:29:13 +00:00
Sebastian Redl 51c79d8740 Activate selectors in chained PCH. Chained PCH now works for Objective-C.
llvm-svn: 110262
2010-08-04 22:21:29 +00:00
Bruno Cardoso Lopes 7c4b513a3f Add AVX intrinsics header
llvm-svn: 110253
2010-08-04 22:03:36 +00:00
Sebastian Redl 6e1a2a0693 Bring stats for the method pool back.
llvm-svn: 110247
2010-08-04 21:22:45 +00:00
Sebastian Redl ada023c5d6 Implement per-file reading of the selector table. This disables statistics about method pool hits for the moment.
llvm-svn: 110245
2010-08-04 20:40:17 +00:00
Ted Kremenek b786156b01 Teach SemaChecking::CheckReturnStackAddr about ImplicitCastExprs that convert values to an lvalue. This allows us to warn (again) about returning references to stack variables. (fixes PR 7812).
llvm-svn: 110242
2010-08-04 20:01:07 +00:00
Fariborz Jahanian afa3c0a875 More objc block variable layout info. work.
llvm-svn: 110239
2010-08-04 18:44:59 +00:00
Ted Kremenek 0950212b50 Add CFGStmtMap, which defines a mapping from Stmt* to CFGBlock*. The immediate intended use is in the unreachable code analysis.
llvm-svn: 110230
2010-08-04 18:23:15 +00:00
Sebastian Redl d95a56e50d When chaining, only write interesting selectors to the PCH.
llvm-svn: 110229
2010-08-04 18:21:41 +00:00
Sebastian Redl 834bb971f6 Store the IDs of selectors in the PCH file explicitly.
llvm-svn: 110219
2010-08-04 17:20:04 +00:00
Douglas Gregor d8a5dba9c2 When performing in-process code completion, don't free the remapped
file buffers until the code completion results are destroyed;
diagnostics may end up referring into the source.

llvm-svn: 110216
2010-08-04 17:07:00 +00:00
Fariborz Jahanian c05349e53a Some early work for providing block layout info.
for objective-c/c++ blocks (NeXt runtime).

llvm-svn: 110213
2010-08-04 16:57:49 +00:00
Douglas Gregor 8e984da800 Add code-completion support directly to ASTUnit, which performs code
completion within the translation unit using the same command-line
arguments for parsing the translation unit. Eventually, we'll reuse
the precompiled preamble to improve code-completion performance, and
this also gives us a place to cache results.

Expose this function via the new libclang function
clang_codeCompleteAt(), which performs the code completion within a
CXTranslationUnit. The completion occurs in-process
(clang_codeCompletion() runs code completion out-of-process).

llvm-svn: 110210
2010-08-04 16:47:14 +00:00
John McCall e16adc2b1e Emit standard-library RTTI with external linkage, not weak_odr.
Apply hidden visibility to most RTTI;  libstdc++ does not rely on exact
pointer equality for the type info (just the type info names).  Apply
the same optimization to RTTI that we do to vtables.

Fixes PR5962.

llvm-svn: 110192
2010-08-04 08:34:44 +00:00
Jordy Rose c36df4d0b7 Change the checker callback cache in GRExprEngine to be more compact (and IMHO a little easier to understand), and add the same sort of caching for EvalAssume (tied for least-used callback), mostly as proof-of-concept.
Before we go further with these, we should figure out a way to reuse the visit-and-cache code in CheckerVisit.

llvm-svn: 110191
2010-08-04 07:10:57 +00:00
John McCall 8a705c15d9 Extend the hidden-visibility vtables optimization to template classes that
haven't been explicitly instantiated.

llvm-svn: 110189
2010-08-04 06:38:15 +00:00
John McCall 2dd7d44135 Some more correctness fixes and code-size optimizations for fragile-ABI
ObjC exceptions:
  - don't enter a try for the catch blocks unless there's a finally
  - put the setjmp buffer in the locals set for liveness reasons
  - dump the sync object into an alloca in the locals set for liveness reasons
Some of this can go away if the backend starts to properly calculate liveness
in the presence of setjmp (which would also be a *much* stabler solution).

llvm-svn: 110188
2010-08-04 05:59:32 +00:00
Douglas Gregor bb420abd0b When we try (but fail) to build a precompiled preamble, wait for a
short "cooling off" period (defaulting to 5 reparses) before trying to
build a precompiled preamble again. Previously, if we failed to build
the precompiled preamble at any time, we just gave up the whole
charade any never tried again.

llvm-svn: 110187
2010-08-04 05:53:38 +00:00
John McCall deb646ebb5 Only look up an 'operator delete' on the definition of a destructor, not on
a declaration.

llvm-svn: 110175
2010-08-04 01:04:25 +00:00
John McCall 66a8759400 Look through using declarations when deciding whether to use an operator
delete for a virtual destructor.  Diagnose ambiguities.

Fixes PR7803.

llvm-svn: 110173
2010-08-04 00:31:26 +00:00
John McCall 8601a75118 Do a very simple pass over every function we emit to infer whether we can
mark it nounwind based on whether it contains any non-nounwind calls.
<rdar://problem/8087431>

llvm-svn: 110163
2010-08-03 22:46:07 +00:00
Chris Lattner 38321174e0 add a hack for visual studio, fixing PR7796
llvm-svn: 110161
2010-08-03 22:13:56 +00:00
Sebastian Redl a19a67f899 Incomplete promotion of selector info to per-file data.
Store all selectors in the selector hash table instead of only those from the method pool.

llvm-svn: 110158
2010-08-03 21:58:15 +00:00
Nate Begeman f568b074db Add support for VFP status & control operations for ARM.
llvm-svn: 110153
2010-08-03 21:32:34 +00:00
Tom Care be633d91d0 Improved false positive detection and numerous small issues in UnreachableCodeChecker
- Reporting now uses getUnreachableStmt which returns the Stmt* we should report
- Indexing of reachable and visited blocks now use CFGBlock ID's instead of pointers
- The CFG used in the unreachable search is now the unoptimized CFG
- Added 'Dead code' category to warnings
- Removed obsolete function getCondition
- Simplified false positive detection based on properties of FindUnreachableEntryPoints

llvm-svn: 110148
2010-08-03 21:24:13 +00:00
Jordy Rose ddec092641 Makes GRState::makeWithStore private, to encourage clients to make store changes through GRState instead of directly accessing the StoreManager. Also adds cover methods for InvalidateRegion(s) and EnterStackFrame to GRState.
This is in preparation for proposed region change notifications. No functionality change.

llvm-svn: 110137
2010-08-03 20:44:35 +00:00
Douglas Gregor e9db88f991 When using a precompiled preamble, keep track of the top-level
declarations that we saw when creating the precompiled preamble, and
provide those declarations in addition to the declarations parsed in
the main source file when traversing top-level declarations. This
makes the use of precompiled preambles a pure optimization, rather
than changing the semantics of the parsed translation unit.

llvm-svn: 110131
2010-08-03 19:06:41 +00:00
Eli Friedman 865afc96f7 PR7795: Fix the definition of __WCHAR_MAX__ with -fshort-wchar.
llvm-svn: 110126
2010-08-03 17:34:19 +00:00
Argyrios Kyrtzidis 839bbacfb2 Apart from storing/retrieving the previous redeclaration from PCH, also store/retrieve the most recent
redeclaration. That way we are sure that the full redeclarations chain is loaded.

When using chained PCHs, first declarations point to the most recent redeclarations in the same PCH.
To address this use a REDECLS_UPDATE_LATEST record block to keep track of which first declarations need
to point to a most recent redeclaration in another PCH.

llvm-svn: 110125
2010-08-03 17:30:10 +00:00
Argyrios Kyrtzidis 1e1de05f18 Send AST dumping/printing to stdout instead of stderr.
llvm-svn: 110123
2010-08-03 17:29:57 +00:00
Argyrios Kyrtzidis edee67f335 Avoid writing a VTABLE_USES record in PCH if there are no entries.
llvm-svn: 110122
2010-08-03 17:29:52 +00:00
Chris Lattner 278008f546 fix some undefined behavior, PR7779.
llvm-svn: 110116
2010-08-03 16:48:42 +00:00
Daniel Dunbar 939c1211cc Driver: Don't forward any -g options to GCC, when using it to drive the
assembler.
 - Fixes PR6218, hopefully.

llvm-svn: 110111
2010-08-03 16:14:14 +00:00
Douglas Gregor 48c8cd3fd0 Reshuffle the PCH generator action and consumer, so that we can re-use
it while generating precompiled preambles. No functionality change.

llvm-svn: 110108
2010-08-03 08:14:03 +00:00
John McCall 5696d6d316 Emit weak vtables of non-template classes with hidden visibility.
llvm-svn: 110107
2010-08-03 07:24:12 +00:00
Zhongxing Xu 42b8c30de6 Allow offsets to be negative. Out-of-bound cases are checked elsewhere. We
shouldn't put restrictions in store manager.

llvm-svn: 110106
2010-08-03 06:34:25 +00:00
Zhongxing Xu 83734e46ce Pull the region offset computation logic into a single method.
llvm-svn: 110102
2010-08-03 04:52:05 +00:00
Tom Care 44081fbc6c Changed GRExprEngine to pass down a reference to itself when checkers are doing postanalysis. This allows the checker to gather information about the state of the engine when it has finished.
- Exposed the worklist and BlockAborted flag in GRCoreEngine
- Changed postanalysis checkers to use the new infrastructure

llvm-svn: 110095
2010-08-03 01:55:07 +00:00
Ted Kremenek 4a2b237967 Add -cc1 option '-unoptimized-cfg' to toggle using a CFG (for static analysis) that doesn't prune CFG edges.
llvm-svn: 110087
2010-08-03 00:09:51 +00:00
Ted Kremenek dc03bd0894 Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to the original
CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)').

llvm-svn: 110085
2010-08-02 23:46:59 +00:00
John McCall 4a33fa95c0 Labels (and case statement) don't create independent scope parents for the
purposes of the jump checker.  Also extend Ted's iteration fix to labels.

Fixes PR7789.

llvm-svn: 110082
2010-08-02 23:33:14 +00:00
Sebastian Redl 75d8a32817 Simplify global method pool implementation in Sema. No functionality change.
llvm-svn: 110078
2010-08-02 23:18:59 +00:00
Ted Kremenek 04d50f5d13 Fix another case (this time in JumpScopeChecker) where walking deeply nested CaseStmts can blow out the stack. Fixes <rdar://problem/8125165>.
llvm-svn: 110071
2010-08-02 22:46:57 +00:00
Ted Kremenek 297e2e5bf6 Fix idempotent operations false positive caused by ivars not being invalidated in function
calls when the enclosing object had retain/release state.  Fixes <rdar://problem/8261992>.

llvm-svn: 110068
2010-08-02 21:59:12 +00:00
John McCall 8b0f4ff317 Further adjustments to -Wglobal-constructors; works for references and direct
initializations now.

llvm-svn: 110063
2010-08-02 21:13:48 +00:00
Douglas Gregor d9a30af25b When using a precompiled preamble, save the diagnostics produced when
creating the preamble and "replay" them when reusing the
preamble. Also, fix a thinko in the copying of the preamble when
building the precompiled preamble.

llvm-svn: 110061
2010-08-02 20:51:39 +00:00
Ted Kremenek 8a4a2b14e8 'Assumption &A' gets default initialized to 'Possible' if it doesn't exist; no need to two
lookups in the hashtable.

llvm-svn: 110059
2010-08-02 20:33:02 +00:00
Sebastian Redl 78f5177d37 Query only the latest version of an identifier in the PCH chain. Make sure this version holds the entire declaration chain. This is a much saner solution than trying to merge the info from all elements, and makes redeclarations work properly. Expand the declarations test case to cover more compliated cases.
llvm-svn: 110052
2010-08-02 18:30:12 +00:00
Sebastian Redl 9d8854ec60 Remove mutable data on TagType and InjectedClassNameType, by instead walking the declaration chain in search of a definition. This is necessary for a sane chained PCH implementation. No observable performance change on Carbon.h syntax-only, and bootstraps cleanly.
llvm-svn: 110051
2010-08-02 18:27:05 +00:00
Fariborz Jahanian 9c6a39e862 Compute width/align of objc builtin types (id, etc)
for radar 8258797.

llvm-svn: 110047
2010-08-02 18:03:20 +00:00
Argyrios Kyrtzidis 2d68810caf Read/write in PCH Sema's StdNamespace and StdBadAlloc and use a LazyDeclPtr for them that will deserialize them when needed.
llvm-svn: 110031
2010-08-02 07:14:54 +00:00
Argyrios Kyrtzidis 4f8e17379d Rename getStdNamespace -> getOrCreateStdNamespace, to better reflect its functionality.
No functionality change.

llvm-svn: 110030
2010-08-02 07:14:39 +00:00
Daniel Dunbar 71c723da29 Driver/Darwin: Change where Darwin computes the host version, to normalize tool
chain construction.

llvm-svn: 110028
2010-08-02 05:44:07 +00:00
Daniel Dunbar a73a9845e2 Driver: Have -ccc-host-triple simply override the default in the driver, for
now.

llvm-svn: 110027
2010-08-02 05:44:04 +00:00