Skip to content

Commit

Permalink
Merge from 'master' to 'sycl-web' (#5)
Browse files Browse the repository at this point in the history
  CONFLICT (content): Merge conflict in clang/test/Misc/nvptx.languageOptsOpenCL.cl
  • Loading branch information
aelovikov-intel committed Oct 22, 2020
2 parents 5ab867b + a779a16 commit e0bbbf5
Show file tree
Hide file tree
Showing 525 changed files with 97,768 additions and 5,587 deletions.
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ namespace readability {
/// This check is similar to `-Wold-style-cast`, but it suggests automated fixes
/// in some cases. The reported locations should not be different from the
/// ones generated by `-Wold-style-cast`.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-casting.html
class AvoidCStyleCastsCheck : public ClangTidyCheck {
public:
AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace readability {

// Check for underscores in the names of googletest tests, per
// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-avoid-underscore-in-googletest-name.html
class AvoidUnderscoreInGoogletestNameCheck : public ClangTidyCheck {
public:
using ClangTidyCheck::ClangTidyCheck;
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/DefaultArgumentsCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace google {
/// Checks that default parameters are not given for virtual methods.
///
/// See https://google.github.io/styleguide/cppguide.html#Default_Arguments
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-default-arguments.html
class DefaultArgumentsCheck : public ClangTidyCheck {
public:
DefaultArgumentsCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace google {
/// Checks that all single-argument constructors are explicit.
///
/// See https://google.github.io/styleguide/cppguide.html#Explicit_Constructors
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-explicit-constructor.html
class ExplicitConstructorCheck : public ClangTidyCheck {
public:
ExplicitConstructorCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ namespace build {
/// specified explicitly, and such use isn't intended in any case.
///
/// Corresponding cpplint.py check name: 'build/explicit_make_pair'.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-build-explicit-make-pair.html
class ExplicitMakePairCheck : public ClangTidyCheck {
public:
ExplicitMakePairCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ namespace readability {
///
/// For extension-less header files, using an empty string or leaving an
/// empty string between ";" if there are other filename extensions.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-global-names-in-headers.html
class GlobalNamesInHeadersCheck : public ClangTidyCheck {
public:
GlobalNamesInHeadersCheck(StringRef Name, ClangTidyContext *Context);
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/IntegerTypesCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ namespace runtime {
/// with `u?intXX(_t)?`.
///
/// Corresponding cpplint.py check: 'runtime/int'.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-runtime-int.html
class IntegerTypesCheck : public ClangTidyCheck {
public:
IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/OverloadedUnaryAndCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace runtime {
/// https://google.github.io/styleguide/cppguide.html#Operator_Overloading
///
/// Corresponding cpplint.py check name: 'runtime/operator'.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-runtime-operator.html
class OverloadedUnaryAndCheck : public ClangTidyCheck {
public:
OverloadedUnaryAndCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/google/TodoCommentCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ namespace readability {
/// Finds TODO comments without a username or bug number.
///
/// Corresponding cpplint.py check: 'readability/todo'
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-todo.html
class TodoCommentCheck : public ClangTidyCheck {
public:
TodoCommentCheck(StringRef Name, ClangTidyContext *Context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ namespace build {
/// https://google.github.io/styleguide/cppguide.html#Namespaces
///
/// Corresponding cpplint.py check name: 'build/namespaces'.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/google-build-namespaces.html
class UnnamedNamespaceInHeaderCheck : public ClangTidyCheck {
public:
UnnamedNamespaceInHeaderCheck(StringRef Name, ClangTidyContext *Context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace build {
/// \endcode
///
/// Corresponding cpplint.py check name: `build/namespaces`.
///
/// For the user-facing documentation see:
/// https://clang.llvm.org/extra/clang-tidy/checks/google-build-using-namespace.html
class UsingNamespaceDirectiveCheck : public ClangTidyCheck {
public:
UsingNamespaceDirectiveCheck(StringRef Name, ClangTidyContext *Context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
declStmt(
has(varDecl(hasLocalStorage(),
hasType(qualType(
hasCanonicalType(
matchers::isExpensiveToCopy()),
hasCanonicalType(allOf(
matchers::isExpensiveToCopy(),
unless(hasDeclaration(namedDecl(
hasName("::std::function")))))),
unless(hasDeclaration(namedDecl(
matchers::matchesAnyListedName(
AllowedTypes)))))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,58 @@ void negativeInitialzedFromFreeFunctionWithNonDefaultArg() {
ExpensiveToCopyType Orig;
const ExpensiveToCopyType Copy = freeFunctionWithDefaultArg(&Orig);
}

namespace std {
inline namespace __1 {

template <class>
class function;
template <class R, class... Args>
class function<R(Args...)> {
public:
function();
function(const function &other);
R operator()(Args &&...args) const;
};

} // namespace __1
} // namespace std

void negativeStdFunction() {
std::function<int()> Orig;
std::function<int()> Copy = Orig;
int i = Orig();
}

using Functor = std::function<int()>;

void negativeAliasedStdFunction() {
Functor Orig;
Functor Copy = Orig;
int i = Orig();
}

typedef std::function<int()> TypedefFunc;

void negativeTypedefedStdFunction() {
TypedefFunc Orig;
TypedefFunc Copy = Orig;
int i = Orig();
}

namespace fake {
namespace std {
template <class R, class... Args>
struct function {
// Custom copy constructor makes it expensive to copy;
function(const function &);
};
} // namespace std

void positiveFakeStdFunction(std::function<void(int)> F) {
auto Copy = F;
// CHECK-MESSAGES: [[@LINE-1]]:8: warning: local copy 'Copy' of the variable 'F' is never modified;
// CHECK-FIXES: const auto& Copy = F;
}

} // namespace fake
1 change: 0 additions & 1 deletion clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
PATTERN "*.def"
PATTERN "*.h"
PATTERN "config.h" EXCLUDE
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
Expand Down
2 changes: 2 additions & 0 deletions clang/docs/ClangCommandLineReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3335,6 +3335,8 @@ X86

.. option:: -mtsxldtrk, -mno-tsxldtrk

.. option:: -muintr, -mno-uintr

.. option:: -mvaes, -mno-vaes

.. option:: -mvpclmulqdq, -mno-vpclmulqdq
Expand Down
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ X86 Support in Clang
implies -mtune=<cpu>. -mtune=generic is the default with no -march or -mtune
specified.

- Support for ``HRESET`` instructions has been added.

- Support for ``UINTR`` instructions has been added.

Internal API Changes
--------------------

Expand Down
34 changes: 24 additions & 10 deletions clang/include/clang/AST/APValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ class APValue {
struct UninitArray {};
struct UninitStruct {};

friend class ASTReader;
friend class ASTRecordReader;
friend class ASTWriter;
friend class ASTImporter;
friend class ASTNodeImporter;

private:
ValueKind Kind;
Expand Down Expand Up @@ -569,11 +571,9 @@ class APValue {
*(APFixedPoint *)(char *)Data.buffer = std::move(FX);
}
void setVector(const APValue *E, unsigned N) {
assert(isVector() && "Invalid accessor");
((Vec*)(char*)Data.buffer)->Elts = new APValue[N];
((Vec*)(char*)Data.buffer)->NumElts = N;
MutableArrayRef<APValue> InternalElts = setVectorUninit(N);
for (unsigned i = 0; i != N; ++i)
((Vec*)(char*)Data.buffer)->Elts[i] = E[i];
InternalElts[i] = E[i];
}
void setComplexInt(APSInt R, APSInt I) {
assert(R.getBitWidth() == I.getBitWidth() &&
Expand All @@ -594,11 +594,7 @@ class APValue {
void setLValue(LValueBase B, const CharUnits &O,
ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
bool IsNullPtr);
void setUnion(const FieldDecl *Field, const APValue &Value) {
assert(isUnion() && "Invalid accessor");
((UnionData*)(char*)Data.buffer)->Field = Field;
*((UnionData*)(char*)Data.buffer)->Value = Value;
}
void setUnion(const FieldDecl *Field, const APValue &Value);
void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,
const AddrLabelExpr* RHSExpr) {
((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr;
Expand Down Expand Up @@ -656,6 +652,24 @@ class APValue {
new ((void*)(char*)Data.buffer) AddrLabelDiffData();
Kind = AddrLabelDiff;
}

private:
/// The following functions are used as part of initialization, during
/// deserialization and importing. Reserve the space so that it can be
/// filled in by those steps.
MutableArrayRef<APValue> setVectorUninit(unsigned N) {
assert(isVector() && "Invalid accessor");
Vec *V = ((Vec *)(char *)Data.buffer);
V->Elts = new APValue[N];
V->NumElts = N;
return {V->Elts, V->NumElts};
}
MutableArrayRef<LValuePathEntry>
setLValueUninit(LValueBase B, const CharUnits &O, unsigned Size,
bool OnePastTheEnd, bool IsNullPtr);
MutableArrayRef<const CXXRecordDecl *>
setMemberPointerUninit(const ValueDecl *Member, bool IsDerivedMember,
unsigned Size);
};

} // end namespace clang.
Expand Down
9 changes: 7 additions & 2 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// Mapping from GUIDs to the corresponding MSGuidDecl.
mutable llvm::FoldingSet<MSGuidDecl> MSGuidDecls;

/// Used to cleanups APValues stored in the AST.
mutable llvm::SmallVector<APValue *, 0> APValueCleanups;
/// Mapping from APValues to the corresponding TemplateParamObjects.
mutable llvm::FoldingSet<TemplateParamObjectDecl> TemplateParamObjectDecls;

/// A cache mapping a string value to a StringLiteral object with the same
/// value.
Expand Down Expand Up @@ -2876,6 +2876,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// GUID value.
MSGuidDecl *getMSGuidDecl(MSGuidDeclParts Parts) const;

/// Return the template parameter object of the given type with the given
/// value.
TemplateParamObjectDecl *getTemplateParamObjectDecl(QualType T,
const APValue &V) const;

/// Parses the target attributes passed in, and returns only the ones that are
/// valid feature names.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const;
Expand Down
8 changes: 8 additions & 0 deletions clang/include/clang/AST/ASTImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_AST_ASTIMPORTER_H
#define LLVM_CLANG_AST_ASTIMPORTER_H

#include "clang/AST/APValue.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExprCXX.h"
Expand Down Expand Up @@ -503,6 +504,13 @@ class TypeSourceInfo;
/// "to" context, or the import error.
llvm::Expected<CXXBaseSpecifier *> Import(const CXXBaseSpecifier *FromSpec);

/// Import the given APValue from the "from" context into
/// the "to" context.
///
/// \return the equivalent APValue in the "to" context or the import
/// error.
llvm::Expected<APValue> Import(const APValue &FromValue);

/// Import the definition of the given declaration, including all of
/// the declarations it contains.
LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From);
Expand Down
Loading

0 comments on commit e0bbbf5

Please sign in to comment.