Skip to content

Commit

Permalink
Merged main:e43b3d1f5e05 into amd-gfx:a2e82546366c
Browse files Browse the repository at this point in the history
Local branch amd-gfx a2e8254 Merged main:ad0a7ad950fe into amd-gfx:a637705ce652
Remote branch main e43b3d1 Revert "[Sema] Fix deleted function problem in implicitly movable test"
  • Loading branch information
Sw authored and Sw committed Jan 4, 2021
2 parents a2e8254 + e43b3d1 commit ff485d5
Show file tree
Hide file tree
Showing 3,353 changed files with 765,459 additions and 498,972 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 0 additions & 4 deletions clang-tools-extra/clang-tidy/ClangTidy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
#include "ExpandModularHeadersPPCallbacks.h"
#include "clang-tidy-config.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
Expand All @@ -43,7 +40,6 @@
#include "clang/Tooling/ReplacementsYaml.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include <algorithm>
#include <utility>

Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"

namespace clang {
namespace tidy {
Expand Down
6 changes: 4 additions & 2 deletions clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
#include "clang/AST/Attr.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/DiagnosticRenderer.h"
#include "clang/Tooling/Core/Diagnostic.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include <tuple>
#include <vector>
using namespace clang;
using namespace tidy;

#ifdef LLVM_CLANG_AST_ATTR_H
//#error
#endif

namespace {
class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
public:
Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/clang-tidy/ClangTidyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include <functional>
#include <map>
#include <memory>
#include <string>

namespace clang {
namespace tidy {
Expand Down
3 changes: 1 addition & 2 deletions clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include <utility>

#define DEBUG_TYPE "clang-tidy-options"
Expand Down Expand Up @@ -393,7 +392,7 @@ parseConfiguration(llvm::MemoryBufferRef Config) {

static void diagHandlerImpl(const llvm::SMDiagnostic &Diag, void *Ctx) {
(*reinterpret_cast<DiagCallback *>(Ctx))(Diag);
};
}

llvm::ErrorOr<ClangTidyOptions>
parseConfigurationWithDiags(llvm::MemoryBufferRef Config,
Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
//===----------------------------------------------------------------------===//

#include "ClangTidyProfiling.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class DeducedTypeVisitor : public RecursiveASTVisitor<DeducedTypeVisitor> {
// Loc of auto in return type (c++14).
auto CurLoc = D->getReturnTypeSourceRange().getBegin();
// Loc of "auto" in operator auto()
if (CurLoc.isInvalid() && dyn_cast<CXXConversionDecl>(D))
if (CurLoc.isInvalid() && isa<CXXConversionDecl>(D))
CurLoc = D->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
// Loc of "auto" in function with trailing return type (c++11).
if (CurLoc.isInvalid())
Expand Down
12 changes: 9 additions & 3 deletions clang-tools-extra/clangd/CodeComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,18 @@ struct CompletionCandidate {
// strings (literal or URI) mapping to the same file. We still want to
// bundle those, so we must resolve the header to be included here.
std::string HeaderForHash;
if (Inserter)
if (auto Header = headerToInsertIfAllowed(Opts))
if (auto HeaderFile = toHeaderFile(*Header, FileName))
if (Inserter) {
if (auto Header = headerToInsertIfAllowed(Opts)) {
if (auto HeaderFile = toHeaderFile(*Header, FileName)) {
if (auto Spelled =
Inserter->calculateIncludePath(*HeaderFile, FileName))
HeaderForHash = *Spelled;
} else {
vlog("Code completion header path manipulation failed {0}",
HeaderFile.takeError());
}
}
}

llvm::SmallString<256> Scratch;
if (IndexResult) {
Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clangd/DumpAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ class DumpVisitor : public RecursiveASTVisitor<DumpVisitor> {
return "const";
return "";
}
if (isa<IntegerLiteral>(S) || isa<FloatingLiteral>(S) ||
isa<FixedPointLiteral>(S) || isa<CharacterLiteral>(S) ||
isa<ImaginaryLiteral>(S) || isa<CXXBoolLiteralExpr>(S))
if (isa<IntegerLiteral, FloatingLiteral, FixedPointLiteral,
CharacterLiteral, ImaginaryLiteral, CXXBoolLiteralExpr>(S))
return toString([&](raw_ostream &OS) {
S->printPretty(OS, nullptr, Ctx.getPrintingPolicy());
});
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/FindTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ llvm::SmallVector<ReferenceLoc> refInStmt(const Stmt *S) {
void VisitMemberExpr(const MemberExpr *E) {
// Skip destructor calls to avoid duplication: TypeLoc within will be
// visited separately.
if (llvm::dyn_cast<CXXDestructorDecl>(E->getFoundDecl().getDecl()))
if (llvm::isa<CXXDestructorDecl>(E->getFoundDecl().getDecl()))
return;
Refs.push_back(ReferenceLoc{E->getQualifierLoc(),
E->getMemberNameInfo().getLoc(),
Expand Down
11 changes: 7 additions & 4 deletions clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,14 @@ void DirectoryBasedGlobalCompilationDatabase::broadcastCDB(
// Given that we know that CDBs have been moved/generated, don't trust caches.
// (This should be rare, so it's OK to add a little latency).
constexpr auto IgnoreCache = std::chrono::steady_clock::time_point::max();
for (DirectoryCache *Dir : getDirectoryCaches(FileAncestors)) {
auto DirectoryCaches = getDirectoryCaches(FileAncestors);
assert(DirectoryCaches.size() == FileAncestors.size());
for (unsigned I = 0; I < DirectoryCaches.size(); ++I) {
bool ShouldBroadcast = false;
if (Dir->get(Opts.TFS, ShouldBroadcast, /*FreshTime=*/IgnoreCache,
/*FreshTimeMissing=*/IgnoreCache))
DirectoryHasCDB.find(Dir->Path)->setValue(true);
if (DirectoryCaches[I]->get(Opts.TFS, ShouldBroadcast,
/*FreshTime=*/IgnoreCache,
/*FreshTimeMissing=*/IgnoreCache))
DirectoryHasCDB.find(FileAncestors[I])->setValue(true);
}

std::vector<std::string> GovernedFiles;
Expand Down
6 changes: 6 additions & 0 deletions clang-tools-extra/clangd/index/Merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ void MergedIndex::lookup(
Dynamic->lookup(Req, [&](const Symbol &S) { B.insert(S); });

auto RemainingIDs = Req.IDs;
auto DynamicContainsFile = Dynamic->indexedFiles();
Static->lookup(Req, [&](const Symbol &S) {
// We expect the definition to see the canonical declaration, so it seems
// to be enough to check only the definition if it exists.
if (DynamicContainsFile(S.Definition ? S.Definition.FileURI
: S.CanonicalDeclaration.FileURI))
return;
const Symbol *Sym = B.find(S.ID);
RemainingIDs.erase(S.ID);
if (!Sym)
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/refactor/Rename.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const NamedDecl *canonicalRenameDecl(const NamedDecl *D) {
// declaration.
while (Method->isVirtual() && Method->size_overridden_methods())
Method = *Method->overridden_methods().begin();
return dyn_cast<NamedDecl>(Method->getCanonicalDecl());
return Method->getCanonicalDecl();
}
if (const auto *Function = dyn_cast<FunctionDecl>(D))
if (const FunctionTemplateDecl *Template = Function->getPrimaryTemplate())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Expected<Tweak::Effect> ExpandAutoType::apply(const Selection& Inputs) {

// if it's a lambda expression, return an error message
if (isa<RecordType>(*DeducedType) &&
dyn_cast<RecordType>(*DeducedType)->getDecl()->isLambda()) {
cast<RecordType>(*DeducedType)->getDecl()->isLambda()) {
return error("Could not expand type of lambda expression");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ computeReferencedDecls(const clang::Expr *Expr) {
}
};
FindDeclRefsVisitor Visitor;
Visitor.TraverseStmt(const_cast<Stmt *>(dyn_cast<Stmt>(Expr)));
Visitor.TraverseStmt(const_cast<Stmt *>(cast<Stmt>(Expr)));
return Visitor.ReferencedDecls;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool RemoveUsingNamespace::prepare(const Selection &Inputs) {
TargetDirective = CA->ASTNode.get<UsingDirectiveDecl>();
if (!TargetDirective)
return false;
if (!dyn_cast<Decl>(TargetDirective->getDeclContext()))
if (!isa<Decl>(TargetDirective->getDeclContext()))
return false;
// FIXME: Unavailable for namespaces containing using-namespace decl.
// It is non-trivial to deal with cases where identifiers come from the inner
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/refactor/tweaks/SwapIfBranches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ bool SwapIfBranches::prepare(const Selection &Inputs) {
for (const SelectionTree::Node *N = Inputs.ASTSelection.commonAncestor();
N && !If; N = N->Parent) {
// Stop once we hit a block, e.g. a lambda in the if condition.
if (dyn_cast_or_null<CompoundStmt>(N->ASTNode.get<Stmt>()))
if (llvm::isa_and_nonnull<CompoundStmt>(N->ASTNode.get<Stmt>()))
return false;
If = dyn_cast_or_null<IfStmt>(N->ASTNode.get<Stmt>());
}
// avoid dealing with single-statement brances, they require careful handling
// to avoid changing semantics of the code (i.e. dangling else).
return If && dyn_cast_or_null<CompoundStmt>(If->getThen()) &&
dyn_cast_or_null<CompoundStmt>(If->getElse());
return If && isa_and_nonnull<CompoundStmt>(If->getThen()) &&
isa_and_nonnull<CompoundStmt>(If->getElse());
}

Expected<Tweak::Effect> SwapIfBranches::apply(const Selection &Inputs) {
Expand Down
34 changes: 34 additions & 0 deletions clang-tools-extra/clangd/unittests/IndexTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,40 @@ TEST(MergeIndexTest, Lookup) {
EXPECT_THAT(lookup(M, {}), UnorderedElementsAre());
}

TEST(MergeIndexTest, LookupRemovedDefinition) {
FileIndex DynamicIndex, StaticIndex;
MergedIndex Merge(&DynamicIndex, &StaticIndex);

const char *HeaderCode = "class Foo;";
auto HeaderSymbols = TestTU::withHeaderCode(HeaderCode).headerSymbols();
auto Foo = findSymbol(HeaderSymbols, "Foo");

// Build static index for test.cc with Foo definition
TestTU Test;
Test.HeaderCode = HeaderCode;
Test.Code = "class Foo {};";
Test.Filename = "test.cc";
auto AST = Test.build();
StaticIndex.updateMain(testPath(Test.Filename), AST);

// Remove Foo definition from test.cc, i.e. build dynamic index for test.cc
// without Foo definition.
Test.Code = "class Foo;";
AST = Test.build();
DynamicIndex.updateMain(testPath(Test.Filename), AST);

// Merged index should not return the symbol definition if this definition
// location is inside a file from the dynamic index.
LookupRequest LookupReq;
LookupReq.IDs = {Foo.ID};
unsigned SymbolCounter = 0;
Merge.lookup(LookupReq, [&](const Symbol &Sym) {
++SymbolCounter;
EXPECT_FALSE(Sym.Definition);
});
EXPECT_EQ(SymbolCounter, 1u);
}

TEST(MergeIndexTest, FuzzyFind) {
auto I = MemIndex::build(generateSymbols({"ns::A", "ns::B"}), RefSlab(),
RelationSlab()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t \
// RUN: -config='{CheckOptions: \
// RUN: [{key: cppcoreguidelines-macro-usage.AllowedRegexp, value: "DEBUG_*|TEST_*"}]}' --
// RUN: -config="{CheckOptions: \
// RUN: [{key: cppcoreguidelines-macro-usage.AllowedRegexp, value: 'DEBUG_*|TEST_*'}]}" --

#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
// RUN: -config='{CheckOptions: [ \
// RUN: -config="{CheckOptions: [ \
// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: "^[a-z]{1,2}$"}, \
// RUN: {key: readability-identifier-naming.ParameterIgnoredRegexp, value: '^[a-z]{1,2}$'}, \
// RUN: {key: readability-identifier-naming.ClassCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: "^fo$|^fooo$"}, \
// RUN: {key: readability-identifier-naming.ClassIgnoredRegexp, value: '^fo$|^fooo$'}, \
// RUN: {key: readability-identifier-naming.StructCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: "sooo|so|soo|$invalidregex["} \
// RUN: ]}'
// RUN: {key: readability-identifier-naming.StructIgnoredRegexp, value: 'sooo|so|soo|$invalidregex['} \
// RUN: ]}"

int testFunc(int a, char **b);
int testFunc(int ab, char **ba);
Expand Down
10 changes: 10 additions & 0 deletions clang/docs/ClangFormatStyleOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,16 @@ the configuration (without a prefix: ``Auto``).
int a = 5; vs. int a= 5;
a += 42; a+= 42;

**SpaceBeforeCaseColon** (``bool``)
If ``false``, spaces will be removed before case colon.

.. code-block:: c++

true: false
switch (x) { vs. switch (x) {
case 1 : break; case 1: break;
} }

**SpaceBeforeCpp11BracedList** (``bool``)
If ``true``, a space will be inserted before a C++11 braced list
used to initialize an object (after the preceding identifier or type).
Expand Down
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ clang-format

- Option ``IndentPragmas`` has been added to allow #pragma to indented with the current scope level. This is especially useful when using #pragma to mark OpenMP sections of code.

- Option ``SpaceBeforeCaseColon`` has been added to add a space before the
colon in a case or default statement.


libclang
--------
Expand Down
2 changes: 1 addition & 1 deletion clang/docs/tools/dump_format_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class State(object):
comment += clean_comment_line(line)
elif line.startswith('enum'):
state = State.InEnum
name = re.sub(r'enum\s+(\w+)\s*\{', '\\1', line)
name = re.sub(r'enum\s+(\w+)\s*(:((\s*\w+)+)\s*)?\{', '\\1', line)
enum = Enum(name, comment)
elif line.startswith('struct'):
state = State.InNestedStruct
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,9 @@ class ParmVarDecl : public VarDecl {
return ParmVarDeclBits.IsObjCMethodParam;
}

/// Determines whether this parameter is destroyed in the callee function.
bool isDestroyedInCallee() const;

unsigned getFunctionScopeDepth() const {
if (ParmVarDeclBits.IsObjCMethodParam) return 0;
return ParmVarDeclBits.ScopeDepthOrObjCQuals;
Expand Down
4 changes: 1 addition & 3 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -5411,9 +5411,7 @@ class ElaboratedType final
ElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
QualType NamedType, QualType CanonType, TagDecl *OwnedTagDecl)
: TypeWithKeyword(Keyword, Elaborated, CanonType,
NamedType->getDependence() |
(NNS ? toTypeDependence(NNS->getDependence())
: TypeDependence::None)),
NamedType->getDependence()),
NNS(NNS), NamedType(NamedType) {
ElaboratedTypeBits.HasOwnedTagDecl = false;
if (OwnedTagDecl) {
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/BuiltinsWebAssembly.def
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ TARGET_BUILTIN(__builtin_wasm_extmul_high_i32x4_s_i64x2, "V2LLiV4iV4i", "nc", "s
TARGET_BUILTIN(__builtin_wasm_extmul_low_i32x4_u_i64x2, "V2ULLiV4UiV4Ui", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_extmul_high_i32x4_u_i64x2, "V2ULLiV4UiV4Ui", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_extadd_pairwise_i8x16_s_i16x8, "V8sV16Sc", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_extadd_pairwise_i8x16_u_i16x8, "V8UsV16Uc", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_extadd_pairwise_i16x8_s_i32x4, "V4iV8s", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_extadd_pairwise_i16x8_u_i32x4, "V4UiV8Us", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_bitselect, "V4iV4iV4iV4i", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_signselect_i8x16, "V16ScV16ScV16ScV16Sc", "nc", "simd128")
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/BuiltinsX86_64.def
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ TARGET_BUILTIN(__builtin_ia32_senduipi, "vUWi", "n", "uintr")
TARGET_BUILTIN(__builtin_ia32_tileloadd64_internal, "V256iUsUsvC*z", "n", "amx-tile")
TARGET_BUILTIN(__builtin_ia32_tdpbssd_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-int8")
TARGET_BUILTIN(__builtin_ia32_tilestored64_internal, "vUsUsv*zV256i", "n", "amx-tile")
TARGET_BUILTIN(__builtin_ia32_tilezero_internal, "V256iUsUs", "n", "amx-tile")
// AMX
TARGET_BUILTIN(__builtin_ia32_tile_loadconfig, "vvC*", "n", "amx-tile")
TARGET_BUILTIN(__builtin_ia32_tile_storeconfig, "vvC*", "n", "amx-tile")
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/CodeGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace clang {
/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
/// that this large collection of bitfields is a trivial class type.
class CodeGenOptionsBase {
friend class CompilerInvocation;

public:
#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
#define ENUM_CODEGENOPT(Name, Type, Bits, Default)
Expand Down
Loading

0 comments on commit ff485d5

Please sign in to comment.