Skip to content

Commit

Permalink
Merge from 'master' to 'sycl-web' (intel#15)
Browse files Browse the repository at this point in the history
  CONFLICT (content): Merge conflict in clang/lib/Sema/CMakeLists.txt
  CONFLICT (content): Merge conflict in clang/lib/CodeGen/CMakeLists.txt
  • Loading branch information
MoringLiu committed Jul 29, 2020
2 parents 7142db9 + 80bd6ae commit 4e46bd3
Show file tree
Hide file tree
Showing 56 changed files with 713 additions and 1,295 deletions.
70 changes: 0 additions & 70 deletions clang/include/clang/Analysis/Analyses/Dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,76 +273,6 @@ class ControlDependencyCalculator : public ManagedAnalysis {

namespace llvm {

/// Clang's CFG contains nullpointers for unreachable succesors, e.g. when an
/// if statement's condition is always false, it's 'then' branch is represented
/// with a nullptr. This however will result in a nullpointer derefernece for
/// dominator tree calculation.
///
/// To circumvent this, let's just crudely specialize the children getters
/// used in LLVM's dominator tree builder.
namespace DomTreeBuilder {

using ClangCFGDomChildrenGetter =
SemiNCAInfo<clang::CFGDomTree::DominatorTreeBase>::ChildrenGetter<
/*Inverse=*/false>;

template <>
template <>
inline ClangCFGDomChildrenGetter::ResultTy ClangCFGDomChildrenGetter::Get(
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/false>) {
auto RChildren = reverse(children<NodePtr>(N));
ResultTy Ret(RChildren.begin(), RChildren.end());
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
return Ret;
}

using ClangCFGDomReverseChildrenGetter =
SemiNCAInfo<clang::CFGDomTree::DominatorTreeBase>::ChildrenGetter<
/*Inverse=*/true>;

template <>
template <>
inline ClangCFGDomReverseChildrenGetter::ResultTy
ClangCFGDomReverseChildrenGetter::Get(
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/true>) {
auto IChildren = inverse_children<NodePtr>(N);
ResultTy Ret(IChildren.begin(), IChildren.end());
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
return Ret;
}

using ClangCFGPostDomChildrenGetter =
SemiNCAInfo<clang::CFGPostDomTree::DominatorTreeBase>::ChildrenGetter<
/*Inverse=*/false>;

template <>
template <>
inline ClangCFGPostDomChildrenGetter::ResultTy
ClangCFGPostDomChildrenGetter::Get(
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/false>) {
auto RChildren = reverse(children<NodePtr>(N));
ResultTy Ret(RChildren.begin(), RChildren.end());
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
return Ret;
}

using ClangCFGPostDomReverseChildrenGetter =
SemiNCAInfo<clang::CFGPostDomTree::DominatorTreeBase>::ChildrenGetter<
/*Inverse=*/true>;

template <>
template <>
inline ClangCFGPostDomReverseChildrenGetter::ResultTy
ClangCFGPostDomReverseChildrenGetter::Get(
clang::CFGBlock *N, std::integral_constant<bool, /*Inverse=*/true>) {
auto IChildren = inverse_children<NodePtr>(N);
ResultTy Ret(IChildren.begin(), IChildren.end());
Ret.erase(std::remove(Ret.begin(), Ret.end(), nullptr), Ret.end());
return Ret;
}

} // end of namespace DomTreeBuilder

//===-------------------------------------
/// DominatorTree GraphTraits specialization so the DominatorTree can be
/// iterable by generic graph iterators.
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -9767,8 +9767,6 @@ def err_opencl_block_ref_block : Error<
"cannot refer to a block inside block">;

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

Expand Down
9 changes: 9 additions & 0 deletions clang/include/clang/Sema/DeclSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,15 @@ class Declarator {
return true;
return false;
}
/// Get the trailing return type appearing (at any level) within this
/// declarator.
ParsedType getTrailingReturnType() const {
for (const auto &Chunk : type_objects())
if (Chunk.Kind == DeclaratorChunk::Function &&
Chunk.Fun.hasTrailingReturnType())
return Chunk.Fun.getTrailingReturnType();
return ParsedType();
}

/// \brief Sets a trailing requires clause for this declarator.
void setTrailingRequiresClause(Expr *TRC) {
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -8334,6 +8334,8 @@ class Sema final {
/// Completely replace the \c auto in \p TypeWithAuto by
/// \p Replacement. This does not retain any \c auto type sugar.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
TypeSourceInfo *ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto,
QualType Replacement);

/// Result type of DeduceAutoType.
enum DeduceAutoResult {
Expand Down
9 changes: 0 additions & 9 deletions clang/lib/ASTMatchers/Dynamic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ set(LLVM_LINK_COMPONENTS
Support
)

# The registry source file ends up generating a lot of sections for each
# matcher. Each matcher appears to get a vtable and several methods. Each
# method needs .text, .pdata, .xdata, and .debug sections, adding to the
# section multiplier. By default MSVC has a 2^16 limit on the number of
# sections in an object file, and this needs more than that.
if (MSVC)
set_source_files_properties(Registry.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()

add_clang_library(clangDynamicASTMatchers
Diagnostics.cpp
Marshallers.cpp
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/CodeGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ set(LLVM_LINK_COMPONENTS
TransformUtils
)

if (MSVC)
set_source_files_properties(CodeGenModule.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()

get_property(LLVMGenXIntrinsics_SOURCE_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_SOURCE_PROP)
get_property(LLVMGenXIntrinsics_BINARY_DIR GLOBAL PROPERTY LLVMGenXIntrinsics_BINARY_PROP)
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Sema/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ set(LLVM_LINK_COMPONENTS
)

if (MSVC)
set_source_files_properties(SemaDeclAttr.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaExpr.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaExprCXX.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaSYCL.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaTemplate.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaTemplateDeduction.cpp PROPERTIES COMPILE_FLAGS /bigobj)
set_source_files_properties(SemaOpenMP.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()

clang_tablegen(OpenCLBuiltins.inc -gen-clang-opencl-builtins
Expand Down
55 changes: 8 additions & 47 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,11 +1274,8 @@ static bool SemaBuiltinPipePackets(Sema &S, CallExpr *Call) {
// \return True if a semantic error has been found, false otherwise.
static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
CallExpr *Call) {
if (Call->getNumArgs() != 1) {
S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_arg_num)
<< Call->getDirectCallee() << Call->getSourceRange();
if (checkArgCount(S, Call, 1))
return true;
}

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

if (TheCall->getNumArgs() > 2) {
Diag(TheCall->getArg(2)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
<< 0 /*function call*/ << 2 << TheCall->getNumArgs()
<< Fn->getSourceRange()
<< SourceRange(TheCall->getArg(2)->getBeginLoc(),
(*(TheCall->arg_end() - 1))->getEndLoc());
if (checkArgCount(*this, TheCall, 2))
return true;
}

if (TheCall->getNumArgs() < 2) {
return Diag(TheCall->getEndLoc(),
diag::err_typecheck_call_too_few_args_at_least)
<< 0 /*function call*/ << 2 << TheCall->getNumArgs();
}

// Type-check the first argument normally.
if (checkBuiltinArgument(*this, TheCall, 0))
Expand Down Expand Up @@ -5832,15 +5816,8 @@ bool Sema::SemaBuiltinVAStartARMMicrosoft(CallExpr *Call) {
/// SemaBuiltinUnorderedCompare - Handle functions like __builtin_isgreater and
/// friends. This is declared to take (...), so we have to check everything.
bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
if (TheCall->getNumArgs() < 2)
return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args)
<< 0 << 2 << TheCall->getNumArgs() /*function call*/;
if (TheCall->getNumArgs() > 2)
return Diag(TheCall->getArg(2)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
<< 0 /*function call*/ << 2 << TheCall->getNumArgs()
<< SourceRange(TheCall->getArg(2)->getBeginLoc(),
(*(TheCall->arg_end() - 1))->getEndLoc());
if (checkArgCount(*this, TheCall, 2))
return true;

ExprResult OrigArg0 = TheCall->getArg(0);
ExprResult OrigArg1 = TheCall->getArg(1);
Expand Down Expand Up @@ -5878,15 +5855,8 @@ bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
/// to check everything. We expect the last argument to be a floating point
/// value.
bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
if (TheCall->getNumArgs() < NumArgs)
return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args)
<< 0 << NumArgs << TheCall->getNumArgs() /*function call*/;
if (TheCall->getNumArgs() > NumArgs)
return Diag(TheCall->getArg(NumArgs)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
<< 0 /*function call*/ << NumArgs << TheCall->getNumArgs()
<< SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(),
(*(TheCall->arg_end() - 1))->getEndLoc());
if (checkArgCount(*this, TheCall, NumArgs))
return true;

// __builtin_fpclassify is the only case where NumArgs != 1, so we can count
// on all preceding parameters just being int. Try all of those.
Expand Down Expand Up @@ -5990,17 +5960,8 @@ bool Sema::SemaBuiltinComplex(CallExpr *TheCall) {
// vector short vec_xxsldwi(vector short, vector short, int);
bool Sema::SemaBuiltinVSX(CallExpr *TheCall) {
unsigned ExpectedNumArgs = 3;
if (TheCall->getNumArgs() < ExpectedNumArgs)
return Diag(TheCall->getEndLoc(),
diag::err_typecheck_call_too_few_args_at_least)
<< 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs()
<< TheCall->getSourceRange();

if (TheCall->getNumArgs() > ExpectedNumArgs)
return Diag(TheCall->getEndLoc(),
diag::err_typecheck_call_too_many_args_at_most)
<< 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs()
<< TheCall->getSourceRange();
if (checkArgCount(*this, TheCall, ExpectedNumArgs))
return true;

// Check the third argument is a compile time constant
if (!TheCall->getArg(2)->isIntegerConstantExpr(Context))
Expand Down
7 changes: 7 additions & 0 deletions clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4896,6 +4896,13 @@ QualType Sema::ReplaceAutoType(QualType TypeWithAuto,
.TransformType(TypeWithAuto);
}

TypeSourceInfo *Sema::ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto,
QualType TypeToReplaceAuto) {
return SubstituteDeducedTypeTransform(*this, TypeToReplaceAuto,
/*UseTypeSugar*/ false)
.TransformType(TypeWithAuto);
}

void Sema::DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init) {
if (isa<InitListExpr>(Init))
Diag(VDecl->getLocation(),
Expand Down
Loading

0 comments on commit 4e46bd3

Please sign in to comment.