Merge remote-tracking branch 'origin/swift-4.1-branch' into stable
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index 236803a..4069ab8 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -207,7 +207,7 @@
conf.lib.clang_disposeString(self)
@staticmethod
- def from_result(res, fn, args):
+ def from_result(res, fn=None, args=None):
assert isinstance(res, _CXString)
return conf.lib.clang_getCString(res)
@@ -459,8 +459,7 @@
"""The command-line option that disables this diagnostic."""
disable = _CXString()
conf.lib.clang_getDiagnosticOption(self, byref(disable))
-
- return conf.lib.clang_getCString(disable)
+ return _CXString.from_result(disable)
def format(self, options=None):
"""
@@ -473,8 +472,7 @@
options = conf.lib.clang_defaultDiagnosticDisplayOptions()
if options & ~Diagnostic._FormatOptionsMask:
raise ValueError('Invalid format options')
- formatted = conf.lib.clang_formatDiagnostic(self, options)
- return conf.lib.clang_getCString(formatted)
+ return conf.lib.clang_formatDiagnostic(self, options)
def __repr__(self):
return "<Diagnostic severity %r, location %r, spelling %r>" % (
diff --git a/bindings/python/tests/cindex/test_diagnostics.py b/bindings/python/tests/cindex/test_diagnostics.py
index ba6e545..23cbe89 100644
--- a/bindings/python/tests/cindex/test_diagnostics.py
+++ b/bindings/python/tests/cindex/test_diagnostics.py
@@ -92,3 +92,11 @@
assert children[0].spelling.endswith('declared here')
assert children[0].location.line == 1
assert children[0].location.column == 1
+
+def test_diagnostic_string_repr():
+ tu = get_tu('struct MissingSemicolon{}')
+ assert len(tu.diagnostics) == 1
+ d = tu.diagnostics[0]
+
+ assert repr(d) == '<Diagnostic severity 3, location <SourceLocation file \'t.c\', line 1, column 26>, spelling "expected \';\' after struct">'
+
diff --git a/bindings/python/tests/test_exception_specification_kind.py b/bindings/python/tests/cindex/test_exception_specification_kind.py
similarity index 100%
rename from bindings/python/tests/test_exception_specification_kind.py
rename to bindings/python/tests/cindex/test_exception_specification_kind.py
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index e1df9c3..1a4b48a 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -3664,8 +3664,9 @@
getFieldAlignmentSource(BaseInfo.getAlignmentSource());
LValueBaseInfo FieldBaseInfo(fieldAlignSource, BaseInfo.getMayAlias());
+ QualType type = field->getType();
const RecordDecl *rec = field->getParent();
- if (rec->isUnion() || rec->hasAttr<MayAliasAttr>())
+ if (rec->isUnion() || rec->hasAttr<MayAliasAttr>() || type->isVectorType())
FieldBaseInfo.setMayAlias(true);
bool mayAlias = FieldBaseInfo.getMayAlias();
@@ -3690,7 +3691,6 @@
return LValue::MakeBitfield(Addr, Info, fieldType, FieldBaseInfo);
}
- QualType type = field->getType();
Address addr = base.getAddress();
unsigned cvr = base.getVRQualifiers();
bool TBAAPath = CGM.getCodeGenOpts().StructPathTBAA;
diff --git a/lib/Driver/ToolChains/BareMetal.cpp b/lib/Driver/ToolChains/BareMetal.cpp
index 529a209..57a6686 100644
--- a/lib/Driver/ToolChains/BareMetal.cpp
+++ b/lib/Driver/ToolChains/BareMetal.cpp
@@ -65,14 +65,6 @@
return new tools::baremetal::Linker(*this);
}
-std::string BareMetal::getThreadModel() const {
- return "single";
-}
-
-bool BareMetal::isThreadModelSupported(const StringRef Model) const {
- return Model == "single";
-}
-
std::string BareMetal::getRuntimesDir() const {
SmallString<128> Dir(getDriver().ResourceDir);
llvm::sys::path::append(Dir, "lib", "baremetal");
diff --git a/lib/Driver/ToolChains/BareMetal.h b/lib/Driver/ToolChains/BareMetal.h
index 4b74899..5e9fd9b 100644
--- a/lib/Driver/ToolChains/BareMetal.h
+++ b/lib/Driver/ToolChains/BareMetal.h
@@ -38,8 +38,6 @@
bool isPICDefaultForced() const override { return false; }
bool SupportsProfiling() const override { return false; }
bool SupportsObjCGC() const override { return false; }
- std::string getThreadModel() const override;
- bool isThreadModelSupported(const StringRef Model) const override;
RuntimeLibType GetDefaultRuntimeLibType() const override {
return ToolChain::RLT_CompilerRT;
diff --git a/test/CodeGen/tbaa-vec.cpp b/test/CodeGen/tbaa-vec.cpp
new file mode 100644
index 0000000..5f61b93
--- /dev/null
+++ b/test/CodeGen/tbaa-vec.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s
+// Test TBAA metadata generated by front-end (vector types are always treated as mayalias).
+
+typedef float __m128 __attribute__ ((__vector_size__ (16)));
+
+struct A {
+ __m128 a, b;
+};
+
+void foo(A *a, __m128 v) {
+ // CHECK-LABEL: define void @_Z3fooP1ADv4_f
+ a->a = v;
+ // CHECK: store <4 x float> %v, <4 x float>* %{{.*}}, align 16, !tbaa [[TAG_char:!.*]]
+ // CHECK: store <4 x float> %{{.*}}, <4 x float>* %{{.*}}, align 16, !tbaa [[TAG_char]]
+}
+
+// CHECK: [[TYPE_char:!.*]] = !{!"omnipotent char", [[TAG_cxx_tbaa:!.*]],
+// CHECK: [[TAG_cxx_tbaa]] = !{!"Simple C++ TBAA"}
+// CHECK: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
+
diff --git a/test/Driver/baremetal.cpp b/test/Driver/baremetal.cpp
index ec78b91..58fa991 100644
--- a/test/Driver/baremetal.cpp
+++ b/test/Driver/baremetal.cpp
@@ -74,4 +74,12 @@
// RUN: %clangxx -target arm-none-eabi -v 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL
-// CHECK-THREAD-MODEL: Thread model: single
+// CHECK-THREAD-MODEL: Thread model: posix
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model single -v 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-SINGLE
+// CHECK-THREAD-MODEL-SINGLE: Thread model: single
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model posix -v 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
+// CHECK-THREAD-MODEL-POSIX: Thread model: posix