Skip to content

Commit

Permalink
Merge from 'main' to 'sycl-web' (intel#58)
Browse files Browse the repository at this point in the history
  CONFLICT (content): Merge conflict in clang/include/clang/Driver/Options.td
  • Loading branch information
dm-vodopyanov committed Jan 25, 2021
2 parents 7989e30 + 46ec025 commit 931487a
Show file tree
Hide file tree
Showing 178 changed files with 7,040 additions and 1,945 deletions.
153 changes: 74 additions & 79 deletions clang/include/clang/Driver/Options.td

Large diffs are not rendered by default.

491 changes: 246 additions & 245 deletions clang/lib/Driver/ToolChains/AVR.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Arch/RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ isExperimentalExtension(StringRef Ext) {
Ext == "zbe" || Ext == "zbf" || Ext == "zbm" || Ext == "zbp" ||
Ext == "zbr" || Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
return RISCVExtensionVersion{"0", "93"};
if (Ext == "v")
if (Ext == "v" || Ext == "zvamo" || Ext == "zvlsseg")
return RISCVExtensionVersion{"0", "9"};
if (Ext == "zfh")
return RISCVExtensionVersion{"0", "1"};
Expand Down
9 changes: 4 additions & 5 deletions clang/lib/Lex/TokenLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ bool TokenLexer::MaybeRemoveCommaBeforeVaArgs(
return false;

// GCC removes the comma in the expansion of " ... , ## __VA_ARGS__ " if
// __VA_ARGS__ is empty, but not in strict C99 mode where there are no
// named arguments, where it remains. In all other modes, including C99
// with GNU extensions, it is removed regardless of named arguments.
// __VA_ARGS__ is empty, but not in strict mode where there are no
// named arguments, where it remains. With GNU extensions, it is removed
// regardless of named arguments.
// Microsoft also appears to support this extension, unofficially.
if (PP.getLangOpts().C99 && !PP.getLangOpts().GNUMode
&& Macro->getNumParams() < 2)
if (!PP.getLangOpts().GNUMode && Macro->getNumParams() < 2)
return false;

// Is a comma available to be removed?
Expand Down
Empty file.
Empty file.
Empty file.
44 changes: 44 additions & 0 deletions clang/test/Driver/avr-ld.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// RUN: %clang -### --target=avr -mmcu=at90s2313 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKA %s
// LINKA: {{".*ld.*"}} {{.*}} {{"-L.*tiny-stack"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lat90s2313" "-mavr2"

// RUN: %clang -### --target=avr -mmcu=at90s8515 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKB %s
// LINKB: {{".*ld.*"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lat90s8515" "-mavr2"

// RUN: %clang -### --target=avr -mmcu=attiny13 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKC %s
// LINKC: {{".*ld.*"}} {{.*}} {{"-L.*avr25/tiny-stack"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lattiny13" "-mavr25"

// RUN: %clang -### --target=avr -mmcu=attiny44 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKD %s
// LINKD: {{".*ld.*"}} {{.*}} {{"-L.*avr25"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lattiny44" "-mavr25"

// RUN: %clang -### --target=avr -mmcu=atmega103 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKE %s
// LINKE: {{".*ld.*"}} {{.*}} {{"-L.*avr31"}} {{.*}} "-Tdata=0x800060" {{.*}} "-latmega103" "-mavr31"

// RUN: %clang -### --target=avr -mmcu=atmega8u2 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKF %s
// LINKF: {{".*ld.*"}} {{.*}} {{"-L.*avr35"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega8u2" "-mavr35"

// RUN: %clang -### --target=avr -mmcu=atmega48pa --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKG %s
// LINKG: {{".*ld.*"}} {{.*}} {{"-L.*avr4"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega48pa" "-mavr4"

// RUN: %clang -### --target=avr -mmcu=atmega328 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKH %s
// LINKH: {{".*ld.*"}} {{.*}} {{"-L.*avr5"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega328" "-mavr5"

// RUN: %clang -### --target=avr -mmcu=atmega1281 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKI %s
// LINKI: {{".*ld.*"}} {{.*}} {{"-L.*avr51"}} {{.*}} "-Tdata=0x800200" {{.*}} "-latmega1281" "-mavr51"

// RUN: %clang -### --target=avr -mmcu=atmega2560 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKJ %s
// LINKJ: {{".*ld.*"}} {{.*}} {{"-L.*avr6"}} {{.*}} "-Tdata=0x800200" {{.*}} "-latmega2560" "-mavr6"

// RUN: %clang -### --target=avr -mmcu=attiny10 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKK %s
// LINKK: {{".*ld.*"}} {{.*}} {{"-L.*avrtiny"}} {{.*}} "-Tdata=0x800040" {{.*}} "-lattiny10" "-mavrtiny"

// RUN: %clang -### --target=avr -mmcu=atxmega16a4 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKL %s
// LINKL: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega2"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega16a4" "-mavrxmega2"

// RUN: %clang -### --target=avr -mmcu=atxmega64b3 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKM %s
// LINKM: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega4"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega64b3" "-mavrxmega4"

// RUN: %clang -### --target=avr -mmcu=atxmega128a3u --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKN %s
// LINKN: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega6"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega128a3u" "-mavrxmega6"

// RUN: %clang -### --target=avr -mmcu=atxmega128a1 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKO %s
// LINKO: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega7"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega128a1" "-mavrxmega7"
38 changes: 38 additions & 0 deletions clang/test/Driver/riscv-arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,41 @@
// RUN: %clang -target riscv32-unknown-elf -march=rv32izfh0p1 -menable-experimental-extensions -### %s \
// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZFH %s
// RV32-EXPERIMENTAL-ZFH: "-target-feature" "+experimental-zfh"

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVAMO-NOFLAG %s
// RV32-EXPERIMENTAL-ZVAMO-NOFLAG: error: invalid arch name 'rv32izvamo'
// RV32-EXPERIMENTAL-ZVAMO-NOFLAG: requires '-menable-experimental-extensions'

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVAMO-NOVERS %s
// RV32-EXPERIMENTAL-ZVAMO-NOVERS: error: invalid arch name 'rv32izvamo'
// RV32-EXPERIMENTAL-ZVAMO-NOVERS: experimental extension requires explicit version number

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo0p1 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVAMO-BADVERS %s
// RV32-EXPERIMENTAL-ZVAMO-BADVERS: error: invalid arch name 'rv32izvamo0p1'
// RV32-EXPERIMENTAL-ZVAMO-BADVERS: unsupported version number 0.1 for experimental extension

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvamo0p9 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVAMO-GOODVERS %s
// RV32-EXPERIMENTAL-ZVAMO-GOODVERS: "-target-feature" "+experimental-zvamo"

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVLSSEG-NOFLAG %s
// RV32-EXPERIMENTAL-ZVLSSEG-NOFLAG: error: invalid arch name 'rv32izvlsseg'
// RV32-EXPERIMENTAL-ZVLSSEG-NOFLAG: requires '-menable-experimental-extensions'

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVLSSEG-NOVERS %s
// RV32-EXPERIMENTAL-ZVLSSEG-NOVERS: error: invalid arch name 'rv32izvlsseg'
// RV32-EXPERIMENTAL-ZVLSSEG-NOVERS: experimental extension requires explicit version number

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg0p1 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVLSSEG-BADVERS %s
// RV32-EXPERIMENTAL-ZVLSSEG-BADVERS: error: invalid arch name 'rv32izvlsseg0p1'
// RV32-EXPERIMENTAL-ZVLSSEG-BADVERS: unsupported version number 0.1 for experimental extension

// RUN: %clang -target riscv32-unknown-elf -march=rv32izvlsseg0p9 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-ZVLSSEG-GOODVERS %s
// RV32-EXPERIMENTAL-ZVLSSEG-GOODVERS: "-target-feature" "+experimental-zvlsseg"
3 changes: 3 additions & 0 deletions clang/test/Preprocessor/macro_fn_comma_swallow2.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Test the __VA_ARGS__ comma swallowing extensions of various compiler dialects.

// RUN: %clang_cc1 -E %s | FileCheck -check-prefix=GCC -strict-whitespace %s
// RUN: %clang_cc1 -E -std=c90 %s | FileCheck -check-prefix=C99 -strict-whitespace %s
// RUN: %clang_cc1 -E -std=c99 %s | FileCheck -check-prefix=C99 -strict-whitespace %s
// RUN: %clang_cc1 -E -std=c11 %s | FileCheck -check-prefix=C99 -strict-whitespace %s
// RUN: %clang_cc1 -E -x c++ %s | FileCheck -check-prefix=GCC -strict-whitespace %s
// RUN: %clang_cc1 -E -x c++ -std=c++03 %s | FileCheck -check-prefix=C99 -strict-whitespace %s
// RUN: %clang_cc1 -E -x c++ -std=c++11 %s | FileCheck -check-prefix=C99 -strict-whitespace %s
// RUN: %clang_cc1 -E -std=gnu99 %s | FileCheck -check-prefix=GCC -strict-whitespace %s
// RUN: %clang_cc1 -E -fms-compatibility %s | FileCheck -check-prefix=MS -strict-whitespace %s
// RUN: %clang_cc1 -E -DNAMED %s | FileCheck -check-prefix=GCC -strict-whitespace %s
Expand Down
6 changes: 5 additions & 1 deletion libcxx/src/filesystem/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,11 @@ path __canonical(path const& orig_p, error_code* ec) {
return err.report(capture_errno());
return {hold.get()};
#else
char buff[PATH_MAX + 1];
#if defined(__MVS__) && !defined(PATH_MAX)
char buff[ _XOPEN_PATH_MAX + 1 ];
#else
char buff[PATH_MAX + 1];
#endif
char* ret;
if ((ret = ::realpath(p.c_str(), buff)) == nullptr)
return err.report(capture_errno());
Expand Down
2 changes: 0 additions & 2 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,6 @@ def canRunLibcxxTests():
return True, "libc++ always present"

if platform == "linux":
if os.path.isdir("/usr/include/c++/v1"):
return True, "Headers found, let's hope they work"
with tempfile.NamedTemporaryFile() as f:
cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"]
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
Expand Down
20 changes: 6 additions & 14 deletions lldb/packages/Python/lldbsuite/test/make/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS) $(CXXFLAGS_EXTRAS)
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
ifneq (,$(LLVM_LIBS_DIR))
ifeq ($(OS),NetBSD)
LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR)
endif
endif
ifeq (,$(filter $(OS), Windows_NT Android Darwin))
ifneq (,$(filter YES,$(ENABLE_THREADS)))
LDFLAGS += -pthread
Expand Down Expand Up @@ -393,21 +388,18 @@ endif

ifeq (1,$(USE_LIBCPP))
CXXFLAGS += -DLLDB_USING_LIBCPP
ifeq "$(OS)" "Linux"
ifneq (,$(findstring clang,$(CC)))
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
else
CXXFLAGS += -isystem /usr/include/c++/v1
LDFLAGS += -lc++
endif
else ifeq "$(OS)" "Android"
ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in
# Android.rules.
else
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
ifneq (,$(filter $(OS), FreeBSD Linux NetBSD))
ifneq (,$(LLVM_LIBS_DIR))
LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR)
endif
endif
endif

#----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ void GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() {
RegisterMemberFunctionHandler(
StringExtractorGDBRemote::eServerPacketType_vAttachWait,
&GDBRemoteCommunicationServerLLGS::Handle_vAttachWait);
RegisterMemberFunctionHandler(
StringExtractorGDBRemote::eServerPacketType_qVAttachOrWaitSupported,
&GDBRemoteCommunicationServerLLGS::Handle_qVAttachOrWaitSupported);
RegisterMemberFunctionHandler(
StringExtractorGDBRemote::eServerPacketType_vAttachOrWait,
&GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait);
RegisterMemberFunctionHandler(
StringExtractorGDBRemote::eServerPacketType_vCont,
&GDBRemoteCommunicationServerLLGS::Handle_vCont);
Expand Down Expand Up @@ -338,7 +344,7 @@ Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) {
}

Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess(
llvm::StringRef process_name) {
llvm::StringRef process_name, bool include_existing) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));

std::chrono::milliseconds polling_interval = std::chrono::milliseconds(1);
Expand All @@ -347,13 +353,17 @@ Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess(
ProcessInstanceInfoList exclusion_list;
ProcessInstanceInfoMatch match_info;
match_info.GetProcessInfo().GetExecutableFile().SetFile(
process_name, llvm::sys::path::Style::posix);
match_info.SetNameMatchType(NameMatch::EndsWith);
process_name, llvm::sys::path::Style::native);
match_info.SetNameMatchType(NameMatch::Equals);

// Create the excluded process list before polling begins.
Host::FindProcesses(match_info, exclusion_list);
LLDB_LOG(log, "placed '{0}' processes in the exclusion list.",
exclusion_list.size());
if (include_existing) {
LLDB_LOG(log, "including existing processes in search");
} else {
// Create the excluded process list before polling begins.
Host::FindProcesses(match_info, exclusion_list);
LLDB_LOG(log, "placed '{0}' processes in the exclusion list.",
exclusion_list.size());
}

LLDB_LOG(log, "waiting for '{0}' to appear", process_name);

Expand Down Expand Up @@ -3275,7 +3285,43 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttachWait(

LLDB_LOG(log, "attempting to attach to process named '{0}'", process_name);

Status error = AttachWaitProcess(process_name);
Status error = AttachWaitProcess(process_name, false);
if (error.Fail()) {
LLDB_LOG(log, "failed to attach to process named '{0}': {1}", process_name,
error);
return SendErrorResponse(error);
}

// Notify we attached by sending a stop packet.
return SendStopReasonForState(m_debugged_process_up->GetState());
}

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_qVAttachOrWaitSupported(
StringExtractorGDBRemote &packet) {
return SendOKResponse();
}

GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait(
StringExtractorGDBRemote &packet) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));

// Consume the ';' after the identifier.
packet.SetFilePos(strlen("vAttachOrWait"));

if (!packet.GetBytesLeft() || packet.GetChar() != ';')
return SendIllFormedResponse(packet, "vAttachOrWait missing expected ';'");

// Allocate the buffer for the process name from vAttachWait.
std::string process_name;
if (!packet.GetHexByteString(process_name))
return SendIllFormedResponse(packet,
"vAttachOrWait failed to parse process name");

LLDB_LOG(log, "attempting to attach to process named '{0}'", process_name);

Status error = AttachWaitProcess(process_name, true);
if (error.Fail()) {
LLDB_LOG(log, "failed to attach to process named '{0}': {1}", process_name,
error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GDBRemoteCommunicationServerLLGS
/// \return
/// An Status object indicating the success or failure of the
/// attach operation.
Status AttachWaitProcess(llvm::StringRef process_name);
Status AttachWaitProcess(llvm::StringRef process_name, bool include_existing);

// NativeProcessProtocol::NativeDelegate overrides
void InitializeDelegate(NativeProcessProtocol *process) override;
Expand Down Expand Up @@ -183,6 +183,10 @@ class GDBRemoteCommunicationServerLLGS

PacketResult Handle_vAttachWait(StringExtractorGDBRemote &packet);

PacketResult Handle_qVAttachOrWaitSupported(StringExtractorGDBRemote &packet);

PacketResult Handle_vAttachOrWait(StringExtractorGDBRemote &packet);

PacketResult Handle_D(StringExtractorGDBRemote &packet);

PacketResult Handle_qThreadStopInfo(StringExtractorGDBRemote &packet);
Expand Down
9 changes: 7 additions & 2 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "lldb/Interpreter/OptionValueProperties.h"

#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
Expand Down Expand Up @@ -3040,8 +3041,12 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) {
if (sc.function) {
DWARFDIE function_die = GetDIE(sc.function->GetID());

const dw_addr_t func_lo_pc = function_die.GetAttributeValueAsAddress(
DW_AT_low_pc, LLDB_INVALID_ADDRESS);
dw_addr_t func_lo_pc = LLDB_INVALID_ADDRESS;
DWARFRangeList ranges;
if (function_die.GetDIE()->GetAttributeAddressRanges(
function_die.GetCU(), ranges,
/*check_hi_lo_pc=*/true))
func_lo_pc = ranges.GetMinRangeBase(0);
if (func_lo_pc != LLDB_INVALID_ADDRESS) {
const size_t num_variables = ParseVariables(
sc, function_die.GetFirstChild(), func_lo_pc, true, true);
Expand Down
Loading

0 comments on commit 931487a

Please sign in to comment.