| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 133036
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the output for -Wshift-overflow and
-Wshift-sign-overflow to an unsigned hexadecimal. It makes
more sense for looking at bits than a signed decimal does.
Also, change the diagnostic's wording from "overrides"
to "sets".
This uses a new optional argument in APInt::toString()
that adds the '0x' prefix to hexademical numbers.
This fixes PR 9651.
Patch by nobled@dreamwidth.org!
llvm-svn: 133033
|
|
|
|
|
|
|
| |
- Move a test from test/SemaTemplate/instantiate-expr-3.cpp, it did not belong there
- Incomplete and abstract types are considered hard errors
llvm-svn: 132979
|
|
|
|
| |
llvm-svn: 132905
|
|
|
|
| |
llvm-svn: 132878
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:
t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
expression of type 'NSArray *' [-Wincompatible-pointer-types]
NSSet *array = [[NSArray alloc] init];
^ ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note:
instance method 'init' is assumed to return an instance of its
receiver
type ('NSArray *')
- (id)init;
^
It also means that we get decent type inference when writing code in
Objective-C++0x:
auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil];
// ^ now infers NSMutableArray* rather than id
llvm-svn: 132868
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a follow-up to r132565, and should address the rest of PR9969:
Warn about cases such as
int foo(A a, bool b) {
return a + b ? 1 : 2; // user probably meant a + (b ? 1 : 2);
}
also when + is an overloaded operator call.
llvm-svn: 132784
|
|
|
|
|
|
|
| |
This fixes a memory error on FreeBSD (and is the right thing to do
in any case).
llvm-svn: 132750
|
|
|
|
|
|
|
| |
__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types.
Added test case.
llvm-svn: 132612
|
|
|
|
|
|
|
|
|
|
| |
Warn in cases such as "x + someCondition ? 42 : 0;",
where the condition expression looks arithmetic, and has
a right-hand side that looks boolean.
This (partly) addresses http://llvm.org/bugs/show_bug.cgi?id=9969
llvm-svn: 132565
|
|
|
|
|
|
| |
pointers. Fixes PR10052.
llvm-svn: 132397
|
|
|
|
|
|
|
|
|
|
|
|
| |
return f() || -1;
where the user meant to write '|'.
This bootstraps without any additional warnings.
Patch by Richard Trieu.
llvm-svn: 132327
|
|
|
|
|
|
|
|
|
|
|
| |
I tried to use an assert to prove that I could remove each of the
arguments I did, but ended up writing my assert with inverted logic.
Doh! Reported by Xi Wang on cfe-dev. I have manually verified the source
locations and ranges for these using -ast-dump. I tried writing a test
case that would catch these, but these expressions aren't exposed in the
c-index-test's token annotation utility.
llvm-svn: 132284
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
within class templates when they are necessary to complete the type of
the member. The canonical example is code like:
template <typename T> struct S {
static const int arr[];
static const int x;
static int f();
};
template <typename T> const int S<T>::arr[] = { 1, 2, 3 };
template <typename T> const int S<T>::x = sizeof(arr) / sizeof(arr[0]);
template <typename T> int S<T>::f() { return x; }
int x = S<int>::f();
We need to instantiate S<T>::arr's definition to pick up its initializer
and complete the array type. This involves new code to specially handle
completing the type of an expression where the type alone is
insufficient. It also requires *updating* the expression with the newly
completed type. Fortunately, all the other infrastructure is already in
Clang to do the instantiation, do the completion, and prune out the
unused bits of code that result from this instantiation.
This addresses the initial bug in PR10001, and will be a step to
fleshing out other cases where we need to work harder to complete an
expression's type. Who knew we still had missing C++03 "features"?
llvm-svn: 132172
|
|
|
|
|
|
|
|
|
|
| |
provide re-usable forms of the rest of the custom validation done here.
Still no functionality changed here.
With this it should be possible to have an expression-centric code path
and a type-centric code path which don't duplicate logic.
llvm-svn: 132118
|
|
|
|
|
|
|
| |
information in the previous comment which was preserved and moved with
the vec_step implementation code.
llvm-svn: 132117
|
|
|
|
|
|
|
| |
It has little overlap with other traits' requirements, so the resulting
code is actually simpler.
llvm-svn: 132116
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
traits which uses the information embedded in the expression. Use this
to simplify several interfaces which repeated information embedded in
the expression through explicit arguments. I added an assertion that the
only extra piece of data to come in from the parser matches what is
stored in the expression. No functionality change intended here.
Also cleaned up the doxygen comments for some of these methods and some
formatting oddities.
llvm-svn: 132115
|
|
|
|
|
|
|
|
|
|
|
|
| |
non-POD/non-trivial object throuugh a C-style varargs. The warning
itself was default-mapped to error, but can be downgraded, but we were
treating it in Sema like a hard error, silently dropping the call.
Instead, treat this problem like a warning, and do what the warning
says we do: abort at runtime. To do so, we fake up a __builtin_trap()
expression that gets evaluated as part of the argument.
llvm-svn: 131805
|
|
|
|
| |
llvm-svn: 131792
|
|
|
|
|
|
| |
Howard Hinnant. Thanks!
llvm-svn: 131349
|
|
|
|
|
|
| |
operators.
llvm-svn: 131338
|
|
|
|
|
|
| |
One more special member to go
llvm-svn: 131287
|
|
|
|
| |
llvm-svn: 131259
|
|
|
|
|
|
|
|
|
|
| |
defaulted default constructors.
As it happens, making sure that we handle out-of-line defaulted
functions properly will involved making sure that we actually parse them
correctly, so that's coming after.
llvm-svn: 131224
|
|
|
|
|
|
|
| |
modify the semantics slightly to accomodate default constructors (I
hope).
llvm-svn: 131087
|
|
|
|
|
|
|
|
| |
We can use this to produce nice diagnostics (and try to fixit-and-recover) in
various cases where we might see "MyFunction" instead of "MyFunction()". The
changes in SemaExpr are an example of how to use isExprCallable.
llvm-svn: 130878
|
|
|
|
|
|
| |
by Richard Trieu!
llvm-svn: 130703
|
|
|
|
|
|
| |
instantiated in a different PCH than its containing class. Otherwise we get double definition errors. Fixes a Boost.MPL problem that affects Boost.Accumulators and probably a lot more of Boost.
llvm-svn: 130488
|
|
|
|
|
|
|
|
|
|
| |
make sure to mark the destructor. This normally isn't required,
because the destructor should have been marked as part of the
declaration of the local, but it's necessary when the variable
is a parameter because it's the call sites that are responsible
for those destructors.
llvm-svn: 130372
|
|
|
|
|
|
|
|
| |
instance methods to have bound-member type.
Fixing that broke __unknown_anytype, which I've in turn fixed.
llvm-svn: 130266
|
|
|
|
|
|
|
|
|
|
|
| |
bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function. Diagnose this in the general case. Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.
llvm-svn: 130239
|
|
|
|
|
|
| |
Addresses rdar://9269271.
llvm-svn: 130207
|
|
|
|
|
|
|
|
| |
to silence the warning and
any other suggestion after that. Related to rdar://9300260.
llvm-svn: 130169
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
performs name lookup for an identifier and resolves it to a
type/expression/template/etc. in the same step. This scheme is
intended to improve both performance (by reducing the number of
redundant name lookups for a given identifier token) and error
recovery (by giving Sema a chance to correct type names before the
parser has decided that the identifier isn't a type name). For
example, this allows us to properly typo-correct type names at the
beginning of a statement:
t.c:6:3: error: use of undeclared identifier 'integer'; did you mean
'Integer'?
integer *i = 0;
^~~~~~~
Integer
t.c:1:13: note: 'Integer' declared here
typedef int Integer;
^
Previously, we wouldn't give a Fix-It because the typo correction
occurred after the parser had checked whether "integer" was a type
name (via Sema::getTypeName(), which isn't allowed to typo-correct)
and therefore decided to parse "integer * i = 0" as an expression. By
typo-correcting earlier, we typo-correct to the type name Integer and
parse this as a declaration.
Moreover, in this context, we can also typo-correct identifiers to
keywords, e.g.,
t.c:7:3: error: use of undeclared identifier 'vid'; did you mean
'void'?
vid *p = i;
^~~
void
and recover appropriately.
Note that this is very much a work-in-progress. The new
Sema::ClassifyName is only used for expression-or-declaration
disambiguation in C at the statement level. The next steps will be to
make this work for the same disambiguation in C++ (where
functional-style casts make some trouble), then push it
further into the parser to eliminate more redundant name lookups.
Fixes <rdar://problem/7963833> for C and starts us down the path of
<rdar://problem/8172000>.
llvm-svn: 130082
|
|
|
|
|
|
|
| |
a 'deprecated' selector in the diagnostics for the
selector. // rdar://9309223
llvm-svn: 130062
|
|
|
|
| |
llvm-svn: 130009
|
|
|
|
|
|
|
|
|
|
|
| |
instance, in the following code, 'case ' will be suggested before the '1:'
switch (x) {
1: return 0;
default: return 1;
}
llvm-svn: 129943
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
warnings diverge from
gcc's unused warnings which don't get emitted if the function is referenced even in an unevaluated context
(e.g. in templates, sizeof, etc.). Also, saying that a function is 'unused' because it won't get codegen'ed
is somewhat misleading.
- Don't emit 'unused' warnings for functions that are referenced in any part of the user's code.
- A warning that an internal function/variable won't get emitted is useful though, so introduce
-Wunneeded-internal-declaration which will warn if a function/variable with internal linkage is not
"needed" ('used' from the codegen perspective), e.g:
static void foo() { }
template <int>
void bar() {
foo();
}
test.cpp:1:13: warning: function 'foo' is not needed and will not be emitted
static void foo() { }
^
Addresses rdar://8733476.
llvm-svn: 129794
|
|
|
|
|
|
|
|
| |
cases where stand-alone ivar can be looked up
in shadowed object. To fix gcc compatibility
breakage. // rdar://9284603
llvm-svn: 129576
|
|
|
|
| |
llvm-svn: 129567
|
|
|
|
| |
llvm-svn: 129564
|
|
|
|
|
|
| |
Luis Felipe Strano Moraes!
llvm-svn: 129559
|
|
|
|
|
|
|
| |
As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.
llvm-svn: 129554
|
|
|
|
|
|
|
| |
DiagnosticBuilder::AddFixItHint: they will be dropped along with any
other (possibly valid) fixits later.
llvm-svn: 129495
|
|
|
|
|
|
|
|
|
|
| |
that the class
named by the nested-name-specifier is same or base of the class in which the member expression appears.
It seems we also had an ill-formed test case, mon dieu! Fixes rdar://8576107.
llvm-svn: 129493
|
|
|
|
|
|
| |
string or not.
llvm-svn: 129488
|
|
|
|
|
|
| |
// rdar://9091893
llvm-svn: 129481
|
|
|
|
|
|
| |
defined in a macro. // rdar://9091893
llvm-svn: 129465
|
|
|
|
|
|
|
| |
objective-c instead of crashing in IRgen.
// rdar://9154582.
llvm-svn: 129412
|