Commit Graph

19100 Commits

Author SHA1 Message Date
Mike Stump 3f6f9febad Implement additional undefined checks for additional loads and stores. WIP.
llvm-svn: 91498
2009-12-16 02:57:00 +00:00
Anders Carlsson afb2dade0c Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename Action::FullExpr to Action::MakeFullExpr to avoid name clashes.
llvm-svn: 91494
2009-12-16 02:09:40 +00:00
John McCall 0db42252f7 Successive anonymous namespaces name the same scope. I misinterpreted the
standard the last time.  Fixes PR5766.

llvm-svn: 91493
2009-12-16 02:06:49 +00:00
Douglas Gregor 85dabae6ad Switch the C++ new expression over to InitializationSequence, rather
than using its own partial implementation of initialization. 

Switched CheckInitializerTypes over to
InitializedEntity/InitializationKind, to help move us closer to
InitializationSequence.

Added InitializedEntity::getName() to retrieve the name of the entity,
for diagnostics that care about such things.

Implemented support for default initialization in
InitializationSequence.

Clean up the determination of the "source expressions" for an
initialization sequence in InitializationSequence::Perform.

Taught CXXConstructExpr to store more location information.

llvm-svn: 91492
2009-12-16 01:38:02 +00:00
Fariborz Jahanian e8d28904b0 Diagnose attempting to assign to a sub-structure of an ivar
using objective-c property. (fixes radar 7449707)

llvm-svn: 91474
2009-12-15 23:59:41 +00:00
Ted Kremenek 9158fb748c Remove ValueManager::getRegionValueSymbolValOrUnknown(). It was just extra veneer on top of getRegionValueSymbolVal().
llvm-svn: 91471
2009-12-15 23:23:27 +00:00
John McCall e9f92a017c Link up member-class redeclarations during template instantiation.
This test courtesy of LLVM.

llvm-svn: 91462
2009-12-15 22:29:06 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Fariborz Jahanian 2b9fc83db5 Fixes a code gen bug related to accessing a now
non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).

llvm-svn: 91455
2009-12-15 21:34:52 +00:00
Anders Carlsson 6e997b2993 ShouldDestroyTemporaries? I don't think so.
llvm-svn: 91450
2009-12-15 20:51:39 +00:00
Chris Lattner 1316249ad2 enable reuse of MacroArgs objects. This is a small (2.5%) win
on PR5610 (2.185 -> 2.130s).  The big issue is that this is making
insanely huge macro argument lists with over a million tokens in it.
The reason that mallco and free are so expensive is that we are 
actually going to the kernel to get it, and switching to a bump 
pointer allocator won't change this in an interesting way.

llvm-svn: 91449
2009-12-15 20:48:12 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Anders Carlsson 714d0969b3 If a ParmVarDecl's default argument is a CXXExprWithTemporaries, return the underlying expr instead. Add getNumDefaultArgTemporaries and getDefaultArgTemporary which returns the temporaries a default arg creates.
llvm-svn: 91439
2009-12-15 19:16:31 +00:00
Nate Begeman ac8183a830 Support OpenCL 1.1 odd-length vector component accessors.
For hi/odd of an odd-length vector, the last component is undefined.  Since
we shuffle with an undef vector, no CodeGen needs to change to support this.

llvm-svn: 91437
2009-12-15 18:13:04 +00:00
Mike Stump 4ec1237106 Add testcase for recent checkin.
Patch by Chip Davis.

llvm-svn: 91436
2009-12-15 18:02:45 +00:00
Fariborz Jahanian d1a2d5719a Implement conditional block invocation rewrite
and some clean up and a block rewriter test.

llvm-svn: 91435
2009-12-15 17:30:20 +00:00
Douglas Gregor 906db8a546 Fix some diagnostic-related FIXMEs, from Nicola Gigante
llvm-svn: 91433
2009-12-15 16:44:32 +00:00
Douglas Gregor dce7d0e8d9 Elaborated types are specifier types, based on a patch from Cornelius
llvm-svn: 91431
2009-12-15 16:28:32 +00:00
Zhongxing Xu 765f3e4f35 Add comments.
llvm-svn: 91430
2009-12-15 09:32:42 +00:00
Zhongxing Xu 950978a44b Remove displayProgress parameter.
llvm-svn: 91429
2009-12-15 09:09:49 +00:00
Chris Lattner 13b3928d62 move isPodLike<clang::QualType> out to Type.h. We don't
want some clients of QualType to think it's a pod and some to 
not know it is.

llvm-svn: 91424
2009-12-15 07:30:12 +00:00
Chris Lattner 2f3da9b205 update to match LLVM API change:
Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91422
2009-12-15 07:26:51 +00:00
Daniel Dunbar f6da2951b6 Add -W[no-]variadic-macros support.
llvm-svn: 91415
2009-12-15 05:29:09 +00:00
Daniel Dunbar 3031aea9cd Forward -isysroot to clang -cc1.
llvm-svn: 91414
2009-12-15 04:55:58 +00:00
Daniel Dunbar 95d40a6701 Fix a COVTCTII (crash-on-valid-that-clang-thinks-is-invalid, duh),
note_previous_decl was used where note_previous_declaration was intended. Better
names or PR5785 might be nice.

llvm-svn: 91413
2009-12-15 04:24:24 +00:00
Ted Kremenek 29f3808667 Until we can make the dead stores checker smarter, dont' emit dead store warnings for C++ objects (whose constructors/destructors have possible side-effects).
llvm-svn: 91412
2009-12-15 04:12:12 +00:00
Eli Friedman 2151725325 Fix a small bug in ComputeMethodVtableIndices.
llvm-svn: 91411
2009-12-15 03:31:17 +00:00
Eli Friedman 8d83842761 Really fix this test.
llvm-svn: 91409
2009-12-15 03:22:41 +00:00
Mike Stump feb1945fee This patch should fix PR2461. It allows clang to apply the noreturn
attribute to function pointers. It also fixes Sema to check function
pointers for the noreturn attribute when checking for fallthrough.

Patch by Chip Davis, with a slight fix to pass the testsuite.

llvm-svn: 91408
2009-12-15 03:11:10 +00:00
Ted Kremenek f65a0c6768 scan-build/ccc-analyzer: start analyzing C++ FTW.
llvm-svn: 91398
2009-12-15 02:35:54 +00:00
Eli Friedman a2761ba52f Fix test broken by my last commit.
llvm-svn: 91396
2009-12-15 02:20:06 +00:00
John McCall 9003406096 Diagnose the use of typedefs for template specialization types in the scope
specifiers for out-of-line declarations, e.g.
  typedef Temp<int> MyTemp;
  template <> MyTemp::foo;

llvm-svn: 91395
2009-12-15 02:19:47 +00:00
Eli Friedman d777cccb47 Don't force the emission of destructor definitions.
llvm-svn: 91394
2009-12-15 02:06:15 +00:00
Chris Lattner d19564b109 set up the machinery for a MacroArgs cache hanging off Preprocessor.
We creating and free thousands of MacroArgs objects (and the related
std::vectors hanging off them) for the testcase in PR5610 even though
there are only ~20 live at a time.  This doesn't actually use the 
cache yet.

llvm-svn: 91391
2009-12-15 01:51:03 +00:00
Ted Kremenek c98cdd175a Start the ball rolling on C++ support in the static analyzer. For
now, don't construct CFGs that contain C++ try/catch statements, and
have GRExprEngine abort a path if it encounters a C++ construct it
doesn't understand (which is mostly everything at this point).

llvm-svn: 91389
2009-12-15 01:38:04 +00:00
Mike Stump cf16d2cc42 Fix spacing.
llvm-svn: 91386
2009-12-15 01:22:35 +00:00
Daniel Dunbar 34e0b8cdee Driver: Pass -resource-dir to clang -cc1, since the driver presumably already found itself.
llvm-svn: 91384
2009-12-15 01:02:52 +00:00
Mike Stump 9a4e0128a8 Ensure we preserve line information for each trap for
-fcatch-undefined-behavior if we aren't optimizing.  WIP.

llvm-svn: 91382
2009-12-15 00:59:40 +00:00
Mike Stump e8c3b3eca4 Switch codegen for -fcatch-undefined-bahavior over to __builtin_trap
instead of abort to improve codesize and codegen.

llvm-svn: 91374
2009-12-15 00:35:12 +00:00
Ted Kremenek 1668046db1 Update checker build.
llvm-svn: 91373
2009-12-15 00:32:46 +00:00
Daniel Dunbar a5a166d01a Add -resource-dir to clang -cc1, this allows the base directory for compiler
resources (e.g., /usr/lib/clang/1.1) to be passed on the command line instead of
computed.

llvm-svn: 91370
2009-12-15 00:06:45 +00:00
Douglas Gregor 7dc42e5d4c Implement value initialization in InitializationSequence; untested
WIP, yet again.

llvm-svn: 91368
2009-12-15 00:01:57 +00:00
Mike Stump 68943780a6 Add documentation for recently added code. WIP.
llvm-svn: 91367
2009-12-14 23:53:10 +00:00
John McCall 2079d0b974 Fix PR5716 by bandaging over the solution until we can come back to it.
I apologize for friend declarations.

llvm-svn: 91359
2009-12-14 23:19:40 +00:00
Fariborz Jahanian 3914ee8fcd Make test more generic.
llvm-svn: 91349
2009-12-14 22:17:35 +00:00
Ted Kremenek 814c416636 Fix: <rdar://problem/7468209> SymbolManager::isLive() should not crash on captured block variables that are passed by reference
llvm-svn: 91348
2009-12-14 22:15:06 +00:00
Mike Stump 590d18f103 We have to allow one to form an address for one past the end. WIP.
llvm-svn: 91347
2009-12-14 22:14:31 +00:00
Chris Lattner ffbf2de1d8 move the VarargsElided member of MacrosArgs to shrink the MacroArgs struct
on 64-bit targets.  Pass Preprocessor into create/destroy methods of MacroArgs
even though it isn't used yet.

llvm-svn: 91345
2009-12-14 22:12:52 +00:00
Chris Lattner d2fa78d0bd fix typo
llvm-svn: 91343
2009-12-14 22:02:43 +00:00
Mike Stump ba6a0c40c4 Add support for detecting undefined shift behavior. WIP.
llvm-svn: 91341
2009-12-14 21:58:14 +00:00
Fariborz Jahanian 9ac0a04b29 Patch to fix 32-bit @try failure with internal assertion when compiling
an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).

llvm-svn: 91335
2009-12-14 21:35:01 +00:00
Douglas Gregor 4881735736 Remove accidental commit containing local paths for the LLVM-Code-Syntax test
llvm-svn: 91326
2009-12-14 20:58:24 +00:00
Douglas Gregor 4f84661c43 Minor cleanups for constructor initialization in InitializationSequence
llvm-svn: 91325
2009-12-14 20:57:13 +00:00
Mike Stump f8858af909 Simplifiy.
llvm-svn: 91324
2009-12-14 20:52:00 +00:00
Douglas Gregor 1e7ffa7571 Constructor initialization for InitializationSequence. Untested WIP.
llvm-svn: 91323
2009-12-14 20:49:26 +00:00
Douglas Gregor d196a58b55 Improve template instantiation for object constructions in several ways:
- During instantiation, drop default arguments from constructor and
    call expressions; they'll be recomputed anyway, and we don't want
    to instantiate them twice.
  - Rewrote the instantiation of variable initializers to cope with
    non-dependent forms properly.

Together, these fix a handful of problems I introduced with the switch
to always rebuild expressions from the source code "as written."

llvm-svn: 91315
2009-12-14 19:27:10 +00:00
Fariborz Jahanian d83359ac82 Make test pass in all cases.
llvm-svn: 91309
2009-12-14 18:38:32 +00:00
Fariborz Jahanian df9f4c6655 Fixes an incomplete test case.
llvm-svn: 91304
2009-12-14 18:18:29 +00:00
Fariborz Jahanian a01b67d7b0 Make tests use the new clang -cc1 flag.
llvm-svn: 91303
2009-12-14 18:00:56 +00:00
Fariborz Jahanian 6ec5119b5f Make tests use the new clang cc1 flag.
llvm-svn: 91300
2009-12-14 17:51:07 +00:00
Fariborz Jahanian c749f2b62f Make tests use the new clang -cc1 flag.
llvm-svn: 91299
2009-12-14 17:47:10 +00:00
Fariborz Jahanian 0a47cdfeef Make tests use the new clang -cc1 flag.
llvm-svn: 91298
2009-12-14 17:43:07 +00:00
Fariborz Jahanian 0399c1c9c0 Change tests to use clang -cc1...
llvm-svn: 91297
2009-12-14 17:36:25 +00:00
Douglas Gregor 540c3b0e50 Implement user-defined conversions in InitializationSequence. WPI that
isn't turned on anyway yet, so it cannot be tested.

llvm-svn: 91294
2009-12-14 17:27:33 +00:00
Fariborz Jahanian 5dc61d7ab5 Test uses the new clang.
llvm-svn: 91292
2009-12-14 17:14:55 +00:00
Fariborz Jahanian 4ee3981574 Tests use the new clang.
llvm-svn: 91290
2009-12-14 17:13:18 +00:00
Douglas Gregor db121bad2a When rebuilding CXXConstructExprs after a transformation, use
CompleteConstructorCall to perform type-checking.

llvm-svn: 91279
2009-12-14 16:27:04 +00:00
Zhongxing Xu 27f686f8ec Replace clang-cc with clang -cc1.
llvm-svn: 91272
2009-12-14 06:34:20 +00:00
Chris Lattner 7c027ee4c2 teach clang to recover gracefully from conflict markers left in source
files: PR5238.

llvm-svn: 91270
2009-12-14 06:16:57 +00:00
Nate Begeman 67dfd4236a Revert mmx palignr to use an intrinsic, since mmx shuffle patterns are missing.
llvm-svn: 91269
2009-12-14 05:15:02 +00:00
Chris Lattner f290e005e4 this was a couple bugzillas too
llvm-svn: 91267
2009-12-14 05:03:13 +00:00
Chris Lattner 4c53c40a4c fix rdar://7466570 - Be more bug compatible with GCC when it comes to
expanding directives withing macro expansions.  This is undefined behavior
according to 6.10.3p11, so we might as well be undefined in ways similar to
GCC.

llvm-svn: 91266
2009-12-14 05:00:18 +00:00
Chris Lattner b8132253c8 filecheckize
llvm-svn: 91265
2009-12-14 04:57:53 +00:00
Nate Begeman 72ec6bc6f4 Support x86's PALIGNR instruction without the use of a palignr intrinsic.
llvm-svn: 91264
2009-12-14 04:57:03 +00:00
Chris Lattner 8cf1f935c2 formatting changes.
llvm-svn: 91263
2009-12-14 04:54:40 +00:00
Chris Lattner 676268e45a reduce indentation.
llvm-svn: 91262
2009-12-14 04:26:45 +00:00
Zhongxing Xu cf86de4067 Use insert to avoid destroying existing nodes.
llvm-svn: 91258
2009-12-14 02:13:39 +00:00
Anders Carlsson e66e2942fc Mangle unary, binary and ternary expressions correctly.
llvm-svn: 91257
2009-12-14 01:45:37 +00:00
Anders Carlsson 8911229187 Rename dump to dumpDeclContext, so that call RD->dump() won't dump the decl context by default.
llvm-svn: 91256
2009-12-14 00:51:04 +00:00
Anders Carlsson c67974ccb1 Simplify BuildSimpleType in the RTTBuilder to avoid using an std::vector.
llvm-svn: 91255
2009-12-13 23:47:29 +00:00
Douglas Gregor 1aa450a078 Fix PR5756 a different, better way: we don't have a "pointer
conversion to void*" according to C++ [over.ics.rank]p4b2 if the type
we're converting from is not a pointer.

llvm-svn: 91254
2009-12-13 21:37:05 +00:00
Douglas Gregor 202eb8fcfd Don't assume that all conversions to a void pointer are converting
from a PointerType. Fixes PR5756.

llvm-svn: 91253
2009-12-13 21:29:20 +00:00
Douglas Gregor b08f1a7b32 Fix template instantiation for non-dependent calls to overloaded call
operators. Fixes PR5266.

llvm-svn: 91252
2009-12-13 20:44:55 +00:00
Anders Carlsson 399f499f0c Don't use a cookie if the global placement new function is used.
llvm-svn: 91251
2009-12-13 20:34:34 +00:00
Anders Carlsson adbe4249d6 Fix regression in my last commit - if a struct has a trivial destructor but no usual deallocation function we don't need a cookie.
llvm-svn: 91249
2009-12-13 20:10:12 +00:00
Anders Carlsson 21122cf657 More array cookie improvements.
llvm-svn: 91247
2009-12-13 20:04:38 +00:00
Anders Carlsson f5af8dead7 If the usual array deallocation function of a class takes two arguments, we need to pass the number of bytes allocated to the deallocation function, just not the number of bytes in a single element.
llvm-svn: 91246
2009-12-13 18:48:07 +00:00
Anders Carlsson f5056f8545 Fix test.
llvm-svn: 91245
2009-12-13 18:30:34 +00:00
Anders Carlsson 7e0b207e54 More improvements to checking allocation and deallocation functions.
llvm-svn: 91244
2009-12-13 17:53:43 +00:00
Anders Carlsson e7025c55a4 Change the RTTIBuilder's finish member function to take a pointer to the constants array + the length of the array.
llvm-svn: 91241
2009-12-13 16:38:01 +00:00
Daniel Dunbar 8d4a202aad Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong).
llvm-svn: 91238
2009-12-13 03:46:13 +00:00
Daniel Dunbar d613677ec9 CompilerInvocation: Move builtin-include-path logic out of CompilerInvocation::CreateFromArgs.
llvm-svn: 91237
2009-12-13 03:45:58 +00:00
Daniel Dunbar 85d2f8f875 Use clang -cc1 in test, to improve determinism.
llvm-svn: 91236
2009-12-13 02:20:49 +00:00
Daniel Dunbar 18a72959f5 Tests: Fix some bugs in clang_f_opts, options were out of order but it worked
because it had two inputs, except on Win32 where /dev/null doesn't exist.

llvm-svn: 91235
2009-12-13 02:00:23 +00:00
Chandler Carruth 8abbc657a9 Silence some release build warnings.
llvm-svn: 91234
2009-12-13 01:37:04 +00:00
Daniel Dunbar efa39f7db1 Backend: Switch to using TargetOptions or TargetMachine to set some options instead of llvm::cl.
llvm-svn: 91229
2009-12-12 23:01:36 +00:00
Fariborz Jahanian 751c1e7b24 patch to add a property from a protocol to a class that adopts the protocol.
(fixes radar 7466494).

llvm-svn: 91227
2009-12-12 21:26:21 +00:00
Ted Kremenek 3b90ed2628 Update checker build.
llvm-svn: 91222
2009-12-12 19:06:20 +00:00
Douglas Gregor 6131b44183 Rework the way we handle template instantiation for
implicitly-generated AST nodes. We previously built instantiated nodes
for each of these AST nodes, then passed them on to Sema, which was
not prepared to see already-type-checked nodes (see PR5755). In some
places, we had ugly workarounds to try to avoid re-type-checking
(e.g., in VarDecl initializer instantiation).

Now, we skip implicitly-generated nodes when performing instantiation,
preferring instead to build just the AST nodes that directly reflect
what was written in the source code. This has several advantages:

  - We don't need to instantiate anything that doesn't have a direct
    correlation to the source code, so we can have better location
    information.
  - Semantic analysis sees the same thing at template instantiation
    time that it would see for a non-template.
  - At least one ugly hack (VarDecl initializers) goes away.

Fixes PR5755.

llvm-svn: 91218
2009-12-12 18:16:41 +00:00
Zhongxing Xu c0484fa611 Add initial support for realloc() in MallocChecker.
llvm-svn: 91216
2009-12-12 12:29:38 +00:00
John McCall 9dab4e68b9 Remember the type name's scope specifier in the DeclSpec.
llvm-svn: 91215
2009-12-12 11:40:51 +00:00
Douglas Gregor fab31f47b2 When certain diagnostics involving run-time behavior would be emitted
in a potentially potentially evaluated context, queue those
diagnostics and only emit them if the context ends up being
potentially evaluated. This completes the fix for PR5761.

llvm-svn: 91213
2009-12-12 07:57:52 +00:00
Douglas Gregor c2744f5add Give PartialDiagnostic copy semantics rather than move semantics, since we typically pass it by reference
llvm-svn: 91212
2009-12-12 07:48:51 +00:00
Douglas Gregor 413c6fc86c Remove unnecessary pointers from PartialDiagnostic
llvm-svn: 91211
2009-12-12 07:31:50 +00:00
Douglas Gregor 7ca84af48e Suppress warnings and errors about certain uses of non-POD types (in
__builtin_offsetof, passing through an ellipsis) when we're in an
unevaluated context. This is the first part of the fix to PR5761,
which deals with the simple case of an unevaluated context.

llvm-svn: 91210
2009-12-12 07:25:49 +00:00
Jeffrey Yasskin 1615d45daa Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
no extra safety anyway.

llvm-svn: 91207
2009-12-12 05:05:38 +00:00
Eli Friedman 3950e8c411 Fix for PR4642: move work in HTMLPrinter out of the destructor.
llvm-svn: 91205
2009-12-12 03:36:52 +00:00
Anders Carlsson 60659a8249 Fix tyop.
llvm-svn: 91204
2009-12-12 02:43:16 +00:00
Mike Stump d954638f02 Implement runtime checks for undefined behavior. WIP.
This implements a new flag -fcatch-undefined-behavior.  The flag turns
on additional runtime checks for:

  T a[I];

  a[i]    abort when i < 0 or i >= I.

Future stuff includes shifts by >= bitwidth amounts.

llvm-svn: 91198
2009-12-12 01:27:46 +00:00
Ted Kremenek 752ecd8818 We should only scan for nested blocks if we are analyzing the body of a function/method.
llvm-svn: 91196
2009-12-12 01:04:14 +00:00
Daniel Dunbar 3c6d1b52a0 Remove clang-cc tool, it has joined in unholy union with clang.
- tools/driver will be renamed to tools/clang at some point.

llvm-svn: 91195
2009-12-12 00:56:47 +00:00
Ted Kremenek e1996c27eb Convert the remainder of this test case over to using FileCheck.
llvm-svn: 91194
2009-12-12 00:42:52 +00:00
Daniel Dunbar f075e62620 XFAIL this test on Win32 until I can take a look.
llvm-svn: 91193
2009-12-12 00:40:42 +00:00
Daniel Dunbar 62ee5340fc Remove non-sensical FIXME.
llvm-svn: 91192
2009-12-12 00:39:58 +00:00
Ted Kremenek eadc7c3537 Make using '-fshort-enums' an error until it is actually implemented (changes the ABI, so it is dangerous to not error out if we don't support it). Fixes <rdar://problem/7461006>.
llvm-svn: 91191
2009-12-12 00:38:18 +00:00
Anders Carlsson e363c8e1df Correctly diagnose [basic.stc.dynamic.allocation]p1
llvm-svn: 91190
2009-12-12 00:32:00 +00:00
Anders Carlsson 22f443f58c Factor operator new declaration checking out into a separate function.
llvm-svn: 91189
2009-12-12 00:26:23 +00:00
Anders Carlsson c0b2ce14cd More work on improving the operator delete diagnostics.
llvm-svn: 91187
2009-12-12 00:16:02 +00:00
Douglas Gregor 9221e646f5 Switch the Emacs clang-completion-mode over to clang -cc1
llvm-svn: 91185
2009-12-11 23:47:56 +00:00
Daniel Dunbar 01bf3397a0 Tests: Stop looking for clang-cc, we don't need it.
llvm-svn: 91183
2009-12-11 23:35:10 +00:00
Anders Carlsson f1f469554c Fix build.
llvm-svn: 91182
2009-12-11 23:31:21 +00:00
Anders Carlsson 12308f41e7 Improve diagnostics for malformed delete operator function declarations.
llvm-svn: 91180
2009-12-11 23:23:22 +00:00
Ted Kremenek f5303fe492 scan-build: when the build command is 'make', override the CC and CXX options by passing them as arguments to make. This fixes <rdar://problem/6790224>.
llvm-svn: 91179
2009-12-11 23:22:52 +00:00
Daniel Dunbar 0910cf54ac Update a few more docs references to clang-cc.
llvm-svn: 91178
2009-12-11 23:17:03 +00:00
Ted Kremenek f92b446dd4 Remove more old references to clang-cc.
llvm-svn: 91177
2009-12-11 23:12:52 +00:00
Daniel Dunbar 520d1e6c6b Update docs/comments/utils/examples to refer to clang -cc1 instead of clang-cc.
llvm-svn: 91176
2009-12-11 23:04:35 +00:00
Daniel Dunbar 6c536aa0fb Driver: Switch to using "clang" "-cc1" instead of "clang-cc".
llvm-svn: 91174
2009-12-11 23:00:49 +00:00
Daniel Dunbar 8c5024a63f Tests: Change substitution to automagically use 'clang -cc1' instead of 'clang-cc'. I still plan to eventually rewrite the tests to clarify the magic (I will probably actually rewrite them to %clang so it is more obvious this is a variable that gets substituted).
llvm-svn: 91173
2009-12-11 22:52:03 +00:00
Ted Kremenek 5c512e63f4 Convert scan-build and ccc-analyzer over to using 'clang -cc1' instead of using 'clang-cc'.
llvm-svn: 91172
2009-12-11 22:44:53 +00:00
Fariborz Jahanian ffe912c647 Patch to allow C-style cast from 'void *' to block pointer type.
(fixes radar 7465023).

llvm-svn: 91171
2009-12-11 22:40:48 +00:00
Daniel Dunbar f72bdf7eed Implement clang -cc1.
- I apologize for the link time horrors, my goal is to kill off clang-cc in fairly short order.

llvm-svn: 91170
2009-12-11 22:20:12 +00:00
John McCall 76d0994ffd StmtDumper::VisitUnresolvedLookupExpr
llvm-svn: 91163
2009-12-11 21:50:11 +00:00
Fariborz Jahanian 8811885366 Consider conversion of objective-c pointer to 'bool' a
valid standard conversion to match g++'s behaviour.

llvm-svn: 91157
2009-12-11 21:23:13 +00:00
Eli Friedman b095e15af4 Fix for PR5714: make sure globals that will be modified aren't marked const.
llvm-svn: 91156
2009-12-11 21:23:03 +00:00
Benjamin Kramer 4dab76a752 Switch PathDiagnostic to StringRef.
llvm-svn: 91155
2009-12-11 21:09:27 +00:00
Benjamin Kramer 2942150df0 Fix two typos.
llvm-svn: 91154
2009-12-11 20:53:46 +00:00
John McCall d53cee1aa0 Reorganize testcase.
llvm-svn: 91153
2009-12-11 20:51:23 +00:00
Eli Friedman 3ace52b3a7 Fix linkage of type info and vtable for classes without linkage.
llvm-svn: 91152
2009-12-11 20:48:18 +00:00
Eli Friedman 75c9b97123 Make sure mangling doesn't crash in another case. Add some more tests.
llvm-svn: 91149
2009-12-11 20:21:38 +00:00
John McCall 2b058ef245 Don't enter a new scope for a namespace-qualified declarator unless we're
in a file context.  In well-formed code, only happens with friend functions.
Fixes PR 5760.

llvm-svn: 91146
2009-12-11 20:04:54 +00:00
Douglas Gregor 3ef5952017 When code completion of an overload set fails, produce results for ordinary name lookup instead.
llvm-svn: 91141
2009-12-11 19:06:04 +00:00
Douglas Gregor 0f622367d3 Add a function's cv-qualifiers to the code-completion results as an
informative chunk.

llvm-svn: 91139
2009-12-11 18:44:16 +00:00
Douglas Gregor 800f2f0ff0 Teach code completion to instantiate templates when it needs to
llvm-svn: 91138
2009-12-11 18:28:39 +00:00
Douglas Gregor 7078839b0e Member function templates can occur after . or ->
llvm-svn: 91137
2009-12-11 18:14:22 +00:00
Eli Friedman 30e94d047e Fix for PR5706: let mangleName deal with mangling names without identifiers
correctly.

llvm-svn: 91136
2009-12-11 18:00:57 +00:00
Douglas Gregor 99fe2ad8c8 Tweak code-completion results by suppressing class template
specializations and class template partial specializations (they're
never named directly). Also, member access expressions only refer to
value declarations (fields, functions, enumerators, etc.) and
Objective-C property declarations; filter out everything else.

llvm-svn: 91133
2009-12-11 17:31:05 +00:00
Anders Carlsson b41a5c9308 XFAIL this for now, fixing linkage bugs causes the order of globals to change. Will fix later today.
llvm-svn: 91130
2009-12-11 17:01:29 +00:00
Anders Carlsson 1d6ad50826 Move info vectors and add assertions in preparation of moving the vector directly into RTTIBuilder.
llvm-svn: 91129
2009-12-11 16:41:51 +00:00
Anders Carlsson a0b98f083a Use GetAddrOfRTTI when getting the RTTI pointer for a base class.
llvm-svn: 91127
2009-12-11 16:37:06 +00:00
Douglas Gregor 83c49b56fe Class template (partial) specializations should not show up in code completion results
llvm-svn: 91125
2009-12-11 16:18:54 +00:00
Benjamin Kramer b11118bd0b Random string-related cleanups.
llvm-svn: 91119
2009-12-11 13:33:18 +00:00
Benjamin Kramer 8a4ad4adc1 Use StringRef.getAsInteger instead of temporary string + strtol. No intended functionality change.
llvm-svn: 91118
2009-12-11 13:26:32 +00:00
Eli Friedman 68396b16f6 Move the code for converting a member pointer to a bool so that it is usable
for logical not.

llvm-svn: 91112
2009-12-11 09:26:29 +00:00
Eli Friedman 1762cf2ad0 Fix for PR5718: implement equality comparisons for member function pointers.
llvm-svn: 91108
2009-12-11 07:36:43 +00:00
Ted Kremenek f6d9cebafd Enhance understanding of VarRegions referenced by a block whose declarations are outside the current stack frame. Fixes <rdar://problem/7462324>.
llvm-svn: 91107
2009-12-11 06:43:27 +00:00
Zhongxing Xu 9cb53b86af Completely evaluate malloc/free in MallocChecker.cpp.
llvm-svn: 91100
2009-12-11 03:09:01 +00:00
John McCall 0048c5115d Test member template using hiding.
llvm-svn: 91099
2009-12-11 02:55:56 +00:00
Anders Carlsson fd7dfeb779 Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
llvm-svn: 91098
2009-12-11 02:46:30 +00:00
Eli Friedman ad6c2e5b3a Fix a recent regression from the initialization changes.
llvm-svn: 91097
2009-12-11 02:42:07 +00:00
John McCall a17e83e437 Check if the target of a using decl is already declared in this scope before
doing any of the other redeclaration checks.  We were missing a few cases.
Fixes PR 5752.

llvm-svn: 91096
2009-12-11 02:33:26 +00:00
John McCall a009726ce3 Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.


We implement access declarations in terms of using declarations, which is
quite reasonable.  However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics.  This
isn't a priority, so I'll just file a PR and hope someone else does it. :)

llvm-svn: 91095
2009-12-11 02:10:03 +00:00
Chris Lattner 56caf31afb Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.
llvm-svn: 91094
2009-12-11 01:52:50 +00:00
Eli Friedman d0e6097bb0 Fix the handling of dependent enums per C++ DR 502.
llvm-svn: 91089
2009-12-11 01:34:50 +00:00
Anders Carlsson c988201417 Use named flags in RTTIBuilder::BuildPointerType.
llvm-svn: 91088
2009-12-11 01:27:37 +00:00
Anders Carlsson 0c6a7d8f42 When extending the lifetime of a temporary, make sure to emit a branch to the cleanup exit block. This fixes a broken module error in LLVMCConfigurationEmitter.cpp.
llvm-svn: 91086
2009-12-11 01:00:09 +00:00
Zhongxing Xu 1239de1592 Use 'class' instead of 'struct'.
llvm-svn: 91085
2009-12-11 00:55:44 +00:00
Anders Carlsson afd1edb52e When an exception needs to be freed by calling __cxa_exception_free, make sure to stash away the exception pointer somewhere.
This fixes an "Instruction does not dominate all uses!" verification error when compiling TableGen.

llvm-svn: 91084
2009-12-11 00:32:37 +00:00
Daniel Dunbar ff141799fb Remove this test for now, it is flaky.
llvm-svn: 91083
2009-12-11 00:27:30 +00:00
Daniel Dunbar 2f1a6c1104 FileManager: Do not cache failed stats, it is easy to construct common
inconsistent situations if we do, and they are not important for PCH performance
(which currently only needs the stats to construct the initial FileManager
entries).
 - No test case, sorry, the machinations are too involved.

This occurs when, for example, the build makes a PCH file and has a header map
or a -I for a directory that does not yet exist. It is possible we will cache
the negative stat on that directory, and then in the build we will never find
header files inside that dir.

For PCH we don't need these stats anyway for performance, so this also makes PCH
files smaller w/ no loss. I hope to eventually eliminate the stat cache
entirely.

llvm-svn: 91082
2009-12-11 00:27:20 +00:00
Fariborz Jahanian 73fab4f3f4 Patch to fix a crash trying to access a category name in
objective-c++ mode and also removed dead-code in this area.
(fixes radar 7456710).

llvm-svn: 91081
2009-12-11 00:26:36 +00:00
Mike Stump 18f4196792 Testcase for recent checkin.
llvm-svn: 91080
2009-12-11 00:10:15 +00:00
Mike Stump 6da5d75449 Implement just a bit more of inline assembly.
llvm-svn: 91079
2009-12-11 00:04:56 +00:00
Mike Stump 37077bf651 Fix spacing.
llvm-svn: 91078
2009-12-11 00:02:10 +00:00
Mike Stump e1f6280093 Don't complain about falling off the end of a function with an asm
block, if the function is supposed to return a value as we don't know
exactly what the asm code does.

llvm-svn: 91073
2009-12-10 22:57:48 +00:00
Douglas Gregor 01ddf7a65f clang_getCompletionChunkText() will treat optional strings as empty text blocks
llvm-svn: 91072
2009-12-10 22:46:19 +00:00
Eli Friedman d70bbfd7d8 Support unary type traits in a scalar context. Not that I've actually seen
this construct, but might as well for completeness.

llvm-svn: 91071
2009-12-10 22:40:32 +00:00
Eli Friedman ee275c82ff Clean up enum constants so that they're finally sane. Fixes PR3173 and a
recently introduced crash.

llvm-svn: 91070
2009-12-10 22:29:29 +00:00
Anders Carlsson 781161dc55 Make sure that explicitly instantiated functions get the right linkage.
llvm-svn: 91069
2009-12-10 22:25:34 +00:00
Douglas Gregor 96156a46e0 Beef up Clang-on-LLVM testing a bit, by making LLVM-Syntax recursive
(since we now parse all of the headers appropriately) and teaching
LLVM-Code-Syntax about the extra paths needed to parse the backends.

llvm-svn: 91068
2009-12-10 22:08:55 +00:00
Benjamin Kramer e9ff5fe2e6 Privatize class members.
llvm-svn: 91067
2009-12-10 21:50:21 +00:00
John McCall 7a2865a217 Actually try to trigger the last diagnostic in the declaration-collision test case.
Surprisingly, we *do* diagnose one of them.  Since we don't really track scopes into
instantiation, this has to signal some kind of bug.

llvm-svn: 91063
2009-12-10 21:17:25 +00:00
Fariborz Jahanian f63a028756 No need to add -x objecitve-c++
llvm-svn: 91060
2009-12-10 20:57:43 +00:00
Fariborz Jahanian 798d2bd546 Add support for finding composite type of twp objective-c pointers
in objective-c++ mode.

llvm-svn: 91059
2009-12-10 20:46:08 +00:00
John McCall e29c5cd239 Improve the diagnostic when a new declaration conflicts with a using shadow
declaration.  Rename note_using_decl to note_using, which is possibly less confusing.
Add a test for non-class-scope using decl collisions and be sure to note the case
we can't diagnose yet.

llvm-svn: 91057
2009-12-10 19:51:03 +00:00
Fariborz Jahanian a430f71406 Move composite type finding of two objective-c expressions
into its own helper method. No change in functionality.

llvm-svn: 91056
2009-12-10 19:47:41 +00:00
Douglas Gregor 5b747a169e Implement C++ DR437, which involves exception-specifications that name
a type currently being defined, from Nicola Gigante!

llvm-svn: 91052
2009-12-10 18:13:52 +00:00
Douglas Gregor 51e77d5ab0 Move initialization via initializer list over to InitializationSequences.
llvm-svn: 91050
2009-12-10 17:56:55 +00:00
John McCall 84d8767c15 Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not.  In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.

llvm-svn: 91045
2009-12-10 09:41:52 +00:00
Eli Friedman e919e382a4 Fix for PR5515: allow "merging" array bounds both forwards and backwards.
llvm-svn: 91044
2009-12-10 08:54:47 +00:00
Eli Friedman d011893e86 Test for r90950.
llvm-svn: 91043
2009-12-10 08:51:23 +00:00
Anders Carlsson bf56946073 Mangle static variables inside Objective-C methods in Objective-C++. We currently mangle them the same way as gcc does.
llvm-svn: 91042
2009-12-10 03:14:39 +00:00
Eli Friedman d5bc94e2eb Get rid of static variable.
llvm-svn: 91041
2009-12-10 02:21:21 +00:00
Chris Lattner 3c674cf804 If we enter parens, colons can become un-sacred, allowing us to emit
a better diagnostic in the second example.

llvm-svn: 91040
2009-12-10 02:08:07 +00:00
Chris Lattner 244b96ba0a fix a more evil case of : / :: confusion arising in ?:.
llvm-svn: 91039
2009-12-10 02:02:58 +00:00
Chris Lattner 17c3b1f278 fix incorrect parsing of bitfields pointed out by Doug. I chose
to use ColonProtectionRAIIObject in the C codepath even though it
won't matter for consistency.

llvm-svn: 91037
2009-12-10 01:59:24 +00:00
Anders Carlsson fefc7b8e7b Actually store the pointer into the global variable, spotted by Eli.
llvm-svn: 91036
2009-12-10 01:58:33 +00:00
Mike Stump 3c6a12ca65 Setup cleanup on eh edge out of the construction of the cleanup object
during throw to deallocate the exception object.  WIP.

llvm-svn: 91035
2009-12-10 01:52:30 +00:00
Chris Lattner 399df12fb1 minimal fix for PR5743
llvm-svn: 91032
2009-12-10 01:38:15 +00:00
Anders Carlsson a72ddd4609 Handle emitting static variables that have reference type.
llvm-svn: 91027
2009-12-10 01:05:11 +00:00
Anders Carlsson 364051c6a6 Separate generating code for static variables and global variables.
llvm-svn: 91026
2009-12-10 00:57:45 +00:00