Skip to content

Commit 99cd42a

Browse files
committed
Merge branch 'master' into release-0.15.2
2 parents c2e9a38 + 584a875 commit 99cd42a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3408
-2711
lines changed

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ before_install:
77
# the official Clang binary package from the llvm.org download page.
88
- echo yes | sudo add-apt-repository ppa:h-rayflood/llvm
99

10-
# LLVM 3.4 / 3.5 / snapshots
10+
# LLVM 3.4 / 3.5 / 3.6 / snapshots
1111
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main' >> /etc/apt/sources.list"
1212
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.5 main' >> /etc/apt/sources.list"
13+
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6-binaries main' >> /etc/apt/sources.list"
1314
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' >> /etc/apt/sources.list"
1415
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
1516

@@ -31,11 +32,11 @@ install:
3132
sudo ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 /usr/lib/i386-linux-gnu/libstdc++.so;
3233
fi
3334
-
34-
if [[ "${LLVM_PACKAGE}" == *3\.[56]* ]] && [[ "${CXX}" == "g++" ]]; then
35-
sudo apt-get install -qq g++-4.8; export CXX="g++-4.8";
35+
if [[ "${LLVM_PACKAGE}" == *3\.[567]* ]] && [[ "${CXX}" == "g++" ]]; then
36+
sudo apt-get install -qq g++-4.9; export CXX="g++-4.9";
3637
fi
3738
-
38-
if [[ "${LLVM_PACKAGE}" == *3\.[56]* ]] && [[ "${CXX}" == "clang++" ]]; then
39+
if [[ "${LLVM_PACKAGE}" == *3\.[567]* ]] && [[ "${CXX}" == "clang++" ]]; then
3940
sudo apt-get install --allow-unauthenticated -qq clang-3.4; export CXX="clang++-3.4";
4041
fi
4142
env:
@@ -52,10 +53,14 @@ env:
5253
- LLVM_PACKAGE="llvm-3.5 llvm-3.5-dev libedit2 libedit-dev"
5354
- LLVM_PACKAGE="llvm-3.6 llvm-3.6-dev libedit2 libedit-dev" TEST_DEBUG=1
5455
- LLVM_PACKAGE="llvm-3.6 llvm-3.6-dev libedit2 libedit-dev"
56+
- LLVM_PACKAGE="llvm-3.7 llvm-3.7-dev libedit2 libedit-dev" TEST_DEBUG=1
57+
- LLVM_PACKAGE="llvm-3.7 llvm-3.7-dev libedit2 libedit-dev"
5558
matrix:
5659
allow_failures:
5760
- env: LLVM_PACKAGE="llvm-3.6 llvm-3.6-dev libedit2 libedit-dev" TEST_DEBUG=1
5861
- env: LLVM_PACKAGE="llvm-3.6 llvm-3.6-dev libedit2 libedit-dev"
62+
- env: LLVM_PACKAGE="llvm-3.7 llvm-3.7-dev libedit2 libedit-dev" TEST_DEBUG=1
63+
- env: LLVM_PACKAGE="llvm-3.7 llvm-3.7-dev libedit2 libedit-dev"
5964
script:
6065
- cmake $OPTS .
6166
- make -j2

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include(CheckCXXCompilerFlag)
1616
#
1717

1818
find_package(LLVM 3.1 REQUIRED
19-
all-targets analysis asmparser asmprinter bitreader bitwriter codegen core debuginfo instcombine ipa ipo instrumentation linker lto mc mcdisassembler mcparser objcarcopts object option profiledata scalaropts selectiondag support tablegen target transformutils vectorize ${EXTRA_LLVM_MODULES})
19+
all-targets analysis asmparser asmprinter bitreader bitwriter codegen core debuginfodwarf instcombine ipa ipo instrumentation linker lto mc mcdisassembler mcparser objcarcopts object option profiledata scalaropts selectiondag support tablegen target transformutils vectorize ${EXTRA_LLVM_MODULES})
2020
math(EXPR LDC_LLVM_VER ${LLVM_VERSION_MAJOR}*100+${LLVM_VERSION_MINOR})
2121

2222
#
@@ -34,7 +34,7 @@ include(GetLinuxDistribution)
3434
#
3535

3636
# Version information
37-
set(LDC_VERSION "0.15.0") # May be overridden by git hash tag
37+
set(LDC_VERSION "0.15.2") # May be overridden by git hash tag
3838
set(DMDFE_MAJOR_VERSION 2)
3939
set(DMDFE_MINOR_VERSION 0)
4040
set(DMDFE_PATCH_VERSION 66)
@@ -513,11 +513,14 @@ endif()
513513
install(FILES ${PROJECT_BINARY_DIR}/bin/${LDC_EXE}_install.conf DESTINATION ${CONF_INST_DIR} RENAME ${LDC_EXE}.conf)
514514

515515
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
516-
set(BASH_COMPLETION_INST_DIR "${CONF_INST_DIR}/bash_completion.d")
517-
if(LINUX_DISTRIBUTION_IS_GENTOO)
518-
set(BASH_COMPLETION_INST_DIR "/usr/share/bash-completion")
516+
find_package(bash-completion QUIET)
517+
if(NOT BASH_COMPLETION_FOUND)
518+
set(BASH_COMPLETION_COMPLETIONSDIR "${CONF_INST_DIR}/bash_completion.d")
519+
if(LINUX_DISTRIBUTION_IS_GENTOO)
520+
set(BASH_COMPLETION_COMPLETIONSDIR "/usr/share/bash-completion")
521+
endif()
519522
endif()
520-
install(DIRECTORY bash_completion.d/ DESTINATION ${BASH_COMPLETION_INST_DIR})
523+
install(DIRECTORY bash_completion.d/ DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR})
521524
endif()
522525

523526
#

Doxyfile

Lines changed: 1784 additions & 867 deletions
Large diffs are not rendered by default.

bash_completion.d/ldc renamed to bash_completion.d/ldc2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# bash completion for ldc2
22

3-
have ldc2 &&{
43
function elementExists(){
54
local i isRunning result
65
i=0
@@ -160,7 +159,6 @@ have ldc2 &&{
160159
fi
161160
}
162161
complete -o nospace -F _ldc ldc2
163-
}
164162

165163
# Local variables:
166164
# mode: shell-script

cmake/Modules/FindLLVM.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
2828
# system default locations such as /usr/local/bin. Executing find_program()
2929
# multiples times is the approach recommended in the docs.
30-
set(llvm_config_names llvm-config-3.6 llvm-config36
30+
set(llvm_config_names llvm-config-3.7 llvm-config37
31+
llvm-config-3.6 llvm-config36
3132
llvm-config-3.5 llvm-config35
3233
llvm-config-3.4 llvm-config34
3334
llvm-config-3.3 llvm-config33
@@ -76,6 +77,12 @@ if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
7677
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
7778
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
7879
endif()
80+
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
81+
# Versions below 3.7 do not support components debuginfodwarf
82+
# Only debuginfo is available
83+
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
84+
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
85+
endif()
7986

8087
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
8188
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
@@ -150,6 +157,12 @@ else()
150157
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
151158
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
152159
endif()
160+
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
161+
# Versions below 3.7 do not support components debuginfodwarf
162+
# Only debuginfo is available
163+
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
164+
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
165+
endif()
153166

154167
llvm_set(LDFLAGS ldflags)
155168
if(NOT ${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")

dmd2/mtype.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ void Type::init()
217217
sizeTy[Treturn] = sizeof(TypeReturn);
218218
sizeTy[Terror] = sizeof(TypeError);
219219
sizeTy[Tnull] = sizeof(TypeNull);
220+
#if IN_LLVM // Backport from DMD 2.067, pull request #4436
221+
sizeTy[Tvector] = sizeof(TypeVector);
222+
#endif
220223

221224
mangleChar[Tarray] = 'A';
222225
mangleChar[Tsarray] = 'G';

dmd2/root/port.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ longdouble Port::strtold(const char *buffer, char **endp)
147147
// Disable useless warnings about unreferenced functions
148148
#pragma warning (disable : 4514)
149149

150+
#include <llvm/ADT/APFloat.h>
151+
#include <llvm/ADT/StringRef.h>
150152
#include <math.h>
151153
#include <float.h> // for _isnan
152154
#include <time.h>
@@ -285,7 +287,11 @@ longdouble strtold_dm(const char *p,char **endp);
285287
longdouble Port::strtold(const char *p, char **endp)
286288
{
287289
#if IN_LLVM
288-
return ::strtold(p, endp);
290+
// MSVC strtold() does not support hex float strings. Just use
291+
// the function provided by LLVM because we going to use it anyway.
292+
llvm::APFloat val(llvm::APFloat::IEEEdouble, llvm::APFloat::uninitialized);
293+
val.convertFromString(llvm::StringRef(p), llvm::APFloat::rmNearestTiesToEven);
294+
return val.convertToDouble();
289295
#else
290296
return ::strtold_dm(p, endp);
291297
#endif

driver/ldmd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ void buildCommandLine(std::vector<const char*>& r, const Params& p)
945945
else if (p.debugInfo == Debug::pretendC) r.push_back("-gc");
946946
if (p.alwaysStackFrame) r.push_back("-disable-fp-elim");
947947
if (p.targetModel == Model::m32) r.push_back("-m32");
948-
else if (p.targetModel == Model::m32) r.push_back("-m64");
948+
else if (p.targetModel == Model::m64) r.push_back("-m64");
949949
if (p.profile) warning("CPU profile generation not yet supported by LDC.");
950950
if (p.verbose) r.push_back("-v");
951951
if (p.logTlsUse) warning("-vtls not yet supported by LDC.");

driver/main.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,12 @@ static void hide(llvm::StringMap<cl::Option *>& map, const char* name) {
190190
/// Removes command line options exposed from within LLVM that are unlikely
191191
/// to be useful for end users from the -help output.
192192
static void hideLLVMOptions() {
193+
#if LDC_LLVM_VER >= 307
194+
llvm::StringMap<cl::Option *>& map = cl::getRegisteredOptions();
195+
#else
193196
llvm::StringMap<cl::Option *> map;
194197
cl::getRegisteredOptions(map);
198+
#endif
195199
hide(map, "bounds-checking-single-trap");
196200
hide(map, "disable-debug-info-verifier");
197201
hide(map, "disable-spill-fusing");
@@ -550,18 +554,25 @@ static void registerMipsABI()
550554
}
551555

552556
/// Register the float ABI.
553-
/// Also defines D_SoftFloat or D_HardFloat depending on ABI type.
554-
static void registerPredefinedFloatABI(const char *soft, const char *hard)
557+
/// Also defines D_HardFloat or D_SoftFloat depending if FPU should be used
558+
static void registerPredefinedFloatABI(const char *soft, const char *hard, const char *softfp=NULL)
555559
{
560+
// Use target floating point unit instead of s/w float routines
561+
bool useFPU = !gTargetMachine->Options.UseSoftFloat;
562+
VersionCondition::addPredefinedGlobalIdent(useFPU ? "D_HardFloat" : "D_SoftFloat");
563+
556564
if (gTargetMachine->Options.FloatABIType == llvm::FloatABI::Soft)
557565
{
558-
VersionCondition::addPredefinedGlobalIdent(soft);
559-
VersionCondition::addPredefinedGlobalIdent("D_SoftFloat");
566+
VersionCondition::addPredefinedGlobalIdent(useFPU && softfp ? softfp : soft);
560567
}
561-
if (gTargetMachine->Options.FloatABIType == llvm::FloatABI::Hard)
568+
else if (gTargetMachine->Options.FloatABIType == llvm::FloatABI::Hard)
562569
{
570+
assert(useFPU && "Should be using the FPU if using float-abi=hard");
563571
VersionCondition::addPredefinedGlobalIdent(hard);
564-
VersionCondition::addPredefinedGlobalIdent("D_HardFloat");
572+
}
573+
else
574+
{
575+
assert(0 && "FloatABIType neither Soft or Hard");
565576
}
566577
}
567578

@@ -603,14 +614,13 @@ static void registerPredefinedTargetVersions() {
603614
case llvm::Triple::armeb:
604615
#endif
605616
VersionCondition::addPredefinedGlobalIdent("ARM");
606-
// FIXME: What about ARM_SoftFP?.
607-
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat");
617+
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat", "ARM_SoftFP");
608618
break;
609619
case llvm::Triple::thumb:
610620
VersionCondition::addPredefinedGlobalIdent("ARM");
611621
VersionCondition::addPredefinedGlobalIdent("Thumb"); // For backwards compatibility.
612622
VersionCondition::addPredefinedGlobalIdent("ARM_Thumb");
613-
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat");
623+
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat", "ARM_SoftFP");
614624
break;
615625
#if LDC_LLVM_VER == 305
616626
case llvm::Triple::arm64:
@@ -622,7 +632,7 @@ static void registerPredefinedTargetVersions() {
622632
case llvm::Triple::aarch64_be:
623633
#endif
624634
VersionCondition::addPredefinedGlobalIdent("AArch64");
625-
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat");
635+
registerPredefinedFloatABI("ARM_SoftFloat", "ARM_HardFloat", "ARM_SoftFP");
626636
break;
627637
#endif
628638
case llvm::Triple::mips:
@@ -989,9 +999,8 @@ int main(int argc, char **argv)
989999
if (m64bits)
9901000
{
9911001
if (bitness != ExplicitBitness::None)
992-
{
9931002
error(Loc(), "cannot use both -m32 and -m64 options");
994-
}
1003+
bitness = ExplicitBitness::M64;
9951004
}
9961005

9971006
if (global.errors)
@@ -1015,7 +1024,9 @@ int main(int argc, char **argv)
10151024
global.params.is64bit = triple.isArch64Bit();
10161025
}
10171026

1018-
#if LDC_LLVM_VER >= 306
1027+
#if LDC_LLVM_VER >= 307
1028+
gDataLayout = gTargetMachine->getDataLayout();
1029+
#elif LDC_LLVM_VER >= 306
10191030
gDataLayout = gTargetMachine->getSubtargetImpl()->getDataLayout();
10201031
#elif LDC_LLVM_VER >= 302
10211032
gDataLayout = gTargetMachine->getDataLayout();
@@ -1212,7 +1223,7 @@ int main(int argc, char **argv)
12121223
if (strcmp(m->srcfile->name->str, global.main_d) == 0)
12131224
{
12141225
static const char buf[] = "void main(){}";
1215-
m->srcfile->setbuffer((void *)buf, sizeof(buf));
1226+
m->srcfile->setbuffer(const_cast<char *>(buf), sizeof(buf));
12161227
m->srcfile->ref = 1;
12171228
}
12181229
else

driver/targetmachine.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,8 @@ llvm::TargetMachine* createTargetMachine(
390390
floatABI = FloatABI::Hard;
391391
break;
392392
case llvm::Triple::arm:
393-
floatABI = getARMFloatABI(triple, getLLVMArchSuffixForARM(cpu));
394-
break;
395393
case llvm::Triple::thumb:
396-
floatABI = FloatABI::Soft;
394+
floatABI = getARMFloatABI(triple, getLLVMArchSuffixForARM(cpu));
397395
break;
398396
}
399397
}

0 commit comments

Comments
 (0)