Skip to content

Commit 4e46bd3

Browse files
committed
Merge from 'master' to 'sycl-web' (intel#15)
CONFLICT (content): Merge conflict in clang/lib/Sema/CMakeLists.txt CONFLICT (content): Merge conflict in clang/lib/CodeGen/CMakeLists.txt
2 parents 7142db9 + 80bd6ae commit 4e46bd3

Some content is hidden

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

56 files changed

+713
-1295
lines changed

clang/include/clang/Analysis/Analyses/Dominators.h

-70
Original file line numberDiff line numberDiff line change
@@ -273,76 +273,6 @@ class ControlDependencyCalculator : public ManagedAnalysis {
273273

274274
namespace llvm {
275275

276-
/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
277-
/// if statement's condition is always false, it's 'then' branch is represented
278-
/// with a nullptr. This however will result in a nullpointer derefernece for
279-
/// dominator tree calculation.
280-
///
281-
/// To circumvent this, let's just crudely specialize the children getters
282-
/// used in LLVM's dominator tree builder.
283-
namespace DomTreeBuilder {
284-
285-
using ClangCFGDomChildrenGetter =
286-
SemiNCAInfo<clang::CFGDomTree::DominatorTreeBase>::ChildrenGetter<
287-
/*Inverse=*/false>;
288-
289-
template <>
290-
template <>
291-
inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
292-
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/false>) {
293-
auto RChildren = reverse(children<NodePtr>(N));
294-
ResultTy Ret(RChildren.begin(), RChildren.end());
295-
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
296-
return Ret;
297-
}
298-
299-
using ClangCFGDomReverseChildrenGetter =
300-
SemiNCAInfo<clang::CFGDomTree::DominatorTreeBase>::ChildrenGetter<
301-
/*Inverse=*/true>;
302-
303-
template <>
304-
template <>
305-
inline ClangCFGDomReverseChildrenGetter::ResultTy
306-
ClangCFGDomReverseChildrenGetter::Get(
307-
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/true>) {
308-
auto IChildren = inverse_children<NodePtr>(N);
309-
ResultTy Ret(IChildren.begin(), IChildren.end());
310-
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
311-
return Ret;
312-
}
313-
314-
using ClangCFGPostDomChildrenGetter =
315-
SemiNCAInfo<clang::CFGPostDomTree::DominatorTreeBase>::ChildrenGetter<
316-
/*Inverse=*/false>;
317-
318-
template <>
319-
template <>
320-
inline ClangCFGPostDomChildrenGetter::ResultTy
321-
ClangCFGPostDomChildrenGetter::Get(
322-
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/false>) {
323-
auto RChildren = reverse(children<NodePtr>(N));
324-
ResultTy Ret(RChildren.begin(), RChildren.end());
325-
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
326-
return Ret;
327-
}
328-
329-
using ClangCFGPostDomReverseChildrenGetter =
330-
SemiNCAInfo<clang::CFGPostDomTree::DominatorTreeBase>::ChildrenGetter<
331-
/*Inverse=*/true>;
332-
333-
template <>
334-
template <>
335-
inline ClangCFGPostDomReverseChildrenGetter::ResultTy
336-
ClangCFGPostDomReverseChildrenGetter::Get(
337-
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/true>) {
338-
auto IChildren = inverse_children<NodePtr>(N);
339-
ResultTy Ret(IChildren.begin(), IChildren.end());
340-
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
341-
return Ret;
342-
}
343-
344-
} // end of namespace DomTreeBuilder
345-
346276
//===-------------------------------------
347277
/// DominatorTree GraphTraits specialization so the DominatorTree can be
348278
/// iterable by generic graph iterators.

clang/include/clang/Basic/DiagnosticSemaKinds.td

-2
Original file line numberDiff line numberDiff line change
@@ -9767,8 +9767,6 @@ def err_opencl_block_ref_block : Error<
97679767
"cannot refer to a block inside block">;
97689768

97699769
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
9770-
def err_opencl_builtin_to_addr_arg_num : Error<
9771-
"invalid number of arguments to function: %0">;
97729770
def err_opencl_builtin_to_addr_invalid_arg : Error<
97739771
"invalid argument %0 to function: %1, expecting a generic pointer argument">;
97749772

clang/include/clang/Sema/DeclSpec.h

+9
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,15 @@ class Declarator {
24352435
return true;
24362436
return false;
24372437
}
2438+
/// Get the trailing return type appearing (at any level) within this
2439+
/// declarator.
2440+
ParsedType getTrailingReturnType() const {
2441+
for (const auto &Chunk : type_objects())
2442+
if (Chunk.Kind == DeclaratorChunk::Function &&
2443+
Chunk.Fun.hasTrailingReturnType())
2444+
return Chunk.Fun.getTrailingReturnType();
2445+
return ParsedType();
2446+
}
24382447

24392448
/// \brief Sets a trailing requires clause for this declarator.
24402449
void setTrailingRequiresClause(Expr *TRC) {

clang/include/clang/Sema/Sema.h

+2
Original file line numberDiff line numberDiff line change
@@ -8334,6 +8334,8 @@ class Sema final {
83348334
/// Completely replace the \c auto in \p TypeWithAuto by
83358335
/// \p Replacement. This does not retain any \c auto type sugar.
83368336
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
8337+
TypeSourceInfo *ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto,
8338+
QualType Replacement);
83378339

83388340
/// Result type of DeduceAutoType.
83398341
enum DeduceAutoResult {

clang/lib/ASTMatchers/Dynamic/CMakeLists.txt

-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ set(LLVM_LINK_COMPONENTS
33
Support
44
)
55

6-
# The registry source file ends up generating a lot of sections for each
7-
# matcher. Each matcher appears to get a vtable and several methods. Each
8-
# method needs .text, .pdata, .xdata, and .debug sections, adding to the
9-
# section multiplier. By default MSVC has a 2^16 limit on the number of
10-
# sections in an object file, and this needs more than that.
11-
if (MSVC)
12-
set_source_files_properties(Registry.cpp PROPERTIES COMPILE_FLAGS /bigobj)
13-
endif()
14-
156
add_clang_library(clangDynamicASTMatchers
167
Diagnostics.cpp
178
Marshallers.cpp

clang/lib/CodeGen/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ set(LLVM_LINK_COMPONENTS
2727
TransformUtils
2828
)
2929

30-
if (MSVC)
31-
set_source_files_properties(CodeGenModule.cpp PROPERTIES COMPILE_FLAGS /bigobj)
32-
endif()
3330

3431
get_property(LLVMGenXIntrinsics_SOURCE_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_SOURCE_PROP)
3532
get_property(LLVMGenXIntrinsics_BINARY_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_BINARY_PROP)

clang/lib/Sema/CMakeLists.txt

-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
)
55

66
if (MSVC)
7-
set_source_files_properties(SemaDeclAttr.cpp PROPERTIES COMPILE_FLAGS /bigobj)
8-
set_source_files_properties(SemaExpr.cpp PROPERTIES COMPILE_FLAGS /bigobj)
9-
set_source_files_properties(SemaExprCXX.cpp PROPERTIES COMPILE_FLAGS /bigobj)
107
set_source_files_properties(SemaSYCL.cpp PROPERTIES COMPILE_FLAGS /bigobj)
11-
set_source_files_properties(SemaTemplate.cpp PROPERTIES COMPILE_FLAGS /bigobj)
12-
set_source_files_properties(SemaTemplateDeduction.cpp PROPERTIES COMPILE_FLAGS /bigobj)
13-
set_source_files_properties(SemaOpenMP.cpp PROPERTIES COMPILE_FLAGS /bigobj)
148
endif()
159

1610
clang_tablegen(OpenCLBuiltins.inc -gen-clang-opencl-builtins

clang/lib/Sema/SemaChecking.cpp

+8-47
Original file line numberDiff line numberDiff line change
@@ -1274,11 +1274,8 @@ static bool SemaBuiltinPipePackets(Sema &S, CallExpr *Call) {
12741274
// \return True if a semantic error has been found, false otherwise.
12751275
static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
12761276
CallExpr *Call) {
1277-
if (Call->getNumArgs() != 1) {
1278-
S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_arg_num)
1279-
<< Call->getDirectCallee() << Call->getSourceRange();
1277+
if (checkArgCount(S, Call, 1))
12801278
return true;
1281-
}
12821279

12831280
auto RT = Call->getArg(0)->getType();
12841281
if (!RT->isPointerType() || RT->getPointeeType()
@@ -5708,21 +5705,8 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
57085705
if (checkVAStartABI(*this, BuiltinID, Fn))
57095706
return true;
57105707

5711-
if (TheCall->getNumArgs() > 2) {
5712-
Diag(TheCall->getArg(2)->getBeginLoc(),
5713-
diag::err_typecheck_call_too_many_args)
5714-
<< 0 /*function call*/ << 2 << TheCall->getNumArgs()
5715-
<< Fn->getSourceRange()
5716-
<< SourceRange(TheCall->getArg(2)->getBeginLoc(),
5717-
(*(TheCall->arg_end() - 1))->getEndLoc());
5708+
if (checkArgCount(*this, TheCall, 2))
57185709
return true;
5719-
}
5720-
5721-
if (TheCall->getNumArgs() < 2) {
5722-
return Diag(TheCall->getEndLoc(),
5723-
diag::err_typecheck_call_too_few_args_at_least)
5724-
<< 0 /*function call*/ << 2 << TheCall->getNumArgs();
5725-
}
57265710

57275711
// Type-check the first argument normally.
57285712
if (checkBuiltinArgument(*this, TheCall, 0))
@@ -5832,15 +5816,8 @@ bool Sema::SemaBuiltinVAStartARMMicrosoft(CallExpr *Call) {
58325816
/// SemaBuiltinUnorderedCompare - Handle functions like __builtin_isgreater and
58335817
/// friends. This is declared to take (...), so we have to check everything.
58345818
bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
5835-
if (TheCall->getNumArgs() < 2)
5836-
return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args)
5837-
<< 0 << 2 << TheCall->getNumArgs() /*function call*/;
5838-
if (TheCall->getNumArgs() > 2)
5839-
return Diag(TheCall->getArg(2)->getBeginLoc(),
5840-
diag::err_typecheck_call_too_many_args)
5841-
<< 0 /*function call*/ << 2 << TheCall->getNumArgs()
5842-
<< SourceRange(TheCall->getArg(2)->getBeginLoc(),
5843-
(*(TheCall->arg_end() - 1))->getEndLoc());
5819+
if (checkArgCount(*this, TheCall, 2))
5820+
return true;
58445821

58455822
ExprResult OrigArg0 = TheCall->getArg(0);
58465823
ExprResult OrigArg1 = TheCall->getArg(1);
@@ -5878,15 +5855,8 @@ bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
58785855
/// to check everything. We expect the last argument to be a floating point
58795856
/// value.
58805857
bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
5881-
if (TheCall->getNumArgs() < NumArgs)
5882-
return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args)
5883-
<< 0 << NumArgs << TheCall->getNumArgs() /*function call*/;
5884-
if (TheCall->getNumArgs() > NumArgs)
5885-
return Diag(TheCall->getArg(NumArgs)->getBeginLoc(),
5886-
diag::err_typecheck_call_too_many_args)
5887-
<< 0 /*function call*/ << NumArgs << TheCall->getNumArgs()
5888-
<< SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(),
5889-
(*(TheCall->arg_end() - 1))->getEndLoc());
5858+
if (checkArgCount(*this, TheCall, NumArgs))
5859+
return true;
58905860

58915861
// __builtin_fpclassify is the only case where NumArgs != 1, so we can count
58925862
// on all preceding parameters just being int. Try all of those.
@@ -5990,17 +5960,8 @@ bool Sema::SemaBuiltinComplex(CallExpr *TheCall) {
59905960
// vector short vec_xxsldwi(vector short, vector short, int);
59915961
bool Sema::SemaBuiltinVSX(CallExpr *TheCall) {
59925962
unsigned ExpectedNumArgs = 3;
5993-
if (TheCall->getNumArgs() < ExpectedNumArgs)
5994-
return Diag(TheCall->getEndLoc(),
5995-
diag::err_typecheck_call_too_few_args_at_least)
5996-
<< 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs()
5997-
<< TheCall->getSourceRange();
5998-
5999-
if (TheCall->getNumArgs() > ExpectedNumArgs)
6000-
return Diag(TheCall->getEndLoc(),
6001-
diag::err_typecheck_call_too_many_args_at_most)
6002-
<< 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs()
6003-
<< TheCall->getSourceRange();
5963+
if (checkArgCount(*this, TheCall, ExpectedNumArgs))
5964+
return true;
60045965

60055966
// Check the third argument is a compile time constant
60065967
if (!TheCall->getArg(2)->isIntegerConstantExpr(Context))

clang/lib/Sema/SemaTemplateDeduction.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -4896,6 +4896,13 @@ QualType Sema::ReplaceAutoType(QualType TypeWithAuto,
48964896
.TransformType(TypeWithAuto);
48974897
}
48984898

4899+
TypeSourceInfo *Sema::ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto,
4900+
QualType TypeToReplaceAuto) {
4901+
return SubstituteDeducedTypeTransform(*this, TypeToReplaceAuto,
4902+
/*UseTypeSugar*/ false)
4903+
.TransformType(TypeWithAuto);
4904+
}
4905+
48994906
void Sema::DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init) {
49004907
if (isa<InitListExpr>(Init))
49014908
Diag(VDecl->getLocation(),

0 commit comments

Comments
 (0)