Douglas Gregor [Thu, 5 Nov 2009 20:54:04 +0000 (20:54 +0000)]
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.
Douglas Gregor [Thu, 5 Nov 2009 17:49:26 +0000 (17:49 +0000)]
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").
Sebastian Redl [Thu, 5 Nov 2009 16:36:20 +0000 (16:36 +0000)]
When collecting types for built-in candidates, make arrays decay to pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360.
Daniel Dunbar [Thu, 5 Nov 2009 16:36:19 +0000 (16:36 +0000)]
Add clang_site_config user variable, so that extra tests (e.g., utils/C++Syntax)
can always find the main clang site config (when invoked via CMake/Makefiles, at
least).
Sebastian Redl [Thu, 5 Nov 2009 15:52:31 +0000 (15:52 +0000)]
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.
Douglas Gregor [Thu, 5 Nov 2009 13:06:35 +0000 (13:06 +0000)]
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!
John McCall [Thu, 5 Nov 2009 09:23:39 +0000 (09:23 +0000)]
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.
Daniel Dunbar [Thu, 5 Nov 2009 02:42:12 +0000 (02:42 +0000)]
Replace DiagnosticClient::setLangOptions with {Begin,End}SourceFile, and clarify
invariants (diagnostics with source informations must occur between
{Begin,End}SourceFile).
Daniel Dunbar [Thu, 5 Nov 2009 02:11:37 +0000 (02:11 +0000)]
Remove clang-cc -html-diags option, this doesn't fit in well and we get plenty
of coverage of this from the analyzer.
If this bothers you, I can add it back in a mode where non-source diagnostics go
to stderr and only source diagnostics use -html-diags, but I don't think anyone
uses this.
Ted Kremenek [Thu, 5 Nov 2009 02:09:23 +0000 (02:09 +0000)]
Acting on Daniel's nagging, remove PathDiagnosticClientFactory() and
migrate work in the destructors of PathDiagnosticClients from their
destructors to FlushReports(). The destructors now currently call
FlushReports(); this will be fixed in a subsequent patch.
Douglas Gregor [Thu, 5 Nov 2009 00:51:44 +0000 (00:51 +0000)]
When instantiating a UnaryOperator, allow the resulting expression to
still be dependent or invoke an overloaded operator. Previously, we
only supported builtin operators.
BinaryOperator/CompoundAssignOperator didn't have this issue because
we always built a CXXOperatorCallExpr node, even when name lookup
didn't find any functions to save until instantiation time. Now, that
code builds a BinaryOperator or CompoundAssignOperator rather than a
CXXOperatorCallExpr, to save some space.
Ted Kremenek [Thu, 5 Nov 2009 00:42:23 +0000 (00:42 +0000)]
Modify GRExprEngine::EvalBind() to take both a "store expression" and
an "assign expression", representing the expressions where the value
binding occurs and the assignment takes place respectively. These are
largely syntactic clues for better error reporting.
Douglas Gregor [Wed, 4 Nov 2009 22:49:18 +0000 (22:49 +0000)]
When starting a C++ member access expression, make sure to compute the
type of the object even when it is dependent. Specifically, this makes
sure that we get the right type for "this->", which is important when
performing name lookup into this scope to determine whether an
identifier or operator-function-id is a template name.
Douglas Gregor [Wed, 4 Nov 2009 07:01:15 +0000 (07:01 +0000)]
When performing template instantiation (transformation) of
expressions, keep track of whether we are immediately taking the
address of the expression. Pass this flag when building a declaration
name expression so that we handle pointer-to-member constants
properly.
John McCall [Wed, 4 Nov 2009 02:18:39 +0000 (02:18 +0000)]
Change our basic strategy for avoiding deprecation warnings when the decl use
appears in a deprecated context. In the new strategy, we emit the warnings
as usual unless we're currently parsing a declaration, where "declaration" is
restricted to mean a decl group or a few special cases in Objective C. If
we *are* parsing a declaration, we queue up the deprecation warnings until
the declaration has been completely parsed, and then emit them only if the
decl is not deprecated.
We also standardize the bookkeeping for deprecation so as to avoid special cases.
Tanya Lattner [Wed, 4 Nov 2009 01:18:09 +0000 (01:18 +0000)]
Merge constant array and structures. This will create a global variables for arrays and structs that are constant and their initializer is constant. It is on by default but can be disable with the flag -fno-merge-all-constants.
Mike Stump [Wed, 4 Nov 2009 00:53:51 +0000 (00:53 +0000)]
Split out return adjustments in thunks from this adjustment in thunks
so the optimizer can tailcall into the return value adjustment thunk.
This improves codesize for complex hierarchies.
Ted Kremenek [Wed, 4 Nov 2009 00:09:15 +0000 (00:09 +0000)]
Refactor StoreManager::BindDecl() to take a VarRegion* instead of a VarDecl*, and modify GRExprEngine::EvalBind() to handle decl initialization as well. This paves the way for adding "checker" visitation in EvalBind().
Ted Kremenek [Tue, 3 Nov 2009 23:30:34 +0000 (23:30 +0000)]
Change GRTransferFuncs::RegisterChecks() to take a GRExprEngine& instead of a BugReporter&. This paves the way for pulling some of the retain/release checker into a "Checker" class.
Mike Stump [Tue, 3 Nov 2009 23:25:48 +0000 (23:25 +0000)]
Refine volatile handling, specifically, we must have the canonical
type to look at the volatile specifier. I found these all from just
hand auditing the code.
Douglas Gregor [Tue, 3 Nov 2009 23:16:33 +0000 (23:16 +0000)]
Parsing and semantic analysis for template-ids that name overloaded
operators, e.g.,
operator+<int>
which now works in declarators, id-expressions, and member access
expressions. This commit only implements the non-dependent case, where
we can resolve the template-id to an actual declaration.
Mike Stump [Tue, 3 Nov 2009 22:20:01 +0000 (22:20 +0000)]
We have to ensure we have the canonical type to do this. This is but
one instance of a large problem. assert for non-canoical types would
help track down these things.
John McCall [Tue, 3 Nov 2009 21:13:47 +0000 (21:13 +0000)]
CFieldCallback doesn't need to create an ExtensionRAIIObject: it's actually
automatically shadowed by the ExtensionRAIIObject created by
ParseStructDeclaration.
Douglas Gregor [Tue, 3 Nov 2009 19:44:04 +0000 (19:44 +0000)]
Replace the code that parses member access expressions after "." or
"->" with a use of ParseUnqualifiedId. Collapse
ActOnMemberReferenceExpr, ActOnDestructorReferenceExpr (both of them),
ActOnOverloadedOperatorReferenceExpr,
ActOnConversionOperatorReferenceExpr, and
ActOnMemberTemplateIdReferenceExpr into a single, new action
ActOnMemberAccessExpr that does the same thing more cleanly (and can
keep more source-location information).