Skip to content

Commit

Permalink
Merge from 'master' to 'sycl-web' (#21)
Browse files Browse the repository at this point in the history
  CONFLICT (modify/delete): clang/test/Lexer/minimize_source_to_dependency_directives_invalid_error.c deleted in 248abe2 and modified in HEAD. Version HEAD of clang/test/Lexer/minimize_source_to_dependency_directives_invalid_error.c left in tree.
  • Loading branch information
iclsrc committed Sep 4, 2019
2 parents c53b705 + 248abe2 commit d92e8f0
Show file tree
Hide file tree
Showing 59 changed files with 1,727 additions and 735 deletions.
156 changes: 73 additions & 83 deletions clang-tools-extra/clang-doc/BitcodeReader.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/Generators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ findGeneratorByName(llvm::StringRef Format) {
continue;
return I->instantiate();
}
return llvm::make_error<llvm::StringError>("Can't find generator: " + Format,
llvm::inconvertibleErrorCode());
return createStringError(llvm::inconvertibleErrorCode(),
"can't find generator: " + Format);
}

// Enum conversion
Expand Down
24 changes: 12 additions & 12 deletions clang-tools-extra/clang-doc/HTMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ llvm::Error HTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
genHTML(*static_cast<clang::doc::FunctionInfo *>(I), CDCtx, "");
break;
case InfoType::IT_default:
return llvm::make_error<llvm::StringError>("Unexpected info type.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"unexpected info type");
}

HTMLFile F =
Expand Down Expand Up @@ -891,9 +891,9 @@ static llvm::Error SerializeIndex(ClangDocContext &CDCtx) {
llvm::sys::path::append(FilePath, "index_json.js");
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::F_None);
if (FileErr != OK) {
return llvm::make_error<llvm::StringError>(
"Error creating index file: " + FileErr.message() + "\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"error creating index file: " +
FileErr.message());
}
CDCtx.Idx.sort();
llvm::json::OStream J(OS, 2);
Expand Down Expand Up @@ -940,9 +940,9 @@ static llvm::Error GenIndex(const ClangDocContext &CDCtx) {
llvm::sys::path::append(IndexPath, "index.html");
llvm::raw_fd_ostream IndexOS(IndexPath, FileErr, llvm::sys::fs::F_None);
if (FileErr != OK) {
return llvm::make_error<llvm::StringError>(
"Error creating main index: " + FileErr.message() + "\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"error creating main index: " +
FileErr.message());
}

HTMLFile F;
Expand Down Expand Up @@ -972,10 +972,10 @@ static llvm::Error CopyFile(StringRef FilePath, StringRef OutDirectory) {
std::error_code OK;
std::error_code FileErr = llvm::sys::fs::copy_file(PathRead, PathWrite);
if (FileErr != OK) {
return llvm::make_error<llvm::StringError>(
"Error creating file " + llvm::sys::path::filename(FilePath) + ": " +
FileErr.message() + "\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"error creating file " +
llvm::sys::path::filename(FilePath) +
": " + FileErr.message() + "\n");
}
return llvm::Error::success();
}
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/MDGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ llvm::Error MDGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
genMarkdown(*static_cast<clang::doc::FunctionInfo *>(I), OS);
break;
case InfoType::IT_default:
return llvm::make_error<llvm::StringError>("Unexpected info type.\n",
llvm::inconvertibleErrorCode());
return createStringError(llvm::inconvertibleErrorCode(),
"unexpected InfoType");
}
return llvm::Error::success();
}
Expand Down
12 changes: 6 additions & 6 deletions clang-tools-extra/clang-doc/Representation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ template <typename T>
llvm::Expected<std::unique_ptr<Info>>
reduce(std::vector<std::unique_ptr<Info>> &Values) {
if (Values.empty())
return llvm::make_error<llvm::StringError>(" No values to reduce.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"no value to reduce");
std::unique_ptr<Info> Merged = std::make_unique<T>(Values[0]->USR);
T *Tmp = static_cast<T *>(Merged.get());
for (auto &I : Values)
Expand Down Expand Up @@ -96,8 +96,8 @@ void reduceChildren(std::vector<EnumInfo> &Children,
llvm::Expected<std::unique_ptr<Info>>
mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
if (Values.empty())
return llvm::make_error<llvm::StringError>("No info values to merge.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"no info values to merge");

switch (Values[0]->IT) {
case InfoType::IT_namespace:
Expand All @@ -109,8 +109,8 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
case InfoType::IT_function:
return reduce<FunctionInfo>(Values);
default:
return llvm::make_error<llvm::StringError>("Unexpected info type.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"unexpected info type");
}
}

Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/YAMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ llvm::Error YAMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
InfoYAML << *static_cast<clang::doc::FunctionInfo *>(I);
break;
case InfoType::IT_default:
return llvm::make_error<llvm::StringError>("Unexpected info type.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"unexpected InfoType");
}
return llvm::Error::success();
}
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ llvm::Expected<llvm::SmallString<128>> getInfoOutputFile(StringRef Root,
llvm::sys::path::native(Root, Path);
llvm::sys::path::append(Path, RelativePath);
if (CreateDirectory(Path))
return llvm::make_error<llvm::StringError>("Unable to create directory.\n",
llvm::inconvertibleErrorCode());
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"failed to create directory");
llvm::sys::path::append(Path, Name + Ext);
return Path;
}
Expand Down
1 change: 0 additions & 1 deletion clang/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Windows line ending tests
test/Lexer/minimize_source_to_dependency_directives_invalid_error.c text eol=crlf
test/FixIt/fixit-newline-style.c text eol=crlf
test/Frontend/system-header-line-directive-ms-lineendings.c text eol=crlf
6 changes: 1 addition & 5 deletions clang/examples/clang-interpreter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ int main(int argc, const char **argv) {
// Initialize a compiler invocation object from the clang (-cc1) arguments.
const llvm::opt::ArgStringList &CCArgs = Cmd.getArguments();
std::unique_ptr<CompilerInvocation> CI(new CompilerInvocation);
CompilerInvocation::CreateFromArgs(*CI,
const_cast<const char **>(CCArgs.data()),
const_cast<const char **>(CCArgs.data()) +
CCArgs.size(),
Diags);
CompilerInvocation::CreateFromArgs(*CI, CCArgs, Diags);

// Show the invocation, with -v.
if (CI->getHeaderSearchOpts().Verbose) {
Expand Down

This file was deleted.

42 changes: 24 additions & 18 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,24 +463,30 @@ add_subdirectory(include)
option(COMPILER_RT_USE_LIBCXX
"Enable compiler-rt to use libc++ from the source tree" ON)
if(COMPILER_RT_USE_LIBCXX)
foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx
${LLVM_MAIN_SRC_DIR}/runtimes/libcxx
${LLVM_MAIN_SRC_DIR}/../libcxx
${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
if(IS_DIRECTORY ${path})
set(COMPILER_RT_LIBCXX_PATH ${path})
break()
endif()
endforeach()
foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxxabi
${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi
${LLVM_MAIN_SRC_DIR}/../libcxxabi
${LLVM_EXTERNAL_LIBCXXABI_SOURCE_DIR})
if(IS_DIRECTORY ${path})
set(COMPILER_RT_LIBCXXABI_PATH ${path})
break()
endif()
endforeach()
if(LLVM_ENABLE_PROJECTS_USED)
# Don't use libcxx if LLVM_ENABLE_PROJECTS does not enable it.
set(COMPILER_RT_LIBCXX_PATH ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
set(COMPILER_RT_LIBCXXABI_PATH ${LLVM_EXTERNAL_LIBCXXABI_SOURCE_DIR})
else()
foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx
${LLVM_MAIN_SRC_DIR}/runtimes/libcxx
${LLVM_MAIN_SRC_DIR}/../libcxx
${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
if(IS_DIRECTORY ${path})
set(COMPILER_RT_LIBCXX_PATH ${path})
break()
endif()
endforeach()
foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxxabi
${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi
${LLVM_MAIN_SRC_DIR}/../libcxxabi
${LLVM_EXTERNAL_LIBCXXABI_SOURCE_DIR})
if(IS_DIRECTORY ${path})
set(COMPILER_RT_LIBCXXABI_PATH ${path})
break()
endif()
endforeach()
endif()
endif()

set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
Expand Down
17 changes: 0 additions & 17 deletions lld/ELF/SyntheticSections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3506,23 +3506,6 @@ bool PPC64LongBranchTargetSection::isNeeded() const {
return !finalized || !entries.empty();
}

RISCVSdataSection::RISCVSdataSection()
: SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, 1, ".sdata") {}

bool RISCVSdataSection::isNeeded() const {
if (!ElfSym::riscvGlobalPointer)
return false;

// __global_pointer$ is defined relative to .sdata . If the section does not
// exist, create a dummy one.
for (BaseCommand *base : getParent()->sectionCommands)
if (auto *isd = dyn_cast<InputSectionDescription>(base))
for (InputSection *isec : isd->sections)
if (isec != this)
return false;
return true;
}

static uint8_t getAbiVersion() {
// MIPS non-PIC executable gets ABI version 1.
if (config->emachine == EM_MIPS) {
Expand Down
10 changes: 0 additions & 10 deletions lld/ELF/SyntheticSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -1100,15 +1100,6 @@ class PartitionIndexSection : public SyntheticSection {
void writeTo(uint8_t *buf) override;
};

// Create a dummy .sdata for __global_pointer$ if .sdata does not exist.
class RISCVSdataSection final : public SyntheticSection {
public:
RISCVSdataSection();
size_t getSize() const override { return 0; }
bool isNeeded() const override;
void writeTo(uint8_t *buf) override {}
};

InputSection *createInterpSection();
MergeInputSection *createCommentSection();
template <class ELFT> void splitSections();
Expand Down Expand Up @@ -1173,7 +1164,6 @@ struct InStruct {
PltSection *plt;
PltSection *iplt;
PPC32Got2Section *ppc32Got2;
RISCVSdataSection *riscvSdata;
RelocationBaseSection *relaPlt;
RelocationBaseSection *relaIplt;
StringTableSection *shStrTab;
Expand Down
20 changes: 9 additions & 11 deletions lld/ELF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,6 @@ template <class ELFT> static void createSyntheticSections() {
add(in.ppc64LongBranchTarget);
}

if (config->emachine == EM_RISCV) {
in.riscvSdata = make<RISCVSdataSection>();
add(in.riscvSdata);
}

in.gotPlt = make<GotPltSection>();
add(in.gotPlt);
in.igotPlt = make<IgotPltSection>();
Expand Down Expand Up @@ -1701,12 +1696,16 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// Define __rel[a]_iplt_{start,end} symbols if needed.
addRelIpltSymbols();

// RISC-V's gp can address +/- 2 KiB, set it to .sdata + 0x800 if not defined.
// This symbol should only be defined in an executable.
if (config->emachine == EM_RISCV && !config->shared)
// RISC-V's gp can address +/- 2 KiB, set it to .sdata + 0x800. This symbol
// should only be defined in an executable. If .sdata does not exist, its
// value/section does not matter but it has to be relative, so set its
// st_shndx arbitrarily to 1 (Out::elfHeader).
if (config->emachine == EM_RISCV && !config->shared) {
OutputSection *sec = findSection(".sdata");
ElfSym::riscvGlobalPointer =
addOptionalRegular("__global_pointer$", findSection(".sdata"), 0x800,
STV_DEFAULT, STB_GLOBAL);
addOptionalRegular("__global_pointer$", sec ? sec : Out::elfHeader,
0x800, STV_DEFAULT, STB_GLOBAL);
}

if (config->emachine == EM_X86_64) {
// On targets that support TLSDESC, _TLS_MODULE_BASE_ is defined in such a
Expand Down Expand Up @@ -1881,7 +1880,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
finalizeSynthetic(in.plt);
finalizeSynthetic(in.iplt);
finalizeSynthetic(in.ppc32Got2);
finalizeSynthetic(in.riscvSdata);
finalizeSynthetic(in.partIndex);

// Dynamic section must be the last one in this list and dynamic
Expand Down
25 changes: 0 additions & 25 deletions lld/test/ELF/riscv-gp-dummy-sdata.s

This file was deleted.

15 changes: 15 additions & 0 deletions lld/test/ELF/riscv-gp-no-sdata.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# REQUIRES: riscv
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o
# RUN: ld.lld -pie %t.32.o -o %t.32
# RUN: llvm-readelf -s %t.32 | FileCheck --check-prefix=SYM %s

# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o
# RUN: ld.lld -pie %t.64.o -o %t.64
# RUN: llvm-readelf -s %t.64 | FileCheck --check-prefix=SYM %s

## If there is an undefined reference to __global_pointer$ but .sdata doesn't
## exist, define __global_pointer$ and set its st_shndx arbitrarily to 1.

# SYM: {{0*}}00000800 0 NOTYPE GLOBAL DEFAULT 1 __global_pointer$

lla gp, __global_pointer$
14 changes: 2 additions & 12 deletions lldb/include/lldb/Interpreter/CommandObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,25 +228,15 @@ class CommandObject {
///
/// \param[in/out] request
/// The completion request that needs to be answered.
///
/// FIXME: This is the wrong return value, since we also need to make a
/// distinction between
/// total number of matches, and the window the user wants returned.
virtual void HandleCompletion(CompletionRequest &request);

/// The input array contains a parsed version of the line. The insertion
/// point is given by cursor_index (the index in input of the word containing
/// the cursor) and cursor_char_position (the position of the cursor in that
/// word.)
/// The input array contains a parsed version of the line.
///
/// We've constructed the map of options and their arguments as well if that
/// is helpful for the completion.
///
/// \param[in/out] request
/// The completion request that needs to be answered.
///
/// FIXME: This is the wrong return value, since we also need to make a
/// distinction between
/// total number of matches, and the window the user wants returned.
virtual void
HandleArgumentCompletion(CompletionRequest &request,
OptionElementVector &opt_element_vector) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
// use that in our jitted expression. Else fall back to the old
// class_getName.
static ConstString g_class_getName_symbol_name("class_getName");
static ConstString g_class_getNameRaw_symbol_name("class_getNameRaw");
static ConstString g_class_getNameRaw_symbol_name("objc_debug_class_getNameRaw");
ConstString class_name_getter_function_name = g_class_getName_symbol_name;

ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
Expand Down
5 changes: 5 additions & 0 deletions llvm/include/llvm/Analysis/MemoryBuiltins.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ bool isReallocLikeFn(const Value *V, const TargetLibraryInfo *TLI,
/// reallocates memory (e.g., realloc).
bool isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI);

/// Tests if a value is a call or invoke to a library function that
/// allocates memory and throws if an allocation failed (e.g., new).
bool isOpNewLikeFn(const Value *V, const TargetLibraryInfo *TLI,
bool LookThroughBitCast = false);

//===----------------------------------------------------------------------===//
// malloc Call Utility Functions.
//
Expand Down
Loading

0 comments on commit d92e8f0

Please sign in to comment.