Commit Graph

19862 Commits

Author SHA1 Message Date
Douglas Gregor ef6eb84da1 Use a sane encoding for CXCursor_ObjCProtocolRef, using the actual
source locations where the protocols were referenced rather than the
location of some random enclosing declaration.

llvm-svn: 93637
2010-01-16 15:44:18 +00:00
Douglas Gregor 002b671055 Keep track of the source locations for each protocol reference in
Objective-C classes, protocol definitions, forward protocol
declarations, and categories. This information isn't actually used
yet; that's coming next.

llvm-svn: 93636
2010-01-16 15:02:53 +00:00
Douglas Gregor 6c8959b71b Give CXCursor_ObjCSuperClassRef a sane encoding, which is only known
to CXCursor.cpp.

llvm-svn: 93634
2010-01-16 14:00:32 +00:00
John McCall 982adb518c Fix a use of uninitialized memory in overload diagnostics.
llvm-svn: 93629
2010-01-16 03:50:16 +00:00
Ted Kremenek 13751dc571 Add mapping from ObjCPropertDecl to CXCursorKind.
llvm-svn: 93623
2010-01-16 02:08:29 +00:00
Ted Kremenek 4ba5263441 Remove 'default' case in switch statement in clang_getCursorKindSpelling(). This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl.
llvm-svn: 93622
2010-01-16 02:02:09 +00:00
Ted Kremenek 9cec00019a Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). This revealed a bunch of inconsistencies in how CXCursorKinds were being computed.
llvm-svn: 93618
2010-01-16 01:44:12 +00:00
Tanya Lattner dbfd16014a Add codgen for BI__builtin_llvm_memory_barrier.
llvm-svn: 93611
2010-01-16 01:21:14 +00:00
Tanya Lattner 68c7113944 The codegen for these builtins was removed long ago, but their definitions remained. Removing them totally.
llvm-svn: 93607
2010-01-16 01:10:51 +00:00
Eli Friedman 8fdc2cb46a Fix crash generating debug info for constructor for anonymous struct.
llvm-svn: 93601
2010-01-16 00:43:13 +00:00
Ted Kremenek c2aa0f1ecb Migrate Decl* -> cursorkind logic into CXCursor.cpp, and drastically tighten TUVisitor.
llvm-svn: 93599
2010-01-16 00:36:30 +00:00
Eli Friedman 1fcf66b0dd Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator.

llvm-svn: 93592
2010-01-16 00:00:48 +00:00
Ted Kremenek 10dd6e9ca5 Remove unused code.
llvm-svn: 93586
2010-01-15 23:35:12 +00:00
Ted Kremenek 6b1d550d4b Refactor USR logic for EnumDecls and RecordDecls so that both handle 'anonymous' declarations in the same way.
llvm-svn: 93585
2010-01-15 23:34:31 +00:00
Mike Stump ea409449aa Generalize handling for unreachable code warnings to all binary operators.
llvm-svn: 93584
2010-01-15 23:33:51 +00:00
John McCall 3712d9e391 Candidates with arity mismatches are extra-special non-viable and need to
stand at the back of the line.

Thanks to Oliver Hunt for reminding me to do this.

llvm-svn: 93583
2010-01-15 23:32:50 +00:00
Mike Stump d4d6fb3374 Refine location reporting for unreachable code warnings for comma expressions.
llvm-svn: 93574
2010-01-15 23:17:13 +00:00
Ted Kremenek a7f7b17bc7 USR generation: look at the typedef of an anonymous struct (if any) when trying to generate a USR.
llvm-svn: 93572
2010-01-15 23:08:25 +00:00
Fariborz Jahanian f0462ff691 define __weak to null in rewritten source for
-fms-extensions as well.

llvm-svn: 93569
2010-01-15 22:29:39 +00:00
Douglas Gregor c58d05bcf9 Make CXCursor's data opaque.
llvm-svn: 93561
2010-01-15 21:56:13 +00:00
John McCall 7fe6e9c2f1 Make LookupResult::resolveKind() robust against NotFoundInCurrentInstantiation.
Fixes PR 6049.

llvm-svn: 93557
2010-01-15 21:27:01 +00:00
Ted Kremenek 87553c42c0 Add CXCursor.[h,cpp]. These files will centralize the logic for creating/probing CXCursors.
llvm-svn: 93547
2010-01-15 20:35:54 +00:00
Eli Friedman cab014721b Fix a couple bugs in copy assignment operator synthesis.
llvm-svn: 93546
2010-01-15 20:06:11 +00:00
Ted Kremenek 8433d1da5e Add USR generation for enums.
llvm-svn: 93543
2010-01-15 20:04:31 +00:00
Douglas Gregor 082c3e69eb Add -cursor-at=file:line:column command line option to c-index-test,
to directly check the results of clang_getCursor(). Also, start
migrating some index-test tests over to c-index test [*] and some
grep-using tests over to FileCheck.

llvm-svn: 93537
2010-01-15 19:40:17 +00:00
John McCall d377e04489 Preserve type source information for C++ named casts through template
instantiation.

llvm-svn: 93533
2010-01-15 19:13:16 +00:00
John McCall ebe5474148 Don't lose type source information when rebuilding C-style cast expressions.
Also we don't need to recheck for altivec initializers, I think.

llvm-svn: 93529
2010-01-15 18:56:44 +00:00
John McCall 9751396d70 Preserve type source information in explicit cast expressions.
Patch by Enea Zaffanella.

llvm-svn: 93522
2010-01-15 18:39:57 +00:00
Ted Kremenek 63b15c3af7 getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location.
llvm-svn: 93520
2010-01-15 18:24:18 +00:00
Fariborz Jahanian 5c26eeefdd Do not do the block-specific rewrite when there is no block literals.
Fixes radar 7546096.

llvm-svn: 93519
2010-01-15 18:14:52 +00:00
Douglas Gregor 5fcb51c09c When determining whether a DeclRefExpr is value-dependent when it
references a const variable of integral type, the initializer may be
in a different declaration than the one that name-lookup saw. Find the
initializer anyway. Fixes PR6045.

llvm-svn: 93514
2010-01-15 16:21:02 +00:00
Douglas Gregor 27b174f4c3 When determining whether the type is the current instantiation, strip
qualifiers. Fixes PR6021.

llvm-svn: 93513
2010-01-15 16:05:33 +00:00
Ken Dyck 02990837ad Convert the type of the LValue offset variable in APValue to CharUnits, moving
the LValue-related methods of APValue out of line to avoid header file leaching.

llvm-svn: 93512
2010-01-15 12:37:54 +00:00
John McCall 38836f0f39 Don't repeat lookup when instantiating resolved member expressions.
Adjust BuildMemberReferenceExpr to perform the inheritance check on implicit
member accesses, which can arise from unqualified lookups and therefore may
reference decls from enclosing class scopes.

Fixes PR 5838.

llvm-svn: 93510
2010-01-15 08:34:02 +00:00
Ted Kremenek abf6ba1612 Don't suggest the developer use 'arc4random' instead of 'rand' when that function is not available. Fixes PR 6012.
llvm-svn: 93508
2010-01-15 08:20:31 +00:00
Ted Kremenek d74cc397c8 Teach BugReporter to "escape" the occurance of '%' characters in diagnostic messages when emitted results to the standard Diagnostics output. Fixes PR 6033.
llvm-svn: 93507
2010-01-15 07:56:51 +00:00
Ted Kremenek 959990b840 Convert a few more uses of std::string& to llvm::StringRef.
llvm-svn: 93506
2010-01-15 07:43:59 +00:00
Mike Stump dec5a39ea5 Add testcase for recent checkin.
llvm-svn: 93503
2010-01-15 03:15:36 +00:00
Mike Stump 6a11229dc8 Refine unreachable warnings. WIP.
llvm-svn: 93500
2010-01-15 02:06:42 +00:00
Douglas Gregor d0d2ee0e4b When performing qualified name lookup into the current instantiation,
do not look into base classes if there are any dependent base
classes. Instead, note in the lookup result that we couldn't look into
any dependent bases. Use that new result kind to detect when this case
occurs, so that we can fall back to treating the type/value/etc. as a
member of an unknown specialization.

Fixes an issue where we were resolving lookup at template definition
time and then missing an ambiguity at template instantiation time.

llvm-svn: 93497
2010-01-15 01:44:47 +00:00
Mike Stump fc4daba5e0 Fix Release-Asserts for the time being.
llvm-svn: 93493
2010-01-15 00:50:35 +00:00
Fariborz Jahanian 195ac2dfab Patch to avoid duplicate declaration of byref structs
for __block variables of same name declared in multiple scopes.
Fixes radar 7540194

llvm-svn: 93474
2010-01-14 23:05:52 +00:00
Devang Patel 2d63010a9c Emit linkage name even if it matches regular name. The code generator uses linkage name to find subprogram entry for the current function.
llvm-svn: 93461
2010-01-14 21:46:57 +00:00
Anton Korobeynikov 485810ec0a Forgot to commit these
llvm-svn: 93458
2010-01-14 21:36:52 +00:00
Chris Lattner 0b534d5969 fix grammaro
llvm-svn: 93452
2010-01-14 21:00:58 +00:00
Anton Korobeynikov 6bedbf1039 long long is 64 bits on msp430
llvm-svn: 93451
2010-01-14 20:22:45 +00:00
John McCall 8cb7a8a39c Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuation
characters to be escaped and implement a scan-forward function which
properly respects brace nesting.

llvm-svn: 93447
2010-01-14 20:11:39 +00:00
Ted Kremenek 91df0ec92c Simplify test case. This test case also applies to PR 6013.
llvm-svn: 93444
2010-01-14 19:47:50 +00:00
Ted Kremenek b9ad45ab60 Associate test case with Bugzilla PR.
llvm-svn: 93440
2010-01-14 19:38:41 +00:00
John McCall 98757030a4 Document the extensions I made to the diagnostics-formatting system yesterday.
llvm-svn: 93439
2010-01-14 19:12:17 +00:00
Douglas Gregor 04b1152aac After dyn_cast'ing, it generally makes sense to check the *output* of
the dyn_cast against NULL rather than the *input*. Fixes PR6025.

llvm-svn: 93435
2010-01-14 18:13:22 +00:00
Devang Patel ea84f59f5c Add comment.
llvm-svn: 93434
2010-01-14 18:06:13 +00:00
Douglas Gregor d2e6a45722 When qualified lookup into the current instantiation fails (because it
finds nothing), and the current instantiation has dependent base
classes, treat the qualified lookup as if it referred to an unknown
specialization. Fixes PR6031.

llvm-svn: 93433
2010-01-14 17:47:39 +00:00
Douglas Gregor fc59ce1ea4 Switch a few callers of MaybeAddResult over to AddResult, when the
declarations we're adding do not need any name-hiding checks.

llvm-svn: 93431
2010-01-14 16:14:35 +00:00
Douglas Gregor 2b8162b7d0 Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller.

llvm-svn: 93430
2010-01-14 16:08:12 +00:00
Douglas Gregor 78a210145b Start migrating code-completion results from
ResultBuilder::MaybeAddResult over to ResultBuilder::AddResult.

llvm-svn: 93429
2010-01-14 16:01:26 +00:00
Douglas Gregor 09bbc651f4 Switch the remaining code completions over to LookupVisibleDecls,
after adding the ability to determine whether our lookup is a
base-class lookup. Eliminate CollectMemberLookupResults, since it is
no longer used (yay).

llvm-svn: 93428
2010-01-14 15:47:35 +00:00
David Chisnall 035ead209f Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).
llvm-svn: 93427
2010-01-14 14:08:19 +00:00
Zhongxing Xu 803ade2532 Fix pr6035.
llvm-svn: 93422
2010-01-14 03:45:06 +00:00
Douglas Gregor 200c99dd1e Move code completion for qualified name lookup (foo::) to
LookupVisibleDecls. Also, a function does not hide another function.

llvm-svn: 93421
2010-01-14 03:35:48 +00:00
John McCall 4700099719 Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics.  Unfortunately, the non-overload diagnostics are not
this good.

llvm-svn: 93420
2010-01-14 03:28:57 +00:00
Douglas Gregor a6e2edcc3a Eliminate the code-completion-specifier CollectLookupResults in favor
of the more general LookupVisibleDecls.

llvm-svn: 93419
2010-01-14 03:27:13 +00:00
Douglas Gregor 6ae4c5278c Simplify the code-completion logic for nested-name-specifiers: rather
than traversing visible declarations twice, only perform one traversal
and recognize nested-name-specifiers as special.

llvm-svn: 93418
2010-01-14 03:21:49 +00:00
Mike Stump 0a7d9305f1 Don't assume a random access iterator, instead just use CFG::iterator.
Thanks Ted.

llvm-svn: 93413
2010-01-14 02:45:29 +00:00
Anders Carlsson 5f9a881e1e Store the address points for constructor vtables directly in the VTT builder, because that's the only time they're needed.
llvm-svn: 93412
2010-01-14 02:29:07 +00:00
Mike Stump 29ce3a3114 Avoid snowballing errors into additional warnings. To do better, we'd
need an error term for the CFG.  I suspect we'll always have to cope
with getCFG returning 0, though, I'd love to see even that possibility
removed.

llvm-svn: 93411
2010-01-14 02:26:52 +00:00
Ted Kremenek e34cbde383 Switch return site to use clang_getNullCursor().
llvm-svn: 93405
2010-01-14 01:51:23 +00:00
Ted Kremenek e1b5525510 Further tweak USR generation by shorting names and distinguish between namespaces and functions.
llvm-svn: 93404
2010-01-14 01:50:21 +00:00
Anders Carlsson 2a4adbea96 Add a DenseMapInfo specialization for BaseSubobject.
llvm-svn: 93399
2010-01-14 01:39:42 +00:00
Douglas Gregor 69a8e083c5 When providing completions for a member access expression in C++,
provided nested-name-specifier results for base classes (only), rather
than everything that could possibly be a nested-name-specifier.

llvm-svn: 93398
2010-01-14 01:17:14 +00:00
Douglas Gregor c580c5205f Switch code-completion for ordinary names over to the new(ish)
LookupVisibleDecls, unifying the name lookup mechanisms used by code
completion and typo correction. Aside from the software-engineering
improvements, this makes code-completion see through using directives
and see ivars when performing unqualified name lookup in an
Objective-C instance method.

llvm-svn: 93397
2010-01-14 01:09:38 +00:00
John McCall a1709fd822 Improve the diagnostic for bad conversions in overload resolution to talk
about 'object argument' vs. 'nth argument'.

llvm-svn: 93395
2010-01-14 00:56:20 +00:00
John McCall 9015cde4dc Add the %ordinal format modifier for turning '1' into '1st'. Hard-coded for
English right now;  would not be impossible to grab a special format string
from the diagnostic pool and localize that way.

llvm-svn: 93390
2010-01-14 00:50:32 +00:00
Devang Patel 4274a326be Because CurLoc is the current source location as far as CGDebugInfo is concerned. It is expected that this is set (usually left bracket location of function body compound statement) before EmitfunctionStart() is used.
llvm-svn: 93389
2010-01-14 00:48:09 +00:00
Douglas Gregor e0717ab39c More refactoring of ResultBuilder::MaybeAddResult. No intended
functionality change.

llvm-svn: 93386
2010-01-14 00:41:07 +00:00
Devang Patel 934661ed73 Emit human readable names for c/c++ functions. Avoid emitting linkage name if it matches regular name.
llvm-svn: 93383
2010-01-14 00:36:21 +00:00
Fariborz Jahanian e2dd5428e6 Fix a bug in rewrite whereby functions using blocks put extern "C" in wrong place.
Fixes radar 7284618.

llvm-svn: 93382
2010-01-14 00:35:56 +00:00
Douglas Gregor 7c208616b4 Refactor the "is this declaration interesting" logic in
code-completion's ResultBuilder::MaybeAddResult for later reuse.

llvm-svn: 93379
2010-01-14 00:20:49 +00:00
Douglas Gregor 0235c4243f Look through using declarations when determining whether one decl hides another
llvm-svn: 93378
2010-01-14 00:06:47 +00:00
John McCall e4d5432136 Perform format-expansion on %select results.
llvm-svn: 93377
2010-01-13 23:58:20 +00:00
Douglas Gregor f98e6a28e4 Banish the notion of a "rank" for code-completion results, since we
are no longer using it for anything. No intended functionality change.

llvm-svn: 93376
2010-01-13 23:51:12 +00:00
Douglas Gregor 52ce62f069 Improve the sorting of code-completion results. We now always sort by
the "typed" text, first, then take into account
nested-name-specifiers, name hiding, etc. This means that the
resulting sort is actually alphabetical :)

llvm-svn: 93370
2010-01-13 23:24:38 +00:00
John McCall e8c8cd2a58 Don't report ambiguities in the user-defined conversion if we weren't supposed
to be considering user-defined conversions in the first place.

Doug, please review;  I'm not sure what we should be doing if we see a real
ambiguity in selecting a copy constructor when otherwise suppressing
user-defined conversions.

Fixes PR6014.

llvm-svn: 93365
2010-01-13 22:30:33 +00:00
John McCall 02bc54d11c Don't a.k.a. through the primary typedef of an anonymous tag decl.
llvm-svn: 93362
2010-01-13 22:07:44 +00:00
Douglas Gregor 48d462573d Code-completion for @public, @protected, @private, @package.
llvm-svn: 93361
2010-01-13 21:54:15 +00:00
Ted Kremenek d5c6eafe09 Reorganize CIndex.cpp into clearer sections of functions, and add a utility function 'MakeCXCursor' to centralize the logic for creating CXCursor objects.
llvm-svn: 93359
2010-01-13 21:46:36 +00:00
Fariborz Jahanian d0bbf66895 Fixes a rewrite bug rewriting a block call argument which has a trvial
constructor. Fixes radar 7537770.

llvm-svn: 93358
2010-01-13 21:41:11 +00:00
Douglas Gregor f193416359 Whenever completing ordinary names for an Objective-C source, also
provide completions for @ keywords. Previously, we only provided
@-completions after an @ was actually typed, which is useful but
probably not the common case.

Also, make sure a few Objective-C 2.0 completions only show up when
Objective-C 2.0 support is enabled (the default).

llvm-svn: 93354
2010-01-13 21:24:21 +00:00
Mike Stump 6f0bf82622 Fix Release-Asserts.
llvm-svn: 93353
2010-01-13 21:23:04 +00:00
Mike Stump 8521f06ced Fix for Release-Assert.
llvm-svn: 93348
2010-01-13 20:58:35 +00:00
Mike Stump 2f7b246a47 Fix for Release-Asserts.
llvm-svn: 93347
2010-01-13 20:57:29 +00:00
Mike Stump 5c1e7259f1 Fix Release-Asserts.
llvm-svn: 93346
2010-01-13 20:43:31 +00:00
Anders Carlsson 20871481d2 Add a BaseSubobject class to uniquely identify a base class subobject. Not yet used.
llvm-svn: 93345
2010-01-13 20:11:15 +00:00
John McCall e8595036c4 Add type source information for both kinds of typeof types.
Patch by Enea Zaffanella.

llvm-svn: 93344
2010-01-13 20:03:27 +00:00
Ted Kremenek e14e372b67 Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.
llvm-svn: 93343
2010-01-13 19:59:20 +00:00
Mike Stump 92d487712e Fix for Release-Asserts.
llvm-svn: 93340
2010-01-13 19:40:37 +00:00
Fariborz Jahanian 3f7b8b274d Predefine __weak attribute when doing objective-c
rewriting for any target. (refixes radar 7530235).

llvm-svn: 93331
2010-01-13 18:51:17 +00:00
Ted Kremenek 95ae5e16b9 Add extra null check in clang_disposeString().
llvm-svn: 93328
2010-01-13 18:45:36 +00:00
Douglas Gregor 9de54ea41b Reimplement constructor declarator parsing to cope with template-ids
that name constructors, the endless joys of out-of-line constructor
definitions, and various other corner cases that the previous hack
never imagined. Fixes PR5688 and tightens up semantic analysis for
constructor names.

Additionally, fixed a problem where we wouldn't properly enter the
declarator scope of a parenthesized declarator. We were entering the
scope, then leaving it when we saw the ")"; now, we re-enter the
declarator scope before parsing the parameter list.

Note that we are forced to perform some tentative parsing within a
class (call it C) to tell the difference between

  C(int); // constructor

and

  C (f)(int); // member function

which is rather unfortunate. And, although it isn't necessary for
correctness, we use the same tentative-parsing mechanism for
out-of-line constructors to improve diagnostics in icky cases like:

  C::C C::f(int); // error: C::C refers to the constructor name, but
                  // we complain nicely and recover by treating it as
                  // a type.

llvm-svn: 93322
2010-01-13 17:31:36 +00:00
Douglas Gregor b89b99f1f2 Fix pasto in __has_feature(cxx_lambdas) docs
llvm-svn: 93320
2010-01-13 16:27:49 +00:00
John McCall 6a61b5203d Record some basic information about bad conversion sequences. Use that
information to feed diagnostics instead of regenerating it.  Much room for
improvement here, but fixes some unfortunate problems reporting on method calls.

llvm-svn: 93316
2010-01-13 09:16:55 +00:00
Alexis Hunt c88db06565 Implement semantic checking for C++ literal operators.
This now rejects literal operators that don't meet the requirements.
Templates are not yet checked for.

llvm-svn: 93315
2010-01-13 09:01:02 +00:00
Alexis Hunt 10e2f7264e Update test function names so as not to use potential keywords.
llvm-svn: 93314
2010-01-13 08:58:42 +00:00
Alexis Hunt af4e28d897 Add a bunch more feature-checking macros for C++0x features. Some of these are
disabled with the intent that users can start with them now and not have to change
a thing to have them work when we implement the features.

llvm-svn: 93312
2010-01-13 08:31:49 +00:00
John McCall 6d11e07b16 Insert clang-flags into the clang command. Currently it needs to be a list;
future work should permit strings (by splitting them into a list o' strings).

llvm-svn: 93299
2010-01-13 06:44:51 +00:00
Chris Lattner 3d756f1a9e diagnose invalid values of -ftabstop, patch by Christian Adaker!
llvm-svn: 93288
2010-01-13 03:06:50 +00:00
Mike Stump 1bacb81d6f Add an unreachable code checker.
llvm-svn: 93287
2010-01-13 02:59:54 +00:00
Daniel Dunbar 4f2bc55d4e cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
clang -cc1 logic for running an action against a set of options.
 - This should make it easier to build tools that have a clang -cc1 like
   interface, but aren't actually part of clang -cc1.

llvm-svn: 93282
2010-01-13 00:48:06 +00:00
Daniel Dunbar 7d38d4da61 cc1: Lift creation of the FrontendAction higher.
llvm-svn: 93281
2010-01-13 00:47:51 +00:00
John McCall e1ac8d1742 Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable.  There's a lot we can do to improve this, but
it's a good start.  Further improvements should probably be integrated with the
bad-initialization reporting routines.

llvm-svn: 93277
2010-01-13 00:25:19 +00:00
Ted Kremenek 78668fdcfb Move definitions for visitor methods in CDeclVisitor out-of-line.
llvm-svn: 93276
2010-01-13 00:22:49 +00:00
Ted Kremenek 1351b09b04 Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.

llvm-svn: 93275
2010-01-13 00:13:47 +00:00
Douglas Gregor 08dc584c3f Remove broken fix-it when a default function argument has been
redefined. There's a FIXME with an apology about why we don't try to
do better here. Fixes <rdar://problem/7513023>.

llvm-svn: 93274
2010-01-13 00:12:48 +00:00
Fariborz Jahanian 6fada5be91 When in objective-c methods, do the built-in name lookup after
ivar name lookup. Fixes pr5986.

llvm-svn: 93271
2010-01-12 23:58:59 +00:00
Ted Kremenek 58a6a8ec62 Add USR printing modes to c-index-test.
llvm-svn: 93269
2010-01-12 23:34:26 +00:00
Ted Kremenek a188cbbf29 Make clang_getDeclUSR() visible.
llvm-svn: 93268
2010-01-12 23:34:05 +00:00
Ted Kremenek cb674f9492 Rename clang_getUSR() -> clang_getDeclUSR(). For now we take a CXDecl instead of a CXEntity.
Enhance USR generation a bit with support for records.

llvm-svn: 93267
2010-01-12 23:33:42 +00:00
Douglas Gregor 49862b8285 Don't emit string-comparison or self-comparison warnings in
unevaluated contexts, because they only matter for code that will
actually be evaluated at runtime.

As part of this, I had to extend PartialDiagnostic to support fix-it
hints.

llvm-svn: 93266
2010-01-12 23:18:54 +00:00
Mike Stump 4b0e352061 Remove unused code.
llvm-svn: 93262
2010-01-12 22:20:00 +00:00
Chris Lattner 0c523e513a testcase for -ftabstop, patch by Christian Adaker!
llvm-svn: 93260
2010-01-12 22:06:58 +00:00
Chris Lattner 7011795ee4 use DiagRuntimeBehavior to silence the div/rem by zero warning when
not in an evaluated context.  This removes some bogus warnings.

llvm-svn: 93258
2010-01-12 21:30:55 +00:00
Douglas Gregor 18473f329d Improve recovery for template-ids whose template-name doesn't actually
name a template, when they occur in a base-specifier. This is one of
the (few) places where we know for sure that an identifier followed by
a '<' must be a template name, so we can diagnose and recover well:

test/SemaTemplate/dependent-base-classes.cpp:9:16: error: missing
'template'
      keyword prior to dependent template name 'T::apply'
struct X1 : T::apply<U> { }; // expected-error{{missing 'template' ...
               ^
               template 
test/SemaTemplate/dependent-base-classes.cpp:12:13: error: unknown
template name
      'vector'
struct X2 : vector<T> { }; // expected-error{{unknown template name
'vector'}}
            ^
2 diagnostics generated.

llvm-svn: 93257
2010-01-12 21:28:44 +00:00
Chris Lattner faa5417264 implement PR6004, warning about divide and remainder by zero.
llvm-svn: 93256
2010-01-12 21:23:57 +00:00
Chris Lattner 20aee9b914 implement PR6007, diagnosing invalid attribute((section))
llvm-svn: 93255
2010-01-12 20:58:53 +00:00
Mike Stump a77e48c322 Improve covariance tester to randomize the return value more.
llvm-svn: 93254
2010-01-12 20:55:39 +00:00
Chandler Carruth 04bdce6407 Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.

llvm-svn: 93252
2010-01-12 20:32:25 +00:00
Ted Kremenek 55e3e83b07 Further tweaking of USR generation. WIP.
llvm-svn: 93250
2010-01-12 19:35:53 +00:00
Ted Kremenek 73eccd2c10 Make 'CXTranslationUnitIterator' an argument to perform_test_load(),
perform_test_load_tu(), and perform_test_load_source().

llvm-svn: 93248
2010-01-12 18:53:15 +00:00
Fariborz Jahanian 42c06998ea Define __weak attribute for objective-c pointers in
win32 targets. Fixes radar 7530235. Daniel please review.

llvm-svn: 93246
2010-01-12 18:33:57 +00:00
Douglas Gregor 46c59614d3 Parse dependent template-ids in base clauses and member
initializers. This isn't actually in the C++ grammar (in any version),
but that's clearly an oversight: both GCC and EDG support this syntax,
and it's used within Boost code. I'll file a core issue proposing
precisely the change made here. Fixes PR6008.

llvm-svn: 93243
2010-01-12 17:52:59 +00:00
Fariborz Jahanian 12e2e86f0f Improve on objective-c pointer recognition
during rewrite. No functionality chang.

llvm-svn: 93241
2010-01-12 17:31:23 +00:00
Douglas Gregor c119dd50c2 When determining whether a given name is a template in a dependent
context, do not attempt typo correction. This harms performance (as
Abramo noted) and can cause some amusing errors, as in this new
testcase.

llvm-svn: 93240
2010-01-12 17:06:20 +00:00
Benjamin Kramer d815825c7d Fix tests for r93231.
llvm-svn: 93238
2010-01-12 11:52:20 +00:00
Benjamin Kramer 59617be4a5 Remove trailing semicolons and silence MSVC warning about C linkage.
warning C4190: 'GetEntity' has C-linkage specified, but returns UDT
'clang::idx::Entity' which is incompatible with C

llvm-svn: 93237
2010-01-12 11:32:40 +00:00
John McCall ad907777e8 So I was sitting around, trying vainly to think of something to commit, and then
I said to myself, self, why don't you go add a couple of parameters to a method
and then fail to use them, and I thought that sounded like a pretty good idea,
so I did it.

llvm-svn: 93233
2010-01-12 07:18:19 +00:00
Douglas Gregor 6a80393385 Use horizontal-space markers in code-completion results rather than
embedding single space characters. <rdar://problem/7485503>

llvm-svn: 93231
2010-01-12 06:38:28 +00:00
Mike Stump edd224743c Add covariance tester.
llvm-svn: 93226
2010-01-12 03:01:18 +00:00
Daniel Dunbar abd3686f49 Remove duplicate class name, MSVC doesn't like this.
llvm-svn: 93225
2010-01-12 02:34:07 +00:00
John McCall 53262c96d9 Reorganize some of the code to note overload candidates. Improves the
fidelity with which we note them as functions/constructors and templates
thereof.  Also will be helpful when reporting bad conversions (next).

llvm-svn: 93224
2010-01-12 02:15:36 +00:00
Ted Kremenek 5631d2d1a1 Add a boilerplate implementation for clang_getUSR(). WIP.
llvm-svn: 93223
2010-01-12 02:07:58 +00:00
Fariborz Jahanian 5951609ac2 Fix rewriting of MacOS sjlj based eh.
Fixes radar 7522880.

llvm-svn: 93219
2010-01-12 01:22:23 +00:00
Douglas Gregor 3c96a46fc3 Name lookup should know better than to look into a class before it's defined
llvm-svn: 93217
2010-01-12 01:17:50 +00:00
John McCall c54cf7373f Chris thinks these diagnostics are better now. :)
llvm-svn: 93216
2010-01-12 01:09:12 +00:00
John McCall ad2587a394 Sort overload results by viability.
llvm-svn: 93215
2010-01-12 00:48:53 +00:00
John McCall 0d1da2298a Introduce a specific representation for the ambiguous implicit conversion
sequence.  Lots of small relevant changes.  Fixes some serious problems with
ambiguous conversions;  also possibly improves associated diagnostics.

llvm-svn: 93214
2010-01-12 00:44:57 +00:00
Ted Kremenek 87be3617e3 Change clang_getUSR() to return a CXString instead of a 'const char *'.
llvm-svn: 93213
2010-01-12 00:38:53 +00:00
Ted Kremenek 46157971e9 Make createCXString() a static member function of class CIndex.
llvm-svn: 93212
2010-01-12 00:36:38 +00:00
Mike Stump ee6dfe55a5 Allow N_FIELDS to be 0.
llvm-svn: 93211
2010-01-12 00:28:59 +00:00
Ted Kremenek e5f86be138 CIndex:
- Remove unused (and unimplemented) clang_getDeclarationName().
- Remove unused (and unimplemented) clang_getEntity().
- Add clang_getEntityFromDecl(): maps from a CXDecl to a CXEntity)
- Add clang_getDeclaration(): maps from a (CXEntity, CXTranslationUnit) to a CXDecl).

llvm-svn: 93209
2010-01-11 23:56:39 +00:00
Douglas Gregor 411e5acce1 Eliminate an embarrassing performance regression in C/ObjC, where we
were performing name lookup for template names in C/ObjC and always
finding nothing. Turn off such lookup unless we're in C++ mode, along
with the check that determines whether the given identifier is a
"current class name", and assert that we don't make this mistake
again.

llvm-svn: 93207
2010-01-11 23:29:10 +00:00
David Chisnall a354f12be2 Reverted r93198; done without reading relevant PR.
llvm-svn: 93205
2010-01-11 23:08:08 +00:00
Fariborz Jahanian 1c2cb6df9e Fix rewriting for forward class declaration.
(fixes radar 6969189).

llvm-svn: 93201
2010-01-11 22:48:40 +00:00
Douglas Gregor 88f3eb898a When performing name lookup into a scope, check that its entity is
non-NULL before looking at the entity itself.

llvm-svn: 93199
2010-01-11 22:40:45 +00:00
David Chisnall 394bf0d0ba Allow VLAs in C++ if in GNU mode (GNU C++ permits them). Clang can now compile LanguageKit, although the resulting code crashes (although not in any of the functions that use VLAs).
llvm-svn: 93198
2010-01-11 22:33:19 +00:00
Douglas Gregor d615026e8d C++0x [dcl.typedef]p4, take 3, where we actually figure out what "that
is not also a typedef-name" actually means. For anyone keeping score,
that's John: 2, Doug: 0.

llvm-svn: 93196
2010-01-11 22:30:10 +00:00
Douglas Gregor 323ade5ac8 Use isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
latter may (eventually) perform multiple levels of desugaring (thus
breaking the newly-added tests) and the former is faster. Thanks, John!

llvm-svn: 93192
2010-01-11 22:04:54 +00:00
Douglas Gregor 7419ce72ae Add test case from PR5763
llvm-svn: 93190
2010-01-11 21:58:49 +00:00
Douglas Gregor 9dd13ab202 Allow redefinitions of typedef-names within class scope when the type
they redefine is a class-name but not a typedef-name, per C++0x
[dcl.typedef]p4. The code in the test was valid C++98 and is valid
C++0x, but an unintended consequence of DR56 made it ill-formed in
C++03 (which we were luck enough to implement). Fixes PR5455.

llvm-svn: 93188
2010-01-11 21:54:40 +00:00
Fariborz Jahanian 2990c029ad Fix a problem related to rewrite of anonymous unions.
(fixes radar 6948022)

llvm-svn: 93186
2010-01-11 21:17:32 +00:00
Benjamin Kramer 378083101c Fix pasto.
llvm-svn: 93181
2010-01-11 20:15:06 +00:00
Chris Lattner e3e76e2a69 Use the new isInteger() method in a couple places, some random cleanup, and
add a fixme.

llvm-svn: 93179
2010-01-11 19:58:10 +00:00
Douglas Gregor b90b66178e When resolving a single function template specialization to a
function, be sure to adjust the resulting argument type to a pointer
(if necessary). Fixes PR5910 and PR5949.

llvm-svn: 93178
2010-01-11 19:55:36 +00:00
Douglas Gregor 0662b16ad2 Test case for naming of conversion function template specializations
llvm-svn: 93177
2010-01-11 19:52:23 +00:00
Benjamin Kramer 0129bd7432 Avoid use of deprecated functions (CStrInCStrNoCase and StringsEqualNoCase).
llvm-svn: 93175
2010-01-11 19:46:28 +00:00
Douglas Gregor 2159182078 When computing surrogates for calls to a value of object type, look
for all visible conversion functions.

llvm-svn: 93173
2010-01-11 19:36:35 +00:00
Ken Dyck de37a67f50 Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in characters.
llvm-svn: 93171
2010-01-11 19:19:56 +00:00
David Chisnall c8fc573ea0 Fix type mismatch on 64-bit platforms (GNU ObjC).
llvm-svn: 93169
2010-01-11 19:02:35 +00:00
Douglas Gregor 217604ac71 Remove some pointless FIXMEs. No functionality change
llvm-svn: 93168
2010-01-11 19:00:50 +00:00
Douglas Gregor 133bc74d7a Add support for out-of-line definitions of conversion function
templates. Previously, a little thinko in the code that replaced a
conversion function template with its redeclaration was causing some
very weird lookup behavior.

llvm-svn: 93166
2010-01-11 18:53:25 +00:00
Douglas Gregor bb91767b82 Tighten up the "cannot return array or function type" diagnostic to
say either "array type" or "function type", whichever it is. No reason
to make the user guess.

llvm-svn: 93164
2010-01-11 18:46:21 +00:00
Douglas Gregor ea0a0a9b3f Implement name lookup for conversion function template specializations
(C++ [temp.mem]p5-6), which involves template argument deduction based
on the type named, e.g., given

  struct X { template<typename T> operator T*(); } x;

when we call

  x.operator int*();

we perform template argument deduction to determine that T=int. This
template argument deduction is needed for template specialization and
explicit instantiation, e.g.,

  template<> X::operator float*() { /* ... */ }

and when calling or otherwise naming a conversion function (as in the
first example). 

This fixes PR5742 and PR5762, although there's some remaining ugliness
that's causing out-of-line definitions of conversion function
templates to fail. I'll look into that separately.

llvm-svn: 93162
2010-01-11 18:40:55 +00:00
Fariborz Jahanian 9146e44124 Fixup rewrite of ivars accessed via an explicit object
in a function. Fixes radar 7522803.

llvm-svn: 93159
2010-01-11 17:50:35 +00:00
Ken Dyck 40775003e6 Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate. 

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, 
fromQuantity(), and getQuantity() for clarity.

llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Sebastian Redl 9a8dd0db89 Make Clang complain about taking the address of an unqualified member function. Fixes PR5985.
llvm-svn: 93150
2010-01-11 15:56:56 +00:00
Zhongxing Xu e47550e452 Enhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.
The old test case has a little mistake.

llvm-svn: 93148
2010-01-11 07:40:00 +00:00
Zhongxing Xu cbbf855432 Enhance SVals::getAsRegion: get the region that is converted to an integer.
This with previous patch fixes a OSAtomic test case.

llvm-svn: 93146
2010-01-11 06:52:53 +00:00
Chris Lattner 21d9b9a948 add a TODO for a perf improvement in LexIdentifier.
llvm-svn: 93141
2010-01-11 02:38:50 +00:00
Ted Kremenek be909b5eff Switch RegionStore over to using <BaseRegion+raw offset> to store
value bindings.  Along with a small change to OSAtomicChecker, this
resolves <rdar://problem/7527292> and resolves some long-standing
issues with how values can be bound to the same physical address by
not have the same "key".  This change is only a beginning; logically
RegionStore needs to better handle loads from addresses where the
stored value is larger/smaller/different type than the loaded value.
We handle these cases in an approximate fashion now (via
CastRetrievedVal and help in SimpleSValuator), but it could be made
much smarter.

llvm-svn: 93137
2010-01-11 02:33:26 +00:00
Ted Kremenek 8e994a2808 Preliminary reworking of value-binding logic in RegionStore:
(1) Introduce a new 'BindingKey' class to match 'BindingValue'.  This
gives us the flexibility to change the current key value from 'const
MemRegion*' to something more interesting.

(2) Rework additions/removals/lookups from the store to use new
'Remove', 'Add', 'Lookup' utility methods.

No "real" functionality change; just prep work and abstraction.

llvm-svn: 93136
2010-01-11 00:07:44 +00:00
Alexis Hunt 91b78382b5 Do not parse hexadecimal floating point literals in C++0x mode because they are
incompatible with user-defined literals, specifically with the following form:

  0x1p+1

The preprocessing-number token extends only as far as the 'p'; the '+' is not
included. Previously we could get away with this extension as p was an invalid
suffix, but now with user-defined literals, 'p' might well be a valid suffix
and we are forced to consider it as such.

This patch also adds a warning in non-0x C++ modes telling the user that
this extension is incompatible with C++0x that is enabled by default
(previously and with other languages, we warn only with a compliance
option such as -pedantic).

llvm-svn: 93135
2010-01-10 23:37:56 +00:00
Douglas Gregor 504a6ae83e Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for

  static_cast<type>(expr)

when we can have an expression, or

  using namespace identifier;

when we can have a using directive.

Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.

llvm-svn: 93134
2010-01-10 23:08:15 +00:00
Ted Kremenek ec144538ae Make sure this test case tests analyzing both x86_64 and i386 archs.
llvm-svn: 93133
2010-01-10 22:31:25 +00:00
Benjamin Kramer e056cea3a6 Silence MSVC warning.
RewriteObjC.cpp(4419) : warning C4804: '>' : unsafe use of type 'bool' in operation

llvm-svn: 93124
2010-01-10 19:57:50 +00:00
Anton Korobeynikov 3d364fddda Make clone() method out-of-line for Attr classes.
llvm-svn: 93120
2010-01-10 14:38:13 +00:00
Anton Korobeynikov b322c3a34b Try to make cmake happy
llvm-svn: 93119
2010-01-10 13:06:34 +00:00
Anton Korobeynikov 55bcea1e65 Generalize target weirdness handling having proper layering in mind:
1. Add helper class for sema checks for target attributes
 2. Add helper class for codegen of target attributes

As a proof-of-concept - implement msp430's 'interrupt' attribute.

llvm-svn: 93118
2010-01-10 12:58:08 +00:00
Anton Korobeynikov 89b14a4309 Rename file to generalization in next commits
llvm-svn: 93117
2010-01-10 12:57:30 +00:00
Benjamin Kramer 307c2c7ebc Simplify code. No functionality change.
llvm-svn: 93114
2010-01-10 09:51:00 +00:00
Zhongxing Xu 9635f6f5ef Enhance test case.
llvm-svn: 93101
2010-01-10 02:52:56 +00:00
Chris Lattner d081f8c851 stringref'ize a bunch of filename handling logic. Much
nicer than passing around two const char*'s.

llvm-svn: 93094
2010-01-10 01:35:12 +00:00
Chris Lattner e0d2e342b3 try to make this more stable?
llvm-svn: 93090
2010-01-10 00:59:17 +00:00
Daniel Dunbar d281a7146a Fix PR5982, a refacto in checking for '=' in a -D argument.
llvm-svn: 93088
2010-01-10 00:46:21 +00:00
Daniel Dunbar 620327d66b Fix a FIXME.
llvm-svn: 93087
2010-01-10 00:46:10 +00:00
Daniel Dunbar 1c4788b66b Darwin/ld: Don't pass '-weak_reference_mismatches non-weak' when
-weak_reference_mismatches is not present, it is the default.

llvm-svn: 93086
2010-01-10 00:46:00 +00:00
Chris Lattner 062a721c46 add comment to test.
llvm-svn: 93085
2010-01-10 00:36:16 +00:00
Chris Lattner abcbb7c05b clarify comment.
llvm-svn: 93084
2010-01-10 00:35:27 +00:00
Chris Lattner 2ceb625f59 implement rdar://7520940: published framework headers should
import other headers within the same framework with the full
framework path, not with a relative include.

llvm-svn: 93083
2010-01-10 00:24:58 +00:00
Ted Kremenek c6aa800eb3 Fix overzealous assertion in GRExprEngine::VisitLValue(). A
CallExpr/ObjCMessageExpr can be visited in an "lvalue" context if it
returns a struct temporary.  Currently the analyzer doesn't reason
about struct temporary returned by function calls, but we shouldn't
crash here either.

llvm-svn: 93081
2010-01-09 22:58:54 +00:00
Chris Lattner e23003d1f1 implement -ftabstop=width, patch by Christian Adåker
llvm-svn: 93078
2010-01-09 21:54:33 +00:00
Chris Lattner b71980f888 revert 91891, a workaround for PR5514.
llvm-svn: 93077
2010-01-09 21:45:57 +00:00
Chris Lattner bb8976e36e implement codegen support for preinc as an lvalue, PR5514.
llvm-svn: 93076
2010-01-09 21:44:40 +00:00
Chris Lattner 116ce8f172 refactor pre/postinc logic into CGF and require the caller to pass in the
lvalue to poke, no functionality change.

llvm-svn: 93075
2010-01-09 21:40:03 +00:00
Chris Lattner 34c72dd683 revert r92749, which is just dead code.
llvm-svn: 93074
2010-01-09 21:14:47 +00:00
Chris Lattner 5ed4390474 make missing prototypes warn by default in c99 mode like GCC does,
rdar://7083878

llvm-svn: 93073
2010-01-09 20:43:38 +00:00
Chris Lattner f9895c48fd add a bunch of missing prototypes to tests
llvm-svn: 93072
2010-01-09 20:43:19 +00:00
Ted Kremenek 9aa01441c3 Fix broken diagnostic when returning the address of a stack-allocated array.
llvm-svn: 93071
2010-01-09 20:05:00 +00:00
Benjamin Kramer 60fbd641ad Simplify with StringSwitch.
llvm-svn: 93064
2010-01-09 18:53:11 +00:00
Chris Lattner 09ac1b888c 2010 is here.
llvm-svn: 93063
2010-01-09 18:40:42 +00:00
Benjamin Kramer dc2f006f4e Hopefully unbreak build with g++ >= 4.3.
llvm-svn: 93060
2010-01-09 18:20:57 +00:00
Benjamin Kramer 2d6fda3205 Use MacroBuilder for TargetDefines instead of std::vector.
llvm-svn: 93058
2010-01-09 17:55:51 +00:00
Benjamin Kramer 3f6323dea5 Move MacroBuilder into Frontend/Utils.h and clean it up a bit.
llvm-svn: 93057
2010-01-09 17:43:21 +00:00
Benjamin Kramer f65e959035 Rework InitPreprocessor to use a MacroBuilder class instead of pushing around
std::vectors.

- MacroBuilder wraps a raw_ostream so it can easily write to any buffer
  supported by raw_ostream.
- MacroBuilder's method take Twines for easy string concatenation (this was done
  with sprintf and temporary buffers before).
- Targets still use std::vector as they don't have access to the builder.

llvm-svn: 93051
2010-01-09 16:17:37 +00:00
Kovarththanan Rajaratnam e8ed5be89f Switch UndefineBuiltinMacro() over to using StringRef
llvm-svn: 93049
2010-01-09 09:31:32 +00:00
Kovarththanan Rajaratnam 2f14619d89 Switch DefineBuiltinMacro() over to using StringRef
llvm-svn: 93048
2010-01-09 09:27:11 +00:00
Zhongxing Xu f1eeb78ffc When binding an rvalue to a reference, create a temporary object. Use
CXXObjectRegion to represent it. 

In Environment, lookup a literal expression before make up a value for it.

llvm-svn: 93047
2010-01-09 09:16:47 +00:00
Chris Lattner 002ba6b4d0 improve support for dragonfly, patch by Sascha Wildner!
llvm-svn: 93044
2010-01-09 05:41:14 +00:00
Mike Stump b3ed45b67c Fix indentation.
llvm-svn: 93023
2010-01-08 19:28:41 +00:00
Mike Stump 9620622431 Add in final overrider logic.
llvm-svn: 93022
2010-01-08 19:25:36 +00:00
Ted Kremenek b92304b42f Fix handling in GRExprEngine of 'default' branch in switch statements
when the default case is winnowed down to be infeasible.  When all
cases were ruled out (and the analysis state for the default case
would be infeasible) we would still consider the default case
possible.  This fixes PR 5969.

llvm-svn: 93017
2010-01-08 18:54:04 +00:00
John McCall af07fbe210 Organize testcase into namespaces.
llvm-svn: 93015
2010-01-08 18:40:32 +00:00
Ted Kremenek ea903067e1 For now, add back clang_getDeclSource().
llvm-svn: 93003
2010-01-08 17:11:32 +00:00
John McCall 12f97bc48a Change the printing of OR_Deleted overload results to print all the candidates,
not just the viable ones.  This is reasonable because the most common use of
deleted functions is to exclude some implicit conversion during calls;  users
therefore will want to figure out why some other options were excluded.

Started sorting overload results.  Right now it just sorts by location in the
translation unit (after putting viable functions first), but we can do better than
that.

Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better
self-documentation.

llvm-svn: 92990
2010-01-08 04:41:39 +00:00
Dan Gohman d1e76b957b Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971.

llvm-svn: 92987
2010-01-08 02:20:44 +00:00
Fariborz Jahanian 39d70940e4 clang ObjC rewriter: generated code used in "for (x in y)" loop uses
incorrect cast, causing compile error (fixes radar 7342867).

llvm-svn: 92986
2010-01-08 01:29:44 +00:00
John McCall d322416233 Reorganize PrintOverloadCandidates. No functionality change.
llvm-svn: 92979
2010-01-08 00:58:21 +00:00
Eli Friedman 5866fe306d Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.

llvm-svn: 92976
2010-01-08 00:50:11 +00:00
Douglas Gregor fa1e36d0de Improve the fix-its for -Wparentheses to ensure that the fix-it
suggestions follow recovery. Additionally, add a note to these
diagnostics which suggests a fix-it for changing the behavior to what
the user probably meant. Examples:

t.cpp:2:9: warning: & has lower precedence than ==; == will be evaluated first
      [-Wparentheses]
  if (i & j == k) {
        ^~~~~~~~
          (     )
t.cpp:2:9: note: place parentheses around the & expression to evaluate it first
  if (i & j == k) {
        ^
      (    )

t.cpp:14:9: warning: using the result of an assignment as a condition
without
      parentheses [-Wparentheses]
  if (i = f()) {
      ~~^~~~~
      (      )
t.cpp:14:9: note: use '==' to turn this assignment into an equality
comparison
  if (i = f()) {
        ^
        ==

llvm-svn: 92975
2010-01-08 00:20:23 +00:00
David Chisnall df34917a38 Export a public symbol for classes with the GNU runtime.
llvm-svn: 92973
2010-01-08 00:14:31 +00:00
Ted Kremenek 32b79317a2 More crashtracer enhancements to CIndex. When "popping" a crashtracer string
restore to the one most recently created.

llvm-svn: 92959
2010-01-07 23:13:53 +00:00
Douglas Gregor b15af899fb Add an "implicit" bit to CXXThisExpr, so that we can track
implicitness without losing track of the (logical or actual) location
where "this" would occur in the source.

llvm-svn: 92958
2010-01-07 23:12:05 +00:00
Fariborz Jahanian bc6811c32e Fixes a bug where we were rewriting two definitions of
_objc_method (part of radar 7490408).

llvm-svn: 92957
2010-01-07 22:51:18 +00:00
Mike Stump a52cf2ca3f Add checker for type infos.
llvm-svn: 92956
2010-01-07 22:50:03 +00:00
Ted Kremenek 7a5ede2ff0 Tidy up crashtracer logic in CIndex.
llvm-svn: 92955
2010-01-07 22:49:05 +00:00
Mike Stump 0015eb93c6 Add checked for VTTs.
llvm-svn: 92954
2010-01-07 22:28:10 +00:00
Mike Stump 24e9b0048c Detailed vtable checker.
llvm-svn: 92953
2010-01-07 22:21:26 +00:00
Fariborz Jahanian 1444230c40 Fixes a bug in my last patch (related to radar 7490331).
llvm-svn: 92952
2010-01-07 22:15:31 +00:00
Mike Stump 441793352d 1/2 off all structs should not have any virtual functions.
Replace magic numbers with uuids.

llvm-svn: 92941
2010-01-07 20:55:28 +00:00
Mike Stump 2a83635337 Add a descriptive tag to each line to make the exact differences
easier to understand.

llvm-svn: 92932
2010-01-07 19:39:43 +00:00
John McCall 64fe233704 When parsing an identifier as an expression in C++, only try to annotate it
as a type or scope token if the next token requires it.

This eliminates a lot of redundant lookups in C++, but there's room for
improvement;  a better solution would do a single lookup whose kind and
results would be passed through the parser.

llvm-svn: 92930
2010-01-07 19:29:58 +00:00
Mike Stump bd0c5da5fc Don't use two argument mixing function.
llvm-svn: 92929
2010-01-07 19:24:27 +00:00
Mike Stump a771b0ad52 Also generate the .s files.
llvm-svn: 92928
2010-01-07 19:19:39 +00:00
Mike Stump 53b926c56f Add a testcase generator for vtable/rtti testing. WIP.
llvm-svn: 92927
2010-01-07 18:58:28 +00:00
Fariborz Jahanian 9ab6349f2a Avoid error when convering a pointer to integer in
rewriting.

llvm-svn: 92925
2010-01-07 18:31:42 +00:00
Fariborz Jahanian 0f3aecf272 Fix rewriting of ivars. Fixes radar 7490331.
llvm-svn: 92924
2010-01-07 18:18:32 +00:00
Kovarththanan Rajaratnam 49c8da95a3 Convert from char pointer to char array
llvm-svn: 92923
2010-01-07 18:11:14 +00:00
Ted Kremenek db2ef3732f Fix typo: rename Rewriter::getRewritenText() -> Rewriter::getRewrittenText().
llvm-svn: 92922
2010-01-07 18:00:35 +00:00
Kovarththanan Rajaratnam b53c7d4d9d Tigthen scope of local char array
llvm-svn: 92917
2010-01-07 16:01:54 +00:00
Nuno Lopes 950d5b2cd3 fix PR5869: mangle static symbols like gcc does to make it easier to diff symbol tables
llvm-svn: 92911
2010-01-07 09:36:51 +00:00
Douglas Gregor 3a08dcc156 Test linkage of typeinfo and typeinfo names for class templates
llvm-svn: 92897
2010-01-07 04:09:30 +00:00
John McCall 0237485287 Improve the lead diagnostic for C++ object subscript expressions with
no viable overloads.  Use a different message when the class provides
no operator[] overloads at all; use it for operator(), too.

Partially addresses PR 5900.

llvm-svn: 92894
2010-01-07 02:04:15 +00:00