Commit Graph

19497 Commits

Author SHA1 Message Date
John McCall 2ce81adbb3 Derive tighter ranges for & and >> in the conversion-checking code.
llvm-svn: 92862
2010-01-06 22:07:33 +00:00
Douglas Gregor dfdda291e0 Add testcase for PR5817, although the bug was already fixed
llvm-svn: 92858
2010-01-06 22:06:13 +00:00
Douglas Gregor 2a34df3264 Fix linkage for RTTI names by re-using the logic for computing the
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.

llvm-svn: 92857
2010-01-06 22:00:56 +00:00
Fariborz Jahanian 8e356bfe28 Fix a bug when property is redeclared in multiple
continuation classes and its original declaration
is imported from a protocol. This fixes radar 7509234.

llvm-svn: 92856
2010-01-06 21:38:30 +00:00
Douglas Gregor ccecc1bb43 Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
llvm-svn: 92855
2010-01-06 20:27:16 +00:00
David Chisnall 9a2073c035 Fix for PR5691
llvm-svn: 92846
2010-01-06 18:02:59 +00:00
Douglas Gregor 859f0ae041 Make sure that the key-function computation produces the correct
result for a nested class whose first non-pure virtual member function
has an inline body. Previously, we were checking for the key function
before we had seen the (delayed) inline body. 

llvm-svn: 92839
2010-01-06 17:00:51 +00:00
John McCall fd0b2f8fe4 Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets.  Also, refer to constructors as 'constructors'
rather than functions.

Adjust a lot of tests.

llvm-svn: 92832
2010-01-06 09:43:14 +00:00
Daniel Dunbar a671c2a9fe Fix (invalid) may-be-uninitialized warning.
llvm-svn: 92828
2010-01-06 07:13:04 +00:00
Daniel Dunbar 143a5b9f3c Add missing CINDEX_LINKAGE.
llvm-svn: 92827
2010-01-06 06:51:48 +00:00
Daniel Dunbar 4ff42d6500 Add _clang_getDeclExtent to export list.
llvm-svn: 92825
2010-01-06 05:41:00 +00:00
John McCall 70aa5391dd Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics.  The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.

Fixes PRs 5887, 5937, 5938, and 5939.

llvm-svn: 92823
2010-01-06 05:24:50 +00:00
Douglas Gregor d01472beee Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.
llvm-svn: 92822
2010-01-06 04:50:56 +00:00
Douglas Gregor 0a0f04dcb9 Make our marking of virtual members functions in a class be
deterministic and work properly with templates. Once a class that
needs a vtable has been defined, we now do one if two things:

  - If the class has no key function, we place the class on a list of
    classes whose virtual functions will need to be "marked" at the
    end of the translation unit. The delay until the end of the
    translation unit is needed because we might see template
    specializations of these virtual functions.
  - If the class has a key function, we do nothing; when the key
    function is defined, the class will be placed on the
    aforementioned list.

At the end of the translation unit, we "mark" all of the virtual
functions of the classes on the list as used, possibly causing
template instantiation and other classes to be added to the
list. This gets LLVM's lib/Support/CommandLine.cpp compiling again.

llvm-svn: 92821
2010-01-06 04:44:19 +00:00
Ted Kremenek 991eb3f6c0 Add enhanced crash reporter breadcrumbs for clang_createTranslationUnitFromSourceFile().
llvm-svn: 92820
2010-01-06 03:42:32 +00:00
Mike Stump 81478719a7 Reorder to avoid invalidating idx which is an accessor into VCall.
llvm-svn: 92819
2010-01-06 03:09:19 +00:00
Mike Stump 13c6670273 Fix spelling.
llvm-svn: 92816
2010-01-06 02:05:39 +00:00
Ted Kremenek e51136ee05 Per offline discussion with Doug, don't perform typo correction when we have encountered a fatal error. On some files that are woefully wrong (missing headers) this can cause a 3x slowdown in some cases when parsing the file. It makes sense not to perform typo correction in this case because after a fatal error diagnostics will either be suppressed or not really make any sense.
llvm-svn: 92809
2010-01-06 00:23:04 +00:00
Fariborz Jahanian 1a5f292fbf Do not diagnose method disguised as property setter
for a 'readonly' property. Fixes radar 7427072.

llvm-svn: 92808
2010-01-06 00:18:12 +00:00
John McCall 1be1c63634 Add Expr::EvaluateAsBooleanCondition(), which does unprincipled folding to
try to evaluate an expression as a constant boolean condition.  This has
the same intended semantics as used in folding conditional operators.

llvm-svn: 92805
2010-01-05 23:42:56 +00:00
Ted Kremenek e50486bbca Remove unused variables.
llvm-svn: 92804
2010-01-05 23:22:20 +00:00
Ted Kremenek bde648030b Remove deprecated function 'clang_getDeclSource()'. Use 'clang_getDeclFile()' instead.
llvm-svn: 92803
2010-01-05 23:21:30 +00:00
Ted Kremenek a44d99c934 Add C API hook 'clang_getDeclExtent()', which returns the source extent of a declaration. This implements <rdar://problem/7280072>.
llvm-svn: 92802
2010-01-05 23:18:49 +00:00
Fariborz Jahanian b8646edecd Fixed a bug where initializer is a macro in rewrite.
llvm-svn: 92801
2010-01-05 23:06:29 +00:00
Ted Kremenek 9cd9f6d861 Split (mostly nonexistent) USR code out from the main CIndex logic.
llvm-svn: 92789
2010-01-05 22:06:45 +00:00
Douglas Gregor 26751ffc53 Silence bogus GCC warning
llvm-svn: 92787
2010-01-05 21:55:26 +00:00
Daniel Dunbar d79f40ac7a Fix -plugin command line argument syntax for clang -cc1 change.
llvm-svn: 92780
2010-01-05 21:42:23 +00:00
Douglas Gregor 1a68ab6c83 Make use of available_externally linkage for vtables when the
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.

llvm-svn: 92779
2010-01-05 21:40:05 +00:00
Ted Kremenek 902292d7ac Add back #include of 'cstdio' to hopefully unbreak the build on Linux.
llvm-svn: 92765
2010-01-05 20:55:39 +00:00
Ted Kremenek 0ec2cca8f2 Split code in CIndex.cpp into multiple source files, and remove some unnecessary #includes.
llvm-svn: 92756
2010-01-05 19:32:54 +00:00
Fariborz Jahanian 7fac65572f API support for __block variables which are also __weak.
llvm-svn: 92755
2010-01-05 19:21:35 +00:00
Douglas Gregor a318efd1f2 Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that.
  non-template classes when computing the key function.
  - We always mark all of the virtual member functions of class
  template instantiations. 
  - The vtable for an instantiation of a class template has weak
  linkage. 

We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.

llvm-svn: 92753
2010-01-05 19:06:31 +00:00
Mike Stump 79ed590c85 Add code to skip the emission of available externally functions at -O0. WIP.
llvm-svn: 92749
2010-01-05 18:48:04 +00:00
Fariborz Jahanian f794543472 Minor clean up.
llvm-svn: 92746
2010-01-05 18:15:57 +00:00
Steve Naroff 7bf01ea165 Remove bogus "C" from preamble block decls.
llvm-svn: 92744
2010-01-05 18:09:31 +00:00
Fariborz Jahanian e389158dbf More rewriting of __block APIs. wip.
llvm-svn: 92742
2010-01-05 18:04:40 +00:00
Steve Naroff 3d38a68b06 Fix <rdar://problem/7490212> clang rewriter: return of the mixed line endings, which is
related to <rdar://problem/6596843> clang ObjC rewriter: Line endings still mixed in rewrite output

This fix was dropped when I integrated the 'objective-rewrite' branch.

llvm-svn: 92737
2010-01-05 17:33:23 +00:00
Zhongxing Xu f22afe32f9 Move test case to a more appropriate file.
llvm-svn: 92725
2010-01-05 11:49:21 +00:00
Zhongxing Xu e6a238b1df Add test case.
llvm-svn: 92724
2010-01-05 11:47:58 +00:00
Zhongxing Xu 662ba69a15 Revert r92318. Instead fix the analyzer: do not call
ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType.

llvm-svn: 92723
2010-01-05 09:27:03 +00:00
Zhongxing Xu cd321a3544 if an arraytype is canonical, then its element is guaranteed to be canonical.
llvm-svn: 92715
2010-01-05 08:15:06 +00:00
Nate Begeman 0e1a625fe4 Allow clang to pass -x cl through to compiler driver.
llvm-svn: 92686
2010-01-05 06:00:15 +00:00
Anders Carlsson a0b025e40f When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
llvm-svn: 92680
2010-01-05 05:04:05 +00:00
Mike Stump d4c4fc4440 Add a radar reference.
llvm-svn: 92678
2010-01-05 03:16:33 +00:00
Mike Stump 8971a86538 Disallow captured arrays in blocks as well. Radar 7438948.
llvm-svn: 92677
2010-01-05 03:10:36 +00:00
Mike Stump 7dafa0d048 Disallow capturing vlas inside blocks.
llvm-svn: 92676
2010-01-05 02:56:35 +00:00
Ted Kremenek acd71a4562 Make static analysis support for C++ 'this' expression context-sensitive. Essentially treat 'this' as a implicit parameter to the method call, and associate a region with it.
llvm-svn: 92675
2010-01-05 02:18:06 +00:00
Chris Lattner 579b551058 fix a bug mike noticed.
llvm-svn: 92559
2010-01-05 01:23:25 +00:00
Fariborz Jahanian 8c07e75a61 More rewriting of __block objective-c pointer variables. wip.
llvm-svn: 92558
2010-01-05 01:16:51 +00:00
Ted Kremenek 68872c9e26 Remove stale comment. We already do format string checking for functions with the format attribute.
llvm-svn: 92553
2010-01-05 00:37:42 +00:00
Mike Stump f86bf4abfa Fix warnings.
llvm-svn: 92551
2010-01-05 00:29:29 +00:00
Ted Kremenek de8e7447b6 Remove references to 'Checker' and 'GRTransferFuncs' from
GRStateManager.  Having these references was an abstraction violation,
as they really should only be known about GRExprEngine.

This change required adding a new 'ProcessAssume' callback in
GRSubEngine.  GRExprEngine implements this callback by calling
'EvalAssume' on all registered Checker objects as well as the
registered GRTransferFunc object.

llvm-svn: 92549
2010-01-05 00:15:18 +00:00
John McCall 263a48b781 Move the -Wconversion logic into SemaChecking.cpp. There's a fair amount of
overlap between this and -Wsign-compare, which is why I want them in the same
place.

llvm-svn: 92543
2010-01-04 23:31:57 +00:00
John McCall ca01b22ed6 Move the -Wsign-compare logic into SemaChecking.cpp.
llvm-svn: 92541
2010-01-04 23:21:16 +00:00
Mike Stump 28d89bd652 Avoid warnings for functions that return a value using MS-style inline
assembly code.  This avoids changing the bahvior when normal asm("")
statements are used.

The type of code affected would be:

  void* t4(void) { __asm mov eax, fs:[0x10] }

I hope people like this version, if not, let me know.

llvm-svn: 92531
2010-01-04 23:01:10 +00:00
Mike Stump 90be58afce Remember if the AsmStmt came from Microsoft-style inline assembly code.
llvm-svn: 92526
2010-01-04 22:37:17 +00:00
John McCall b8e66c3b14 -Wsign-compare shouldn't warn when the signed operand is a conditional operator
whose operands are non-negative integer constant expressions.  This comes up
in LLVM in a few places.

llvm-svn: 92525
2010-01-04 22:35:07 +00:00
Douglas Gregor 936dc5638c Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure.

llvm-svn: 92523
2010-01-04 22:11:45 +00:00
Daniel Dunbar 699e014588 Add missing newline (which breaks MSVC build???)
llvm-svn: 92522
2010-01-04 22:04:01 +00:00
Fariborz Jahanian d6cba5065f More rewriting of __block declared objective-c/block pointers.
This is wip.

llvm-svn: 92501
2010-01-04 19:50:07 +00:00
Douglas Gregor 51af7f628c Turn on code-completion for macros within CIndex
llvm-svn: 92500
2010-01-04 19:45:17 +00:00
Douglas Gregor 9882a5aac6 Teach Preprocessor::macro_begin/macro_end to lazily load all macro
definitions from a precompiled header. This ensures that
code-completion with macro names behaves the same with or without
precompiled headers.

llvm-svn: 92497
2010-01-04 19:18:44 +00:00
Daniel Dunbar d443c0a02a Revert r92431, this code isn't dead and broke the ntfs build.
llvm-svn: 92493
2010-01-04 18:47:06 +00:00
Daniel Dunbar 5b9019515a Fix -Asserts warning.
llvm-svn: 92491
2010-01-04 18:02:28 +00:00
Douglas Gregor 40f7a007e9 When declaring an Objective-C implementation without a corresponding
interface, suggest correction of typos. For example, given:

  @interface NSString
  @end

  @implementation NSstring
  @end

we'll warn with:

t.m:4:19: warning: cannot find interface declaration for 'NSstring';
    did you mean 'NSString'?
  @implementation NSstring
                  ^

However, since this is just a warning, we don't provide a fix-it
hint. Good idea, Ted!

llvm-svn: 92488
2010-01-04 17:27:12 +00:00
Benjamin Kramer 0128f668a9 __builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.
llvm-svn: 92453
2010-01-03 18:18:37 +00:00
Douglas Gregor 35b0bac8c5 Implement typo correction for a variety of Objective-C-specific
constructs:

  - Instance variable lookup ("foo->ivar" and, in instance methods, "ivar")
  - Property name lookup ("foo.prop")
  - Superclasses
  - Various places where a class name is required
  - Protocol names (e.g., id<proto>)

This seems to cover many of the common places where typos could occur.

llvm-svn: 92449
2010-01-03 18:01:57 +00:00
Eli Friedman c6f59b1c49 Better coverage for -dump-record-layouts and -print-decl-contexts.
llvm-svn: 92441
2010-01-03 02:01:11 +00:00
Eli Friedman 50f6aa11cf Improve coverage for test.
llvm-svn: 92440
2010-01-03 01:20:41 +00:00
Eli Friedman 6257e08a3d Get rid of more dead code.
llvm-svn: 92439
2010-01-03 01:11:47 +00:00
Eli Friedman 906be1b580 Add test for annotate attribute for coverage.
llvm-svn: 92435
2010-01-03 00:51:58 +00:00
Eli Friedman 090adddf15 Fix minor oversight for increment/decrement of complex int. Add tests for
coverage.

llvm-svn: 92433
2010-01-03 00:20:48 +00:00
Eli Friedman c52a9367b3 Get rid of some unnecessary code.
llvm-svn: 92432
2010-01-02 23:43:59 +00:00
Eli Friedman 14e4005851 Delete impossible case.
llvm-svn: 92431
2010-01-02 23:28:56 +00:00
Eli Friedman bb333722c1 Add a couple more tests for coverage.
llvm-svn: 92430
2010-01-02 23:21:40 +00:00
Eli Friedman 81390dfcfd Get rid of more unnecessary code.
llvm-svn: 92429
2010-01-02 22:56:07 +00:00
Eli Friedman 5906ea4f76 Get rid of some unnecessary code.
llvm-svn: 92428
2010-01-02 22:43:56 +00:00
Eli Friedman d423dcc9bd Eliminate dead code.
llvm-svn: 92424
2010-01-02 21:44:36 +00:00
Anders Carlsson c92a37e917 Speculative MSVC fix.
llvm-svn: 92421
2010-01-02 18:46:23 +00:00
Anders Carlsson 93a1884fde Move address points to CGVtableInfo, no functionality change.
llvm-svn: 92420
2010-01-02 18:02:32 +00:00
Anders Carlsson e36a6b3e44 Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.
llvm-svn: 92409
2010-01-02 01:01:18 +00:00
Anders Carlsson 27da15ba8e Move a few more functions away from CGCXX and to CGClass and CGExprCXX.
llvm-svn: 92399
2010-01-01 20:29:01 +00:00
Douglas Gregor 4f2486353a Make sure that the search for visible declarations looks into the semantic parents of out-of-line function contexts
llvm-svn: 92397
2010-01-01 17:44:25 +00:00
Douglas Gregor 3f8f44757f Fix typo test RUN lines
llvm-svn: 92396
2010-01-01 17:23:17 +00:00
Mike Stump 9d44fdb397 Fix last patch, catch of reference to non-pointer.
llvm-svn: 92386
2010-01-01 03:20:32 +00:00
Mike Stump 5ee041873b Fix catching a reference to a pointer.
llvm-svn: 92385
2010-01-01 02:51:52 +00:00
Douglas Gregor 2536398a5d When typo correction for an id-expression finds a type (or Objective-C
class), provide a suggestion for the type or class found. However,
since we can't recover properly in this case, don't provide a fix-it
hint. Example:

test/FixIt/typo.m:8:3: error: use of undeclared identifier 'NSstring';
did you
      mean 'NSString'?
  NSstring *str = @"A string";
  ...
  ^
1 diagnostic generated.

llvm-svn: 92379
2010-01-01 00:15:04 +00:00
Douglas Gregor 4e0299b657 Typo correction for C99 designated field initializers, e.g.,
test/FixIt/typo.c:19:4: error: field designator 'bunds' does not refer to any
      field in type 'struct Window'; did you mean 'bounds'?
  .bunds.
   ^~~~~
   bounds

llvm-svn: 92376
2010-01-01 00:03:05 +00:00
Anders Carlsson 2d21394190 If the key function of a record is inline, then the RTTI data should have weak_odr linkage.
llvm-svn: 92371
2009-12-31 19:36:25 +00:00
Anders Carlsson 0c9dd8476f It's OK for a return type to be incomplete if it's being defined.
llvm-svn: 92367
2009-12-31 18:54:35 +00:00
Anders Carlsson e60365b7b5 Make sure that an overriding return type is complete before checking if it's covariant. Fixes PR5920.
llvm-svn: 92365
2009-12-31 18:34:24 +00:00
Anders Carlsson bc7def9850 Remove rtti.cpp, it's very fragile and has been marked XFAIL for a while now. Between rtti-layout.cpp and rtti-linkage.cpp, RTTI testing should be covered.
llvm-svn: 92361
2009-12-31 17:44:32 +00:00
Anders Carlsson 7ae81bb711 More RTTI builder cleanup.
llvm-svn: 92360
2009-12-31 17:43:53 +00:00
Benjamin Kramer d77adb5b1c Avoid an unnecessary copy of Predefines. getMemBufferCopy does the null termination for us.
llvm-svn: 92358
2009-12-31 15:33:09 +00:00
Benjamin Kramer 14488464be Convert to StringRef, avoid a memcpy in the common case.
llvm-svn: 92357
2009-12-31 13:32:38 +00:00
Douglas Gregor 15e77a2fd3 Typo correction for C++ base and member initializers, e.g.,
test/FixIt/typo.cpp:41:15: error: initializer 'base' does not name a non-static
      data member or base class; did you mean the base class 'Base'?
  Derived() : base(),
              ^~~~
              Base
test/FixIt/typo.cpp:42:15: error: initializer 'ember' does not name a non-static
      data member or base class; did you mean the member 'member'?
              ember() { }
              ^~~~~
              member

llvm-svn: 92355
2009-12-31 09:10:24 +00:00
Douglas Gregor 103dae42d7 Add another typo test for nested-name-specifiers
llvm-svn: 92351
2009-12-31 08:27:32 +00:00
Douglas Gregor 532e68f1f3 Typo correction for identifiers within nested name specifiers, e.g.,
typo.cpp:18:1: error: use of undeclared identifier 'other_std'; did
      you mean 'otherstd'?
other_std::strng str1;
^~~~~~~~~
otherstd

llvm-svn: 92350
2009-12-31 08:26:35 +00:00
Douglas Gregor ff18cc1141 Typo correction for template names, e.g.,
typo.cpp:27:8: error: no template named 'basic_sting' in namespace 'std'; 
    did you mean 'basic_string'?
  std::basic_sting<char> b2;
  ~~~~~^~~~~~~~~~~
       basic_string

llvm-svn: 92348
2009-12-31 08:11:17 +00:00
Douglas Gregor af2bd473d2 Typo correction for member access into classes/structs/unions, e.g.,
s.fnd("hello")

llvm-svn: 92345
2009-12-31 07:42:17 +00:00
Zhongxing Xu b0e15df36b Let constraint manager inform checkers that some assumption logic has happend.
Add new states for symbolic regions tracked by malloc checker. This enables us
to do malloc checking more accurately. See test case.

Based on Lei Zhang's patch and discussion.

llvm-svn: 92342
2009-12-31 06:13:07 +00:00
Douglas Gregor 598b08f818 Implement typo correction for id-expressions, e.g.,
typo.cpp:22:10: error: use of undeclared identifier 'radious'; did
      you mean 'radius'?
  return radious * pi;
         ^~~~~~~
         radius

This was super-easy, since we already had decent recovery by looking
for names in dependent base classes.

llvm-svn: 92341
2009-12-31 05:20:13 +00:00
Chris Lattner b0283c06b2 improve diagnostics for case when a field type is unknown by
not emitting a follow-on error about 'int', which the user
never wrote.  PR5924.

llvm-svn: 92339
2009-12-31 03:10:55 +00:00
Anders Carlsson a442499072 Fix a bunch of bugs with VMI RTTI building, and add a whole bunch of tests.
llvm-svn: 92319
2009-12-30 23:47:56 +00:00
Zhongxing Xu da3ddfce43 The element type should also be canonicalized. Add a case for VariableArrayType.
llvm-svn: 92318
2009-12-30 22:59:54 +00:00
Chris Lattner d866c5a678 testcase for previous patch!
llvm-svn: 92317
2009-12-30 22:10:22 +00:00
Chris Lattner 8977c433d3 when making a decl for __builtin_fabsf() make sure to
attach the appropriate attributes to it.  I don't think
this manifests as any real change though, we're still
not getting the right LLVM IR attributes out of codegen.

llvm-svn: 92316
2009-12-30 22:06:22 +00:00
Zhongxing Xu 1563a76fd3 Fix a comment.
llvm-svn: 92314
2009-12-30 21:24:23 +00:00
Chris Lattner c3847ba3fa fix PR5917, L'x' was getting the wrong type in c++ mode. Per
C++2.13.2p2: "A wide-character literal has type wchar_t"

llvm-svn: 92313
2009-12-30 21:19:39 +00:00
Fariborz Jahanian 92368a15f9 When rewriting a __block declaration, use a suitable API to get location of
the declaration in the presence of an initializer macro.

llvm-svn: 92312
2009-12-30 20:38:08 +00:00
Chris Lattner 1ca1d7adc2 remove extraneous #include
llvm-svn: 92310
2009-12-30 19:54:10 +00:00
Douglas Gregor 2d435306e5 Typo correction for type names when they appear in declarations, e.g., given
tring str2;

we produce the following diagnostic + fix-it:

typo.cpp:15:1: error: unknown type name 'tring'; did you mean 'string'?
  tring str2;
  ^~~~~
  string


To make this really useful, we'll need to introduce typo correction in
many more places (wherever we do name lookup), and implement
declaration-vs-expression heuristics that cope with typos
better. However, for now this will handle the simple cases where we
already get good "unknown type name" diagnostics.

The LookupVisibleDecls functions are intended to be used by code
completion as well as typo correction; that refactoring will happen
later.

llvm-svn: 92308
2009-12-30 17:04:44 +00:00
Douglas Gregor ad183ac3c7 Fix typo in comment
llvm-svn: 92307
2009-12-30 16:01:52 +00:00
Zhongxing Xu 4629e92e78 Remove an duplicated #include.
llvm-svn: 92306
2009-12-30 06:48:20 +00:00
Zhongxing Xu 7b8b4d70ef Simplify code by using an equivalent template class.
llvm-svn: 92305
2009-12-30 06:38:20 +00:00
Chandler Carruth c712ce1b60 More fixes to the handling of CVR-comparisons on array types. Adds a method to
QualType to get CVR-qualifiers through array types, and switches the primary
comparison methods to use it. This may allow simplifying some of the callers of
getUnqualifiedArrayType.

Also fix the normalizing of CV-qualification during template deduction to
normalize through arrays and allow a more qualified deduced array type. This
fixes PR5911.

llvm-svn: 92289
2009-12-30 04:10:01 +00:00
Anders Carlsson 1e4cd33f13 Add base class checks.
llvm-svn: 92286
2009-12-30 01:29:05 +00:00
Anders Carlsson a4bbe58c3b Add more vtable tests.
llvm-svn: 92285
2009-12-30 01:25:42 +00:00
Anders Carlsson ac2f681777 More RTTI cleanup, test that RTTI classes have the correct vtables.
llvm-svn: 92284
2009-12-30 01:00:12 +00:00
John McCall 91f1a02648 Typedefs can be redeclared. That seems like something we should record in
the AST lest we run into some crazy canonicalization bug like PR5874.

llvm-svn: 92283
2009-12-30 00:31:22 +00:00
Eli Friedman be55976627 Test for PR5908.
llvm-svn: 92282
2009-12-30 00:20:14 +00:00
Eli Friedman 84341cd668 Make sure to explicitly pass type/value dependence to Expr constructor. This
caught several cases where we were not doing the right thing. I'm
not completely sure all cases are being handled correctly, but this should
be an improvement.

llvm-svn: 92281
2009-12-30 00:13:48 +00:00
Anders Carlsson 79c184e975 Match gcc and treat vector types as fundamental types.
llvm-svn: 92278
2009-12-29 22:30:11 +00:00
Anders Carlsson ef88695860 Handle enum types as well.
llvm-svn: 92276
2009-12-29 22:13:01 +00:00
Anders Carlsson 0e4151c685 Test linkage of RTTI descriptors of array types.
llvm-svn: 92274
2009-12-29 21:58:32 +00:00
Anders Carlsson 26cf4ab8e2 Fix function type RTTI linkage and add tests.
llvm-svn: 92266
2009-12-29 20:20:19 +00:00
Chandler Carruth 585fb1e97e Fix support for const_cast<>s of array types which actual change the
CV-qualifiers. Remove an error expectation from the 'good' set of const-cast
test cases. With this patch, the final non-template test case from PR5542
passes. (It's the same as the one already in const-cast.cpp.)

llvm-svn: 92257
2009-12-29 08:05:19 +00:00
Chris Lattner 3f8e5dd898 strength reduce this call away.
llvm-svn: 92253
2009-12-29 07:49:13 +00:00
Chris Lattner 426b709a81 fix whitespace in test to match llvm asmprinter change.
llvm-svn: 92251
2009-12-29 07:42:23 +00:00
Chandler Carruth 607f38e05f Correctly refer to element CVR qualifications when determining if a type is
more or less cv-qualified than another during implicit conversion and overload
resolution ([basic.type.qualifier] p5). Factors the logic out of template
deduction and into the ASTContext so it can be shared.

This fixes several aspects of PR5542, but not all of them.

llvm-svn: 92248
2009-12-29 07:16:59 +00:00
Anders Carlsson 88ea2455f8 Get rid of FixedWidthIntType, as suggested by Chris and Eli.
llvm-svn: 92246
2009-12-29 07:07:36 +00:00
Chandler Carruth c25c6ee3db Handle using declarations in overloaded and template functions during ADL and
address resolution. This fixes PR5751.

Also, while we're here, remove logic from ADL which mistakenly included the
definition namespaces of overloaded and/or templated functions whose name or
address is used as an argument.

llvm-svn: 92245
2009-12-29 06:17:27 +00:00
Chris Lattner 9f021fd05d adjust for llvm api changes.
llvm-svn: 92236
2009-12-28 23:41:39 +00:00
Chris Lattner 5e124bf913 this form of SetDebugLocation is about to go away, add some #includes that
are about to not come in implicitly.

llvm-svn: 92228
2009-12-28 21:44:41 +00:00
Zhongxing Xu 6de8201a63 Adjust indentation.
llvm-svn: 92205
2009-12-28 06:52:51 +00:00
Zhongxing Xu 947420d6ad Fix 80-col violation.
llvm-svn: 92204
2009-12-28 06:49:22 +00:00
Chris Lattner 9e0005f445 use best-fit instead of first-fit when reusing a MacroArgs object,
this speeds up Eonly on the testcase in PR5888 from 30.5s to 0.85s

llvm-svn: 92203
2009-12-28 06:36:46 +00:00
Chris Lattner 394f589e73 The PreExpArgTokens array is indexed with an argument #,
not a token number.  Fix the reserve logic to get the right
amount of space.

llvm-svn: 92202
2009-12-28 06:17:16 +00:00
Sam Weinig b999f68ed9 Fix for PR5871. Make __PRETTY_FUNCTION__ work for member functions defined in a class local to a function.
llvm-svn: 92200
2009-12-28 03:19:38 +00:00
Eli Friedman affd5fdf37 Make sure to give an error for template argument lists followed by junk.
llvm-svn: 92177
2009-12-27 22:31:18 +00:00
Anton Korobeynikov 73d50b9141 Promote arguments of frameaddr / returnaddr builtins to i32 type, when needed.
This is needed for the platforms, where bitwidth of "int" is not 32 bits
(e.g. 16 on msp430).

llvm-svn: 92176
2009-12-27 14:27:22 +00:00
Eli Friedman 1e26278b3b Add a sanity assertion so that we don't silently generate bad code; I'll file
a bug with a testcase hitting this assertion in a moment.

llvm-svn: 92175
2009-12-27 07:02:50 +00:00
Eli Friedman e513c6af97 Fix runline.
llvm-svn: 92174
2009-12-27 05:59:41 +00:00
Eli Friedman 847a2bce04 Fix PointerExprEvaluator::VisitCastExpr so it doesn't misfold C++ casts which
it doesn't know how to fold, like derived-to-base casts.

llvm-svn: 92173
2009-12-27 05:43:15 +00:00
Eli Friedman af76ad73ed Fix obvious mistake.
llvm-svn: 92172
2009-12-27 03:44:17 +00:00
Sam Weinig 4e83bd2795 Fix for PR5872. Add static specifier and const/volatile qualifiers to member functions in __PRETTY_FUNCTION__ predefined expressions.
llvm-svn: 92171
2009-12-27 01:38:20 +00:00
Daniel Dunbar 54f330f342 Tests: Tweak LLVM-Code-Symbols test to ignore common and undefined symbols for
now, let's start small.

llvm-svn: 92170
2009-12-26 22:58:48 +00:00
Eli Friedman e14b1997db Don't look through casts when looking for the underlying decl for a function
call; the standard doesn't expect us to, and the program could be doing
something crazy.  Fixes PR5882.

llvm-svn: 92166
2009-12-26 03:35:45 +00:00
Eli Friedman 11c7b15148 Attempted fix for PR5884; this code will be dead soon, but this fix should
help for the moment.

llvm-svn: 92165
2009-12-25 23:59:21 +00:00
Daniel Dunbar b2138e5529 Driver: Use "g++" as generic gcc name when running in C++ mode, for platforms
that lack real tool definitions.

llvm-svn: 92164
2009-12-25 20:21:23 +00:00