Skip to content

Commit 4e7b5d5

Browse files
committed
Merge from 'main' to 'sycl-web' (#7)
CONFLICT (content): Merge conflict in clang/lib/Sema/SemaType.cpp
2 parents 61266eb + bc7cc20 commit 4e7b5d5

File tree

187 files changed

+12681
-4824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+12681
-4824
lines changed

clang-tools-extra/clangd/Transport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H_
1919
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRANSPORT_H_
2020

21-
#include "Features.h"
2221
#include "llvm/ADT/StringRef.h"
2322
#include "llvm/Support/JSON.h"
2423
#include "llvm/Support/raw_ostream.h"

clang-tools-extra/clangd/index/remote/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if (CLANGD_ENABLE_REMOTE)
1414
)
1515
include_directories(${CMAKE_CURRENT_BINARY_DIR})
1616
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
17+
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../)
1718

1819
# FIXME(kirillbobyrev): target_compile_definitions is not working with
1920
# add_clang_library for some reason. Is there any way to make this

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// Must be before Transport.h include.
10+
#include "Features.h"
11+
912
#include "ClangdLSPServer.h"
1013
#include "CodeComplete.h"
1114
#include "Config.h"
1215
#include "ConfigProvider.h"
13-
#include "Features.h"
1416
#include "PathMapping.h"
1517
#include "Protocol.h"
1618
#include "TidyProvider.h"

clang/include/clang/AST/Expr.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,11 +3039,22 @@ class CallExpr : public Expr {
30393039
}
30403040

30413041
/// setArg - Set the specified argument.
3042+
/// ! the dependence bits might be stale after calling this setter, it is
3043+
/// *caller*'s responsibility to recompute them by calling
3044+
/// computeDependence().
30423045
void setArg(unsigned Arg, Expr *ArgExpr) {
30433046
assert(Arg < getNumArgs() && "Arg access out of range!");
30443047
getArgs()[Arg] = ArgExpr;
30453048
}
30463049

3050+
/// Compute and set dependence bits.
3051+
void computeDependence() {
3052+
setDependence(clang::computeDependence(
3053+
this, llvm::makeArrayRef(
3054+
reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
3055+
getNumPreArgs())));
3056+
}
3057+
30473058
/// Reduce the number of arguments in this call expression. This is used for
30483059
/// example during error recovery to drop extra arguments. There is no way
30493060
/// to perform the opposite because: 1.) We don't track how much storage

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ class AttributeCommonInfo {
155155

156156
bool isC2xAttribute() const { return SyntaxUsed == AS_C2x; }
157157

158+
/// The attribute is spelled [[]] in either C or C++ mode, including standard
159+
/// attributes spelled with a keyword, like alignas.
160+
bool isStandardAttributeSyntax() const {
161+
return isCXX11Attribute() || isC2xAttribute();
162+
}
163+
158164
bool isKeywordAttribute() const {
159165
return SyntaxUsed == AS_Keyword || SyntaxUsed == AS_ContextSensitiveKeyword;
160166
}

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6533,12 +6533,6 @@ def warn_pessimizing_move_on_initialization : Warning<
65336533
InGroup<PessimizingMove>, DefaultIgnore;
65346534
def note_remove_move : Note<"remove std::move call here">;
65356535

6536-
def warn_return_std_move : Warning<
6537-
"local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
6538-
InGroup<ReturnStdMove>, DefaultIgnore;
6539-
def note_add_std_move : Note<
6540-
"call 'std::move' explicitly to avoid copying">;
6541-
65426536
def warn_string_plus_int : Warning<
65436537
"adding %0 to a string does not append to the string">,
65446538
InGroup<StringPlusInt>;

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5018,8 +5018,7 @@ class Sema final {
50185018
bool isCopyElidable() const { return S == MoveEligibleAndCopyElidable; }
50195019
};
50205020
NamedReturnInfo getNamedReturnInfo(Expr *&E, bool ForceCXX2b = false);
5021-
NamedReturnInfo getNamedReturnInfo(const VarDecl *VD,
5022-
bool ForceCXX20 = false);
5021+
NamedReturnInfo getNamedReturnInfo(const VarDecl *VD);
50235022
const VarDecl *getCopyElisionCandidate(NamedReturnInfo &Info,
50245023
QualType ReturnType);
50255024

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef<Expr *> PreArgs,
14531453
for (unsigned I = Args.size(); I != NumArgs; ++I)
14541454
setArg(I, nullptr);
14551455

1456-
setDependence(computeDependence(this, PreArgs));
1456+
this->computeDependence();
14571457

14581458
CallExprBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
14591459
if (hasStoredFPFeatures())

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,8 @@ void UnwrappedLineParser::parseStructuralElement() {
14821482
}
14831483
case tok::equal:
14841484
// Fat arrows (=>) have tok::TokenKind tok::equal but TokenType
1485-
// TT_FatArrow. The always start an expression or a child block if
1486-
// followed by a curly.
1485+
// TT_FatArrow. They always start an expression or a child block if
1486+
// followed by a curly brace.
14871487
if (FormatTok->is(TT_FatArrow)) {
14881488
nextToken();
14891489
if (FormatTok->is(tok::l_brace)) {
@@ -1790,14 +1790,20 @@ bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons,
17901790
bool HasError = false;
17911791

17921792
// FIXME: Once we have an expression parser in the UnwrappedLineParser,
1793-
// replace this by using parseAssigmentExpression() inside.
1793+
// replace this by using parseAssignmentExpression() inside.
17941794
do {
17951795
if (Style.isCSharp()) {
1796+
// Fat arrows (=>) have tok::TokenKind tok::equal but TokenType
1797+
// TT_FatArrow. They always start an expression or a child block if
1798+
// followed by a curly brace.
17961799
if (FormatTok->is(TT_FatArrow)) {
17971800
nextToken();
1798-
// Fat arrows can be followed by simple expressions or by child blocks
1799-
// in curly braces.
18001801
if (FormatTok->is(tok::l_brace)) {
1802+
// C# may break after => if the next character is a newline.
1803+
if (Style.isCSharp() && Style.BraceWrapping.AfterFunction == true) {
1804+
// calling `addUnwrappedLine()` here causes odd parsing errors.
1805+
FormatTok->MustBreakBefore = true;
1806+
}
18011807
parseChildBlock();
18021808
continue;
18031809
}
@@ -1927,6 +1933,12 @@ void UnwrappedLineParser::parseParens() {
19271933
parseBracedList();
19281934
}
19291935
break;
1936+
case tok::equal:
1937+
if (Style.isCSharp() && FormatTok->is(TT_FatArrow))
1938+
parseStructuralElement();
1939+
else
1940+
nextToken();
1941+
break;
19301942
case tok::kw_class:
19311943
if (Style.Language == FormatStyle::LK_JavaScript)
19321944
parseRecord(/*ParseAsExpr=*/true);

clang/lib/Parse/Parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
12141214
// a definition. Late parsed attributes are checked at the end.
12151215
if (Tok.isNot(tok::equal)) {
12161216
for (const ParsedAttr &AL : D.getAttributes())
1217-
if (AL.isKnownToGCC() && !AL.isCXX11Attribute())
1217+
if (AL.isKnownToGCC() && !AL.isStandardAttributeSyntax())
12181218
Diag(AL.getLoc(), diag::warn_attribute_on_function_definition) << AL;
12191219
}
12201220

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,7 @@ static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
21892189
ValueDecl *VD = dyn_cast<ValueDecl>(D);
21902190
if (!VD || (!VD->getType()->isBlockPointerType() &&
21912191
!VD->getType()->isFunctionPointerType())) {
2192-
S.Diag(AL.getLoc(), AL.isCXX11Attribute()
2192+
S.Diag(AL.getLoc(), AL.isStandardAttributeSyntax()
21932193
? diag::err_attribute_wrong_decl_type
21942194
: diag::warn_attribute_wrong_decl_type)
21952195
<< AL << ExpectedFunctionMethodOrBlock;
@@ -2959,7 +2959,7 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) {
29592959
}
29602960

29612961
StringRef Str;
2962-
if ((AL.isCXX11Attribute() || AL.isC2xAttribute()) && !AL.getScopeName()) {
2962+
if (AL.isStandardAttributeSyntax() && !AL.getScopeName()) {
29632963
// The standard attribute cannot be applied to variable declarations such
29642964
// as a function pointer.
29652965
if (isa<VarDecl>(D))
@@ -8915,8 +8915,8 @@ static void handleDeprecatedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
89158915
!S.checkStringLiteralArgumentAttr(AL, 0, Str))
89168916
return;
89178917

8918-
// Only support a single optional message for Declspec and CXX11.
8919-
if (AL.isDeclspecAttribute() || AL.isCXX11Attribute())
8918+
// Support a single optional message only for Declspec and [[]] spellings.
8919+
if (AL.isDeclspecAttribute() || AL.isStandardAttributeSyntax())
89208920
AL.checkAtMostNumArgs(S, 1);
89218921
else if (AL.isArgExpr(1) && AL.getArgAsExpr(1) &&
89228922
!S.checkStringLiteralArgumentAttr(AL, 1, Replacement))
@@ -8983,7 +8983,7 @@ static void handleNoSanitizeSpecificAttr(Sema &S, Decl *D,
89838983
// getSpelling() or prettyPrint() on the resulting semantic attribute object
89848984
// without failing assertions.
89858985
unsigned TranslatedSpellingIndex = 0;
8986-
if (AL.isC2xAttribute() || AL.isCXX11Attribute())
8986+
if (AL.isStandardAttributeSyntax())
89878987
TranslatedSpellingIndex = 1;
89888988

89898989
AttributeCommonInfo Info = AL;

clang/lib/Sema/SemaExpr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6011,6 +6011,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
60116011
for (unsigned i = 0; i < TotalNumArgs; ++i)
60126012
Call->setArg(i, AllArgs[i]);
60136013

6014+
Call->computeDependence();
60146015
return false;
60156016
}
60166017

@@ -6951,6 +6952,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
69516952

69526953
TheCall->setArg(i, Arg);
69536954
}
6955+
TheCall->computeDependence();
69546956
}
69556957

69566958
if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9403,11 +9403,21 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
94039403

94049404
// Build expression: UB = min(UB, prevUB) for #for in composite or combined
94059405
// construct
9406+
ExprResult NewPrevUB = PrevUB;
94069407
SourceLocation DistEUBLoc = AStmt->getBeginLoc();
9407-
ExprResult IsUBGreater =
9408-
SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT, UB.get(), PrevUB.get());
9408+
if (!SemaRef.Context.hasSameType(UB.get()->getType(),
9409+
PrevUB.get()->getType())) {
9410+
NewPrevUB = SemaRef.BuildCStyleCastExpr(
9411+
DistEUBLoc,
9412+
SemaRef.Context.getTrivialTypeSourceInfo(UB.get()->getType()),
9413+
DistEUBLoc, NewPrevUB.get());
9414+
if (!NewPrevUB.isUsable())
9415+
return 0;
9416+
}
9417+
ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT,
9418+
UB.get(), NewPrevUB.get());
94099419
ExprResult CondOp = SemaRef.ActOnConditionalOp(
9410-
DistEUBLoc, DistEUBLoc, IsUBGreater.get(), PrevUB.get(), UB.get());
9420+
DistEUBLoc, DistEUBLoc, IsUBGreater.get(), NewPrevUB.get(), UB.get());
94119421
PrevEUB = SemaRef.BuildBinOp(CurScope, DistIncLoc, BO_Assign, UB.get(),
94129422
CondOp.get());
94139423
PrevEUB =

0 commit comments

Comments
 (0)