| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compilation pipeline doesn't actually need to know about the high-level
concept of diagnostic mappings, and hiding the final computed level presents
several simplifications and other potential benefits.
The only exceptions are opportunistic checks to see whether expensive code
paths can be avoided for diagnostics that are guaranteed to be ignored at a
certain SourceLocation.
This commit formalizes that invariant by introducing and using
DiagnosticsEngine::isIgnored() in place of individual level checks throughout
lex, parse and sema.
llvm-svn: 211005
|
|
|
|
|
|
|
|
|
| |
This patch implements semantic analysis to make sure that the loop is in OpenMP canonical form.
This is the form required for 'omp simd', 'omp for' and other loop pragmas.
Differential revision: http://reviews.llvm.org/D3778
llvm-svn: 210095
|
|
|
|
| |
llvm-svn: 209812
|
|
|
|
|
|
| |
takeAs to getAs.
llvm-svn: 209800
|
|
|
|
| |
llvm-svn: 209613
|
|
|
|
|
|
|
|
|
| |
Make better diagnostic produced by erroneous switch statement.
It fixes PR19022.
Differential Revision: http://reviews.llvm.org/D3137
llvm-svn: 209302
|
|
|
|
| |
llvm-svn: 208768
|
|
|
|
| |
llvm-svn: 208077
|
|
|
|
|
|
|
|
| |
apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal.
Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith.
llvm-svn: 207890
|
|
|
|
|
|
|
| |
when building the candidate set, rather than trying to contort name lookup into
handling this.
llvm-svn: 206436
|
|
|
|
|
|
| |
iterator_range decls(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203947
|
|
|
|
|
|
| |
class.
llvm-svn: 203640
|
|
|
|
|
|
|
| |
-Wunused-comparison. Also, newly warn on unused result from overloaded
relational comparisons, now also in -Wunused-comparison.
llvm-svn: 203535
|
|
|
|
|
|
|
|
| |
instead, per post-commit review feedback.
Replacing llvm::copy changes with SmallVector range-based construction which is a considerably cleaner approach.
llvm-svn: 203461
|
|
|
|
|
|
| |
iterator_range fields(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203355
|
|
|
|
|
|
| |
with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203353
|
|
|
|
|
|
|
|
| |
Follow up to r200082.
Spotted by Dmitri
llvm-svn: 200105
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A return type is the declared or deduced part of the function type specified in
the declaration.
A result type is the (potentially adjusted) type of the value of an expression
that calls the function.
Rule of thumb:
* Declarations have return types and parameters.
* Expressions have result types and arguments.
llvm-svn: 200082
|
|
|
|
|
|
| |
in Sema::CheckReturnValExpr. Add the missing handling of value-dependent expressions for returns_nonnull.
llvm-svn: 199989
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside
its body, for example:
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
This code is rejected by GCC if compiled in C mode but is accepted in C++
code. GCC bug 44715 tracks this discrepancy. Clang used code generation
that differs from GCC in both modes: only statement of the third
expression of 'for' behaves as if it was inside loop body.
This change makes code generation more close to GCC, considering 'break'
or 'continue' statement in condition and increment expressions of a
loop as it was inside the loop body. It also adds error for the cases
when 'break'/'continue' appear outside loop due to this syntax. If
code generation differ from GCC, warning is issued.
Differential Revision: http://llvm-reviews.chandlerc.com/D2518
llvm-svn: 199897
|
|
|
|
|
|
|
|
|
|
| |
'returns_nonnull'.
This involved making CheckReturnStackAddr into a static function, which
is now called by a top-level return value checking routine called
CheckReturnValExpr.
llvm-svn: 199790
|
|
|
|
|
|
|
|
| |
pointer, since this invokes undefined behavior. Based on a patch by Artyom
Skrobov! Handling of dependent exception specifications and some additional
testcases by me.
llvm-svn: 199452
|
|
|
|
|
|
| |
change intended -- this only replaces Boolean uses of getAttr.
llvm-svn: 197648
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes -Wassign-enum to compare unqualified types. One could
think that this does not matter much, because who wants a value of enum type
that is const-qualified? But this breaks the intended pattern to silence this
warning with an explicit cast:
static const enum Foo z = (enum Foo) 42;
In this case, source type is 'enum Foo', and destination type is 'const enum
Foo', and if we compare qualified types, they don't match, so we used warn.
llvm-svn: 196548
|
|
|
|
|
|
|
|
|
|
| |
the following pattern.
If 'case' expression refers to a static const variable of the correct enum
type, then we count this as a sufficient declaration of intent by the user,
so we silence the warning.
llvm-svn: 196546
|
|
|
|
|
|
|
| |
return void expression. // rdar://15366494
pr17759.
llvm-svn: 196296
|
|
|
|
|
|
|
| |
There are about 30 removed in this patch, generated by a new FixIt I haven't
got round to submitting yet.
llvm-svn: 195814
|
|
|
|
|
|
|
|
|
| |
function parameter that has array type. Such a parameter will be treated as
a pointer type instead, resulting in a missing begin function error is a
suggestion to dereference the pointer. This provides a different,
more informative diagnostic as well as point to the parameter declaration.
llvm-svn: 192512
|
|
|
|
|
|
|
|
| |
the fereach loop must be a non-const lvalue expression as
it will be assigned to at the beginning of the loop.
// rdar://15123684
llvm-svn: 192399
|
|
|
|
|
|
| |
out of the working paper. This reverts r179962 and r179992.
llvm-svn: 191718
|
|
|
|
|
|
|
| |
return type in C++1y mode. No functionality change intended. Extracted and
tweaked from a patch by Faisal Vali!
llvm-svn: 191354
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an AST file is built based on another AST file, it can use a decl from
the fist file, and therefore mark the "isUsed" bit. We need to note this in
the AST file so that the bit is set correctly when the second AST file is
loaded.
This patch introduces the distinction between setIsUsed() and markUsed() so
that we don't call into the ASTMutationListener callback when it wouldn't
be appropriate.
Fixes PR16635.
llvm-svn: 190016
|
|
|
|
|
|
|
|
| |
- Some documenation were added.
- Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get().
- Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively.
llvm-svn: 189346
|
|
|
|
|
|
| |
This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7.
llvm-svn: 189004
|
|
|
|
|
|
|
|
| |
changing Parameter from MutableArrayRef to
ArrayRef.
No functionality change intended.
llvm-svn: 188994
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- nested lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware
As an example of what compiles:
template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }
};
auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
};
auto Base = [](auto Self, auto h) {
return 1;
};
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');
Please see attached tests for more examples.
Some implementation notes:
- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters
- Augment AutoType's constructor (similar to how variadic
template-type-parameters ala TemplateTypeParmDecl are implemented) to
accept an IsParameterPack to encode a generic lambda parameter pack.
- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class
- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that Sema::ActOnLambdaAutoParameter may use it to create the
appropriate list of corresponding TemplateTypeParmDecl for each
auto parameter identified within the generic lambda (also stored
within the current LambdaScopeInfo). Additionally,
a TemplateParameterList data-member was added to hold the invented
TemplateParameterList AST node which will be much more useful
once we teach TreeTransform how to transform generic lambdas.
- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)
- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.
- Teach Sema::ActOnStartOfLambdaDefinition to set the
return type of a lambda without a trailing return type
to 'auto' in C++1y mode, and teach the return type
deduction machinery in SemaStmt.cpp to process either
C++11 and C++14 lambda's correctly depending on the flag.
- various tests were added - but much more will be needed.
A greatful thanks to all reviewers including Eli Friedman,
James Dennett and the ever illuminating Richard Smith. And
yet I am certain that I have allowed unidentified bugs to creep in;
bugs, that I will do my best to slay, once identified!
Thanks!
llvm-svn: 188977
|
|
|
|
|
|
|
| |
loop variable has a type containing 'auto', set the declaration to be invalid
(because we couldn't deduce its type) to prevent follow-on errors.
llvm-svn: 188853
|
|
|
|
|
|
|
|
| |
changing Parameter of Sema::ActOnCompoundStmt from MutableArrayRef to
ArrayRef.
No functionality change intended.
llvm-svn: 188705
|
|
|
|
|
|
|
|
|
|
|
| |
referenced as a member of the current instantiation. In that case, deduce the
type of the function to a dependent type rather than exposing an undeduced auto
type to the rest of the current instantiation.
The standard doesn't really say that the type is dependent in this case; I'll
bring this up with CWG.
llvm-svn: 188410
|
|
|
|
|
|
|
|
| |
decrements inside for loops. Idea for this warning proposed in PR15636:
http://llvm.org/bugs/show_bug.cgi?id=15636
llvm-svn: 187817
|
|
|
|
|
|
|
| |
no return type is specified, C++11 will deduce a cv-qualified return type in
some cases, but C++1y never will.
llvm-svn: 187275
|
|
|
|
|
|
| |
return type has already been determined to be a type containing an 'auto'.
llvm-svn: 187266
|
|
|
|
|
|
| |
size.
llvm-svn: 186284
|
|
|
|
|
|
|
|
| |
result type, a diagnostic being issued, issue a 'note'
mentioning reason behind the unexpected warning.
// rdar://14121570.
llvm-svn: 186105
|
|
|
|
|
|
|
|
| |
Sema::ActOnDocumentableDecls.
Patch by Robert Wilhelm.
llvm-svn: 185931
|
|
|
|
|
|
| |
// rdar://14182680.
llvm-svn: 185762
|
|
|
|
|
|
| |
avoid specifying the vector size unnecessarily.
llvm-svn: 185610
|
|
|
|
|
|
|
|
|
|
| |
constant. Also fix some spelling mistakes and formatting issues.
Reviewed by Richard Smith over IRC.
Fixes PR15069.
llvm-svn: 183409
|
|
|
|
| |
llvm-svn: 183056
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
common function. The C++1y contextual implicit conversion rules themselves are
not yet implemented, however.
This also fixes a subtle bug where template instantiation context notes were
dropped for diagnostics coming from conversions for integral constant
expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a
DiagnosticBuilder when producing these diagnostics, and losing their context
notes in the process.
llvm-svn: 182406
|