| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D63894
llvm-svn: 365555
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
template name is not visible to unqualified lookup.
In order to support this without a severe degradation in our ability to
diagnose typos in template names, this change significantly restructures
the way we handle template-id-shaped syntax for which lookup of the
template name finds nothing.
Instead of eagerly diagnosing an undeclared template name, we now form a
placeholder template-name representing a name that is known to not find
any templates. When the parser sees such a name, it attempts to
disambiguate whether we have a less-than comparison or a template-id.
Any diagnostics or typo-correction for the name are delayed until its
point of use.
The upshot should be a small improvement of our diagostic quality
overall: we now take more syntactic context into account when trying to
resolve an undeclared identifier on the left hand side of a '<'. In
fact, this works well enough that the backwards-compatible portion (for
an undeclared identifier rather than a lookup that finds functions but
no function templates) is enabled in all language modes.
llvm-svn: 360308
|
|
|
|
|
|
| |
24 tests have been updated for C++11 compatibility.
llvm-svn: 266387
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clang currently crashes on
class C {
C() = default;
C() = delete;
};
My cunning plan for fixing this was to change the `if (!FnD)` in
Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but
alas, the second constructor decl wasn't marked as invalid. This lets
Sema::MergeFunctionDecl() return true on function redeclarations, which leads
to them being marked invalid.
This also improves error messages when functions are redeclared.
llvm-svn: 226365
|
|
|
|
|
|
| |
Differential Revision: http://llvm-reviews.chandlerc.com/D924
llvm-svn: 188133
|
|
|
|
|
|
|
|
| |
warning to an error. C++ bans it, and both GCC and EDG diagnose it as
an error. Microsoft allows it, so we still warn in Microsoft
mode. Fixes <rdar://problem/11135644>.
llvm-svn: 163831
|
|
|
|
|
|
|
| |
right place to pick up parsing. In C++, this had a tendency to skip everything
declared within headers if the TU starts with garbage.
llvm-svn: 154530
|
|
|
|
|
|
|
|
|
|
|
|
| |
* s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted
the former by 28-2 in our diagnostics.
* Fix the "use of member in static member function" diagnostic to correctly
detect this situation inside a block or lambda.
* Produce a more specific "invalid use of non-static member" diagnostic for
the case where a nested class member refers to a member of a
lexically-surrounding class.
llvm-svn: 154073
|
|
|
|
|
|
|
| |
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.
llvm-svn: 147357
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:
// expect-error{{candidate function has different number of parameters}}
will match the following error messages from Clang:
candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters
It will also match these other error messages:
candidate function
function has different number of parameters
number of parameters
This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:
87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)
llvm-svn: 146619
|
|
|
|
|
|
|
| |
valid C++98/03 code. However, add these warnings to -Wall, for those
who obviously already like clean code.
llvm-svn: 142903
|
|
|
|
|
|
|
|
| |
We'd also like for "C++11" or "c++11" to be used for the warning
groups, but without removing the old warning flags. Patches welcome;
I've run out of time to work on this today.
llvm-svn: 141801
|
|
|
|
|
|
|
| |
declarator, so that the declarator is in scope for the
initializer. Fixes PR9989.
llvm-svn: 141539
|
|
|
|
|
|
| |
as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.
llvm-svn: 140820
|
|
|
|
| |
llvm-svn: 140809
|
|
|
|
|
|
| |
We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).
llvm-svn: 140801
|
|
|
|
|
|
| |
for-range and auto with an ExtWarn, and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a storage class.
llvm-svn: 139102
|
|
|
|
| |
llvm-svn: 132878
|
|
|
|
|
|
|
|
| |
use of nonstatic data member"
not "call to non-static member function without an object argument".
llvm-svn: 124576
|
|
|
|
|
|
|
|
|
|
|
| |
for member functions. + Fixit.
Example:
class A {
void A::foo(); //warning: extra qualification on member 'foo'
};
llvm-svn: 115347
|
|
|
|
| |
llvm-svn: 113663
|
|
|
|
|
|
|
| |
which is should have done from the beginning. As usual, the most
fun with this sort of change is updating all the testcases.
llvm-svn: 113090
|
|
|
|
|
|
|
|
| |
"previous token" location at the end of the class definition. This
eliminates a badly-placed error + Fix-It when the ';' following a
class definition is missing. Fixes <rdar://problem/8066414>.
llvm-svn: 106175
|
|
|
|
|
|
|
| |
enum contexts (along with block contexts, which we already did). Fixes
PR7196.
llvm-svn: 104444
|
|
|
|
|
|
| |
actually works
llvm-svn: 103959
|
|
|
|
|
|
| |
Fixes PR7153
llvm-svn: 103954
|
|
|
|
|
|
|
| |
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.
llvm-svn: 100814
|
|
|
|
| |
llvm-svn: 98702
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
definition. This allows sema to not emit spurious diagnostics in some invalid code.
llvm-svn: 89816
|
|
|
|
|
|
| |
decls. This fixes PR5415.
llvm-svn: 89777
|
|
|
|
|
|
| |
Tests and drivers updated, still need to shuffle dirs.
llvm-svn: 67602
|
|
|
|
|
|
| |
general routines. This is a step toward separating the checking logic from Declarators, which in turn is required for template instantiation.
llvm-svn: 66734
|
|
|
|
|
|
|
| |
for FieldDecls so that the parser and the template instantiation make
use of the same semantic checking module.
llvm-svn: 66685
|
|
|
|
| |
llvm-svn: 66213
|
|
|
|
|
|
| |
more consistently.
llvm-svn: 66210
|
|
|
|
|
|
|
| |
rules are slightly different than in C, and now we handle both
dialects properly.
llvm-svn: 63211
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:
- Fields are now in the "member" namespace (IDNS_Member), to keep
them separate from tags and ordinary names in C. See the new test
in Sema/member-reference.c for an example of why this matters. In
C++, ordinary and member name lookup will find members in both the
ordinary and member namespace, so the difference between
IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
only in C++!).
- We always introduce a Scope and push a DeclContext when we're
defining a tag, in both C and C++. Previously, we had different
actions and different Scope/CurContext behavior for enums, C
structs/unions, and C++ structs/unions/classes. Now, it's one pair
of actions. (Yay!)
There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:
struct X {
struct T { int x; } t;
};
to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c
llvm-svn: 61940
|
|
|
|
|
|
|
|
| |
Examples:
int;
typedef int;
llvm-svn: 61454
|
|
|
|
| |
llvm-svn: 59470
|
|
|
|
|
|
| |
Thanks to Doug for the review. Actual effects of mutable to follow.
llvm-svn: 59331
|
|
|
|
| |
llvm-svn: 58804
|
|
|
|
|
|
|
|
|
| |
typedef int f();
struct S {
f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};
llvm-svn: 57598
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
class C {
static const int number = 50;
static int arr[number];
};
Here's how it worked:
-GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator.
-VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr.
-On exit they both tried to destroy that one DeclRefExpr.
The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator.
llvm-svn: 57313
|
|
llvm-svn: 54853
|