Skip to content

Commit

Permalink
Manually merged master:d0d076fed96 into amd-gfx:c9b42a6a87f
Browse files Browse the repository at this point in the history
Local branch amd-gfx c9b42a6 Merged master:b632fe5a363 into amd-gfx:0a785d33aa1
Remote branch master d0d076f [Driver] Flip the CC1 default of -fdiagnostics-show-option

Change-Id: I620ebac98ab650fc48de900b2950a203aae9281b
  • Loading branch information
piotrAMD committed Apr 6, 2020
2 parents c9b42a6 + d0d076f commit 443a747
Show file tree
Hide file tree
Showing 404 changed files with 9,980 additions and 3,365 deletions.
264 changes: 105 additions & 159 deletions clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TargetDeclTest : public ::testing::Test {
protected:
using Rel = DeclRelation;
std::string Code;
std::vector<const char *> Flags;
std::vector<std::string> Flags;

// Asserts that `Code` has a marked selection of a node `NodeType`,
// and returns allTargetDecls() as PrintedDecl structs.
Expand Down
44 changes: 28 additions & 16 deletions clang-tools-extra/clangd/unittests/TestTU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace clang {
namespace clangd {

ParsedAST TestTU::build() const {
ParseInputs TestTU::inputs() const {
std::string FullFilename = testPath(Filename),
FullHeaderName = testPath(HeaderFilename),
ImportThunk = testPath("import_thunk.h");
Expand All @@ -34,25 +34,24 @@ ParsedAST TestTU::build() const {
Files[FullHeaderName] = HeaderCode;
Files[ImportThunk] = ThunkContents;

std::vector<const char *> Cmd = {"clang"};
ParseInputs Inputs;
auto& Argv = Inputs.CompileCommand.CommandLine;
Argv = {"clang"};
// FIXME: this shouldn't need to be conditional, but it breaks a
// GoToDefinition test for some reason (getMacroArgExpandedLocation fails).
if (!HeaderCode.empty()) {
Cmd.push_back("-include");
Cmd.push_back(ImplicitHeaderGuard ? ImportThunk.c_str()
: FullHeaderName.c_str());
Argv.push_back("-include");
Argv.push_back(ImplicitHeaderGuard ? ImportThunk : FullHeaderName);
// ms-compatibility changes the meaning of #import.
// The default is OS-dependent (on on windows), ensure it's off.
if (ImplicitHeaderGuard)
Cmd.push_back("-fno-ms-compatibility");
Inputs.CompileCommand.CommandLine.push_back("-fno-ms-compatibility");
}
Cmd.insert(Cmd.end(), ExtraArgs.begin(), ExtraArgs.end());
Argv.insert(Argv.end(), ExtraArgs.begin(), ExtraArgs.end());
// Put the file name at the end -- this allows the extra arg (-xc++) to
// override the language setting.
Cmd.push_back(FullFilename.c_str());
ParseInputs Inputs;
Argv.push_back(FullFilename);
Inputs.CompileCommand.Filename = FullFilename;
Inputs.CompileCommand.CommandLine = {Cmd.begin(), Cmd.end()};
Inputs.CompileCommand.Directory = testRoot();
Inputs.Contents = Code;
Inputs.FS = buildTestFS(Files);
Expand All @@ -62,15 +61,20 @@ ParsedAST TestTU::build() const {
Inputs.Index = ExternalIndex;
if (Inputs.Index)
Inputs.Opts.SuggestMissingIncludes = true;
return Inputs;
}

ParsedAST TestTU::build() const {
auto Inputs = inputs();
StoreDiags Diags;
auto CI = buildCompilerInvocation(Inputs, Diags);
assert(CI && "Failed to build compilation invocation.");
auto Preamble =
buildPreamble(FullFilename, *CI,
buildPreamble(testPath(Filename), *CI,
/*OldPreamble=*/nullptr, Inputs,
/*StoreInMemory=*/true, /*PreambleCallback=*/nullptr);
auto AST =
buildAST(FullFilename, std::move(CI), Diags.take(), Inputs, Preamble);
auto AST = buildAST(testPath(Filename), std::move(CI), Diags.take(), Inputs,
Preamble);
if (!AST.hasValue()) {
ADD_FAILURE() << "Failed to build code:\n" << Code;
llvm_unreachable("Failed to build TestTU!");
Expand All @@ -79,9 +83,17 @@ ParsedAST TestTU::build() const {
// This guards against accidental syntax errors silently subverting tests.
// error-ok is awfully primitive - using clang -verify would be nicer.
// Ownership and layering makes it pretty hard.
if (llvm::none_of(Files, [](const auto &KV) {
return llvm::StringRef(KV.second).contains("error-ok");
})) {
bool ErrorOk = [&, this] {
llvm::StringLiteral Marker = "error-ok";
if (llvm::StringRef(Code).contains(Marker) ||
llvm::StringRef(HeaderCode).contains(Marker))
return true;
for (const auto& KV : this->AdditionalFiles)
if (llvm::StringRef(KV.second).contains(Marker))
return true;
return false;
}();
if (!ErrorOk) {
for (const auto &D : AST->getDiagnostics())
if (D.Severity >= DiagnosticsEngine::Error) {
ADD_FAILURE()
Expand Down
4 changes: 3 additions & 1 deletion clang-tools-extra/clangd/unittests/TestTU.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_TESTTU_H
#define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_TESTTU_H

#include "Compiler.h"
#include "ParsedAST.h"
#include "Path.h"
#include "index/Index.h"
Expand Down Expand Up @@ -54,7 +55,7 @@ struct TestTU {
llvm::StringMap<std::string> AdditionalFiles;

// Extra arguments for the compiler invocation.
std::vector<const char *> ExtraArgs;
std::vector<std::string> ExtraArgs;

llvm::Optional<std::string> ClangTidyChecks;
llvm::Optional<std::string> ClangTidyWarningsAsErrors;
Expand All @@ -67,6 +68,7 @@ struct TestTU {
// By default, build() will report Error diagnostics as GTest errors.
// Suppress this behavior by adding an 'error-ok' comment to the code.
ParsedAST build() const;
ParseInputs inputs() const;
SymbolSlab headerSymbols() const;
std::unique_ptr<SymbolIndex> index() const;
};
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/TweakTesting.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TweakTest : public ::testing::Test {
llvm::StringRef FileName = "TestTU.cpp";

// Extra flags passed to the compilation in apply().
std::vector<const char *> ExtraArgs;
std::vector<std::string> ExtraArgs;

// Context in which snippets of code should be placed to run tweaks.
CodeContext Context = File;
Expand Down
2 changes: 2 additions & 0 deletions clang/cmake/caches/CrossWinToARMLinux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ set(LIBCXXABI_TARGET_TRIPLE "${CMAKE_C_COMPILER_TARGET}" CACHE S
set(LIBCXXABI_SYSROOT "${DEFAULT_SYSROOT}" CACHE STRING "")
set(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI OFF CACHE BOOL "")
set(LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX OFF CACHE BOOL "")
set(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI OFF CACHE BOOL "")
set(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX OFF CACHE BOOL "")

set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
set(LIBCXX_TARGET_TRIPLE "${CMAKE_C_COMPILER_TARGET}" CACHE STRING "")
Expand Down
2 changes: 1 addition & 1 deletion clang/docs/OpenMPSupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| base language | lambda support | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| misc extension | array shaping | :part:`worked on` | D74144 |
| misc extension | array shaping | :good:`done` | D74144 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| misc extension | library shutdown (omp_pause_resource[_all]) | :none:`unclaimed parts` | D55078 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ class FunctionDecl : public DeclaratorDecl,
/// declaration to the declaration that is a definition (if there is one).
bool isDefined(const FunctionDecl *&Definition) const;

virtual bool isDefined() const {
bool isDefined() const {
const FunctionDecl* Definition;
return isDefined(Definition);
}
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/CodeGenOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ CODEGENOPT(UnwindTables , 1, 0) ///< Emit unwind tables.
CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer.
CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer.
CODEGENOPT(ProfileSampleAccurate, 1, 0) ///< Sample profile is accurate.
CODEGENOPT(CallGraphProfile , 1, 0) ///< Run call graph profile.

/// Attempt to use register sized accesses to bit-fields in structures, when
/// possible.
Expand Down
12 changes: 6 additions & 6 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ def note_drv_verify_prefix_spelling : Note<
"-verify prefixes must start with a letter and contain only alphanumeric"
" characters, hyphens, and underscores">;

def warn_drv_experimental_isel_incomplete : Warning<
"-fexperimental-isel support for the '%0' architecture is incomplete">,
InGroup<ExperimentalISel>;
def warn_drv_global_isel_incomplete : Warning<
"-fglobal-isel support for the '%0' architecture is incomplete">,
InGroup<GlobalISel>;

def warn_drv_experimental_isel_incomplete_opt : Warning<
"-fexperimental-isel support is incomplete for this architecture at the current optimization level">,
InGroup<ExperimentalISel>;
def warn_drv_global_isel_incomplete_opt : Warning<
"-fglobal-isel support is incomplete for this architecture at the current optimization level">,
InGroup<GlobalISel>;

def warn_drv_moutline_unsupported_opt : Warning<
"The '%0' architecture does not support -moutline; flag ignored">,
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -1154,8 +1154,8 @@ def UnknownArgument : DiagGroup<"unknown-argument">;
// compiling OpenCL C/C++ but which is not compatible with the SPIR spec.
def SpirCompat : DiagGroup<"spir-compat">;

// Warning for the experimental-isel options.
def ExperimentalISel : DiagGroup<"experimental-isel">;
// Warning for the GlobalISel options.
def GlobalISel : DiagGroup<"global-isel">;

// A warning group specifically for warnings related to function
// multiversioning.
Expand Down
5 changes: 3 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -5946,7 +5946,7 @@ def err_func_def_incomplete_result : Error<
def err_atomic_specifier_bad_type : Error<
"_Atomic cannot be applied to "
"%select{incomplete |array |function |reference |atomic |qualified |sizeless |}0type "
"%1 %select{||||||which is not trivially copyable}0">;
"%1 %select{|||||||which is not trivially copyable}0">;

// Expressions.
def select_unary_expr_or_type_trait_kind : TextSubstitution<
Expand Down Expand Up @@ -10203,7 +10203,8 @@ def warn_nested_declare_variant
"nested context ignored">,
InGroup<SourceUsesOpenMP>;
def err_omp_non_pointer_type_array_shaping_base : Error<
"expected pointer type expression as a base of an array shaping operation">;
"expected expression with a pointer to a complete type as a base of an array "
"shaping operation">;
} // end of OpenMP category

let CategoryName = "Related Result Type Issue" in {
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Driver/CC1Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarNam
def fcaret_diagnostics_max_lines :
Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"<N>">,
HelpText<"Set the maximum number of source lines to show in a caret diagnostic">;
def fmessage_length : Separate<["-"], "fmessage-length">, MetaVarName<"<N>">,
HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">;
def verify_EQ : CommaJoined<["-"], "verify=">,
MetaVarName<"<prefixes>">,
HelpText<"Verify diagnostic output using comment directives that start with"
Expand Down
15 changes: 10 additions & 5 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-thre
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<number>">,
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count">;
def fdiagnostics_show_option : Flag<["-"], "fdiagnostics-show-option">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Print option name with mappable diagnostics">;
HelpText<"Print option name with mappable diagnostics">;
def fdiagnostics_show_note_include_stack : Flag<["-"], "fdiagnostics-show-note-include-stack">,
Group<f_Group>, Flags<[CC1Option]>, HelpText<"Display include stacks for diagnostic notes">;
def fdiagnostics_format_EQ : Joined<["-"], "fdiagnostics-format=">, Group<f_clang_Group>;
Expand Down Expand Up @@ -1249,8 +1249,10 @@ def finline_functions : Flag<["-"], "finline-functions">, Group<f_clang_Group>,
def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Inline functions which are (explicitly or implicitly) marked inline">;
def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>;
def fglobal_isel : Flag<["-"], "fglobal-isel">, Group<f_clang_Group>,
HelpText<"Enables the global instruction selector">;
def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>,
HelpText<"Enables the experimental global instruction selector">;
Alias<fglobal_isel>;
def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Enables an experimental new pass manager in LLVM.">;
Expand Down Expand Up @@ -1362,7 +1364,8 @@ def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
Group<f_Group>, Flags<[DriverOption, CoreOption]>;
def fmerge_all_constants : Flag<["-"], "fmerge-all-constants">, Group<f_Group>,
Flags<[CC1Option, CoreOption]>, HelpText<"Allow merging of constants">;
def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group<f_Group>;
def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Format message diagnostics so that they fit within N columns">;
def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
def fms_compatibility : Flag<["-"], "fms-compatibility">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
Expand Down Expand Up @@ -1512,7 +1515,7 @@ def fno_cxx_modules : Flag <["-"], "fno-cxx-modules">, Group<f_Group>,
def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Do not include fixit information in diagnostics">;
def fno_diagnostics_show_hotness : Flag<["-"], "fno-diagnostics-show-hotness">, Group<f_Group>;
def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>;
def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>, Flags<[CC1Option]>;
def fno_diagnostics_show_note_include_stack : Flag<["-"], "fno-diagnostics-show-note-include-stack">,
Flags<[CC1Option]>, Group<f_Group>;
def fdigraphs : Flag<["-"], "fdigraphs">, Group<f_Group>, Flags<[CC1Option]>,
Expand All @@ -1530,8 +1533,10 @@ def fno_exceptions : Flag<["-"], "fno-exceptions">, Group<f_Group>;
def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group<f_Group>, Flags<[CC1Option]>;
def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fno_inline : Flag<["-"], "fno-inline">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fno_global_isel : Flag<["-"], "fno-global-isel">, Group<f_clang_Group>,
HelpText<"Disables the global instruction selector">;
def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_Group>,
HelpText<"Disables the experimental global instruction selector">;
Alias<fno_global_isel>;
def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Disables an experimental new pass manager in LLVM.">;
Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/Frontend/CompilerInvocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class TargetOptions;
/// report the error(s).
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
DiagnosticsEngine *Diags = nullptr,
bool DefaultDiagColor = true,
bool DefaultShowOpt = true);
bool DefaultDiagColor = true);

class CompilerInvocationBase {
public:
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Frontend/FrontendAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class WrapperFrontendAction : public FrontendAction {
bool BeginSourceFileAction(CompilerInstance &CI) override;
void ExecuteAction() override;
void EndSourceFileAction() override;
bool shouldEraseOutputFiles() override;

public:
/// Construct a WrapperFrontendAction from an existing action, taking
Expand Down
4 changes: 1 addition & 3 deletions clang/include/clang/Sema/Scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ class Scope {

/// isDeclScope - Return true if this is the scope that the specified decl is
/// declared in.
bool isDeclScope(Decl *D) {
return DeclsInScope.count(D) != 0;
}
bool isDeclScope(const Decl *D) const { return DeclsInScope.count(D) != 0; }

DeclContext *getEntity() const { return Entity; }
void setEntity(DeclContext *E) { Entity = E; }
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
PTO.CallGraphProfile = CodeGenOpts.CallGraphProfile;
PTO.Coroutines = LangOpts.Coroutines;

PassInstrumentationCallbacks PIC;
Expand Down Expand Up @@ -1518,6 +1519,7 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
Conf.PTO.LoopInterleaving = CGOpts.UnrollLoops;
Conf.PTO.LoopVectorization = CGOpts.VectorizeLoop;
Conf.PTO.SLPVectorization = CGOpts.VectorizeSLP;
Conf.PTO.CallGraphProfile = CGOpts.CallGraphProfile;

// Context sensitive profile.
if (CGOpts.hasProfileCSIRInstr()) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,

// Shuffle vector to get vec3.
V = Builder.CreateShuffleVector(V, llvm::UndefValue::get(vec4Ty),
{0, 1, 2}, "extractVec");
ArrayRef<int>{0, 1, 2}, "extractVec");
return EmitFromMemory(V, Ty);
}
}
Expand Down
Loading

0 comments on commit 443a747

Please sign in to comment.