| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
code as well.
rdar://13829073
llvm-svn: 181345
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implementation doesn't warn on anything that GCC doesn't warn on with the
exception of templates specializations (GCC doesn't warn, Clang does). The
specific skipped cases (boolean, constant expressions, enums) are open for
debate/adjustment if anyone wants to demonstrate that GCC is being overly
conservative here. The only really obvious false positive I found was in the
Clang regression suite's MPI test - apparently MPI uses specific flag values in
pointer constants. (eg: #define FOO (void*)~0)
llvm-svn: 166039
|
|
|
|
|
|
| |
with-arguments case as well as the no-arguments case.
llvm-svn: 160999
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
accurate by asking the parser whether there was an ambiguity rather than trying
to reverse-engineer it from the DeclSpec. Make the with-parameters case have
better diagnostics by using semantic information to drive the warning,
improving the diagnostics and adding a fixit.
Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for
declarations of the form 'T (*x)(...)', which seem to have a very high false
positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'.
llvm-svn: 160998
|
|
|
|
|
|
| |
of giving unhelpful errors about undeclared identifers and missing semicolons.
llvm-svn: 155965
|
|
|
|
|
|
| |
incomplete return type.
llvm-svn: 148088
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- If the declarator is at the start of a line, and the previous line contained
another declarator and ended with a comma, then that comma was probably a
typo for a semicolon:
int n = 0, m = 1, l = 2, // k = 5;
myImportantFunctionCall(); // oops!
- If removing the parentheses would correctly initialize the object, then
produce a note suggesting that fix.
- Otherwise, if there is a simple initializer we can suggest which performs
value-initialization, then provide a note suggesting a correction to that
initializer.
Sema::Declarator now tracks the location of the comma prior to the declarator in
the declaration, if there is one, to facilitate providing the note. The code to
determine an appropriate initializer from the -Wuninitialized warning has been
factored out to allow use in both that and -Wvexing-parse.
llvm-svn: 148072
|
|
|
|
|
|
| |
Thanks to David Blaikie for pointing this out.
llvm-svn: 147783
|
|
|
|
|
|
|
|
| |
int f();
in function scopes under -Wvexing-parse, so now we do.
llvm-svn: 147649
|
|
|
|
|
|
|
| |
the Semantic Powers to only warn on class types (or dependent types), where the
constructor or destructor could do something interesting.
llvm-svn: 147642
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.
Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.
Add a new warning group -Wvexing-parse containing both of these warnings.
The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.
llvm-svn: 147599
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.
In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.
This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.
Ted Kremenek kindly contributed the analyzer workarounds in this patch.
llvm-svn: 120890
|
|
|
|
| |
llvm-svn: 114318
|
|
|
|
| |
llvm-svn: 114316
|
|
|
|
|
|
|
|
| |
function-style cast. Previously, we had a (redundant, incorrect)
semantic-checking path for non-class types, which allowed
value-initialization of a reference type and then crashed.
llvm-svn: 113415
|
|
|
|
|
|
|
|
| |
voids in sub-expressions. Patch by Mike M!
Fixes PR4806.
llvm-svn: 98335
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
| |
llvm-svn: 77780
|
|
|
|
|
|
|
|
| |
regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators.
Add custom conversions to static_cast.
llvm-svn: 77076
|
|
|
|
|
|
| |
type for C++.
llvm-svn: 72747
|
|
|
|
|
|
|
| |
narrower, so it doesn't catch expresions that aren't sub-expressions of
__extension__ operator.
llvm-svn: 71967
|
|
|
|
| |
llvm-svn: 70283
|
|
|
|
|
|
| |
Tests and drivers updated, still need to shuffle dirs.
llvm-svn: 67602
|
|
|
|
|
|
|
|
|
|
|
|
| |
a.k.a. Koenig lookup) in C++. Most of the pieces are in place, but for
two:
- In an unqualified call g(x), even if the name does not refer to
anything in the current scope, we can still find functions named
"g" based on ADL. We don't yet have this ability.
- ADL will need updating for friend functions and templates.
llvm-svn: 63692
|
|
|
|
|
|
|
|
|
|
| |
warning: statement was disambiguated as declaration
because it is currently firing in cases where the declaration would
not actually parse as a statement. We'd love to bring this warning
back if we can make it more accurate.
llvm-svn: 61137
|
|
|
|
|
|
| |
"previously defined here" diagnostics all notes.
llvm-svn: 59920
|
|
|
|
| |
llvm-svn: 59484
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes:
- Sema::IsQualificationConversion determines whether we have a qualification
conversion.
- Sema::CheckSingleAssignment constraints now follows the C++ rules in C++,
performing an implicit conversion from the right-hand side to the type of
the left-hand side rather than checking based on the C notion of
"compatibility". We now rely on the implicit-conversion code to
determine whether the conversion can happen or
not. Sema::TryCopyInitialization has an ugly reference-related
hack to cope with the initialization of references, for now.
- When building DeclRefExprs, strip away the reference type, since
there are no expressions whose type is a reference. We'll need to
do this throughout Sema.
- Expr::isLvalue now permits functions to be lvalues in C++ (but not
in C).
llvm-svn: 57935
|
|
|
|
|
|
| |
'int (void)' because it has the same meaning in C and C++.
llvm-svn: 57901
|
|
|
|
|
|
|
|
| |
a direct initializer for a variable defition).
Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524
llvm-svn: 57609
|
|
|
|
|
|
| |
No funcitonality change.
llvm-svn: 57136
|
|
|
|
|
|
|
|
|
| |
parentheses, e.g.:
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.
llvm-svn: 57131
|
|
|
|
|
|
|
|
|
|
|
|
| |
TentativeParsingResult enum).
This was the motivation of the following changes:
-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).
llvm-svn: 57125
|
|
|
|
|
|
| |
'for-init-statement' part of a 'for' statement.
llvm-svn: 57112
|
|
|
|
| |
llvm-svn: 57111
|
|
|
|
|
|
| |
a if/switch/while/for statement.
llvm-svn: 57109
|
|
|
|
| |
llvm-svn: 57108
|
|
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.
llvm-svn: 57084
|