Commit Graph

17546 Commits

Author SHA1 Message Date
Zhongxing Xu f9667229a1 Ignore parentheses when check the type of the expr.
llvm-svn: 86677
2009-11-10 08:33:44 +00:00
John McCall a31577ce9a Simple test case for [basic.lookup.udir].
llvm-svn: 86674
2009-11-10 07:56:40 +00:00
Zhongxing Xu 537db5d652 SizeofPointerChecker: Many false positives have the form 'sizeof *p'.
This is reasonable because people know what they are doing when they 
intentionally dereference the pointer.
So now we only emit warning when a pointer variable is use literally.

llvm-svn: 86673
2009-11-10 07:52:53 +00:00
Mike Stump d846d0825b Add vtable caching to prevent multiple vtables for the same class from
being generated.

Add the most derived vtable pointer to the VTT.

llvm-svn: 86671
2009-11-10 07:44:33 +00:00
John McCall f6c8a4ef1f Fix unqualified lookup through using directives.
This is a pretty minimal test case;  I'll make a better one later.

llvm-svn: 86669
2009-11-10 07:01:13 +00:00
Anders Carlsson ace5d07e50 When trying to assign a regular string literal to an Objective-C 'id' type or a pointer to an NSString, emit a code insertion hint that turns it into an Objective-C string. For example:
@class NSString;

@interface Test
+ (void)test:(NSString *)string;
@end

void g(NSString *a);

void f() {
  NSString *a = "Foo";
  g("Foo");
  [Test test:"Foo"];
}

will produce

t.m:10:17: warning: incompatible pointer types initializing 'char [4]', expected 'NSString *'
  NSString *a = "Foo";
                ^~~~~
                @
t.m:11:5: warning: incompatible pointer types passing 'char [4]', expected 'NSString *'
  g("Foo");
    ^~~~~
    @
t.m:12:14: warning: incompatible pointer types sending 'char [4]', expected 'NSString *'
  [Test test:"Foo"];
             ^~~~~
             @
3 diagnostics generated.

llvm-svn: 86665
2009-11-10 04:46:30 +00:00
Anders Carlsson 7ddc6a98a7 Don't try to emit null fixit hints.
llvm-svn: 86664
2009-11-10 04:36:33 +00:00
Zhongxing Xu 456706c205 Now we can safely use the argument expression's source range.
llvm-svn: 86663
2009-11-10 04:22:08 +00:00
Zhongxing Xu 9a7448ceef SizeofPointerChecker: If an explicit type specifier is used, do not issue warnings.
llvm-svn: 86662
2009-11-10 04:20:20 +00:00
Anders Carlsson 1566eb5a26 Use PP.getLocForEndOfToken as suggested by John.
llvm-svn: 86661
2009-11-10 03:32:44 +00:00
Zhongxing Xu 77c470e8c7 Use the source range of the whole sizeof expression, otherwise it crashes when
the argument is not an expression.

llvm-svn: 86660
2009-11-10 03:27:00 +00:00
Anders Carlsson 0b8ea554e5 If a function with a default argument is redefined and the new function also has a defualt argument then add a fixit hint that removes the default argument. Fixes PR5444.
llvm-svn: 86659
2009-11-10 03:24:44 +00:00
Anders Carlsson f5e98fcff4 Update xode project.
llvm-svn: 86658
2009-11-10 03:23:35 +00:00
Zhongxing Xu 70ba4908d0 Add test case for PointerSubChecker.
llvm-svn: 86657
2009-11-10 02:45:49 +00:00
Zhongxing Xu 80bbc6d138 Refine PointerSubChecker: compare the base region instead of the original
region, so that arithmetic within a memory chunk is allowed.

llvm-svn: 86652
2009-11-10 02:37:53 +00:00
Mike Stump 9f23a149cb Be sure to clear out VCall when we clear out VCalls.
Start implementing VTTs.  WIP.

llvm-svn: 86650
2009-11-10 02:30:51 +00:00
Zhongxing Xu f8f3f9ddbc Rename: StripCasts describes what it does better.
getBaseRegion will be used in another method.

llvm-svn: 86649
2009-11-10 02:17:20 +00:00
Mike Stump 3b9176985d Finish off mangling for the VTT.
llvm-svn: 86647
2009-11-10 01:58:37 +00:00
Mike Stump ef15744092 Add mangling for the construction vtable.
llvm-svn: 86643
2009-11-10 01:41:59 +00:00
Jeffrey Yasskin 612e38026a Fix clang's use of DenseMap iterators after r86636 fixed their constness.
Patch by Victor Zverovich!

llvm-svn: 86638
2009-11-10 01:17:45 +00:00
Daniel Dunbar a8b869e794 Simplify, following MemoryBuffer::getSTDIN API fix.
llvm-svn: 86633
2009-11-10 00:46:25 +00:00
Daniel Dunbar 69914f4134 Switch to getFileOrSTDIN().
llvm-svn: 86632
2009-11-10 00:46:19 +00:00
Daniel Dunbar 190401566e Remove some if-0'd code, we can resurrect this if we ever decide to support
continuing after invalid PCH loads.

llvm-svn: 86631
2009-11-10 00:46:12 +00:00
Douglas Gregor 983136e3a1 Move all of the type-printing logic to its own C++ source file
llvm-svn: 86629
2009-11-10 00:39:07 +00:00
Daniel Dunbar 60198df262 Add PreprocessorOptions to CompilerInvocation.
llvm-svn: 86623
2009-11-09 23:12:31 +00:00
Daniel Dunbar 4df9aa2388 Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now.

llvm-svn: 86617
2009-11-09 23:02:47 +00:00
Daniel Dunbar e213db84cb Move LangOptions, HeaderSearchOptions, and the target feature map into
CompilerInvocation.

llvm-svn: 86612
2009-11-09 22:46:17 +00:00
Daniel Dunbar d673bfa6aa Switch Target* to Target&.
llvm-svn: 86611
2009-11-09 22:46:09 +00:00
Daniel Dunbar 9707d8262b Add default initializer for Sysroot ivar.
llvm-svn: 86610
2009-11-09 22:46:04 +00:00
Daniel Dunbar 1de7855155 Change clang-cc to expect that all inputs have the same language (so we can only construct a single LangInfo). This matches how it is used in practice (since the compiler only it invokes it for one file at a time).
llvm-svn: 86609
2009-11-09 22:45:57 +00:00
Daniel Dunbar 06d4716297 (llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.
llvm-svn: 86608
2009-11-09 22:45:47 +00:00
Mike Stump 68ec7ee0e8 Enable the use of the new llvm objectsize intrinsic.
llvm-svn: 86607
2009-11-09 22:40:09 +00:00
Fariborz Jahanian a44e8d85a7 Further change in a comment.
llvm-svn: 86599
2009-11-09 22:28:08 +00:00
Fariborz Jahanian 3fe453c48c Removed a FIXME on nested type specifier warning.
llvm-svn: 86598
2009-11-09 22:25:11 +00:00
Fariborz Jahanian b98dade25b Changed error for nested type qualifier mismatch to
warning, to match gcc. It used to be warning, so
better keep it a warning (it broke a certain project).

llvm-svn: 86597
2009-11-09 22:16:37 +00:00
Douglas Gregor 4ef1d400d9 Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.

llvm-svn: 86596
2009-11-09 22:08:55 +00:00
Ted Kremenek dd51f7cca2 Remove stale FIXME.
llvm-svn: 86595
2009-11-09 21:56:44 +00:00
Douglas Gregor 8caea94c74 Make sure that we look into nested, transparent declaration contexts
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.

llvm-svn: 86591
2009-11-09 21:35:27 +00:00
Fariborz Jahanian facfdd4d93 For array pointee type, get its cvr qualifier from
its element type. Fixes pr5432.

llvm-svn: 86587
2009-11-09 21:02:05 +00:00
Daniel Dunbar b2eae89108 Add CompilerInvocation object, to capture all the options one needs to invoke
the compiler, and start flood filling it into clang-cc.

llvm-svn: 86586
2009-11-09 20:55:08 +00:00
Eli Friedman 0bf69cc7b7 Stub out a few more warning groups.
llvm-svn: 86585
2009-11-09 20:19:49 +00:00
Benjamin Kramer 382414d519 Fix build after r86579.
llvm-svn: 86584
2009-11-09 20:14:44 +00:00
Douglas Gregor 1bc688dc60 Make sure that we instantiate default function arguments for an
overloaded operator(). 

llvm-svn: 86581
2009-11-09 19:27:57 +00:00
Eli Friedman 9cf6b59400 Add additional note to mark the cause of synthesized constructors. Mark
declaration invalid if the constructor can't be properly built.  Addresses
remaining review comments from Fariborz for r86500.

llvm-svn: 86579
2009-11-09 19:20:36 +00:00
Douglas Gregor 36d7c5f29b Improve instantiation of default template arguments for nested
templates. The instantiation of these default arguments must be (and
now, is) delayed until the template argument is actually used, at
which point we substitute all levels of template arguments
concurrently.

llvm-svn: 86578
2009-11-09 19:17:50 +00:00
Benjamin Kramer 04c99a6fe8 Factor CXString creation into a helper method.
llvm-svn: 86577
2009-11-09 19:13:48 +00:00
Eli Friedman 56acd1e819 Add code generation test for r86500.
llvm-svn: 86574
2009-11-09 18:49:09 +00:00
Fariborz Jahanian 222c0b517e Test case for Sean Hunt's patch which I left out.
llvm-svn: 86573
2009-11-09 18:48:53 +00:00
Eli Friedman e4310c8273 Add support for cdecl attribute. (As far as I know, it doesn't affect CodeGen
unless we start implementing command-line switches which override the default
calling convention, so the effect is mostly to silence unknown attribute
warnings.)

llvm-svn: 86571
2009-11-09 18:38:53 +00:00
Douglas Gregor a8ab71bad7 Slightly more testing for instantiation of non-type template parameters in nested templates, for my own sanity's sake
llvm-svn: 86570
2009-11-09 18:29:00 +00:00
Benjamin Kramer d6f85a8c88 Writing to a struct passed by value is pointless. Remove dead code.
- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
  please change the method to take a pointer.

llvm-svn: 86568
2009-11-09 18:24:53 +00:00
Douglas Gregor f96ea29b39 Improve c-index-test's parsing of the -code-completion-at=file:line:column argument
llvm-svn: 86566
2009-11-09 18:19:57 +00:00
Anders Carlsson 2256497780 Add a triple to try to fix the buildbot error.
llvm-svn: 86563
2009-11-09 17:54:53 +00:00
Steve Naroff 8675d5c754 Introduce CXString type and associated functions clang_getCString() and clang_disposeString().
This abstraction will help us manage string memory for complex names that cross the C++/C boundary (e.g. ObjC methods, selectors). This patch also uses it in clang_getTranslationUnitSpelling (which I'm not sure is necessary). Will investigate later...since the extra malloc() can't hurt (for now).

Patch by John Thompson.

llvm-svn: 86562
2009-11-09 17:45:52 +00:00
Anders Carlsson 69999d9c23 __uint128_t is indeed an unsigned integer type. Fixes PR5435.
llvm-svn: 86561
2009-11-09 17:34:18 +00:00
Douglas Gregor d3d9306275 When transforming an InitListExpr, if we already computed a non-dependent type for the InitListExpr, keep it
llvm-svn: 86559
2009-11-09 17:16:50 +00:00
Douglas Gregor f81f528db1 C doesn't allow mixing declarations and statements, silly
llvm-svn: 86556
2009-11-09 17:05:28 +00:00
Douglas Gregor 5ea234dcec Simplify test to deal with type-based ordering variations
llvm-svn: 86552
2009-11-09 16:22:45 +00:00
Douglas Gregor 022d3c2f42 Verify that code-completion is at least a little bit robust against inclusion of missing headers
llvm-svn: 86551
2009-11-09 16:06:30 +00:00
Douglas Gregor 8b14f8fde4 Minor cleanup for CIndex-based code-completion:
- Provide an actual test for code-completion via CIndex. 
  - Actually print optional strings in c-index-test
  - Export clang_getCompletionChunkCompletionString from CIndex

llvm-svn: 86550
2009-11-09 16:04:45 +00:00
Douglas Gregor 44ab140001 Fix a broken link
llvm-svn: 86545
2009-11-09 15:15:41 +00:00
Zhongxing Xu 6d967cbd8e update test case.
llvm-svn: 86541
2009-11-09 13:56:44 +00:00
Zhongxing Xu ab0e27ff0c Add check for pointer arithmetic on non-array variables.
llvm-svn: 86538
2009-11-09 13:23:31 +00:00
Zhongxing Xu d6e7f9d4b2 Add check for obsolete function call of getpw().
llvm-svn: 86537
2009-11-09 12:19:26 +00:00
Zhongxing Xu d09b22aa5a remove redundant file name in CMakeLists.txt.
llvm-svn: 86536
2009-11-09 09:35:41 +00:00
Zhongxing Xu 08670a89aa update CMakeList.txt
llvm-svn: 86535
2009-11-09 09:32:38 +00:00
Daniel Dunbar 53272bbf40 Update CMake
llvm-svn: 86533
2009-11-09 08:13:45 +00:00
Zhongxing Xu f69973c858 Add comments.
llvm-svn: 86532
2009-11-09 08:13:04 +00:00
Zhongxing Xu f06c684a33 Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.
llvm-svn: 86529
2009-11-09 08:07:38 +00:00
Daniel Dunbar 65c0db98ab Update CMake
llvm-svn: 86528
2009-11-09 08:04:31 +00:00
Zhongxing Xu 85000203bb Put all long strings in 80-col.
llvm-svn: 86527
2009-11-09 07:29:39 +00:00
Zhongxing Xu 6c306c8b89 Add checker for CWE-587: Assignment of a Fixed Address to a Pointer.
llvm-svn: 86523
2009-11-09 06:52:44 +00:00
Zhongxing Xu 86b1e01c13 Add checker for CWE-469: Use of Pointer Subtraction to Determine Size. This
checker does not build sink nodes. Because svaluator computes an unknown value
for the subtraction now.

llvm-svn: 86517
2009-11-09 05:34:10 +00:00
Eli Friedman cc522d9ab3 Rearrange function to avoid recursive use-after-free.
llvm-svn: 86516
2009-11-09 05:07:37 +00:00
Eli Friedman a72bf0fae8 Explicitly note that pre-inc/dec lvalues are not supported yet, so that it
doesn't crash.  (Such expressions are valid in C++, but not in C.)

llvm-svn: 86513
2009-11-09 04:20:47 +00:00
Zhongxing Xu 1521c85c04 Remove dead code.
llvm-svn: 86512
2009-11-09 04:19:30 +00:00
Chris Lattner e6e64be1d9 fix thinko
llvm-svn: 86509
2009-11-09 04:04:07 +00:00
Eli Friedman cb29876839 Add hack to make the given testcase work. As far as I can tell, this change is
reasonably safe, but it doesn't seem like the right solution.

llvm-svn: 86508
2009-11-09 03:59:26 +00:00
Chris Lattner e5eb726e2e mention that clang defaults to C99 mode, PR5388
llvm-svn: 86507
2009-11-09 03:21:02 +00:00
Chris Lattner b8ca95481f remove a mostly obsolete "word of warning"
llvm-svn: 86506
2009-11-09 03:18:18 +00:00
Zhongxing Xu 0f92ec6ebd Add a test case for CWE-467, and simplify the wording of the warning.
llvm-svn: 86504
2009-11-09 02:28:12 +00:00
Daniel Dunbar 11c08c8e5b Rename areAllFields32Or64BitBasicType to canExpandIndirectArgument to closer match what it is semantically used for.
Also, fix a major bug where fields from a C++ struct might be dropped -- the expand action doesn't handle them correctly yet.

llvm-svn: 86502
2009-11-09 01:33:53 +00:00
Eli Friedman 96c0a3e6c2 Remove a useless variable that got left behind.
llvm-svn: 86501
2009-11-09 01:11:03 +00:00
Eli Friedman d7686ef31c Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors.  This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors.  This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.

llvm-svn: 86500
2009-11-09 01:05:47 +00:00
Eli Friedman fd8d4e1383 Fix use-after-free bug.
llvm-svn: 86485
2009-11-08 22:15:39 +00:00
Benjamin Kramer 489232c466 Update CMake file.
llvm-svn: 86479
2009-11-08 18:30:42 +00:00
Sebastian Redl 14236c8e82 Special-case default argument expression in instantiation. This should fix PR4301. Doug, please double-check my assumptions. Read the PR for more details.
llvm-svn: 86465
2009-11-08 13:56:19 +00:00
Zhongxing Xu b0a05f7ca1 Add a checker for CWE-467: Use of sizeof() on a Pointer Type.
llvm-svn: 86464
2009-11-08 13:10:34 +00:00
Sebastian Redl afb8be743d When checking the namespace of a redeclaration or definition, look through linkage specs. Fixes PR5430.
llvm-svn: 86461
2009-11-08 11:36:54 +00:00
Sebastian Redl 3752e1dbb4 Don't reprocess non-dependent initializers of non-dependent VarDecls. Fixes PR5426.
llvm-svn: 86460
2009-11-08 10:16:43 +00:00
Edward O'Callaghan 932c32043a Fix for FreeBSD toolchain in regards to CPP, Credit to Roman Divacky.
llvm-svn: 86459
2009-11-08 10:13:36 +00:00
Daniel Dunbar 7e215ea165 Add clarifying parens.
llvm-svn: 86457
2009-11-08 09:46:46 +00:00
Daniel Dunbar 3b339a3aa3 Simplify.
llvm-svn: 86456
2009-11-08 09:46:39 +00:00
Daniel Dunbar bd33c94d6f Revert unintentional change to this file.
llvm-svn: 86455
2009-11-08 09:46:33 +00:00
Alexis Hunt 6f3de50ca7 Test commit - minor terminology change to my recent patch suggested by John McCall
llvm-svn: 86442
2009-11-08 07:46:34 +00:00
Douglas Gregor 4100db6174 Always make sure we're using an unqualified type when building a
constructor name.  Fixes PR5418.

llvm-svn: 86441
2009-11-08 07:12:55 +00:00
Daniel Dunbar 2679a884d7 Move a function which returns a class outside of extern C scope.
llvm-svn: 86439
2009-11-08 04:13:53 +00:00
Daniel Dunbar a797946755 CIndex: Add temporary hack to leak memory instead of returning invalid pointers.
llvm-svn: 86438
2009-11-08 04:11:32 +00:00
Daniel Dunbar d90e0a113e Drop require_and_and argument.
llvm-svn: 86433
2009-11-08 01:47:35 +00:00
Daniel Dunbar 34546ce43d Remove RUN: true lines.
llvm-svn: 86432
2009-11-08 01:47:25 +00:00
Daniel Dunbar 6eb1201c90 Move test/Index input files into a sub directory (not scanned as tests).
llvm-svn: 86431
2009-11-08 01:46:19 +00:00
Daniel Dunbar 8b57697954 Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Daniel Dunbar 066967052c Rework site config for cmake to be generated at configure time, and only pass
the 'build_config' value in at runtime using the new lit runtime user parameter
feature.

This simplifies things and drops a dependency on 'sed', FWIW.

llvm-svn: 86421
2009-11-07 23:53:32 +00:00
Daniel Dunbar 8466a0d944 Tweak a FIXME.
llvm-svn: 86420
2009-11-07 23:53:17 +00:00
Anders Carlsson 5bbdc9f857 Handle member expressions where the member declaration is actually a static variable. Fixes PR5392.
llvm-svn: 86414
2009-11-07 23:16:50 +00:00
Anders Carlsson ea4c30b39a More LValue related code cleanup.
llvm-svn: 86413
2009-11-07 23:06:58 +00:00
Anders Carlsson 2ff6395ddc More cleanup, the code is much easier to follow now.
llvm-svn: 86412
2009-11-07 22:53:10 +00:00
Anders Carlsson 6eee97276b Reduce nesting, no functionality change.
llvm-svn: 86411
2009-11-07 22:46:42 +00:00
Anders Carlsson 03f83e58f7 We only need to call SetObjCNonGC for local variables. No functionality change.
llvm-svn: 86410
2009-11-07 22:43:34 +00:00
Anders Carlsson 509850ebec Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.
llvm-svn: 86407
2009-11-07 22:00:15 +00:00
Fariborz Jahanian d7aa9d8a63 Patch to gives an error that at least points users in the direction of the error, rather
than an error about incompatible types. Patch by Sean Hunt.

llvm-svn: 86402
2009-11-07 20:20:40 +00:00
Chris Lattner 3f5124815d commit test update
llvm-svn: 86396
2009-11-07 18:59:51 +00:00
Chris Lattner 5c67237ff6 teach the various targets what native integer types they have.
llvm-svn: 86395
2009-11-07 18:59:41 +00:00
Daniel Dunbar 4ba3b297e6 Fix some build warnings.
llvm-svn: 86393
2009-11-07 18:34:24 +00:00
Daniel Dunbar 5a3b974446 Add some missing libraries for CMake as well.
llvm-svn: 86390
2009-11-07 17:53:40 +00:00
Daniel Dunbar 05aaf77d6c Add some missing libraries.
llvm-svn: 86389
2009-11-07 17:52:11 +00:00
Douglas Gregor 358e7745ed Cope with calls to operator() templates. Fixes PR5419.
llvm-svn: 86387
2009-11-07 17:23:56 +00:00
Chris Lattner 15275e55ce add missing #include
llvm-svn: 86368
2009-11-07 09:22:46 +00:00
John McCall b61e9d03c1 Support -Wshorten-64-to-32 for integer types only, which seems to satisfy the
core requirements.  Fixes rdar://problem/6389954

llvm-svn: 86364
2009-11-07 09:03:53 +00:00
Anders Carlsson d3569efb5a Add bug number.
llvm-svn: 86357
2009-11-07 08:24:59 +00:00
John McCall b397956338 Improve -Wconversion by permitting binary operations on values of the target
type (or smaller) to stay "closed" within the type.

llvm-svn: 86356
2009-11-07 08:15:46 +00:00
Anders Carlsson f5dc6fa252 Don't treat variables with non-trivial ctors or dtors as unused. Fixes PR5407.
llvm-svn: 86352
2009-11-07 07:26:56 +00:00
Anders Carlsson 2889e0e72c Cleanup, no functionality change.
llvm-svn: 86351
2009-11-07 07:18:14 +00:00
Anders Carlsson c0a3561f0f Always mangle functions with special names. Fixes PR5420.
llvm-svn: 86350
2009-11-07 07:15:03 +00:00
Anders Carlsson 3d70975917 When instantiating a field decl, make sure to clone its attributes. With this change FileCheck no longer crashes when it's run without any arguments.
llvm-svn: 86344
2009-11-07 06:07:58 +00:00
Ted Kremenek 975a119f31 Use SaveAndRestore to simplify logic in LiveVariables::runOnAllBlocks(). Patch by Kovarththanan Rajaratnam!
llvm-svn: 86343
2009-11-07 05:57:35 +00:00
Daniel Dunbar 8ec8804de1 Switch clang-cc to use ApplyHeaderSearchOptions, and fix a thinko.
llvm-svn: 86341
2009-11-07 04:58:12 +00:00
Anders Carlsson ce21431fc4 When looking up and adding substitutions to the substitution table, make sure to always use the canonical declaration. With tihs change, FileCheck compiles and links but crashes during startup.
llvm-svn: 86339
2009-11-07 04:26:04 +00:00
Daniel Dunbar 08d5669b01 Add HeaderSearchOptions class, for packaging the information needed to
initialize HeaderSearch. Not used yet.

llvm-svn: 86338
2009-11-07 04:20:50 +00:00
Daniel Dunbar ec87991c8f Lift InitHeaderSearch::AddEnvVarPaths logic higher.
llvm-svn: 86337
2009-11-07 04:20:39 +00:00
Daniel Dunbar 6dc9638153 Formatting fixes.
llvm-svn: 86336
2009-11-07 04:20:25 +00:00
Daniel Dunbar 00f8a397c6 Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
filenames.

Also, move InitializePreprocessor to Utils.h.

llvm-svn: 86335
2009-11-07 04:20:15 +00:00
Daniel Dunbar b10ac0d708 Lift compiler builtin include path logic higher.
llvm-svn: 86334
2009-11-07 04:19:57 +00:00
Ted Kremenek ae3361de2d Remove Checker::CheckType() (and instead using CheckerVisitor::PreVisitDeclStmt()), and refactor VLASizeChecker to have only one Checker subclass (not two) and to not use the node builders directly (and instead use the newer CheckerContext).
llvm-svn: 86329
2009-11-07 03:56:57 +00:00
John McCall 554e857cf4 Test case for -Wconversion.
llvm-svn: 86327
2009-11-07 03:30:38 +00:00
John McCall fceb64bd04 Implement -Wconversion. Off by default, in the non-gcc group. There's
significant work left to be done to reduce the false-positive rate here.

llvm-svn: 86326
2009-11-07 03:30:10 +00:00
Steve Naroff eae650366d Add basic code completion support for ObjC messages.
Still a work in progress...

llvm-svn: 86323
2009-11-07 02:08:14 +00:00
Anders Carlsson 3d888e4548 Revert r86315 and add Type::FixedWidthInt to the FIXME cases.
llvm-svn: 86320
2009-11-07 01:19:37 +00:00
Devang Patel 22053c0f46 MIPS linkage name confuses gdb here. Generate and test DW_AT_name here.
llvm-svn: 86318
2009-11-07 00:41:37 +00:00
Devang Patel 5b39e2382f Do not assert if debug info for certain type is not generated.
llvm-svn: 86315
2009-11-07 00:29:05 +00:00
Devang Patel eef461c230 Do not emit linkage name for global variables. It confuses gdb, because it picks up AT_MIPS_linkage_name and ignores AT_name.
llvm-svn: 86308
2009-11-07 00:10:18 +00:00
Eli Friedman 01cad4c6b0 Make sure isCopyAssignment is only true for actual copy assignment operators,
instead of all assignment operators.  The mistake messes up IRGen because
it ends up assuming that the assignment operator is actually the implicit
copy assignment operator, and therefore tries to emit the RHS as an lvalue.

llvm-svn: 86307
2009-11-07 00:02:45 +00:00
Douglas Gregor 9eb7701dff Various improvements to Clang's code-completion infrastructure:
- Introduce more code-completion string "chunk" kinds that describe
  symbols, the actual text that the user is expected to type, etc.
  - Make the generation of macro results optional, since it can be
  slow
  - Make code-completion accessible through the C API, marshalling the
  code-completion results through a temporary file (ick) to maintain
  process separation.

The last doesn't have tests yet.

llvm-svn: 86306
2009-11-07 00:00:49 +00:00
Mike Stump cd6f9ed906 Refine the non-virtual this adjustment. Optimize out virtual this
adjustments of zero.

llvm-svn: 86300
2009-11-06 23:27:42 +00:00
Fariborz Jahanian 3600f41a3a Since default writable attribute is 'assign', allow
specification of 'assign' (no warning to be issued),
when a continuation class makes a 'readonly' attribute
'readwrite' but also specifies the 'assign' attribute.
(this matches gcc's behavior and prevents exessive 
 warnings)/

llvm-svn: 86297
2009-11-06 22:59:12 +00:00
Fariborz Jahanian 2f487126ce Make fragile-abi test run happy.
llvm-svn: 86293
2009-11-06 22:15:27 +00:00
Ted Kremenek 795c611cfa Make the VLASizeChecker implementation private, and its creation only known to GRExprEngineInternalChecks.cpp.
llvm-svn: 86292
2009-11-06 21:51:50 +00:00
Fariborz Jahanian 95239110cd Fix a bogus objective-c warning with -pedantic.
(radar 7370882).

llvm-svn: 86291
2009-11-06 21:48:47 +00:00
Ted Kremenek 53a70c055d Make the implementation of DivZeroChecker private.
llvm-svn: 86288
2009-11-06 20:47:51 +00:00
Fariborz Jahanian e8e631c912 Prevent a code gen. crash on empty unions - pr5408.
llvm-svn: 86287
2009-11-06 20:47:40 +00:00
Ted Kremenek e3423e84a9 testing: Merge PR3135.c into misc-ps-region-store.m.
llvm-svn: 86286
2009-11-06 20:32:38 +00:00
Ted Kremenek df9ca633b6 Sentence-case bug type, and pull tests from region-only-test.c into misc-ps-region.store.m (removing an extra unneeded test file). Also add a bunch of FIXME comments for future enhancements.
llvm-svn: 86282
2009-11-06 20:16:31 +00:00
Anders Carlsson 443f677302 Simplify the debug info code, handle lvalue references and template specializations.
llvm-svn: 86277
2009-11-06 19:19:55 +00:00
Fariborz Jahanian c2d71b531c This patch fixes code gen. part of pr5333 (Conversion
using elipsis conversion).

llvm-svn: 86276
2009-11-06 18:47:57 +00:00
Anders Carlsson 8a6512961f Handle QualifiedNameType and SubstTemplateTypeParmType types in CGDebugInfo::CreateTypeNode.
llvm-svn: 86274
2009-11-06 18:45:16 +00:00
Nuno Lopes ac5eba93ca add test case for PR3135 which was already fixed
llvm-svn: 86273
2009-11-06 18:42:13 +00:00
Anders Carlsson 25ed5c2f42 Don't assert when trying to generate debug info for vector types. This needs to be fixed eventually...
llvm-svn: 86268
2009-11-06 18:24:04 +00:00
John McCall e2c91e6b26 Don't warn -Wsign-compare if we're in an unevaluated context, and fixed
a typo pointed out by Fariborz.

llvm-svn: 86265
2009-11-06 18:16:06 +00:00
Chris Lattner 353fc1e447 update comment, pointed out by Gabor
llvm-svn: 86263
2009-11-06 18:10:47 +00:00
Chris Lattner 45540e91d1 add some const qualifiers, patch by Kovarththanan Rajaratnam!
llvm-svn: 86260
2009-11-06 18:01:14 +00:00
Chris Lattner 4f24225e8e indirectbr seems to work! Rip out the old code.
llvm-svn: 86256
2009-11-06 17:38:18 +00:00
Anders Carlsson eb9bc2ba82 Instead of returning a null DIType for unhandled types, assert.
llvm-svn: 86254
2009-11-06 17:01:39 +00:00
Zhongxing Xu 167bce9cf1 Add a checker for CWE-466: Return of Pointer Value Outside of Expected Range.
llvm-svn: 86252
2009-11-06 13:30:44 +00:00
John McCall e46fd8531c compare.c also needs a target triple now, and improve some comments while we're
at it.

llvm-svn: 86243
2009-11-06 08:53:51 +00:00
John McCall 99ce6bfe28 Improve the -Wsign-compare heuristics:
* If the unsigned type is smaller than the signed type, never warn, because
    its value will not change when zero-extended to the larger type.
  * If we're testing for (in)equality, and the unsigned value is an integer
    constant whose sign bit is not set, never warn, because even though the
    signed value might change, it can't affect the result of the equality.

Also make the comparison test cases much more rigorous, and have them expose
the subtle differences between C and C++ here.

llvm-svn: 86242
2009-11-06 08:49:08 +00:00
John McCall d59dd65fa4 Create a warning group "non-gcc" for diagnostics which are not enabled
by default in GCC.  Users who want to emulate gcc's warning behavior
exactly should be able to use CC="clang -Wno-non-gcc";  this should help
projects to transition.

llvm-svn: 86241
2009-11-06 07:53:21 +00:00
Chris Lattner 3e4fac7408 add some fixit hints.
llvm-svn: 86240
2009-11-06 06:40:12 +00:00
Douglas Gregor d82ae38d53 Rework the fix-it hint for code like
get_origin->x

where get_origin is actually a function and the user has forgotten the
parentheses. Instead of giving a lame note for the fix-it, give a
full-fledge error, early, then build the call expression to try to
recover. 

llvm-svn: 86238
2009-11-06 06:30:47 +00:00
Douglas Gregor f4f2ff773b Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210
llvm-svn: 86234
2009-11-06 05:48:00 +00:00
Douglas Gregor 6af6c3ee56 Turn off -Wsign-compare warnings by default
llvm-svn: 86233
2009-11-06 05:24:12 +00:00
Anders Carlsson 421a5c9651 If a member variable of reference type is bound to a temporary in its member initializer it needs to be destroyed at the end of the constructor.
llvm-svn: 86230
2009-11-06 04:19:02 +00:00
Anders Carlsson 5852b13827 If a member initializer create temporaries we need to destroy them. Fixes PR5077.
llvm-svn: 86225
2009-11-06 04:11:09 +00:00
Anders Carlsson a7cb98b202 More cleanup.
llvm-svn: 86224
2009-11-06 03:23:06 +00:00
Anders Carlsson 438cf92533 Cleanup ctor/dtor emission.
llvm-svn: 86222
2009-11-06 02:55:43 +00:00
Anders Carlsson 9e4e0237e4 Handle ParenExprs in mangleExpression.
llvm-svn: 86218
2009-11-06 02:50:19 +00:00
Mike Stump 72431bd9ea Refine the vcall for a function that is defined in a virtual base
class that is overridden in a base that isn't morally virtual.

llvm-svn: 86217
2009-11-06 02:38:24 +00:00
Ted Kremenek bee01e5b61 static analyzer: refactor checking logic for returning the address of a stack variable or a garbage
value into their own respective subclasses of Checker (and put them in .cpp files where their
implementation details are hidden from GRExprEngine).

llvm-svn: 86215
2009-11-06 02:24:13 +00:00
Douglas Gregor ad8b22269e If we have a C-style cast, functional cast, or a static_cast to a
class type, don't perform the array-to-pointer or function-to-pointer
conversions, because we may end up binding a reference to a function
or array.

With this change, FileCheck now passes -fsyntax-only!

llvm-svn: 86211
2009-11-06 01:14:41 +00:00
Douglas Gregor 02ba0ea461 When we encounter a derived-to-base conversion when performing an
implicit conversion sequence, check the validity of this conversion
and then perform it.

llvm-svn: 86210
2009-11-06 01:02:41 +00:00
Fariborz Jahanian eec642f8ab Minor cleanup of my last patch.
llvm-svn: 86209
2009-11-06 00:55:14 +00:00
Ted Kremenek 2980b975ee Minor cleanup: use BuiltinBug (which will soon be renamed) for DeferenceChecker and friends so that they always report the same bug type.
llvm-svn: 86208
2009-11-06 00:44:32 +00:00
Fariborz Jahanian 5582451e91 This patch implements Sema for clause 13.3.3.1p4.
It has to do with vararg constructors used as conversion
functions. Code gen needs work. This is WIP.

llvm-svn: 86207
2009-11-06 00:23:08 +00:00
Mike Stump aea4b8a0c3 Convert file over to checking the .ll file for codegen. Also, we
speed up this file by not doing twice the checking.

llvm-svn: 86205
2009-11-06 00:18:25 +00:00
John Thompson a8cb86bfd4 Update clang web pages with respect to Windows
llvm-svn: 86200
2009-11-06 00:06:29 +00:00
Douglas Gregor b2186fe23c Make sure that EnumConstantDecls always get a type, even when they have type-dependent initializers.
llvm-svn: 86197
2009-11-06 00:03:12 +00:00
Douglas Gregor 4c25ce723f Strip off the /clang/tools/clang at the end of the Subversion URL, if it's there
llvm-svn: 86195
2009-11-05 23:46:05 +00:00
John Thompson 864bf7562f Eliminate tabls
llvm-svn: 86183
2009-11-05 22:03:02 +00:00
Chris Lattner e4a8c64731 clean up integer preprocessor type definitions, patch by Ken Dyck!
llvm-svn: 86177
2009-11-05 21:21:32 +00:00
Sebastian Redl 87869bc435 Make ASTContext::getIntWidth return 1 for all boolean type variations, not just for the unqualified, unaliased bool.
llvm-svn: 86174
2009-11-05 21:10:57 +00:00
Sebastian Redl 0b7c85fc5a The signed/unsigned checker should not warn for value-dependent expressions, and should especially not try to evaluate them.
llvm-svn: 86173
2009-11-05 21:09:23 +00:00
Douglas Gregor 4ebb7f3e4c Be a little more careful when trying to extract a TypeDecl from a enum/class/struct/union specifier; in invalid code, we may also see ClassTemplateDecls.
llvm-svn: 86171
2009-11-05 20:54:04 +00:00
John Thompson ed4e2950bc Adding -fshort-wchar option.
llvm-svn: 86167
2009-11-05 20:14:16 +00:00
Douglas Gregor 866ad5d8ea De-FIXME a test
llvm-svn: 86166
2009-11-05 20:02:41 +00:00
Sebastian Redl 1060067dd1 Don't allow definitions of array variables without some size information in C++. Fixed PR5401
llvm-svn: 86165
2009-11-05 19:47:47 +00:00
Devang Patel ba3c6681f0 Enable debug info for global variables at -O1+
llvm-svn: 86156
2009-11-05 19:13:29 +00:00
Fariborz Jahanian c5a044e057 Adds doxygen comment for HasSideEffects method.
llvm-svn: 86150
2009-11-05 18:47:38 +00:00
Fariborz Jahanian 4127b8ef97 Added support for static variables which require
initialization before main. Fixes pr5396.

llvm-svn: 86145
2009-11-05 18:03:03 +00:00
Douglas Gregor 13a2c03801 Eliminate some false positives due to a thinko in the "'blah' is
always zero in this context" warning logic. Also, make the diagnostic
itself more precise when referring to pointer values ("NULL" vs. "zero").

llvm-svn: 86143
2009-11-05 17:49:26 +00:00
Sebastian Redl fec61e2111 Add Ubuntu 9.10 libstdc++ install location.
llvm-svn: 86142
2009-11-05 17:44:49 +00:00
Sebastian Redl 65ae200a13 When collecting types for built-in candidates, make arrays decay to pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360.
llvm-svn: 86140
2009-11-05 16:36:20 +00:00