Commit Graph

9415 Commits

Author SHA1 Message Date
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
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
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
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
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
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 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
Sebastian Redl 2dfdb820ca Allow the element type of arrays to be incomplete in C++.
This fixes PR5048. Also fix a bug where zero-sized arrays weren't warned about when the size was unsigned.

llvm-svn: 86136
2009-11-05 15:52:31 +00:00
Sebastian Redl 39c2a8bbbc Parse C++0x constexpr. Test case follows when this does something useful.
llvm-svn: 86135
2009-11-05 15:47:02 +00:00
Douglas Gregor 3ec1bf240d Fixed two places where we needed to force completion of a type
(without complaining if it fails) to get proper semantics: reference
binding with a derived-to-base conversion and the enumeration of
constructors for user-defined conversions. There are probably more
cases to fix, but my prior attempt at statically ensuring that
complete-type checking always happens failed. Perhaps I'll try again.

With this change, Clang can parse include/llvm/*.h!

llvm-svn: 86129
2009-11-05 13:06:35 +00:00
John McCall 1fa36b7cab Implement the conditional-operator part of -Wsign-compare. Turn
DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places.

Add some enumerator tests.  These seem to expose some oddities in the
types we're converting C++ enumerators to;  in particular, they're converting
to unsigned before int, which seems to contradict 4.5 [conv.prom] p2.

Note to self: stop baiting Doug in my commit messages.

llvm-svn: 86128
2009-11-05 09:23:39 +00:00
Ted Kremenek c92ff053e9 Tweak wording and classifications of analyzer diagnostics.
llvm-svn: 86127
2009-11-05 08:30:12 +00:00
Mike Stump c550768a11 References can't be zero; omit zero check for return value adjustments
in covariant thunks that return references.

llvm-svn: 86121
2009-11-05 06:32:02 +00:00
Mike Stump b8da7a046d Refine covariant return value adjustments for thunks when null
pointers are returned.

llvm-svn: 86120
2009-11-05 06:12:26 +00:00
Mike Stump 2b84dd39be Refine layout for indirect virtual base classes.
llvm-svn: 86116
2009-11-05 04:02:15 +00:00
Daniel Dunbar 0231895ce6 Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
invariants (diagnostics with source informations must occur between
{Begin,End}SourceFile).

llvm-svn: 86113
2009-11-05 02:42:12 +00:00
Daniel Dunbar b5f2025b77 Convert CreateAnalysisConsumer and friends to just take a const Preprocessor&, and simplify.
llvm-svn: 86112
2009-11-05 02:41:58 +00:00