Skip to content

Commit

Permalink
Merged master:ab77fa515583 into amd-gfx:ef113cf4b2c1
Browse files Browse the repository at this point in the history
Local branch amd-gfx ef113cf Merge master:a1de391dae8b into amd-gfx
Remote branch master ab77fa5 [AIX][XCOFF][Patch2] decode vector information and extent long table of the traceback table of the xcoff.
  • Loading branch information
Sw authored and Sw committed Nov 19, 2020
2 parents ef113cf + ab77fa5 commit cb1a5dc
Show file tree
Hide file tree
Showing 78 changed files with 2,153 additions and 392 deletions.
4 changes: 4 additions & 0 deletions clang-tools-extra/clangd/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
CI->getFrontendOpts().DisableFree = false;
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
// Disable "clang -verify" diagnostics, they are rarely useful in clangd, and
// our compiler invocation set-up doesn't seem to work with it (leading
// assertions in VerifyDiagnosticConsumer).
CI->getDiagnosticOpts().VerifyDiagnostics = false;

// Disable any dependency outputting, we don't want to generate files or write
// to stdout/stderr.
Expand Down
9 changes: 9 additions & 0 deletions clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,15 @@ TEST(DiagnosticsTest, Preprocessor) {
ElementsAre(Diag(Test.range(), "use of undeclared identifier 'b'")));
}

TEST(DiagnosticsTest, IgnoreVerify) {
auto TU = TestTU::withCode(R"cpp(
int a; // expected-error {{}}
)cpp");
TU.ExtraArgs.push_back("-Xclang");
TU.ExtraArgs.push_back("-verify");
EXPECT_THAT(TU.build().getDiagnostics(), IsEmpty());
}

// Recursive main-file include is diagnosed, and doesn't crash.
TEST(DiagnosticsTest, RecursivePreamble) {
auto TU = TestTU::withCode(R"cpp(
Expand Down
2 changes: 2 additions & 0 deletions clang-tools-extra/clangd/unittests/SerializationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class ScopedMemoryLimit {
};
#endif

#ifndef LLVM_ADDRESS_SANITIZER_BUILD
// Test that our deserialization detects invalid array sizes without allocating.
// If this detection fails, the test should allocate a huge array and crash.
TEST(SerializationTest, NoCrashOnBadArraySize) {
Expand Down Expand Up @@ -382,6 +383,7 @@ TEST(SerializationTest, NoCrashOnBadArraySize) {
EXPECT_EQ(llvm::toString(CorruptParsed.takeError()),
"malformed or truncated include uri");
}
#endif

} // namespace
} // namespace clangd
Expand Down
57 changes: 38 additions & 19 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,8 @@ def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
def fcomment_block_commands : CommaJoined<["-"], "fcomment-block-commands=">, Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Treat each comma separated argument in <arg> as a documentation comment block command">,
MetaVarName<"<arg>">;
def fparse_all_comments : Flag<["-"], "fparse-all-comments">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fparse_all_comments : Flag<["-"], "fparse-all-comments">, Group<f_clang_Group>, Flags<[CC1Option]>,
MarshallingInfoFlag<"LangOpts->CommentOpts.ParseAllComments">;
def frecord_command_line : Flag<["-"], "frecord-command-line">,
Group<f_clang_Group>;
def fno_record_command_line : Flag<["-"], "fno-record-command-line">,
Expand Down Expand Up @@ -3663,7 +3664,8 @@ def fno_padding_on_unsigned_fixed_point : Flag<["-"], "fno-padding-on-unsigned-f
//===----------------------------------------------------------------------===//

def analysis_UnoptimizedCFG : Flag<["-"], "unoptimized-cfg">,
HelpText<"Generate unoptimized CFGs for all analyses">;
HelpText<"Generate unoptimized CFGs for all analyses">,
MarshallingInfoFlag<"AnalyzerOpts->UnoptimizedCFG">;
def analysis_CFGAddImplicitDtors : Flag<["-"], "cfg-add-implicit-dtors">,
HelpText<"Add C++ implicit destructors to CFGs for all analyses">;

Expand All @@ -3686,18 +3688,23 @@ def analyzer_purge : Separate<["-"], "analyzer-purge">,
def analyzer_purge_EQ : Joined<["-"], "analyzer-purge=">, Alias<analyzer_purge>;

def analyzer_opt_analyze_headers : Flag<["-"], "analyzer-opt-analyze-headers">,
HelpText<"Force the static analyzer to analyze functions defined in header files">;
HelpText<"Force the static analyzer to analyze functions defined in header files">,
MarshallingInfoFlag<"AnalyzerOpts->AnalyzeAll">;
def analyzer_opt_analyze_nested_blocks : Flag<["-"], "analyzer-opt-analyze-nested-blocks">,
HelpText<"Analyze the definitions of blocks in addition to functions">;
HelpText<"Analyze the definitions of blocks in addition to functions">,
MarshallingInfoFlag<"AnalyzerOpts->AnalyzeNestedBlocks">;
def analyzer_display_progress : Flag<["-"], "analyzer-display-progress">,
HelpText<"Emit verbose output about the analyzer's progress">;
HelpText<"Emit verbose output about the analyzer's progress">,
MarshallingInfoFlag<"AnalyzerOpts->AnalyzerDisplayProgress">;
def analyze_function : Separate<["-"], "analyze-function">,
HelpText<"Run analysis on specific function (for C++ include parameters in name)">;
def analyze_function_EQ : Joined<["-"], "analyze-function=">, Alias<analyze_function>;
def trim_egraph : Flag<["-"], "trim-egraph">,
HelpText<"Only show error-related paths in the analysis graph">;
HelpText<"Only show error-related paths in the analysis graph">,
MarshallingInfoFlag<"AnalyzerOpts->TrimGraph">;
def analyzer_viz_egraph_graphviz : Flag<["-"], "analyzer-viz-egraph-graphviz">,
HelpText<"Display exploded graph using GraphViz">;
HelpText<"Display exploded graph using GraphViz">,
MarshallingInfoFlag<"AnalyzerOpts->visualizeExplodedGraphWithGraphViz">;
def analyzer_dump_egraph : Separate<["-"], "analyzer-dump-egraph">,
HelpText<"Dump exploded graph to the specified file">;
def analyzer_dump_egraph_EQ : Joined<["-"], "analyzer-dump-egraph=">, Alias<analyzer_dump_egraph>;
Expand All @@ -3712,12 +3719,14 @@ def analyzer_inlining_mode : Separate<["-"], "analyzer-inlining-mode">,
def analyzer_inlining_mode_EQ : Joined<["-"], "analyzer-inlining-mode=">, Alias<analyzer_inlining_mode>;

def analyzer_disable_retry_exhausted : Flag<["-"], "analyzer-disable-retry-exhausted">,
HelpText<"Do not re-analyze paths leading to exhausted nodes with a different strategy (may decrease code coverage)">;
HelpText<"Do not re-analyze paths leading to exhausted nodes with a different strategy (may decrease code coverage)">,
MarshallingInfoFlag<"AnalyzerOpts->NoRetryExhausted">;

def analyzer_max_loop : Separate<["-"], "analyzer-max-loop">,
HelpText<"The maximum number of times the analyzer will go through a loop">;
def analyzer_stats : Flag<["-"], "analyzer-stats">,
HelpText<"Print internal analyzer statistics.">;
HelpText<"Print internal analyzer statistics.">,
MarshallingInfoFlag<"AnalyzerOpts->PrintStats">;

def analyzer_checker : Separate<["-"], "analyzer-checker">,
HelpText<"Choose analyzer checkers to enable">,
Expand All @@ -3742,41 +3751,50 @@ def analyzer_disable_checker_EQ : Joined<["-"], "analyzer-disable-checker=">,
Alias<analyzer_disable_checker>;

def analyzer_disable_all_checks : Flag<["-"], "analyzer-disable-all-checks">,
HelpText<"Disable all static analyzer checks">;
HelpText<"Disable all static analyzer checks">,
MarshallingInfoFlag<"AnalyzerOpts->DisableAllCheckers">;

def analyzer_checker_help : Flag<["-"], "analyzer-checker-help">,
HelpText<"Display the list of analyzer checkers that are available">;
HelpText<"Display the list of analyzer checkers that are available">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerHelp">;

def analyzer_checker_help_alpha : Flag<["-"], "analyzer-checker-help-alpha">,
HelpText<"Display the list of in development analyzer checkers. These "
"are NOT considered safe, they are unstable and will emit incorrect "
"reports. Enable ONLY FOR DEVELOPMENT purposes">;
"reports. Enable ONLY FOR DEVELOPMENT purposes">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerHelpAlpha">;

def analyzer_checker_help_developer : Flag<["-"], "analyzer-checker-help-developer">,
HelpText<"Display the list of developer-only checkers such as modeling "
"and debug checkers">;
"and debug checkers">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerHelpDeveloper">;

def analyzer_config_help : Flag<["-"], "analyzer-config-help">,
HelpText<"Display the list of -analyzer-config options. These are meant for "
"development purposes only!">;
"development purposes only!">,
MarshallingInfoFlag<"AnalyzerOpts->ShowConfigOptionsList">;

def analyzer_list_enabled_checkers : Flag<["-"], "analyzer-list-enabled-checkers">,
HelpText<"Display the list of enabled analyzer checkers">;
HelpText<"Display the list of enabled analyzer checkers">,
MarshallingInfoFlag<"AnalyzerOpts->ShowEnabledCheckerList">;

def analyzer_config : Separate<["-"], "analyzer-config">,
HelpText<"Choose analyzer options to enable">;

def analyzer_checker_option_help : Flag<["-"], "analyzer-checker-option-help">,
HelpText<"Display the list of checker and package options">;
HelpText<"Display the list of checker and package options">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerOptionList">;

def analyzer_checker_option_help_alpha : Flag<["-"], "analyzer-checker-option-help-alpha">,
HelpText<"Display the list of in development checker and package options. "
"These are NOT considered safe, they are unstable and will emit "
"incorrect reports. Enable ONLY FOR DEVELOPMENT purposes">;
"incorrect reports. Enable ONLY FOR DEVELOPMENT purposes">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerOptionAlphaList">;

def analyzer_checker_option_help_developer : Flag<["-"], "analyzer-checker-option-help-developer">,
HelpText<"Display the list of checker and package options meant for "
"development purposes only">;
"development purposes only">,
MarshallingInfoFlag<"AnalyzerOpts->ShowCheckerOptionDeveloperList">;

def analyzer_config_compatibility_mode : Separate<["-"], "analyzer-config-compatibility-mode">,
HelpText<"Don't emit errors on invalid analyzer-config inputs">;
Expand All @@ -3785,7 +3803,8 @@ def analyzer_config_compatibility_mode_EQ : Joined<["-"], "analyzer-config-compa
Alias<analyzer_config_compatibility_mode>;

def analyzer_werror : Flag<["-"], "analyzer-werror">,
HelpText<"Emit analyzer results as errors rather than warnings">;
HelpText<"Emit analyzer results as errors rather than warnings">,
MarshallingInfoFlag<"AnalyzerOpts->AnalyzerWerror">;

//===----------------------------------------------------------------------===//
// Migrator Options
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 @@ -11501,6 +11501,8 @@ class Sema final {
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS,
SourceLocation Loc, bool IsCompAssign);

bool isValidSveBitcast(QualType srcType, QualType destType);

bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
bool isLaxVectorConversion(QualType srcType, QualType destType);

Expand Down
14 changes: 9 additions & 5 deletions clang/lib/CodeGen/CGDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ void CodeGenFunction::registerGlobalDtorWithAtExit(const VarDecl &VD,

void CodeGenFunction::registerGlobalDtorWithAtExit(llvm::Constant *dtorStub) {
// extern "C" int atexit(void (*f)(void));
assert(cast<llvm::Function>(dtorStub)->getFunctionType() ==
llvm::FunctionType::get(CGM.VoidTy, false) &&
assert(dtorStub->getType() ==
llvm::PointerType::get(
llvm::FunctionType::get(CGM.VoidTy, false),
dtorStub->getType()->getPointerAddressSpace()) &&
"Argument to atexit has a wrong type.");

llvm::FunctionType *atexitTy =
Expand All @@ -290,16 +292,18 @@ void CodeGenFunction::registerGlobalDtorWithAtExit(llvm::Constant *dtorStub) {
}

llvm::Value *
CodeGenFunction::unregisterGlobalDtorWithUnAtExit(llvm::Function *dtorStub) {
CodeGenFunction::unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub) {
// The unatexit subroutine unregisters __dtor functions that were previously
// registered by the atexit subroutine. If the referenced function is found,
// it is removed from the list of functions that are called at normal program
// termination and the unatexit returns a value of 0, otherwise a non-zero
// value is returned.
//
// extern "C" int unatexit(void (*f)(void));
assert(dtorStub->getFunctionType() ==
llvm::FunctionType::get(CGM.VoidTy, false) &&
assert(dtorStub->getType() ==
llvm::PointerType::get(
llvm::FunctionType::get(CGM.VoidTy, false),
dtorStub->getType()->getPointerAddressSpace()) &&
"Argument to unatexit has a wrong type.");

llvm::FunctionType *unatexitTy =
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -4304,7 +4304,7 @@ class CodeGenFunction : public CodeGenTypeCache {
void registerGlobalDtorWithAtExit(llvm::Constant *dtorStub);

/// Call unatexit() with function dtorStub.
llvm::Value *unregisterGlobalDtorWithUnAtExit(llvm::Function *dtorStub);
llvm::Value *unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub);

/// Emit code in this function to perform a guarded variable
/// initialization. Guarded initializations are used when it's not
Expand Down
11 changes: 5 additions & 6 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,11 +1278,10 @@ void CodeGenModule::AddGlobalCtor(llvm::Function *Ctor, int Priority,

/// AddGlobalDtor - Add a function to the list that will be called
/// when the module is unloaded.
void CodeGenModule::AddGlobalDtor(llvm::Function *Dtor, int Priority) {
if (CodeGenOpts.RegisterGlobalDtorsWithAtExit) {
if (getCXXABI().useSinitAndSterm())
llvm::report_fatal_error(
"register global dtors with atexit() is not supported yet");
void CodeGenModule::AddGlobalDtor(llvm::Function *Dtor, int Priority,
bool IsDtorAttrFunc) {
if (CodeGenOpts.RegisterGlobalDtorsWithAtExit &&
(!getContext().getTargetInfo().getTriple().isOSAIX() || IsDtorAttrFunc)) {
DtorsUsingAtExit[Priority].push_back(Dtor);
return;
}
Expand Down Expand Up @@ -4716,7 +4715,7 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
if (const ConstructorAttr *CA = D->getAttr<ConstructorAttr>())
AddGlobalCtor(Fn, CA->getPriority());
if (const DestructorAttr *DA = D->getAttr<DestructorAttr>())
AddGlobalDtor(Fn, DA->getPriority());
AddGlobalDtor(Fn, DA->getPriority(), true);
if (D->hasAttr<AnnotateAttr>())
AddGlobalAnnotations(D, Fn);
}
Expand Down
8 changes: 7 additions & 1 deletion clang/lib/CodeGen/CodeGenModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,8 @@ class CodeGenModule : public CodeGenTypeCache {
// FIXME: Hardcoding priority here is gross.
void AddGlobalCtor(llvm::Function *Ctor, int Priority = 65535,
llvm::Constant *AssociatedData = nullptr);
void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535);
void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535,
bool IsDtorAttrFunc = false);

/// EmitCtorList - Generates a global array of functions and priorities using
/// the given list and name. This array will have appending linkage and is
Expand Down Expand Up @@ -1508,6 +1509,11 @@ class CodeGenModule : public CodeGenTypeCache {
/// __cxa_atexit, if it is available, or atexit otherwise.
void registerGlobalDtorsWithAtExit();

// When using sinit and sterm functions, unregister
// __attribute__((destructor)) annotated functions which were previously
// registered by the atexit subroutine using unatexit.
void unregisterGlobalDtorsWithUnAtExit();

void emitMultiVersionFunctions();

/// Emit any vtables which we deferred and still have a use for.
Expand Down
Loading

0 comments on commit cb1a5dc

Please sign in to comment.