[PATCH] D48159: [clangd] Implement hover for "auto" and "decltype"
malaperle updated this revision to Diff 153612. malaperle added a comment. Add comment about AutoTypeLoc work-around. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48159 Files: clangd/XRefs.cpp unittests/clangd/TestTU.cpp unittests/clangd/TestTU.h unittests/clangd/XRefsTests.cpp Index: unittests/clangd/XRefsTests.cpp === --- unittests/clangd/XRefsTests.cpp +++ unittests/clangd/XRefsTests.cpp @@ -343,6 +343,13 @@ OneTest Tests[] = { { + R"cpp(// No hover +^int main() { +} + )cpp", + "", + }, + { R"cpp(// Local variable int main() { int bonjour; @@ -637,16 +644,275 @@ )cpp", "", }, + { + R"cpp(// Simple initialization with auto +void foo() { + ^auto i = 1; +} + )cpp", + "int", + }, + { + R"cpp(// Simple initialization with const auto +void foo() { + const ^auto i = 1; +} + )cpp", + "int", + }, + { + R"cpp(// Simple initialization with const auto& +void foo() { + const ^auto& i = 1; +} + )cpp", + "int", + }, + { + R"cpp(// Simple initialization with auto& +void foo() { + ^auto& i = 1; +} + )cpp", + "int", + }, + { + R"cpp(// Auto with initializer list. +namespace std +{ + template + class initializer_list {}; +} +void foo() { + ^auto i = {1,2}; +} + )cpp", + "class std::initializer_list", + }, + { + R"cpp(// User defined conversion to auto +struct Bar { + operator ^auto() const { return 10; } +}; + )cpp", + "int", + }, + { + R"cpp(// Simple initialization with decltype(auto) +void foo() { + ^decltype(auto) i = 1; +} + )cpp", + "int", + }, + { + R"cpp(// Simple initialization with const decltype(auto) +void foo() { + const int j = 0; + ^decltype(auto) i = j; +} + )cpp", + "const int", + }, + { + R"cpp(// Simple initialization with const& decltype(auto) +void foo() { + int k = 0; + const int& j = k; + ^decltype(auto) i = j; +} + )cpp", + "const int &", + }, + { + R"cpp(// Simple initialization with & decltype(auto) +void foo() { + int k = 0; + int& j = k; + ^decltype(auto) i = j; +} + )cpp", + "int &", + }, + { + R"cpp(// decltype with initializer list: nothing +namespace std +{ + template + class initializer_list {}; +} +void foo() { + ^decltype(auto) i = {1,2}; +} + )cpp", + "", + }, + { + R"cpp(// auto function return with trailing type +struct Bar {}; +^auto test() -> decltype(Bar()) { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// trailing return type +struct Bar {}; +auto test() -> ^decltype(Bar()) { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// auto in function return +struct Bar {}; +^auto test() { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// auto& in function return +struct Bar {}; +^auto& test() { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// const auto& in function return +struct Bar {}; +const ^auto& test() { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// decltype(auto) in function return +struct Bar {}; +^decltype(auto) test() { + return Bar(); +} + )cpp", + "struct Bar", + }, + { + R"cpp(// decltype(auto) reference in function return +struct Bar {}; +^decltype(auto) test() { + int a; + return (a); +} + )cpp", + "int &", + }, + { + R"cpp(// decltype lvalue reference +
[PATCH] D48342: [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.
mclow.lists added a comment. I want to point out that this code (not -necessarily- this patch, but where it lives) needs to be rewritten. There is no prohibition on users specializing `allocator_traits` for their allocators, and yet libc++'s vector depends on the existence of `allocator_traits::__construct_range_forward` (among other things). https://reviews.llvm.org/D48342 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47846: [clangd] Implementation of textDocument/documentSymbol
malaperle updated this revision to Diff 153611. malaperle added a comment. Fix handling of externs, definition vs declaration and call more common code. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D47846 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h clangd/FindSymbols.cpp clangd/FindSymbols.h clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h clangd/SourceCode.cpp clangd/SourceCode.h clangd/XRefs.cpp test/clangd/initialize-params-invalid.test test/clangd/initialize-params.test test/clangd/symbols.test unittests/clangd/FindSymbolsTests.cpp unittests/clangd/SyncAPI.cpp unittests/clangd/SyncAPI.h Index: unittests/clangd/SyncAPI.h === --- unittests/clangd/SyncAPI.h +++ unittests/clangd/SyncAPI.h @@ -43,6 +43,9 @@ llvm::Expected> runWorkspaceSymbols(ClangdServer , StringRef Query, int Limit); +llvm::Expected> +runDocumentSymbols(ClangdServer , PathRef File); + } // namespace clangd } // namespace clang Index: unittests/clangd/SyncAPI.cpp === --- unittests/clangd/SyncAPI.cpp +++ unittests/clangd/SyncAPI.cpp @@ -117,5 +117,12 @@ return std::move(*Result); } +llvm::Expected> +runDocumentSymbols(ClangdServer , PathRef File) { + llvm::Optional>> Result; + Server.documentSymbols(File, capture(Result)); + return std::move(*Result); +} + } // namespace clangd } // namespace clang Index: unittests/clangd/FindSymbolsTests.cpp === --- unittests/clangd/FindSymbolsTests.cpp +++ unittests/clangd/FindSymbolsTests.cpp @@ -22,6 +22,7 @@ using ::testing::AllOf; using ::testing::AnyOf; using ::testing::ElementsAre; +using ::testing::ElementsAreArray; using ::testing::IsEmpty; using ::testing::UnorderedElementsAre; @@ -37,6 +38,7 @@ return (arg.containerName + "::" + arg.name) == Name; } MATCHER_P(WithKind, Kind, "") { return arg.kind == Kind; } +MATCHER_P(SymRange, Range, "") { return arg.location.range == Range; } ClangdServer::Options optsForTests() { auto ServerOpts = ClangdServer::optsForTest(); @@ -287,5 +289,274 @@ EXPECT_THAT(getSymbols("foo"), ElementsAre(QName("foo"))); } +namespace { +class DocumentSymbolsTest : public ::testing::Test { +public: + DocumentSymbolsTest() + : Server(CDB, FSProvider, DiagConsumer, optsForTests()) {} + +protected: + MockFSProvider FSProvider; + MockCompilationDatabase CDB; + IgnoreDiagnostics DiagConsumer; + ClangdServer Server; + + std::vector getSymbols(PathRef File) { +EXPECT_TRUE(Server.blockUntilIdleForTest()) << "Waiting for preamble"; +auto SymbolInfos = runDocumentSymbols(Server, File); +EXPECT_TRUE(bool(SymbolInfos)) << "documentSymbols returned an error"; +return *SymbolInfos; + } + + void addFile(StringRef FilePath, StringRef Contents) { +FSProvider.Files[FilePath] = Contents; +Server.addDocument(FilePath, Contents); + } +}; +} // namespace + +TEST_F(DocumentSymbolsTest, BasicSymbols) { + std::string FilePath = testPath("foo.cpp"); + Annotations Main(R"( + class Foo; + class Foo { +Foo() {} +Foo(int a) {} +void $decl[[f]](); +friend void f1(); +friend class Friend; +Foo& operator=(const Foo&); +~Foo(); +class Nested { +void f(); +}; + }; + class Friend { + }; + + void f1(); + inline void f2() {} + static const int KInt = 2; + const char* kStr = "123"; + + void f1() {} + + namespace foo { + // Type alias + typedef int int32; + using int32_t = int32; + + // Variable + int v1; + + // Namespace + namespace bar { + int v2; + } + // Namespace alias + namespace baz = bar; + + // FIXME: using declaration is not supported as the IndexAction will ignore + // implicit declarations (the implicit using shadow declaration) by default, + // and there is no way to customize this behavior at the moment. + using bar::v2; + } // namespace foo +)"); + + addFile(FilePath, Main.code()); + EXPECT_THAT(getSymbols(FilePath), + ElementsAreArray( + {AllOf(QName("Foo"), WithKind(SymbolKind::Class)), + AllOf(QName("Foo"), WithKind(SymbolKind::Class)), + AllOf(QName("Foo::Foo"), WithKind(SymbolKind::Method)), + AllOf(QName("Foo::Foo"), WithKind(SymbolKind::Method)), + AllOf(QName("Foo::f"), WithKind(SymbolKind::Method)), + AllOf(QName("f1"), WithKind(SymbolKind::Function)), + AllOf(QName("Foo::operator="), WithKind(SymbolKind::Method)), + AllOf(QName("Foo::~Foo"), WithKind(SymbolKind::Method)), +
r336039 - Driver: Add an explicit target to testcase from r336037
Author: tstellar Date: Fri Jun 29 20:50:10 2018 New Revision: 336039 URL: http://llvm.org/viewvc/llvm-project?rev=336039=rev Log: Driver: Add an explicit target to testcase from r336037 Modified: cfe/trunk/test/Driver/linux-ld.c Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=336039=336038=336039=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Fri Jun 29 20:50:10 2018 @@ -1784,6 +1784,7 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=x86_64-unknown-linux-gnu \ // RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ // RUN: --sysroot=%S/Inputs/rhel_7_tree \ // RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336037 - Driver: Don't mix system tools with devtoolset tools on RHEL
Author: tstellar Date: Fri Jun 29 19:55:54 2018 New Revision: 336037 URL: http://llvm.org/viewvc/llvm-project?rev=336037=rev Log: Driver: Don't mix system tools with devtoolset tools on RHEL Summary: On RHEL, devtoolset provides a more up-to-date toolchain than the base install, and we want to make sure all the tools use are from the same toolchain. Reviewers: rsmith, bruno Reviewed By: bruno Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D34848 Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp cfe/trunk/test/Driver/linux-ld.c Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=336037=336036=336037=diff == --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Fri Jun 29 19:55:54 2018 @@ -238,6 +238,15 @@ Linux::Linux(const Driver , const llvm ExtraOpts.push_back("relro"); } + if (GCCInstallation.getParentLibPath().find("opt/rh/devtoolset") != + StringRef::npos) +// With devtoolset on RHEL, we want to add a bin directory that is relative +// to the detected gcc install, because if we are using devtoolset gcc then +// we want to use other tools from devtoolset (e.g. ld) instead of the +// standard system tools. +PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X"); Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=336037=336036=336037=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Fri Jun 29 19:55:54 2018 @@ -1782,3 +1782,12 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ +// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s +// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld +// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34848: Driver: Don't mix system tools with devtoolset tools on RHEL
This revision was automatically updated to reflect the committed changes. Closed by commit rL336037: Driver: Dont mix system tools with devtoolset tools on RHEL (authored by tstellar, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D34848?vs=142294=153608#toc Repository: rL LLVM https://reviews.llvm.org/D34848 Files: cfe/trunk/lib/Driver/ToolChains/Linux.cpp cfe/trunk/test/Driver/linux-ld.c Index: cfe/trunk/test/Driver/linux-ld.c === --- cfe/trunk/test/Driver/linux-ld.c +++ cfe/trunk/test/Driver/linux-ld.c @@ -1782,3 +1782,12 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ +// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s +// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld +// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp === --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp @@ -238,6 +238,15 @@ ExtraOpts.push_back("relro"); } + if (GCCInstallation.getParentLibPath().find("opt/rh/devtoolset") != + StringRef::npos) +// With devtoolset on RHEL, we want to add a bin directory that is relative +// to the detected gcc install, because if we are using devtoolset gcc then +// we want to use other tools from devtoolset (e.g. ld) instead of the +// standard system tools. +PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X"); Index: cfe/trunk/test/Driver/linux-ld.c === --- cfe/trunk/test/Driver/linux-ld.c +++ cfe/trunk/test/Driver/linux-ld.c @@ -1782,3 +1782,12 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ +// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s +// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld +// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp === --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp @@ -238,6 +238,15 @@ ExtraOpts.push_back("relro"); } + if (GCCInstallation.getParentLibPath().find("opt/rh/devtoolset") != + StringRef::npos) +// With devtoolset on RHEL, we want to add a bin directory that is relative +// to the detected gcc install, because if we are using devtoolset gcc then +// we want to use other tools from devtoolset (e.g. ld) instead of the +// standard system tools. +PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros
enyquist added a comment. @klimek having gotten that out of the way, I do occasionally drink too much and have sudden urges to re-implement things from scratch. Close it if you need to, since I can't commit to anything, but it it happens to be still open on one of those nights, who knows, maybe I'll end up doing it :) Repository: rL LLVM https://reviews.llvm.org/D28462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48027: [analyzer] Improve `CallDescription` to handle c++ method.
MTC added a comment. kindly ping! Repository: rC Clang https://reviews.llvm.org/D48027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336036 - [X86] Remove masking from the avx512 rotate builtins. Use a select builtin instead.
Author: ctopper Date: Fri Jun 29 18:32:14 2018 New Revision: 336036 URL: http://llvm.org/viewvc/llvm-project?rev=336036=rev Log: [X86] Remove masking from the avx512 rotate builtins. Use a select builtin instead. Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/lib/Headers/avx512vlintrin.h cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/CodeGen/avx512f-builtins.c cfe/trunk/test/CodeGen/avx512vl-builtins.c Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=336036=336035=336036=diff == --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Fri Jun 29 18:32:14 2018 @@ -1352,30 +1352,30 @@ TARGET_BUILTIN(__builtin_ia32_rangepd512 TARGET_BUILTIN(__builtin_ia32_rangeps512_mask, "V16fV16fV16fIiV16fUsIi", "nc", "avx512dq") TARGET_BUILTIN(__builtin_ia32_reducepd512_mask, "V8dV8dIiV8dUcIi", "nc", "avx512dq") TARGET_BUILTIN(__builtin_ia32_reduceps512_mask, "V16fV16fIiV16fUsIi", "nc", "avx512dq") -TARGET_BUILTIN(__builtin_ia32_prold512_mask, "V16iV16iIiV16iUs", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prolq512_mask, "V8LLiV8LLiIiV8LLiUc", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prold128_mask, "V4iV4iIiV4iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prold256_mask, "V8iV8iIiV8iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolq128_mask, "V2LLiV2LLiIiV2LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolq256_mask, "V4LLiV4LLiIiV4LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolvd512_mask, "V16iV16iV16iV16iUs", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prolvq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prord512_mask, "V16iV16iIiV16iUs", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prorq512_mask, "V8LLiV8LLiIiV8LLiUc", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prolvd128_mask, "V4iV4iV4iV4iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolvd256_mask, "V8iV8iV8iV8iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolvq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prolvq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prord128_mask, "V4iV4iIiV4iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prord256_mask, "V8iV8iIiV8iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorq128_mask, "V2LLiV2LLiIiV2LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorq256_mask, "V4LLiV4LLiIiV4LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorvd512_mask, "V16iV16iV16iV16iUs", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prorvq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "nc", "avx512f") -TARGET_BUILTIN(__builtin_ia32_prorvd128_mask, "V4iV4iV4iV4iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorvd256_mask, "V8iV8iV8iV8iUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorvq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "nc", "avx512vl") -TARGET_BUILTIN(__builtin_ia32_prorvq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prold512, "V16iV16iIi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prolq512, "V8LLiV8LLiIi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prold128, "V4iV4iIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prold256, "V8iV8iIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolq128, "V2LLiV2LLiIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolq256, "V4LLiV4LLiIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolvd512, "V16iV16iV16i", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prolvq512, "V8LLiV8LLiV8LLi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prord512, "V16iV16iIi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prorq512, "V8LLiV8LLiIi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prolvd128, "V4iV4iV4i", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolvd256, "V8iV8iV8i", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolvq128, "V2LLiV2LLiV2LLi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prolvq256, "V4LLiV4LLiV4LLi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prord128, "V4iV4iIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prord256, "V8iV8iIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prorq128, "V2LLiV2LLiIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prorq256, "V4LLiV4LLiIi", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prorvd512, "V16iV16iV16i", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prorvq512, "V8LLiV8LLiV8LLi", "nc", "avx512f") +TARGET_BUILTIN(__builtin_ia32_prorvd128, "V4iV4iV4i", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prorvd256, "V8iV8iV8i", "nc", "avx512vl") +TARGET_BUILTIN(__builtin_ia32_prorvq128, "V2LLiV2LLiV2LLi", "nc",
[libcxxabi] r336034 - [libc++abi] Look for __config instead of vector
Author: smeenai Date: Fri Jun 29 18:25:47 2018 New Revision: 336034 URL: http://llvm.org/viewvc/llvm-project?rev=336034=rev Log: [libc++abi] Look for __config instead of vector vector is a generic C++ header, whereas __config is libc++-specific, so we can look for it instead to guarantee we're finding a libc++ installation. This was suggested by Eric in https://reviews.llvm.org/D48694. This is less important now that we're limiting the header search to the specified directories (which definitely shouldn't have any other C++ library's headers anyway), but it shouldn't hurt either. There's a chance some other library could also be providing a __config header, so there's still a trade-off there. It would be ideal if we could check for the presence of both __config and vector in the same directory, but there doesn't seem to be any easy way to do that in CMake. Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=336034=336033=336034=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Fri Jun 29 18:25:47 2018 @@ -110,7 +110,7 @@ endforeach() find_path( LIBCXXABI_LIBCXX_INCLUDES - vector + __config PATHS ${LIBCXXABI_LIBCXX_INCLUDES} ${LIBCXXABI_LIBCXX_PATH}/include ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48694: [libc++abi] Limit libc++ header search to specified paths
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL336032: [libc++abi] Limit libc++ header search to specified paths (authored by smeenai, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48694 Files: libcxxabi/trunk/CMakeLists.txt Index: libcxxabi/trunk/CMakeLists.txt === --- libcxxabi/trunk/CMakeLists.txt +++ libcxxabi/trunk/CMakeLists.txt @@ -116,6 +116,7 @@ ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} ${LIBCXXABI_LIBCXX_INCLUDE_DIRS} ${LLVM_INCLUDE_DIR}/c++/v1 + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) Index: libcxxabi/trunk/CMakeLists.txt === --- libcxxabi/trunk/CMakeLists.txt +++ libcxxabi/trunk/CMakeLists.txt @@ -116,6 +116,7 @@ ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} ${LIBCXXABI_LIBCXX_INCLUDE_DIRS} ${LLVM_INCLUDE_DIR}/c++/v1 + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r336032 - [libc++abi] Limit libc++ header search to specified paths
Author: smeenai Date: Fri Jun 29 18:04:50 2018 New Revision: 336032 URL: http://llvm.org/viewvc/llvm-project?rev=336032=rev Log: [libc++abi] Limit libc++ header search to specified paths Right now, when libc++abi is locating libc++ headers, it specifies several search locations, but it also doesn't prevent CMake from looking for those headers in system directories. I don't know if this was intentional or an oversight, but it has several issues: * We're looking specifically for the vector header, which could just as easily be found in a libstdc++ (or other C++ library) installation. * No system I know of places their C++ headers directly in system include directories (they're always under a C++ subdirectory), so the system search will never succeed. * find_path searches system paths before the user-specified PATHS, so if some system does happen to have C++ headers in its system include directories, those headers will be preferred, which doesn't seem desirable. It makes sense to me to limit this header search to the explicitly specified paths (using NO_DEFAULT_PATH, as is done for the other find_path call in this file), but I'm putting it up for review in case there's some use case I'm not thinking of. Differential Revision: https://reviews.llvm.org/D48694 Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=336032=336031=336032=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Fri Jun 29 18:04:50 2018 @@ -116,6 +116,7 @@ find_path( ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} ${LIBCXXABI_LIBCXX_INCLUDE_DIRS} ${LLVM_INCLUDE_DIR}/c++/v1 + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48694: [libc++abi] Limit libc++ header search to specified paths
smeenai added a comment. In https://reviews.llvm.org/D48694#1148718, @EricWF wrote: > > For whether it makes sense to search for includes in the system path, that > > boils down to @ldionne's question of whether building libc++abi against a > > system-installed libc++ is supported. I actually don't know the answer to > > that myself ... @dexonsmith and @EricWF, what are your thoughts on that? > > The current search won't find the system-installed libc++ headers on Darwin > > anyway though, where they're placed in the compiler's include directory > > rather than a system include directory. > > Building libc++abi against an installed libc++ doesn't make sense IMO, so I > don't care if we try to support it. Libc++abi is a lower lever component with > libc++ being built on top of it. > If you want to update libc++abi, you should be building a new libc++ as > well. (Note: Using system libc++abi headers to build libc++ would make sense > though). > > As an aside, libc++abi should really live in the libc++ repository. That way > it would always have the correct headers available. But every time I pitch > that idea I get a ton of push back. All right. In that case I'll go ahead and commit this and make the `__config` change in a follow-up. Repository: rCXXA libc++abi https://reviews.llvm.org/D48694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48694: [libc++abi] Limit libc++ header search to specified paths
EricWF added a comment. > For whether it makes sense to search for includes in the system path, that > boils down to @ldionne's question of whether building libc++abi against a > system-installed libc++ is supported. I actually don't know the answer to > that myself ... @dexonsmith and @EricWF, what are your thoughts on that? The > current search won't find the system-installed libc++ headers on Darwin > anyway though, where they're placed in the compiler's include directory > rather than a system include directory. Building libc++abi against an installed libc++ doesn't make sense IMO, so I don't care if we try to support it. Libc++abi is a lower lever component with libc++ being built on top of it. If you want to update libc++abi, you should be building a new libc++ as well. (Note: Using system libc++abi headers to build libc++ would make sense though). As an aside, libc++abi should really live in the libc++ repository. That way it would always have the correct headers available. But every time I pitch that idea I get a ton of push back. Repository: rCXXA libc++abi https://reviews.llvm.org/D48694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
This revision was automatically updated to reflect the committed changes. Closed by commit rL336031: Add protocol redefinition to the current scope/context (authored by bruno, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47297?vs=148308=153604#toc Repository: rL LLVM https://reviews.llvm.org/D47297 Files: cfe/trunk/lib/Sema/SemaDeclObjC.cpp cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap cfe/trunk/test/Modules/protocol-redefinition.m Index: cfe/trunk/test/Modules/protocol-redefinition.m === --- cfe/trunk/test/Modules/protocol-redefinition.m +++ cfe/trunk/test/Modules/protocol-redefinition.m @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/protocol-redefinition -fsyntax-only %s -Wno-private-module -verify + +// expected-no-diagnostics + +@import Kit; Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h @@ -0,0 +1,3 @@ +@protocol Foo +- (void)someMethodOnFoo; +@end Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Base { + header "Base.h" + export * +} \ No newline at end of file Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h @@ -0,0 +1,6 @@ +#import + +// REDECLARATION +@protocol Foo +- (void)someMethodOnFoo; +@end Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Kit { + header "Kit.h" + export * +} \ No newline at end of file Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp === --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp @@ -1210,6 +1210,11 @@ PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName, ProtocolLoc, AtProtoInterfaceLoc, /*PrevDecl=*/nullptr); + +// If we are using modules, add the decl to the context in order to +// serialize something meaningful. +if (getLangOpts().Modules) + PushOnScopeChains(PDecl, TUScope); PDecl->startDefinition(); } else { if (PrevDecl) { Index: cfe/trunk/test/Modules/protocol-redefinition.m === --- cfe/trunk/test/Modules/protocol-redefinition.m +++ cfe/trunk/test/Modules/protocol-redefinition.m @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/protocol-redefinition -fsyntax-only %s -Wno-private-module -verify + +// expected-no-diagnostics + +@import Kit; Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h @@ -0,0 +1,3 @@ +@protocol Foo +- (void)someMethodOnFoo; +@end Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap === --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Base { + header "Base.h" + export * +} \ No
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
This revision was automatically updated to reflect the committed changes. Closed by commit rC336031: Add protocol redefinition to the current scope/context (authored by bruno, committed by ). Repository: rL LLVM https://reviews.llvm.org/D47297 Files: lib/Sema/SemaDeclObjC.cpp test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap test/Modules/protocol-redefinition.m Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h === --- test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h +++ test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h @@ -0,0 +1,3 @@ +@protocol Foo +- (void)someMethodOnFoo; +@end Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap === --- test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap +++ test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Base { + header "Base.h" + export * +} \ No newline at end of file Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap === --- test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap +++ test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Kit { + header "Kit.h" + export * +} \ No newline at end of file Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h === --- test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h +++ test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h @@ -0,0 +1,6 @@ +#import + +// REDECLARATION +@protocol Foo +- (void)someMethodOnFoo; +@end Index: test/Modules/protocol-redefinition.m === --- test/Modules/protocol-redefinition.m +++ test/Modules/protocol-redefinition.m @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/protocol-redefinition -fsyntax-only %s -Wno-private-module -verify + +// expected-no-diagnostics + +@import Kit; Index: lib/Sema/SemaDeclObjC.cpp === --- lib/Sema/SemaDeclObjC.cpp +++ lib/Sema/SemaDeclObjC.cpp @@ -1210,6 +1210,11 @@ PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName, ProtocolLoc, AtProtoInterfaceLoc, /*PrevDecl=*/nullptr); + +// If we are using modules, add the decl to the context in order to +// serialize something meaningful. +if (getLangOpts().Modules) + PushOnScopeChains(PDecl, TUScope); PDecl->startDefinition(); } else { if (PrevDecl) { Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h === --- test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h +++ test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h @@ -0,0 +1,3 @@ +@protocol Foo +- (void)someMethodOnFoo; +@end Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap === --- test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap +++ test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Base { + header "Base.h" + export * +} \ No newline at end of file Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap === --- test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap +++ test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap @@ -0,0 +1,4 @@ +framework module Kit { + header "Kit.h" + export * +} \ No newline at end of file Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h === --- test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h +++ test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h @@ -0,0 +1,6 @@ +#import + +// REDECLARATION +@protocol Foo +- (void)someMethodOnFoo; +@end Index: test/Modules/protocol-redefinition.m
r336031 - Add protocol redefinition to the current scope/context
Author: bruno Date: Fri Jun 29 17:49:27 2018 New Revision: 336031 URL: http://llvm.org/viewvc/llvm-project?rev=336031=rev Log: Add protocol redefinition to the current scope/context Not doing so causes the AST writter to assert since the decl in question never gets emitted. This is fine when modules is not used, but otherwise we need to serialize something other than garbage. rdar://problem/39844933 Differential Revision: https://reviews.llvm.org/D47297 Added: cfe/trunk/test/Modules/Inputs/protocol-redefinition/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap cfe/trunk/test/Modules/protocol-redefinition.m Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=336031=336030=336031=diff == --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Jun 29 17:49:27 2018 @@ -1210,6 +1210,11 @@ Sema::ActOnStartProtocolInterface(Source PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName, ProtocolLoc, AtProtoInterfaceLoc, /*PrevDecl=*/nullptr); + +// If we are using modules, add the decl to the context in order to +// serialize something meaningful. +if (getLangOpts().Modules) + PushOnScopeChains(PDecl, TUScope); PDecl->startDefinition(); } else { if (PrevDecl) { Added: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h?rev=336031=auto == --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h (added) +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h Fri Jun 29 17:49:27 2018 @@ -0,0 +1,3 @@ +@protocol Foo +- (void)someMethodOnFoo; +@end Added: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap?rev=336031=auto == --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap (added) +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap Fri Jun 29 17:49:27 2018 @@ -0,0 +1,4 @@ +framework module Base { + header "Base.h" + export * +} \ No newline at end of file Added: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h?rev=336031=auto == --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h (added) +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h Fri Jun 29 17:49:27 2018 @@ -0,0 +1,6 @@ +#import + +// REDECLARATION +@protocol Foo +- (void)someMethodOnFoo; +@end Added: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap?rev=336031=auto == --- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap (added) +++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap Fri Jun 29 17:49:27 2018 @@ -0,0 +1,4 @@ +framework module Kit { + header "Kit.h" + export * +} \ No newline at end of file Added: cfe/trunk/test/Modules/protocol-redefinition.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/protocol-redefinition.m?rev=336031=auto
[PATCH] D48037: [CUDA] Add tests to ensure that std::min/max can be called from __host__ __device__ functions.
This revision was automatically updated to reflect the committed changes. Closed by commit rL336029: [CUDA] Add tests to ensure that std::min/max can be called from __host__… (authored by jlebar, committed by ). Repository: rL LLVM https://reviews.llvm.org/D48037 Files: test-suite/trunk/External/CUDA/algorithm.cu Index: test-suite/trunk/External/CUDA/algorithm.cu === --- test-suite/trunk/External/CUDA/algorithm.cu +++ test-suite/trunk/External/CUDA/algorithm.cu @@ -17,10 +17,16 @@ __device__ void min() { assert(std::min(0, 1) == 0); } +__host__ __device__ void min_hd() { + assert(std::min(0, 1) == 0); +} __device__ void max() { assert(std::max(0, 1) == 1); } +__host__ __device__ void max_hd() { + assert(std::max(0, 1) == 1); +} // Clang has device-side shims implementing std::min and std::max for scalars // starting in C++11, but doesn't implement minimax or std::min/max on @@ -39,10 +45,27 @@ #endif } +// Same tests as cpp14_tests, but from a host-device context. +__host__ __device__ void cpp14_tests_hd() { +#if __cplusplus >= 201402L && STDLIB_VERSION >= 2014 + assert(std::greater()(1, 0)); + assert(std::min({5, 1, 10}) == 1); + assert(std::max({5, 1, 10}, std::less()) == 10); + + assert(std::minmax(1, 0).first == 0); + assert(std::minmax(1, 0).second == 1); + assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); + assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); +#endif +} + __global__ void kernel() { min(); + min_hd(); max(); + max_hd(); cpp14_tests(); + cpp14_tests_hd(); } int main() { @@ -52,6 +75,11 @@ printf("CUDA error %d\n", (int)err); return 1; } + + min_hd(); + max_hd(); + cpp14_tests_hd(); + printf("Success!\n"); return 0; } Index: test-suite/trunk/External/CUDA/algorithm.cu === --- test-suite/trunk/External/CUDA/algorithm.cu +++ test-suite/trunk/External/CUDA/algorithm.cu @@ -17,10 +17,16 @@ __device__ void min() { assert(std::min(0, 1) == 0); } +__host__ __device__ void min_hd() { + assert(std::min(0, 1) == 0); +} __device__ void max() { assert(std::max(0, 1) == 1); } +__host__ __device__ void max_hd() { + assert(std::max(0, 1) == 1); +} // Clang has device-side shims implementing std::min and std::max for scalars // starting in C++11, but doesn't implement minimax or std::min/max on @@ -39,10 +45,27 @@ #endif } +// Same tests as cpp14_tests, but from a host-device context. +__host__ __device__ void cpp14_tests_hd() { +#if __cplusplus >= 201402L && STDLIB_VERSION >= 2014 + assert(std::greater()(1, 0)); + assert(std::min({5, 1, 10}) == 1); + assert(std::max({5, 1, 10}, std::less()) == 10); + + assert(std::minmax(1, 0).first == 0); + assert(std::minmax(1, 0).second == 1); + assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); + assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); +#endif +} + __global__ void kernel() { min(); + min_hd(); max(); + max_hd(); cpp14_tests(); + cpp14_tests_hd(); } int main() { @@ -52,6 +75,11 @@ printf("CUDA error %d\n", (int)err); return 1; } + + min_hd(); + max_hd(); + cpp14_tests_hd(); + printf("Success!\n"); return 0; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48152: [CUDA] Add tests that, in C++14 mode, min/max are constexpr.
This revision was automatically updated to reflect the committed changes. Closed by commit rL336030: [CUDA] Add tests that, in C++14 mode, min/max are constexpr. (authored by jlebar, committed by ). Repository: rL LLVM https://reviews.llvm.org/D48152 Files: test-suite/trunk/External/CUDA/algorithm.cu Index: test-suite/trunk/External/CUDA/algorithm.cu === --- test-suite/trunk/External/CUDA/algorithm.cu +++ test-suite/trunk/External/CUDA/algorithm.cu @@ -42,6 +42,8 @@ assert(std::minmax(1, 0).second == 1); assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); + constexpr auto min = std::min(1, 2); + constexpr auto max = std::max(1, 2); #endif } @@ -56,6 +58,8 @@ assert(std::minmax(1, 0).second == 1); assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); + constexpr auto min = std::min(1, 2); + constexpr auto max = std::max(1, 2); #endif } Index: test-suite/trunk/External/CUDA/algorithm.cu === --- test-suite/trunk/External/CUDA/algorithm.cu +++ test-suite/trunk/External/CUDA/algorithm.cu @@ -42,6 +42,8 @@ assert(std::minmax(1, 0).second == 1); assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); + constexpr auto min = std::min(1, 2); + constexpr auto max = std::max(1, 2); #endif } @@ -56,6 +58,8 @@ assert(std::minmax(1, 0).second == 1); assert(std::minmax({0, 10, -10, 100}, std::less()).first == -10); assert(std::minmax({0, 10, -10, 100}, std::less()).second == 100); + constexpr auto min = std::min(1, 2); + constexpr auto max = std::max(1, 2); #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48694: [libc++abi] Limit libc++ header search to specified paths
smeenai added a comment. In https://reviews.llvm.org/D48694#1146232, @EricWF wrote: > LGTM, but I'm a bit confused. You seem to argue that no system places C++ > headers on the default search paths, but also that it would be a problem if > such a system did. > Why wouldn't the conclusion be true? That is, although C++ includes aren't > normally found along the default paths, when they are found, we should still > consider them? > > That being said, the current behavior of searching certian default include > paths first does seem incorrect. So I'm OK with disabling it. > > I also agree that we shouldn't necessarily be looking for `vector` header, > how about looking for `__config` instead, since it's libc++ specific? Switching to `__config` is a good idea. I can do that separately, since it should be pretty uncontroversial. For whether it makes sense to search for includes in the system path, that boils down to @ldionne's question of whether building libc++abi against a system-installed libc++ is supported. I actually don't know the answer to that myself ... @dexonsmith and @EricWF, what are your thoughts on that? The current search won't find the system-installed libc++ headers on Darwin anyway though, where they're placed in the compiler's include directory rather than a system include directory. If we do decide that searching for C++ headers in the system is important, we can do two separate find_path calls, to ensure our specified paths are searched before the system paths. (We may also want to tweak the second call to actually look for the system C++ headers in the right places in that case.) Repository: rCXXA libc++abi https://reviews.llvm.org/D48694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk updated this revision to Diff 153597. anniecherk added a comment. Herald added a subscriber: eraman. - addressed Julie's comments - updated logic to consider both access specifier & linkage - added tests for each type of linkage https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-module-excluded.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-module-included.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonInlineFunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonStaticFunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonclass.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonfunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-classPrivate.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-functionInnerClass.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-namespace-private.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-static.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp clang-tools-extra/test/clang-doc/yaml-module.cpp Index: clang-tools-extra/test/clang-doc/yaml-module.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-module.cpp @@ -0,0 +1,63 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --extra-arg=-fmodules-ts --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/moduleFunction.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/staticModuleFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/exportedModuleFunction.yaml | FileCheck %s --check-prefix=CHECK-C + +export module M; + +int moduleFunction(int x); //ModuleLinkage +// CHECK-A: --- +// CHECK-A-NEXT: USR: '4429AA8706EF483A44B1DCE2D956BF0FEF82A9B7' +// CHECK-A-NEXT: Name:'moduleFunction' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 12 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Params: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'x' +// CHECK-A-NEXT: ReturnType: +// CHECK-A-NEXT: Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: ... + + +static int staticModuleFunction(int x); //ModuleInternalLinkage +// CHECK-B: --- +// CHECK-B-NEXT: USR: '2E49675BF9D3FCCF51D5AA5EA02C280D894C1E4C' +// CHECK-B-NEXT: Name:'staticModuleFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 29 +// CHECK-B-NEXT: Filename:'test' +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: Name:'x' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: ... + + +export double exportedModuleFunction(double y, int z); //ExternalLinkage +// CHECK-C: --- +// CHECK-C-NEXT: USR: '325C328D4EB158CCBA4DF2B5321F63EB39C2B17C' +// CHECK-C-NEXT: Name:'exportedModuleFunction' +// CHECK-C-NEXT: Location: +// CHECK-C-NEXT: - LineNumber: 46 +// CHECK-C-NEXT: Filename:'test' +// CHECK-C-NEXT: Params: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'double' +// CHECK-C-NEXT: Name:'y' +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: Name:'z' +// CHECK-C-NEXT: ReturnType: +// CHECK-C-NEXT: Type: +// CHECK-C-NEXT: Name:'double' +// CHECK-C-NEXT: ... Index: clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp @@ -0,0 +1,311 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/function.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/inlinedFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/functionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/inlinedFunctionWithInnerClass.yaml | FileCheck %s
[PATCH] D48151: [CUDA] Make __host__/__device__ min/max overloads constexpr in C++14.
This revision was automatically updated to reflect the committed changes. Closed by commit rL336026: [CUDA] Make __host__/__device__ min/max overloads constexpr in C++14. (authored by jlebar, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D48151?vs=151248=153594#toc Repository: rL LLVM https://reviews.llvm.org/D48151 Files: cfe/trunk/lib/Headers/cuda_wrappers/algorithm Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm === --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm @@ -67,34 +67,43 @@ #endif #endif +#pragma push_macro("_CPP14_CONSTEXPR") +#if __cplusplus >= 201402L +#define _CPP14_CONSTEXPR constexpr +#else +#define _CPP14_CONSTEXPR +#endif + template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } +#pragma pop_macro("_CPP14_CONSTEXPR") + #ifdef _LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD #else Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm === --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm @@ -67,34 +67,43 @@ #endif #endif +#pragma push_macro("_CPP14_CONSTEXPR") +#if __cplusplus >= 201402L +#define _CPP14_CONSTEXPR constexpr +#else +#define _CPP14_CONSTEXPR +#endif + template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } +#pragma pop_macro("_CPP14_CONSTEXPR") + #ifdef _LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD #else ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336026 - [CUDA] Make __host__/__device__ min/max overloads constexpr in C++14.
Author: jlebar Date: Fri Jun 29 15:28:09 2018 New Revision: 336026 URL: http://llvm.org/viewvc/llvm-project?rev=336026=rev Log: [CUDA] Make __host__/__device__ min/max overloads constexpr in C++14. Summary: Tests in a separate change to the test-suite. Reviewers: rsmith, tra Subscribers: lahwaacz, sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D48151 Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=336026=336025=336026=diff == --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original) +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Jun 29 15:28:09 2018 @@ -67,34 +67,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif +#pragma push_macro("_CPP14_CONSTEXPR") +#if __cplusplus >= 201402L +#define _CPP14_CONSTEXPR constexpr +#else +#define _CPP14_CONSTEXPR +#endif + template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } +#pragma pop_macro("_CPP14_CONSTEXPR") + #ifdef _LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD #else ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336025 - [CUDA] Make min/max shims host+device.
Author: jlebar Date: Fri Jun 29 15:27:56 2018 New Revision: 336025 URL: http://llvm.org/viewvc/llvm-project?rev=336025=rev Log: [CUDA] Make min/max shims host+device. Summary: Fixes PR37753: min/max can't be called from __host__ __device__ functions in C++14 mode. Testcase in a separate test-suite commit. Reviewers: rsmith Subscribers: sanjoy, lahwaacz, cfe-commits Differential Revision: https://reviews.llvm.org/D48036 Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=336025=336024=336025=diff == --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original) +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Jun 29 15:27:56 2018 @@ -69,28 +69,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48036: [CUDA] Make min/max shims host+device.
This revision was automatically updated to reflect the committed changes. Closed by commit rL336025: [CUDA] Make min/max shims host+device. (authored by jlebar, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D48036?vs=150790=153593#toc Repository: rL LLVM https://reviews.llvm.org/D48036 Files: cfe/trunk/lib/Headers/cuda_wrappers/algorithm Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm === --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm @@ -69,28 +69,28 @@ template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } Index: cfe/trunk/lib/Headers/cuda_wrappers/algorithm === --- cfe/trunk/lib/Headers/cuda_wrappers/algorithm +++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm @@ -69,28 +69,28 @@ template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template __attribute__((enable_if(true, ""))) -inline __device__ const __T & +inline __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48036: [CUDA] Make min/max shims host+device.
jlebar added a comment. > Looks right to me (other than the missing constexpr in C++14 onwards). Though > this is subtle enough that I suspect the only way to know for sure is to try > it. Thanks a lot, Richard. FTR the missing constexpr is in https://reviews.llvm.org/D48151. https://reviews.llvm.org/D48036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48036: [CUDA] Make min/max shims host+device.
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. Looks right to me (other than the missing `constexpr` in C++14 onwards). Though this is subtle enough that I suspect the only way to know for sure is to try it. https://reviews.llvm.org/D48036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336022 - [analyzer] [tests] Fix 80 column violation in SATestBuild.py
Author: george.karpenkov Date: Fri Jun 29 15:05:13 2018 New Revision: 336022 URL: http://llvm.org/viewvc/llvm-project?rev=336022=rev Log: [analyzer] [tests] Fix 80 column violation in SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestBuild.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=336022=336021=336022=diff == --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Fri Jun 29 15:05:13 2018 @@ -274,13 +274,13 @@ def runScanBuild(Dir, SBOutputDir, PBuil SBOptions += "-plist-html -o '%s' " % SBOutputDir SBOptions += "-enable-checker " + AllCheckers + " " SBOptions += "--keep-empty " -AnalyzerConfig = { -"stable-report-filename": "true", -"serialize-stats": "true" -} +AnalyzerConfig = [ +("stable-report-filename", "true"), +("serialize-stats", "true"), +] SBOptions += "-analyzer-config '%s' " % ( -",".join("%s=%s" % (key, value) for key, value in AnalyzerConfig.iteritems())) +",".join("%s=%s" % (key, value) for (key, value) in AnalyzerConfig)) # Always use ccc-analyze to ensure that we can locate the failures # directory. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336023 - [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
Author: george.karpenkov Date: Fri Jun 29 15:05:32 2018 New Revision: 336023 URL: http://llvm.org/viewvc/llvm-project?rev=336023=rev Log: [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper Modified: cfe/trunk/utils/analyzer/SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestBuild.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=336023=336022=336023=diff == --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Fri Jun 29 15:05:32 2018 @@ -136,6 +136,9 @@ CleanupScript = "cleanup_run_static_anal # This is a file containing commands for scan-build. BuildScript = "run_static_analyzer.cmd" +# A comment in a build script which disables wrapping. +NoPrefixCmd = "#NOPREFIX" + # The log file name. LogFolderName = "Logs" BuildLogName = "run_static_analyzer.log" @@ -285,6 +288,7 @@ def runScanBuild(Dir, SBOutputDir, PBuil # Always use ccc-analyze to ensure that we can locate the failures # directory. SBOptions += "--override-compiler " +ExtraEnv = {} try: SBCommandFile = open(BuildScriptPath, "r") SBPrefix = "scan-build " + SBOptions + " " @@ -292,6 +296,15 @@ def runScanBuild(Dir, SBOutputDir, PBuil Command = Command.strip() if len(Command) == 0: continue + +# Custom analyzer invocation specified by project. +# Communicate required information using environment variables +# instead. +if Command == NoPrefixCmd: +SBPrefix = "" +ExtraEnv['OUTPUT'] = SBOutputDir +continue + # If using 'make', auto imply a -jX argument # to speed up analysis. xcodebuild will # automatically use the maximum number of cores. @@ -305,6 +318,7 @@ def runScanBuild(Dir, SBOutputDir, PBuil check_call(SBCommand, cwd=SBCwd, stderr=PBuildLogFile, stdout=PBuildLogFile, + env=dict(os.environ, **ExtraEnv), shell=True) except CalledProcessError: Local.stderr.write("Error: scan-build failed. Its output was: \n") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48794: [AArch64] Implement execute-only support.
ivanlozano created this revision. ivanlozano added reviewers: srhines, eugenis, peter.smith, echristo. Herald added a reviewer: javed.absar. Herald added subscribers: cfe-commits, kristof.beyls. This implements execute-only support for AArch64 targets, similar to the ARM execute-only support. Repository: rC Clang https://reviews.llvm.org/D48794 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Arch/AArch64.cpp lib/Driver/ToolChains/Arch/AArch64.h lib/Driver/ToolChains/Clang.cpp test/CodeGen/aarch64-execute-only.c Index: test/CodeGen/aarch64-execute-only.c === --- /dev/null +++ test/CodeGen/aarch64-execute-only.c @@ -0,0 +1,24 @@ +// RUN: %clang -target aarch64-linux-eabi -### %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY + +// RUN: %clang -target aarch64-linux-eabi -### -mexecute-only %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-EXECUTE-ONLY + +// RUN: %clang -target aarch64-linux-eabi -### -mexecute-only -mno-execute-only %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY + + +// -mpure-code flag for GCC compatibility +// RUN: %clang -target aarch64-linux-eabi -### %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY + +// RUN: %clang -target aarch64-linux-eabi -### -mpure-code %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-EXECUTE-ONLY + +// RUN: %clang -target aarch64-linux-eabi -### -mpure-code -mno-pure-code %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY + +// CHECK-NO-EXECUTE-ONLY-NOT: "+execute-only" +// CHECK-EXECUTE-ONLY: "+execute-only" + +void a() {} Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -341,7 +341,7 @@ break; case llvm::Triple::aarch64: case llvm::Triple::aarch64_be: -aarch64::getAArch64TargetFeatures(D, Args, Features); +aarch64::getAArch64TargetFeatures(D, Args, CmdArgs, Features); break; case llvm::Triple::x86: case llvm::Triple::x86_64: Index: lib/Driver/ToolChains/Arch/AArch64.h === --- lib/Driver/ToolChains/Arch/AArch64.h +++ lib/Driver/ToolChains/Arch/AArch64.h @@ -22,6 +22,7 @@ namespace aarch64 { void getAArch64TargetFeatures(const Driver , const llvm::opt::ArgList , + llvm::opt::ArgStringList , std::vector ); std::string getAArch64TargetCPU(const llvm::opt::ArgList , Index: lib/Driver/ToolChains/Arch/AArch64.cpp === --- lib/Driver/ToolChains/Arch/AArch64.cpp +++ lib/Driver/ToolChains/Arch/AArch64.cpp @@ -150,6 +150,7 @@ } void aarch64::getAArch64TargetFeatures(const Driver , const ArgList , + ArgStringList , std::vector ) { Arg *A; bool success = true; @@ -203,4 +204,11 @@ if (Args.hasArg(options::OPT_mno_neg_immediates)) Features.push_back("+no-neg-immediates"); + + // Generate execute-only output (no data access to code sections). + if (Arg *A = Args.getLastArg(options::OPT_mexecute_only, options::OPT_mno_execute_only)) { +if (A->getOption().matches(options::OPT_mexecute_only)) { + Features.push_back("+execute-only"); +} + } } Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1885,9 +1885,9 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">, Group, HelpText<"Restore the default behaviour of not generating long calls">; def mexecute_only : Flag<["-"], "mexecute-only">, Group, - HelpText<"Disallow generation of data access to code sections (ARM only)">; + HelpText<"Disallow generation of data access to code sections (ARM/AArch64 only)">; def mno_execute_only : Flag<["-"], "mno-execute-only">, Group, - HelpText<"Allow generation of data access to code sections (ARM only)">; + HelpText<"Allow generation of data access to code sections (ARM/AArch64 only)">; def mtp_mode_EQ : Joined<["-"], "mtp=">, Group, Values<"soft, cp15">, HelpText<"Read thread pointer from coprocessor register (ARM only)">; def mpure_code : Flag<["-"], "mpure-code">, Alias; // Alias for GCC compatibility Index: test/CodeGen/aarch64-execute-only.c === --- /dev/null +++ test/CodeGen/aarch64-execute-only.c @@ -0,0 +1,24 @@ +// RUN: %clang -target aarch64-linux-eabi -### %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY + +// RUN: %clang -target aarch64-linux-eabi -### -mexecute-only %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-EXECUTE-ONLY + +// RUN: %clang -target
r336021 - PR33924: merge local declarations that have linkage of some kind within
Author: rsmith Date: Fri Jun 29 14:58:50 2018 New Revision: 336021 URL: http://llvm.org/viewvc/llvm-project?rev=336021=rev Log: PR33924: merge local declarations that have linkage of some kind within merged function definitions; also merge functions with deduced return types. This seems like two independent fixes, but unfortunately they are hard to separate because it's challenging to reliably test either one of them without also testing the other. A complication arises with deduced return type support: we need the type of the function in order to know how to merge it, but we can't load the actual type of the function because it might reference an entity declared within the function (and we need to have already merged the function to correctly merge that entity, which we would need to do to determine if the function types match). So we instead compare the declared function type when merging functions, and defer loading the actual type of a function with a deduced type until we've finished loading and merging the function. Added: cfe/trunk/test/Modules/merge-deduced-return.cpp cfe/trunk/test/Modules/merge-lambdas.cpp cfe/trunk/test/Modules/merge-static-locals.cpp Modified: cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/lib/Serialization/ASTCommon.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=336021=336020=336021=diff == --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Jun 29 14:58:50 2018 @@ -546,7 +546,7 @@ private: /// Mergeable declaration contexts that have anonymous declarations /// within them, and those anonymous declarations. - llvm::DenseMap> + llvm::DenseMap> AnonymousDeclarationsForMerging; struct FileDeclsInfo { Modified: cfe/trunk/lib/Serialization/ASTCommon.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTCommon.cpp?rev=336021=336020=336021=diff == --- cfe/trunk/lib/Serialization/ASTCommon.cpp (original) +++ cfe/trunk/lib/Serialization/ASTCommon.cpp Fri Jun 29 14:58:50 2018 @@ -419,9 +419,21 @@ bool serialization::needsAnonymousDeclar return true; } - // Otherwise, we only care about anonymous class members. + // At block scope, we number everything that we need to deduplicate, since we + // can't just use name matching to keep things lined up. + // FIXME: This is only necessary for an inline function or a template or + // similar. + if (D->getLexicalDeclContext()->isFunctionOrMethod()) { +if (auto *VD = dyn_cast(D)) + return VD->isStaticLocal(); +// FIXME: What about CapturedDecls (and declarations nested within them)? +return isa(D) || isa(D); + } + + // Otherwise, we only care about anonymous class members / block-scope decls. + // FIXME: We need to handle lambdas and blocks within inline / templated + // variables too. if (D->getDeclName() || !isa(D->getLexicalDeclContext())) return false; return isa(D) || isa(D); } - Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=336021=336020=336021=diff == --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Jun 29 14:58:50 2018 @@ -87,7 +87,7 @@ namespace clang { using RecordData = ASTReader::RecordData; -TypeID TypeIDForTypeDecl = 0; +TypeID DeferredTypeID = 0; unsigned AnonymousDeclNumber; GlobalDeclID NamedDeclForTagDecl = 0; IdentifierInfo *TypedefNameForLinkage = nullptr; @@ -177,6 +177,8 @@ namespace clang { void MergeDefinitionData(ObjCProtocolDecl *D, struct ObjCProtocolDecl::DefinitionData &); +static DeclContext *getPrimaryDCForAnonymousDecl(DeclContext *LexicalDC); + static NamedDecl *getAnonymousDeclForMerging(ASTReader , DeclContext *DC, unsigned Index); @@ -528,7 +530,7 @@ void ASTDeclReader::Visit(Decl *D) { if (auto *TD = dyn_cast(D)) { // We have a fully initialized TypeDecl. Read its type now. -TD->setTypeForDecl(Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull()); +TD->setTypeForDecl(Reader.GetType(DeferredTypeID).getTypePtrOrNull()); // If this is a tag declaration with a typedef name for linkage, it's safe // to load that typedef now. @@ -537,8 +539,11 @@ void ASTDeclReader::Visit(Decl *D) { cast(Reader.GetDecl(NamedDeclForTagDecl)); } else if (auto *ID =
r336020 - Spurious commit just to help Richard, because git is weird.
Author: dblaikie Date: Fri Jun 29 14:58:24 2018 New Revision: 336020 URL: http://llvm.org/viewvc/llvm-project?rev=336020=rev Log: Spurious commit just to help Richard, because git is weird. Modified: cfe/trunk/test/Modules/codegen.test Modified: cfe/trunk/test/Modules/codegen.test URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/codegen.test?rev=336020=336019=336020=diff == --- cfe/trunk/test/Modules/codegen.test (original) +++ cfe/trunk/test/Modules/codegen.test Fri Jun 29 14:58:24 2018 @@ -6,6 +6,7 @@ RUN: %clang_cc1 -triple=x86_64-linux-gnu RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - %t/foo.pcm | FileCheck --check-prefix=FOO --check-prefix=BOTH %s RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -fmodules -disable-llvm-passes -fmodule-file=%t/foo.pcm %S/Inputs/codegen/use.cpp | FileCheck --check-prefix=BOTH --check-prefix=USE %s + For want of any better definition, inline asm goes "everywhere" the same as it if it were in a header (with the disadvantage that the inline asm will be included in the program if the module is used, even if the header containing ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
This revision was automatically updated to reflect the committed changes. Closed by commit rCRT336019: [profile] Add llvm_gcov_flush to be called outside a shared library (authored by chh, committed by ). Herald added a subscriber: Sanitizers. Repository: rCRT Compiler Runtime https://reviews.llvm.org/D45454 Files: lib/profile/GCDAProfiling.c test/profile/Inputs/instrprof-dlopen-dlclose-main.c Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,12 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call for any linked .so file. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,12 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call for any linked .so file. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
davidxl accepted this revision. davidxl added a comment. This revision is now accepted and ready to land. lgtm https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh updated this revision to Diff 153576. chh marked an inline comment as done. https://reviews.llvm.org/D45454 Files: lib/profile/GCDAProfiling.c test/profile/Inputs/instrprof-dlopen-dlclose-main.c Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,12 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call for any linked .so file. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,12 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call for any linked .so file. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) {
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
srhines added a comment. LGTM. Thanks for making the checking more clear. This should help bridge the gap for now, so that we can resume getting per-library profile data in Android. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh added inline comments. Comment at: test/profile/Inputs/instrprof-dlopen-dlclose-main.c:20 + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); srhines wrote: > Should also clear dlerror() before this call and check that dlerror() > returned a non-NULL pointer indicating that this search failed. Look up of __gcov_flush is expected to fail because it's hidden. Other places checks for returned value and report dlerror() messages. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh updated this revision to Diff 153573. chh added a comment. check dlerror() where it shouldn't be NULL https://reviews.llvm.org/D45454 Files: lib/profile/GCDAProfiling.c test/profile/Inputs/instrprof-dlopen-dlclose-main.c Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that case, it dumps profile data of a .so file. +// If it is called directly inside a .so file, the unified copy of +// llvm_gcov_flush might dump data of other .so file or the main module. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL || dlerror() == NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that case, it
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
davidxl added inline comments. Comment at: lib/profile/GCDAProfiling.c:546 +// find and call. In that case, it dumps profile data of a .so file. +// If it is called directly inside a .so file, the unified copy of +// llvm_gcov_flush might dump data of other .so file or the main module. Just document this interface has non-hidden visibility and will resolve to a unified copy. The right underlying behavior is for it to dump profiles from all dynamic modules, but it is not there until Marco's patch is in. In other words, do not need to document the current behavior for now. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh updated this revision to Diff 153569. chh marked an inline comment as done. chh added a comment. Added calls to dlerror() before other dl* functions. https://reviews.llvm.org/D45454 Files: lib/profile/GCDAProfiling.c test/profile/Inputs/instrprof-dlopen-dlclose-main.c Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that case, it dumps profile data of a .so file. +// If it is called directly inside a .so file, the unified copy of +// llvm_gcov_flush might dump data of other .so file or the main module. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -10,12 +10,42 @@ return EXIT_FAILURE; } + dlerror(); void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL); if (f2_handle == NULL) { fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; } + dlerror(); + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + dlerror(); + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f1_flush(); + + dlerror(); + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared': %s\n", dlerror()); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + + dlerror(); if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that
r336016 - [modules] Emit the type of the TypeSourceInfo for a DeclaratorDecl (but
Author: rsmith Date: Fri Jun 29 13:46:25 2018 New Revision: 336016 URL: http://llvm.org/viewvc/llvm-project?rev=336016=rev Log: [modules] Emit the type of the TypeSourceInfo for a DeclaratorDecl (but not the corresponding location information) earlier. We need the type as written in order to properly merge functions with deduced return types, so we need to load that early. But we don't want to load the location information early, because that contains problematic things such as the function parameters. Modified: cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=336016=336015=336016=diff == --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Jun 29 13:46:25 2018 @@ -1771,6 +1771,10 @@ public: TypeSourceInfo *GetTypeSourceInfo(ModuleFile , const RecordData , unsigned ); + /// Raad the type locations for the given TInfo. + void ReadTypeLoc(ModuleFile , const RecordData , unsigned , + TypeLoc TL); + /// Resolve a type ID into a type, potentially building a new /// type. QualType GetType(serialization::TypeID ID); @@ -2460,6 +2464,11 @@ public: return Reader->GetTypeSourceInfo(*F, Record, Idx); } + /// Reads the location information for a type. + void readTypeLoc(TypeLoc TL) { +return Reader->ReadTypeLoc(*F, Record, Idx, TL); + } + /// Map a local type ID within a given AST file to a global type ID. serialization::TypeID getGlobalTypeID(unsigned LocalID) const { return Reader->getGlobalTypeID(*F, LocalID); Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=336016=336015=336016=diff == --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Jun 29 13:46:25 2018 @@ -886,7 +886,7 @@ public: /// Emits a reference to a declarator info. void AddTypeSourceInfo(TypeSourceInfo *TInfo); - /// Emits a type with source-location information. + /// Emits source location information for a type. Does not emit the type. void AddTypeLoc(TypeLoc TL); /// Emits a template argument location info. Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=336016=336015=336016=diff == --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Jun 29 13:46:25 2018 @@ -6733,6 +6733,13 @@ void TypeLocReader::VisitPipeTypeLoc(Pip TL.setKWLoc(ReadSourceLocation()); } +void ASTReader::ReadTypeLoc(ModuleFile , const ASTReader::RecordData , +unsigned , TypeLoc TL) { + TypeLocReader TLR(F, *this, Record, Idx); + for (; !TL.isNull(); TL = TL.getNextTypeLoc()) +TLR.Visit(TL); +} + TypeSourceInfo * ASTReader::GetTypeSourceInfo(ModuleFile , const ASTReader::RecordData , unsigned ) { @@ -6741,9 +6748,7 @@ ASTReader::GetTypeSourceInfo(ModuleFile return nullptr; TypeSourceInfo *TInfo = getContext().CreateTypeSourceInfo(InfoTy); - TypeLocReader TLR(F, *this, Record, Idx); - for (TypeLoc TL = TInfo->getTypeLoc(); !TL.isNull(); TL = TL.getNextTypeLoc()) -TLR.Visit(TL); + ReadTypeLoc(F, Record, Idx, TInfo->getTypeLoc()); return TInfo; } Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=336016=336015=336016=diff == --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Jun 29 13:46:25 2018 @@ -522,13 +522,8 @@ void ASTDeclReader::Visit(Decl *D) { IsDeclMarkedUsed = false; if (auto *DD = dyn_cast(D)) { -if (DD->DeclInfo) { - auto *Info = DD->DeclInfo.get(); - Info->TInfo = GetTypeSourceInfo(); -} -else { - DD->DeclInfo = GetTypeSourceInfo(); -} +if (auto *TInfo = DD->getTypeSourceInfo()) + Record.readTypeLoc(TInfo->getTypeLoc()); } if (auto *TD = dyn_cast(D)) { @@ -815,6 +810,10 @@ void ASTDeclReader::VisitDeclaratorDecl( ReadQualifierInfo(*Info);
Re: r335925 - PR37979: integral promotions in C++ treat enum bit-fields like enums,
Should be fixed in r336013. Thanks for pointing this out. On Fri, 29 Jun 2018 at 11:24, Galina Kistanova via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Hello Richard, > > This commit broke tests at one of our builders: > > http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10599 > > Failing Tests (1): > Clang :: CXX/conv/conv.prom/p5.cpp > > Please have a look? > > Thanks > > Galina > > On Thu, Jun 28, 2018 at 2:17 PM, Richard Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: rsmith >> Date: Thu Jun 28 14:17:55 2018 >> New Revision: 335925 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=335925=rev >> Log: >> PR37979: integral promotions in C++ treat enum bit-fields like enums, >> not like bit-fields. >> >> We used to get this right "by accident", because conversions for the >> selected built-in overloaded operator would convert the enum bit-field >> to its corresponding underlying type early. But after DR1687 that no >> longer happens. >> >> Technically this change should also apply to C, where bit-fields only >> have special promotion rules if the bit-field's declared type is >> _Bool, int, signed int, or unsigned int, but for GCC compatibility we >> only look at the bit-width and not the underlying type when performing >> bit-field integral promotions in C. >> >> Added: >> cfe/trunk/test/CXX/conv/conv.prom/p5.cpp >> Modified: >> cfe/trunk/lib/AST/ASTContext.cpp >> cfe/trunk/lib/Sema/SemaOverload.cpp >> >> Modified: cfe/trunk/lib/AST/ASTContext.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=335925=335924=335925=diff >> >> == >> --- cfe/trunk/lib/AST/ASTContext.cpp (original) >> +++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jun 28 14:17:55 2018 >> @@ -5456,6 +5456,12 @@ QualType ASTContext::isPromotableBitFiel >>if (E->isTypeDependent() || E->isValueDependent()) >> return {}; >> >> + // C++ [conv.prom]p5: >> + //If the bit-field has an enumerated type, it is treated as any >> other >> + //value of that type for promotion purposes. >> + if (getLangOpts().CPlusPlus && E->getType()->isEnumeralType()) >> +return {}; >> + >>// FIXME: We should not do this unless E->refersToBitField() is true. >> This >>// matters in C where getSourceBitField() will find bit-fields for >> various >>// cases where the source expression is not a bit-field designator. >> @@ -5482,13 +5488,15 @@ QualType ASTContext::isPromotableBitFiel >>// >>// FIXME: C does not permit promotion of a 'long : 3' bitfield to int. >>//We perform that promotion here to match GCC and C++. >> + // FIXME: C does not permit promotion of an enum bit-field whose rank >> is >> + //greater than that of 'int'. We perform that promotion to >> match GCC. >>if (BitWidth < IntSize) >> return IntTy; >> >>if (BitWidth == IntSize) >> return FT->isSignedIntegerType() ? IntTy : UnsignedIntTy; >> >> - // Types bigger than int are not subject to promotions, and therefore >> act >> + // Bit-fields wider than int are not subject to promotions, and >> therefore act >>// like the base type. GCC has some weird bugs in this area that we >>// deliberately do not follow (GCC follows a pre-standard resolution to >>// C's DR315 which treats bit-width as being part of the type, and >> this leaks >> >> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=335925=335924=335925=diff >> >> == >> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Jun 28 14:17:55 2018 >> @@ -2007,6 +2007,14 @@ bool Sema::IsIntegralPromotion(Expr *Fro >> isCompleteType(From->getLocStart(), FromType)) >>return Context.hasSameUnqualifiedType( >>ToType, FromEnumType->getDecl()->getPromotionType()); >> + >> +// C++ [conv.prom]p5: >> +// If the bit-field has an enumerated type, it is treated as any >> other >> +// value of that type for promotion purposes. >> +// >> +// ... so do not fall through into the bit-field checks below in C++. >> +if (getLangOpts().CPlusPlus) >> + return false; >>} >> >>// C++0x [conv.prom]p2: >> @@ -2054,6 +2062,11 @@ bool Sema::IsIntegralPromotion(Expr *Fro >>// other value of that type for promotion purposes (C++ 4.5p3). >>// FIXME: We should delay checking of bit-fields until we actually >> perform the >>// conversion. >> + // >> + // FIXME: In C, only bit-fields of types _Bool, int, or unsigned int >> may be >> + // promoted, per C11 6.3.1.1/2. We promote all bit-fields (including >> enum >> + // bit-fields and those whose underlying type is larger than int) for >> GCC >> + // compatibility. >>if (From) {
[PATCH] D48733: Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl dependency
This revision was automatically updated to reflect the committed changes. Closed by commit rL336014: Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly… (authored by rupprecht, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48733 Files: libunwind/trunk/src/AddressSpace.hpp Index: libunwind/trunk/src/AddressSpace.hpp === --- libunwind/trunk/src/AddressSpace.hpp +++ libunwind/trunk/src/AddressSpace.hpp @@ -18,7 +18,15 @@ #include #include -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#ifndef _LIBUNWIND_USE_DLADDR + #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#define _LIBUNWIND_USE_DLADDR 1 + #else +#define _LIBUNWIND_USE_DLADDR 0 + #endif +#endif + +#if _LIBUNWIND_USE_DLADDR #include #endif @@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, size_t bufLen, unw_word_t *offset) { -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#if _LIBUNWIND_USE_DLADDR Dl_info dyldInfo; if (dladdr((void *)addr, )) { if (dyldInfo.dli_sname != NULL) { Index: libunwind/trunk/src/AddressSpace.hpp === --- libunwind/trunk/src/AddressSpace.hpp +++ libunwind/trunk/src/AddressSpace.hpp @@ -18,7 +18,15 @@ #include #include -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#ifndef _LIBUNWIND_USE_DLADDR + #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#define _LIBUNWIND_USE_DLADDR 1 + #else +#define _LIBUNWIND_USE_DLADDR 0 + #endif +#endif + +#if _LIBUNWIND_USE_DLADDR #include #endif @@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, size_t bufLen, unw_word_t *offset) { -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#if _LIBUNWIND_USE_DLADDR Dl_info dyldInfo; if (dladdr((void *)addr, )) { if (dyldInfo.dli_sname != NULL) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r336014 - Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl depe
Author: rupprecht Date: Fri Jun 29 13:41:50 2018 New Revision: 336014 URL: http://llvm.org/viewvc/llvm-project?rev=336014=rev Log: Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl dependency. Reviewers: saugustine Subscribers: christof, chrib, cfe-commits, echristo Differential Revision: https://reviews.llvm.org/D48733 Modified: libunwind/trunk/src/AddressSpace.hpp Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=336014=336013=336014=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Fri Jun 29 13:41:50 2018 @@ -18,7 +18,15 @@ #include #include -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#ifndef _LIBUNWIND_USE_DLADDR + #if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#define _LIBUNWIND_USE_DLADDR 1 + #else +#define _LIBUNWIND_USE_DLADDR 0 + #endif +#endif + +#if _LIBUNWIND_USE_DLADDR #include #endif @@ -576,7 +584,7 @@ inline bool LocalAddressSpace::findOther inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, size_t bufLen, unw_word_t *offset) { -#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) +#if _LIBUNWIND_USE_DLADDR Dl_info dyldInfo; if (dladdr((void *)addr, )) { if (dyldInfo.dli_sname != NULL) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336013 - Specify an explicit underlying type for this enum to fix Windows
Author: rsmith Date: Fri Jun 29 13:41:23 2018 New Revision: 336013 URL: http://llvm.org/viewvc/llvm-project?rev=336013=rev Log: Specify an explicit underlying type for this enum to fix Windows buildbots. On Windows targets, enums always get an underlying type of 'int', even if they have wider enumerators. (This is non-conforming, but it's effectively part of the target ABI.) Modified: cfe/trunk/test/CXX/conv/conv.prom/p5.cpp Modified: cfe/trunk/test/CXX/conv/conv.prom/p5.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/conv/conv.prom/p5.cpp?rev=336013=336012=336013=diff == --- cfe/trunk/test/CXX/conv/conv.prom/p5.cpp (original) +++ cfe/trunk/test/CXX/conv/conv.prom/p5.cpp Fri Jun 29 13:41:23 2018 @@ -8,7 +8,7 @@ static_assert(sizeof(+X().e) == sizeof(i static_assert(sizeof(X().e + 1) == sizeof(int), ""); static_assert(sizeof(true ? X().e : 0) == sizeof(int), ""); -enum E { a = __LONG_LONG_MAX__ }; +enum E : long long { a = __LONG_LONG_MAX__ }; static_assert(sizeof(E{}) == sizeof(long long), ""); // If the bit-field has an enumerated type, it is treated as any other value of ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48616: Implement LWG 2946, 3075 and 3076
ldionne accepted this revision. ldionne added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D48616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r336012 - Revert "Revert "Support for multiarch runtimes layout""
Author: echristo Date: Fri Jun 29 13:27:40 2018 New Revision: 336012 URL: http://llvm.org/viewvc/llvm-project?rev=336012=rev Log: Revert "Revert "Support for multiarch runtimes layout"" This reverts commit r336005 that was accidentally committed. Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=336012=336011=336012=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Fri Jun 29 13:27:40 2018 @@ -170,7 +170,14 @@ set(CMAKE_MODULE_PATH set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER}) set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -if (LLVM_LIBRARY_OUTPUT_INTDIR) + +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) + +if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}) +elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) @@ -180,13 +187,9 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING +set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libunwind destination prefix.") -if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/") - message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".") -endif() - set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") set(LIBUNWIND_COMPILE_FLAGS "") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47846: [clangd] Implementation of textDocument/documentSymbol
malaperle added inline comments. Comment at: clangd/FindSymbols.cpp:181 +/// Finds document symbols in the main file of the AST. +class DocumentSymbolsConsumer : public index::IndexDataConsumer { + ASTContext sammccall wrote: > I guess the alternative here is to use SymbolCollector and then convert > Symbol->SymbolInformation (which we should already have for workspace/symbol). > > I also guess there's some divergence in behavior, which is why you went this > route :-) > Mostly in filtering? (I'd think that for e.g. printing, we'd want to be > consistent) > > Do you think it's worth adding enough customization to SymbolCollector to > make it usable here? Even if it was making `shouldFilterDecl` a > std::function, there'd be some value in unifying the rest. WDYT? I put a bit of the justification in the summary, perhaps you missed it or maybe did you think it was not enough of a justification? > An AST-based approach is used to retrieve the document symbols rather than an > in-memory index query. The index is not an ideal fit to achieve this because > of > the file-centric query being done here whereas the index is suited for > project-wide queries. Document symbols also includes more symbols and need to > keep the order as seen in the file. It's not a clear cut decision but I felt that there was more diverging parts than common and that it would be detrimental to SymbolCollector in terms of added complexity. Differences: - We need a different way to filter (as you suggested) - Don't need anything about completion - Don't need to distinguish declaration vs definition or canonical declaration - Don't need a map, we just need them in same order as they appear and SymbolCollector should be free to store them in whichever order for purposes of proving a project-wide collection of symbols - Don't want to track references - DocumentSymbols needs symbols in main files Common things: - Both need to generate Position/Uri from a SourceLocation. But they can both call sourceLocToPosition. - Both need to generate a symbol name from Decl&. But they can both call AST.h's printQualifiedName (I fixed this in a new version). - Both use/extend a IndexDataConsumer. Not worth sharing the same code path just to not have to create a class definition IMO. Let me know if that makes sense to you, otherwise I can try to make another version that uses SymbolCollector. Comment at: unittests/clangd/FindSymbolsTests.cpp:447 + EXPECT_THAT(getSymbols(FilePath), + ElementsAre(AllOf(QName("Tmpl"), WithKind(SymbolKind::Struct)), + AllOf(QName("Tmpl::x"), WithKind(SymbolKind::Field)), sammccall wrote: > in a perfect world, I think the template definitions might be printed > `Tmpl`, `Tmpl`. Not sure about `Tmpl::x` vs `Tmpl::x` though. WDYT? > > (Not necessarily worth doing this patch, keep it simple) I'm thinking `Tmpl`, `Tmpl`, so that we can more easily distinguish between a primary and specialization, especially in partial specializations and when the generic type might not be just a single letter. And `Tmpl::x`. Maybe this is too much :) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D47846 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48322: [Sema] Discarded statment should be an evaluatable context
rsmith added a comment. Hmm, so this will mean that we can have internal linkage declarations marked `Used` for which there is no definition, and we need to not warn on that. I think it might be better to avoid marking things used in this case (even though they're still technically odr-used). Repository: rC Clang https://reviews.llvm.org/D48322 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48322: [Sema] Discarded statment should be an evaluatable context
erik.pilkington added a comment. Herald added a subscriber: dexonsmith. Ping! Repository: rC Clang https://reviews.llvm.org/D48322 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48720: [clang-format] Put ObjC method arguments into one line when they fit
benhamilton accepted this revision. benhamilton added inline comments. This revision is now accepted and ready to land. Comment at: lib/Format/ContinuationIndenter.cpp:1411 + // line). + if (Current.MatchingParen && Current.MatchingParen->Previous) { +const FormatToken = *Current.MatchingParen->Previous; Should we check if `State.Stack.back().BreakBeforeParameter` is `true` before doing any of this? Repository: rC Clang https://reviews.llvm.org/D48720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48787: Un-revert "Support for multiarch runtimes layout"This reverts https://reviews.llvm.org/rL336005, which was an accidental commit.
rupprecht created this revision. Herald added subscribers: cfe-commits, christof, mgorny. Repository: rUNW libunwind https://reviews.llvm.org/D48787 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -170,7 +170,14 @@ set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER}) set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -if (LLVM_LIBRARY_OUTPUT_INTDIR) + +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) + +if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}) +elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) @@ -180,13 +187,9 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING +set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libunwind destination prefix.") -if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/") - message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".") -endif() - set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") set(LIBUNWIND_COMPILE_FLAGS "") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -170,7 +170,14 @@ set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER}) set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -if (LLVM_LIBRARY_OUTPUT_INTDIR) + +string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION + ${PACKAGE_VERSION}) + +if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) + set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}) +elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) @@ -180,13 +187,9 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING +set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING "Define libunwind destination prefix.") -if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/") - message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".") -endif() - set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") set(LIBUNWIND_COMPILE_FLAGS "") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
marco-c added a comment. OK! Sounds good to me to keep it hidden until https://reviews.llvm.org/D48538 is done (I'm going to try to finish it soon). Il 29/06/2018 19:34, David Li via Phabricator ha scritto: > davidxl added a comment. > > With the current gcov_flush implementation in LLVM, making gcov_flush's > visibility to be default will simply lead to wrong behavior. GCC libgcov's > implementation is more elaborate -- it allows gcov_flush to dump gcda data > for all dynamic objects while making sure gcov_exit only dumps the gcda files > from the same dynamic module (otherwise, there will be wrong profile > merging). This is done via two levels of linked list. > > The patch https://reviews.llvm.org/D48538 is in the right direction, but not > complete yet. > > https://reviews.llvm.org/D45454 https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
OK! Sounds good to me to keep it hidden until https://reviews.llvm.org/D48538 is done (I'm going to try to finish it soon). Il 29/06/2018 19:34, David Li via Phabricator ha scritto: > davidxl added a comment. > > With the current gcov_flush implementation in LLVM, making gcov_flush's > visibility to be default will simply lead to wrong behavior. GCC libgcov's > implementation is more elaborate -- it allows gcov_flush to dump gcda data > for all dynamic objects while making sure gcov_exit only dumps the gcda files > from the same dynamic module (otherwise, there will be wrong profile > merging). This is done via two levels of linked list. > > The patch https://reviews.llvm.org/D48538 is in the right direction, but not > complete yet. > > > https://reviews.llvm.org/D45454 > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48719: [clang-format] Fix split priorities for ObjC methods
benhamilton accepted this revision. benhamilton added a comment. This revision is now accepted and ready to land. Nice improvement! Repository: rC Clang https://reviews.llvm.org/D48719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336008 - Request init/fini array on FreeBSD 12 and later
Author: dim Date: Fri Jun 29 12:18:17 2018 New Revision: 336008 URL: http://llvm.org/viewvc/llvm-project?rev=336008=rev Log: Request init/fini array on FreeBSD 12 and later Summary: It seems a bad idea to change the default in the middle of a release branch due to possible changes in global ctor / dtor ordering between .ctors and .init_array. With FreeBSD 11.0's release imminent lets change the default now for FreeBSD 12 (the current development stream) and later. FreeBSD rtld has supported .init_array / .fini_array for many years. As of Jan 1 2017 all supported FreeBSD releases and branches will have support. Reviewers: dim, brooks, arichardson Reviewed By: dim, brooks, arichardson Subscribers: bsdjhb, krytarowski, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D24867 Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/constructors.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=336008=336007=336008=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Fri Jun 29 12:18:17 2018 @@ -2543,6 +2543,8 @@ void Generic_ELF::addClangTargetOptions( bool UseInitArrayDefault = getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || + (getTriple().getOS() == llvm::Triple::FreeBSD && + getTriple().getOSMajorVersion() >= 12) || (getTriple().getOS() == llvm::Triple::Linux && ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || getTriple().isAndroid())) || Modified: cfe/trunk/test/Driver/constructors.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/constructors.c?rev=336008=336007=336008=diff == --- cfe/trunk/test/Driver/constructors.c (original) +++ cfe/trunk/test/Driver/constructors.c Fri Jun 29 12:18:17 2018 @@ -80,6 +80,14 @@ // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target arm64-none-none-eabi \ // RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd11 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd12 \ +// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s // // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1\ // RUN: -target sparc-sun-solaris2.11 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24867: Request init/fini array on FreeBSD 12 and later
This revision was automatically updated to reflect the committed changes. Closed by commit rL336008: Request init/fini array on FreeBSD 12 and later (authored by dim, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D24867?vs=72282=153554#toc Repository: rL LLVM https://reviews.llvm.org/D24867 Files: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/constructors.c Index: cfe/trunk/test/Driver/constructors.c === --- cfe/trunk/test/Driver/constructors.c +++ cfe/trunk/test/Driver/constructors.c @@ -80,6 +80,14 @@ // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target arm64-none-none-eabi \ // RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd11 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd12 \ +// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s // // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1\ // RUN: -target sparc-sun-solaris2.11 \ Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp === --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp @@ -2543,6 +2543,8 @@ bool UseInitArrayDefault = getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || + (getTriple().getOS() == llvm::Triple::FreeBSD && + getTriple().getOSMajorVersion() >= 12) || (getTriple().getOS() == llvm::Triple::Linux && ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || getTriple().isAndroid())) || Index: cfe/trunk/test/Driver/constructors.c === --- cfe/trunk/test/Driver/constructors.c +++ cfe/trunk/test/Driver/constructors.c @@ -80,6 +80,14 @@ // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target arm64-none-none-eabi \ // RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd11 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-INIT-ARRAY %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-freebsd12 \ +// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s // // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1\ // RUN: -target sparc-sun-solaris2.11 \ Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp === --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp @@ -2543,6 +2543,8 @@ bool UseInitArrayDefault = getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || + (getTriple().getOS() == llvm::Triple::FreeBSD && + getTriple().getOSMajorVersion() >= 12) || (getTriple().getOS() == llvm::Triple::Linux && ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || getTriple().isAndroid())) || ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48786: [Preprocessor] Stop entering included files after hitting a fatal error.
vsapsai created this revision. vsapsai added reviewers: bruno, rsmith. Herald added a subscriber: dexonsmith. Fixes a problem when we have multiple inclusion cycles and try to enumerate all possible ways to reach the max inclusion depth. rdar://problem/38871876 https://reviews.llvm.org/D48786 Files: clang/lib/Lex/PPDirectives.cpp clang/test/Preprocessor/Inputs/cycle/a.h clang/test/Preprocessor/Inputs/cycle/b.h clang/test/Preprocessor/Inputs/cycle/c.h clang/test/Preprocessor/include-cycle.c Index: clang/test/Preprocessor/include-cycle.c === --- /dev/null +++ clang/test/Preprocessor/include-cycle.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 -E -I%S/Inputs -ferror-limit 20 %s + +// Test that preprocessing terminates even if we have inclusion cycles. + +#include "cycle/a.h" Index: clang/test/Preprocessor/Inputs/cycle/c.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/c.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/b.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/b.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/a.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/a.h @@ -0,0 +1,8 @@ +// Presence of 2 inclusion cycles +//b.h -> a.h -> b.h -> ... +//c.h -> a.h -> c.h -> ... +// makes it unfeasible to reach max inclusion depth in all possible ways. Need +// to stop earlier. + +#include "b.h" +#include "c.h" Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -1871,6 +1871,11 @@ if (PPOpts->SingleFileParseMode) ShouldEnter = false; + // Stop further preprocessing if a fatal error has occurred. Any diagnostics + // we might have raised will not be visible. + if (ShouldEnter && Diags->hasFatalErrorOccurred()) +ShouldEnter = false; + // Determine whether we should try to import the module for this #include, if // there is one. Don't do so if precompiled module support is disabled or we // are processing this module textually (because we're building the module). Index: clang/test/Preprocessor/include-cycle.c === --- /dev/null +++ clang/test/Preprocessor/include-cycle.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 -E -I%S/Inputs -ferror-limit 20 %s + +// Test that preprocessing terminates even if we have inclusion cycles. + +#include "cycle/a.h" Index: clang/test/Preprocessor/Inputs/cycle/c.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/c.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/b.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/b.h @@ -0,0 +1 @@ +#include "a.h" Index: clang/test/Preprocessor/Inputs/cycle/a.h === --- /dev/null +++ clang/test/Preprocessor/Inputs/cycle/a.h @@ -0,0 +1,8 @@ +// Presence of 2 inclusion cycles +//b.h -> a.h -> b.h -> ... +//c.h -> a.h -> c.h -> ... +// makes it unfeasible to reach max inclusion depth in all possible ways. Need +// to stop earlier. + +#include "b.h" +#include "c.h" Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/lib/Lex/PPDirectives.cpp @@ -1871,6 +1871,11 @@ if (PPOpts->SingleFileParseMode) ShouldEnter = false; + // Stop further preprocessing if a fatal error has occurred. Any diagnostics + // we might have raised will not be visible. + if (ShouldEnter && Diags->hasFatalErrorOccurred()) +ShouldEnter = false; + // Determine whether we should try to import the module for this #include, if // there is one. Don't do so if precompiled module support is disabled or we // are processing this module textually (because we're building the module). ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48785: Add a blank line to docs/README.txt test commit access
This revision was automatically updated to reflect the committed changes. Closed by commit rL336006: Add a blank line to docs/README.txt test commit access (authored by rupprecht, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48785 Files: libunwind/trunk/docs/README.txt Index: libunwind/trunk/docs/README.txt === --- libunwind/trunk/docs/README.txt +++ libunwind/trunk/docs/README.txt @@ -11,3 +11,4 @@ After configuring libunwind with these options the make rule `docs-libunwind-html` should be available. + Index: libunwind/trunk/docs/README.txt === --- libunwind/trunk/docs/README.txt +++ libunwind/trunk/docs/README.txt @@ -11,3 +11,4 @@ After configuring libunwind with these options the make rule `docs-libunwind-html` should be available. + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r336006 - Add a blank line to docs/README.txt test commit access
Author: rupprecht Date: Fri Jun 29 12:05:21 2018 New Revision: 336006 URL: http://llvm.org/viewvc/llvm-project?rev=336006=rev Log: Add a blank line to docs/README.txt test commit access Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D48785 Modified: libunwind/trunk/docs/README.txt Modified: libunwind/trunk/docs/README.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/README.txt?rev=336006=336005=336006=diff == --- libunwind/trunk/docs/README.txt (original) +++ libunwind/trunk/docs/README.txt Fri Jun 29 12:05:21 2018 @@ -11,3 +11,4 @@ To build the documents into html configu After configuring libunwind with these options the make rule `docs-libunwind-html` should be available. + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r336005 - Revert "Support for multiarch runtimes layout"
Author: rupprecht Date: Fri Jun 29 12:05:20 2018 New Revision: 336005 URL: http://llvm.org/viewvc/llvm-project?rev=336005=rev Log: Revert "Support for multiarch runtimes layout" This reverts commit 0c7cea3c0c6338b99e30c13201365a3dd4edc6f4. Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=336005=336004=336005=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Fri Jun 29 12:05:20 2018 @@ -170,14 +170,7 @@ set(CMAKE_MODULE_PATH set(LIBUNWIND_COMPILER${CMAKE_CXX_COMPILER}) set(LIBUNWIND_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - -string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION - ${PACKAGE_VERSION}) - -if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/) - set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}) -elseif(LLVM_LIBRARY_OUTPUT_INTDIR) +if (LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) else() set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) @@ -187,9 +180,13 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR}) -set(LIBUNWIND_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING +set(LIBUNWIND_INSTALL_PREFIX "" CACHE STRING "Define libunwind destination prefix.") +if (NOT LIBUNWIND_INSTALL_PREFIX MATCHES "^$|.*/") + message(FATAL_ERROR "LIBUNWIND_INSTALL_PREFIX has to end with \"/\".") +endif() + set(LIBUNWIND_C_FLAGS "") set(LIBUNWIND_CXX_FLAGS "") set(LIBUNWIND_COMPILE_FLAGS "") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336004 - [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.
Author: brad Date: Fri Jun 29 12:03:03 2018 New Revision: 336004 URL: http://llvm.org/viewvc/llvm-project?rev=336004=rev Log: [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el. Reviewers: atanasyan Differential Revision: https://reviews.llvm.org/D48515 Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/freebsd.c cfe/trunk/test/Driver/openbsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=336004=336003=336004=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Fri Jun 29 12:03:03 2018 @@ -2412,11 +2412,13 @@ bool Generic_GCC::IsIntegratedAssemblerD return true; case llvm::Triple::mips64: case llvm::Triple::mips64el: -// Enabled for Debian and Android mips64/mipsel, as they can precisely -// identify the ABI in use (Debian) or only use N64 for MIPS64 (Android). -// Other targets are unable to distinguish N32 from N64. +// Enabled for Debian, Android, FreeBSD and OpenBSD mips64/mipsel, as they +// can precisely identify the ABI in use (Debian) or only use N64 for MIPS64 +// (Android). Other targets are unable to distinguish N32 from N64. if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 || -getTriple().isAndroid()) +getTriple().isAndroid() || +getTriple().isOSFreeBSD() || +getTriple().isOSOpenBSD()) return true; return false; default: Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=336004=336003=336004=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Fri Jun 29 12:03:03 2018 @@ -183,3 +183,10 @@ // RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" + +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" Modified: cfe/trunk/test/Driver/openbsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=336004=336003=336004=diff == --- cfe/trunk/test/Driver/openbsd.c (original) +++ cfe/trunk/test/Driver/openbsd.c Fri Jun 29 12:03:03 2018 @@ -74,6 +74,13 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" + // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48515: [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.
This revision was automatically updated to reflect the committed changes. Closed by commit rC336004: [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el. (authored by brad, committed by ). Changed prior to commit: https://reviews.llvm.org/D48515?vs=152580=153550#toc Repository: rC Clang https://reviews.llvm.org/D48515 Files: lib/Driver/ToolChains/Gnu.cpp test/Driver/freebsd.c test/Driver/openbsd.c Index: lib/Driver/ToolChains/Gnu.cpp === --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -2412,11 +2412,13 @@ return true; case llvm::Triple::mips64: case llvm::Triple::mips64el: -// Enabled for Debian and Android mips64/mipsel, as they can precisely -// identify the ABI in use (Debian) or only use N64 for MIPS64 (Android). -// Other targets are unable to distinguish N32 from N64. +// Enabled for Debian, Android, FreeBSD and OpenBSD mips64/mipsel, as they +// can precisely identify the ABI in use (Debian) or only use N64 for MIPS64 +// (Android). Other targets are unable to distinguish N32 from N64. if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 || -getTriple().isAndroid()) +getTriple().isAndroid() || +getTriple().isOSFreeBSD() || +getTriple().isOSOpenBSD()) return true; return false; default: Index: test/Driver/openbsd.c === --- test/Driver/openbsd.c +++ test/Driver/openbsd.c @@ -74,6 +74,13 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" + // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s Index: test/Driver/freebsd.c === --- test/Driver/freebsd.c +++ test/Driver/freebsd.c @@ -183,3 +183,10 @@ // RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-MIPS64-CPU %s // CHECK-MIPS64-CPU: "-target-cpu" "mips3" + +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-freebsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" Index: lib/Driver/ToolChains/Gnu.cpp === --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -2412,11 +2412,13 @@ return true; case llvm::Triple::mips64: case llvm::Triple::mips64el: -// Enabled for Debian and Android mips64/mipsel, as they can precisely -// identify the ABI in use (Debian) or only use N64 for MIPS64 (Android). -// Other targets are unable to distinguish N32 from N64. +// Enabled for Debian, Android, FreeBSD and OpenBSD mips64/mipsel, as they +// can precisely identify the ABI in use (Debian) or only use N64 for MIPS64 +// (Android). Other targets are unable to distinguish N32 from N64. if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 || -getTriple().isAndroid()) +getTriple().isAndroid() || +getTriple().isOSFreeBSD() || +getTriple().isOSOpenBSD()) return true; return false; default: Index: test/Driver/openbsd.c === --- test/Driver/openbsd.c +++ test/Driver/openbsd.c @@ -74,6 +74,13 @@ // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC" +// Check that the integrated assembler is enabled for MIPS64 +// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-MIPS64-AS %s +// CHECK-MIPS64-AS-NOT: "-no-integrated-as" + // Check linking against correct startup code when (not) using PIE // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PIE %s Index: test/Driver/freebsd.c === --- test/Driver/freebsd.c +++ test/Driver/freebsd.c @@ -183,3 +183,10 @@ // RUN: %clang -target mips64el-unknown-freebsd -### -c
[PATCH] D48785: Add a blank line to docs/README.txt test commit access
rupprecht created this revision. Herald added subscribers: cfe-commits, christof. Repository: rUNW libunwind https://reviews.llvm.org/D48785 Files: docs/README.txt Index: docs/README.txt === --- docs/README.txt +++ docs/README.txt @@ -11,3 +11,4 @@ After configuring libunwind with these options the make rule `docs-libunwind-html` should be available. + Index: docs/README.txt === --- docs/README.txt +++ docs/README.txt @@ -11,3 +11,4 @@ After configuring libunwind with these options the make rule `docs-libunwind-html` should be available. + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48412: [RISCV] Add support for interrupt attribute
aaron.ballman added inline comments. Comment at: lib/Sema/SemaDeclAttr.cpp:5305 + + if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 0; apazos wrote: > aaron.ballman wrote: > > I would have assumed this would be: `!hasFunctionProto(D) || > > getFunctionOrMethodNumParams(D) != 0`, but it depends on whether you want > > to support K C functions. > hasFunctionProto also returns true for a function definition like this one > __attribute__((interrupt)) void foo1(int) {}. That's correct, which is why I recommended the predicate the way I did. If the function has no prototype, we want to diagnose it. If the function has a prototype, we want to see how many parameters are listed and if there are more than zero parameters, we want to diagnose it. Comment at: test/Sema/riscv-interrupt-attr.c:23 + // expected-note {{repeated RISC-V 'interrupt' attribute is here}} +__attribute__((interrupt("user"))) void foo8() {} +__attribute__((interrupt("supervisor"))) void foo9() {} apazos wrote: > aaron.ballman wrote: > > aaron.ballman wrote: > > > Do you intend for functions without a prototype to be accepted? foo8() > > > can be passed an arbitrary number of arguments, which is a bit different > > > than what I thought you wanted the semantic check to be. > > This question remains outstanding. > The checks are validating both function definitions and function prototypes > like these: > _attribute__((interrupt)) void foo1() {} > __attribute__((interrupt)) void foo(void); > Not sure what the confusion is. Ah, now I see where the confusion is. In C, an empty parameter list declares a function without a prototype; functions without prototypes can accept any number of arguments. To declare a function that accepts no arguments, you must have a prototype for the function and the parameter list is void. In C++, all functions are prototyped and an empty parameter list is equivalent to a parameter list of void. The word "prototype" doesn't mean "forward declaration". e.g., ``` // C code void foo1(); // Declaration; no prototype; accepts any number of arguments. void foo2() {} // Definition; no prototype; accepts any number of arguments. void foo3(void); // Declaration; prototype; accepts no arguments. void foo4(void) {} // Definition; prototype; accepts no arguments. foo2(1, 2, 3); // ok foo4(1, 2, 3); // error ``` Because a function without a prototype can accept any number of arguments, I think you want to diagnose such a function signature. https://reviews.llvm.org/D48412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
arphaman accepted this revision. arphaman added a comment. This revision is now accepted and ready to land. Thanks for explaining! LGTM Repository: rC Clang https://reviews.llvm.org/D47297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh added a comment. Marco, latest patch does not change __gcov_flush, which is also hidden in libgcov. Android coverage test programs have depended on an earlier compiler-rt that did not hide __gcov_flush. If that's the only use case broken by recent change of compiler-rt, which hide __gcov_flush, I think it is okay to keep compiler-rt the same as it is now. Adding a visible llvm_gcov_flush will allow Android coverage test program to use it and dump system .so profiling data, from the main test program. Keeping an hidden __gcov_flush has the purpose that David mentioned earlier, to let each .so file dump its own profiling data. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
bruno added inline comments. Comment at: lib/Sema/SemaDeclObjC.cpp:1208 +// serialize something meaningful. +if (getLangOpts().Modules) + PushOnScopeChains(PDecl, TUScope); arphaman wrote: > Is this a problem only for modules or does this show up in PCHs too? What > would be the cost of using PushOnScopeChains unconditionally? > Is this a problem only for modules or does this show up in PCHs too? It only shows up in PCHs if Modules are being used, otherwise works as expected, because we don't have to serialize a different module which contains the dup, we just ignore it. > What would be the cost of using PushOnScopeChains unconditionally? I'm afraid that without the modules visibility rules, adding it unconditionally will make it available for name lookup, which we don't want here. Repository: rC Clang https://reviews.llvm.org/D47297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
dblaikie added a subscriber: paulsemel. dblaikie added a comment. Yeah, doesn't look like this code handles a value crossing the boundary of the size of the bitfield type (it's reading only the low bit). I suspect looking at the code that generates bitfield accesses would be useful - and/or maybe actually calling into that very code, rather than reimplementing it here? CodeGenFunction::EmitLoadOfBitfieldLValue seems to be the place to go (I found this by writing a short example that loads one of these strided bitfield values & then breaking in llvm::BinaryOperator::BinaryOperator until I found the 'and' operation, since that seemed like the more interesting one). Repository: rC Clang https://reviews.llvm.org/D47953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
Yeah, doesn't look like this code handles a value crossing the boundary of the size of the bitfield type (it's reading only the low bit). I suspect looking at the code that generates bitfield accesses would be useful - and/or maybe actually calling into that very code, rather than reimplementing it here? CodeGenFunction::EmitLoadOfBitfieldLValue seems to be the place to go (I found this by writing a short example that loads one of these strided bitfield values & then breaking in llvm::BinaryOperator::BinaryOperator until I found the 'and' operation, since that seemed like the more interesting one). On Fri, Jun 29, 2018 at 9:47 AM Paul Semel via Phabricator < revi...@reviews.llvm.org> wrote: > paulsemel added a comment. > > In https://reviews.llvm.org/D47953#1143044, @dblaikie wrote: > > > This doesn't seem to build for me - so hard to debug/probe it: > > > > llvm/src/tools/clang/lib/CodeGen/CGBuiltin.cpp:1264:65: error: no viable > conversion from 'clang::QualType' to 'llvm::Type *' > > > > CGF.CGM.getDataLayout().getTypeSizeInBits(CanonicalType), > > ^ > > > > llvm/src/include/llvm/IR/DataLayout.h:560:53: note: passing argument to > parameter 'Ty' here > > inline uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const { > > > > ^ > > > > 1 error generated. > > > Very sorry about it, I should have paid more attention.. > > > Repository: > rC Clang > > https://reviews.llvm.org/D47953 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
davidxl added a comment. With the current gcov_flush implementation in LLVM, making gcov_flush's visibility to be default will simply lead to wrong behavior. GCC libgcov's implementation is more elaborate -- it allows gcov_flush to dump gcda data for all dynamic objects while making sure gcov_exit only dumps the gcda files from the same dynamic module (otherwise, there will be wrong profile merging). This is done via two levels of linked list. The patch https://reviews.llvm.org/D48538 is in the right direction, but not complete yet. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r335925 - PR37979: integral promotions in C++ treat enum bit-fields like enums,
Hello Richard, This commit broke tests at one of our builders: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10599 Failing Tests (1): Clang :: CXX/conv/conv.prom/p5.cpp Please have a look? Thanks Galina On Thu, Jun 28, 2018 at 2:17 PM, Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Thu Jun 28 14:17:55 2018 > New Revision: 335925 > > URL: http://llvm.org/viewvc/llvm-project?rev=335925=rev > Log: > PR37979: integral promotions in C++ treat enum bit-fields like enums, > not like bit-fields. > > We used to get this right "by accident", because conversions for the > selected built-in overloaded operator would convert the enum bit-field > to its corresponding underlying type early. But after DR1687 that no > longer happens. > > Technically this change should also apply to C, where bit-fields only > have special promotion rules if the bit-field's declared type is > _Bool, int, signed int, or unsigned int, but for GCC compatibility we > only look at the bit-width and not the underlying type when performing > bit-field integral promotions in C. > > Added: > cfe/trunk/test/CXX/conv/conv.prom/p5.cpp > Modified: > cfe/trunk/lib/AST/ASTContext.cpp > cfe/trunk/lib/Sema/SemaOverload.cpp > > Modified: cfe/trunk/lib/AST/ASTContext.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ > ASTContext.cpp?rev=335925=335924=335925=diff > > == > --- cfe/trunk/lib/AST/ASTContext.cpp (original) > +++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jun 28 14:17:55 2018 > @@ -5456,6 +5456,12 @@ QualType ASTContext::isPromotableBitFiel >if (E->isTypeDependent() || E->isValueDependent()) > return {}; > > + // C++ [conv.prom]p5: > + //If the bit-field has an enumerated type, it is treated as any > other > + //value of that type for promotion purposes. > + if (getLangOpts().CPlusPlus && E->getType()->isEnumeralType()) > +return {}; > + >// FIXME: We should not do this unless E->refersToBitField() is true. > This >// matters in C where getSourceBitField() will find bit-fields for > various >// cases where the source expression is not a bit-field designator. > @@ -5482,13 +5488,15 @@ QualType ASTContext::isPromotableBitFiel >// >// FIXME: C does not permit promotion of a 'long : 3' bitfield to int. >//We perform that promotion here to match GCC and C++. > + // FIXME: C does not permit promotion of an enum bit-field whose rank is > + //greater than that of 'int'. We perform that promotion to > match GCC. >if (BitWidth < IntSize) > return IntTy; > >if (BitWidth == IntSize) > return FT->isSignedIntegerType() ? IntTy : UnsignedIntTy; > > - // Types bigger than int are not subject to promotions, and therefore > act > + // Bit-fields wider than int are not subject to promotions, and > therefore act >// like the base type. GCC has some weird bugs in this area that we >// deliberately do not follow (GCC follows a pre-standard resolution to >// C's DR315 which treats bit-width as being part of the type, and this > leaks > > Modified: cfe/trunk/lib/Sema/SemaOverload.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ > SemaOverload.cpp?rev=335925=335924=335925=diff > > == > --- cfe/trunk/lib/Sema/SemaOverload.cpp (original) > +++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Jun 28 14:17:55 2018 > @@ -2007,6 +2007,14 @@ bool Sema::IsIntegralPromotion(Expr *Fro > isCompleteType(From->getLocStart(), FromType)) >return Context.hasSameUnqualifiedType( >ToType, FromEnumType->getDecl()->getPromotionType()); > + > +// C++ [conv.prom]p5: > +// If the bit-field has an enumerated type, it is treated as any > other > +// value of that type for promotion purposes. > +// > +// ... so do not fall through into the bit-field checks below in C++. > +if (getLangOpts().CPlusPlus) > + return false; >} > >// C++0x [conv.prom]p2: > @@ -2054,6 +2062,11 @@ bool Sema::IsIntegralPromotion(Expr *Fro >// other value of that type for promotion purposes (C++ 4.5p3). >// FIXME: We should delay checking of bit-fields until we actually > perform the >// conversion. > + // > + // FIXME: In C, only bit-fields of types _Bool, int, or unsigned int > may be > + // promoted, per C11 6.3.1.1/2. We promote all bit-fields (including > enum > + // bit-fields and those whose underlying type is larger than int) for > GCC > + // compatibility. >if (From) { > if (FieldDecl *MemberDecl = From->getSourceBitField()) { >llvm::APSInt BitWidth; > > Added: cfe/trunk/test/CXX/conv/conv.prom/p5.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/ > conv/conv.prom/p5.cpp?rev=335925=auto >
[PATCH] D48565: [analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a function to merge ConstraintSets
This revision was automatically updated to reflect the committed changes. Closed by commit rC336002: [analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a… (authored by mramalho, committed by ). Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D48565 Files: include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Index: include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h === --- include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h +++ include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h @@ -336,18 +336,20 @@ class FalsePositiveRefutationBRVisitor final : public BugReporterVisitor { private: /// Holds the constraints in a given path - // TODO: should we use a set? - llvm::SmallVector Constraints; + ConstraintRangeTy Constraints; public: - FalsePositiveRefutationBRVisitor() = default; + FalsePositiveRefutationBRVisitor(); void Profile(llvm::FoldingSetNodeID ) const override; std::shared_ptr VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext , BugReport ) override; + + void finalizeVisitor(BugReporterContext , const ExplodedNode *EndPathNode, + BugReport ) override; }; namespace bugreporter { Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp === --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -2349,39 +2349,55 @@ return std::make_shared(L, "Taint originated here"); } -static bool -areConstraintsUnfeasible(BugReporterContext , - const llvm::SmallVector ) { +static bool areConstraintsUnfeasible(BugReporterContext , + const ConstraintRangeTy ) { // Create a refutation manager std::unique_ptr RefutationMgr = CreateZ3ConstraintManager( BRC.getStateManager(), BRC.getStateManager().getOwningEngine()); SMTConstraintManager *SMTRefutationMgr = static_cast(RefutationMgr.get()); // Add constraints to the solver - for (const auto : Cs) -SMTRefutationMgr->addRangeConstraints(C); + SMTRefutationMgr->addRangeConstraints(Cs); // And check for satisfiability return SMTRefutationMgr->isModelFeasible().isConstrainedFalse(); } +static void addNewConstraints(ConstraintRangeTy , + const ConstraintRangeTy , + ConstraintRangeTy::Factory ) { + // Add constraints if we don't have them yet + for (auto const : NewCs) { +const SymbolRef = C.first; +if (!Cs.contains(Sym)) { + Cs = CF.add(Cs, Sym, C.second); +} + } +} + +FalsePositiveRefutationBRVisitor::FalsePositiveRefutationBRVisitor() +: Constraints(ConstraintRangeTy::Factory().getEmptyMap()) {} + +void FalsePositiveRefutationBRVisitor::finalizeVisitor( +BugReporterContext , const ExplodedNode *EndPathNode, BugReport ) { + // Collect new constraints + VisitNode(EndPathNode, nullptr, BRC, BR); + + // Create a new refutation manager and check feasibility + if (areConstraintsUnfeasible(BRC, Constraints)) +BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext()); +} + std::shared_ptr FalsePositiveRefutationBRVisitor::VisitNode(const ExplodedNode *N, const ExplodedNode *PrevN, BugReporterContext , BugReport ) { - // Collect the constraint for the current state - const ConstraintRangeTy = N->getState()->get(); - Constraints.push_back(CR); - - // If there are no predecessor, we reached the root node. In this point, - // a new refutation manager will be created and the path will be checked - // for reachability - if (PrevN->pred_size() == 0 && areConstraintsUnfeasible(BRC, Constraints)) { -BR.markInvalid("Infeasible constraints", N->getLocationContext()); - } + // Collect new constraints + addNewConstraints(Constraints, N->getState()->get(), +N->getState()->get_context()); return nullptr; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r336002 - [analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a function to merge ConstraintSets
Author: mramalho Date: Fri Jun 29 11:11:43 2018 New Revision: 336002 URL: http://llvm.org/viewvc/llvm-project?rev=336002=rev Log: [analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a function to merge ConstraintSets Now, instead of adding the constraints when they are removed, this patch adds them when they first appear and, since we walk the bug report backward, it should be the last set of ranges generated by the CSA for a given symbol. These are the number before and after the patch: ``` Project| current | patch | tmux | 283.222 | 123.052 | redis | 614.858 | 400.347 | openssl| 308.292 | 307.149 | twin | 274.478 | 245.411 | git| 547.687 | 477.335 | postgresql | 2927.495 | 2002.526 | sqlite3| 3264.305 | 1028.416 | ``` Major speedups in tmux and sqlite (less than half of the time), redis and postgresql were about 25% faster while the rest are basically the same. Reviewers: NoQ, george.karpenkov Reviewed By: george.karpenkov Subscribers: rnkovacs, xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48565 Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h?rev=336002=336001=336002=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h Fri Jun 29 11:11:43 2018 @@ -336,11 +336,10 @@ public: class FalsePositiveRefutationBRVisitor final : public BugReporterVisitor { private: /// Holds the constraints in a given path - // TODO: should we use a set? - llvm::SmallVector Constraints; + ConstraintRangeTy Constraints; public: - FalsePositiveRefutationBRVisitor() = default; + FalsePositiveRefutationBRVisitor(); void Profile(llvm::FoldingSetNodeID ) const override; @@ -348,6 +347,9 @@ public: const ExplodedNode *PrevN, BugReporterContext , BugReport ) override; + + void finalizeVisitor(BugReporterContext , const ExplodedNode *EndPathNode, + BugReport ) override; }; namespace bugreporter { Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=336002=336001=336002=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Fri Jun 29 11:11:43 2018 @@ -2349,9 +2349,8 @@ TaintBugVisitor::VisitNode(const Explode return std::make_shared(L, "Taint originated here"); } -static bool -areConstraintsUnfeasible(BugReporterContext , - const llvm::SmallVector ) { +static bool areConstraintsUnfeasible(BugReporterContext , + const ConstraintRangeTy ) { // Create a refutation manager std::unique_ptr RefutationMgr = CreateZ3ConstraintManager( BRC.getStateManager(), BRC.getStateManager().getOwningEngine()); @@ -2360,28 +2359,45 @@ areConstraintsUnfeasible(BugReporterCont static_cast(RefutationMgr.get()); // Add constraints to the solver - for (const auto : Cs) -SMTRefutationMgr->addRangeConstraints(C); + SMTRefutationMgr->addRangeConstraints(Cs); // And check for satisfiability return SMTRefutationMgr->isModelFeasible().isConstrainedFalse(); } +static void addNewConstraints(ConstraintRangeTy , + const ConstraintRangeTy , + ConstraintRangeTy::Factory ) { + // Add constraints if we don't have them yet + for (auto const : NewCs) { +const SymbolRef = C.first; +if (!Cs.contains(Sym)) { + Cs = CF.add(Cs, Sym, C.second); +} + } +} + +FalsePositiveRefutationBRVisitor::FalsePositiveRefutationBRVisitor() +: Constraints(ConstraintRangeTy::Factory().getEmptyMap()) {} + +void FalsePositiveRefutationBRVisitor::finalizeVisitor( +BugReporterContext , const ExplodedNode *EndPathNode, BugReport ) { + // Collect new constraints + VisitNode(EndPathNode, nullptr, BRC, BR); + + // Create a new refutation manager and check feasibility + if (areConstraintsUnfeasible(BRC, Constraints)) +BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext()); +} + std::shared_ptr FalsePositiveRefutationBRVisitor::VisitNode(const ExplodedNode *N,
r336001 - [MachineOutliner] Make -mno-outline use -enable-machine-outliner=never
Author: paquette Date: Fri Jun 29 11:06:10 2018 New Revision: 336001 URL: http://llvm.org/viewvc/llvm-project?rev=336001=rev Log: [MachineOutliner] Make -mno-outline use -enable-machine-outliner=never This updates -mno-outline so that it passes -enable-machine-outliner=never instead of nothing. This puts it in sync with the behaviour in llc and other tools. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/aarch64-outliner.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=336001=336000=336001=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Jun 29 11:06:10 2018 @@ -4797,23 +4797,30 @@ void Clang::ConstructJob(Compilation , options::OPT_fno_complete_member_pointers, false)) CmdArgs.push_back("-fcomplete-member-pointers"); - if (Args.hasFlag(options::OPT_moutline, options::OPT_mno_outline, false)) { -// We only support -moutline in AArch64 right now. If we're not compiling -// for AArch64, emit a warning and ignore the flag. Otherwise, add the -// proper mllvm flags. -if (Triple.getArch() != llvm::Triple::aarch64) { - D.Diag(diag::warn_drv_moutline_unsupported_opt) << Triple.getArchName(); -} else { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-machine-outliner"); - - // The outliner shouldn't compete with linkers that dedupe linkonceodr - // functions in LTO. Enable that behaviour by default when compiling with - // LTO. - if (getToolChain().getDriver().isUsingLTO()) { + if (Arg *A = Args.getLastArg(options::OPT_moutline, + options::OPT_mno_outline)) { +if (A->getOption().matches(options::OPT_moutline)) { + // We only support -moutline in AArch64 right now. If we're not compiling + // for AArch64, emit a warning and ignore the flag. Otherwise, add the + // proper mllvm flags. + if (Triple.getArch() != llvm::Triple::aarch64) { +D.Diag(diag::warn_drv_moutline_unsupported_opt) << Triple.getArchName(); + } else { CmdArgs.push_back("-mllvm"); -CmdArgs.push_back("-enable-linkonceodr-outlining"); +CmdArgs.push_back("-enable-machine-outliner"); + +// The outliner shouldn't compete with linkers that dedupe linkonceodr +// functions in LTO. Enable that behaviour by default when compiling with +// LTO. +if (getToolChain().getDriver().isUsingLTO()) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-enable-linkonceodr-outlining"); +} } +} else { + // Disable all outlining behaviour. + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-enable-machine-outliner=never"); } } Modified: cfe/trunk/test/Driver/aarch64-outliner.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-outliner.c?rev=336001=336000=336001=diff == --- cfe/trunk/test/Driver/aarch64-outliner.c (original) +++ cfe/trunk/test/Driver/aarch64-outliner.c Fri Jun 29 11:06:10 2018 @@ -2,7 +2,7 @@ // RUN: %clang -target aarch64 -moutline -S %s -### 2>&1 | FileCheck %s -check-prefix=ON // ON: "-mllvm" "-enable-machine-outliner" // RUN: %clang -target aarch64 -moutline -mno-outline -S %s -### 2>&1 | FileCheck %s -check-prefix=OFF -// OFF-NOT: "-mllvm" "-enable-machine-outliner" +// OFF: "-mllvm" "-enable-machine-outliner=never" // RUN: %clang -target aarch64 -moutline -flto=thin -S %s -### 2>&1 | FileCheck %s -check-prefix=FLTO // FLTO: "-mllvm" "-enable-linkonceodr-outlining" // RUN: %clang -target aarch64 -moutline -flto=full -S %s -### 2>&1 | FileCheck %s -check-prefix=TLTO ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
marco-c added a comment. Why keeping a __gcov_flush which is incompatible with GCC and previous versions of LLVM and adding a __llvm_gcov_flush which is compatible? I feel the other way around (or even just having an unhidden "__gcov_flush" and not introducing "__llvm_gcov_flush") would be more sensible. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48412: [RISCV] Add support for interrupt attribute
apazos updated this revision to Diff 153544. https://reviews.llvm.org/D48412 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td lib/CodeGen/TargetInfo.cpp lib/Sema/SemaDeclAttr.cpp test/Sema/riscv-interrupt-attr.c test/Sema/riscv-interrupt-attr.cpp Index: test/Sema/riscv-interrupt-attr.cpp === --- /dev/null +++ test/Sema/riscv-interrupt-attr.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only + +[[gnu::interrupt]] [[gnu::interrupt]] void foo1() {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \ + // expected-note {{repeated RISC-V 'interrupt' attribute is here}} +[[gnu::interrupt]] void foo2() {} + Index: test/Sema/riscv-interrupt-attr.c === --- /dev/null +++ test/Sema/riscv-interrupt-attr.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 %s -triple riscv32-unknown-elf -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple riscv64-unknown-elf -verify -fsyntax-only + +struct a { int b; }; + +struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions}} + +__attribute__((interrupt("USER"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: USER}} + +__attribute__((interrupt("user", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} + +__attribute__((interrupt)) int foo3() {return 0;} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}} + +__attribute__((interrupt())) int foo4(void) {} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}} + +__attribute__((interrupt())) void foo5(int a) {} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have no parameters}} + +__attribute__((interrupt("user"), interrupt("supervisor"))) void foo6() {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \ +// expected-note {{repeated RISC-V 'interrupt' attribute is here}} + +__attribute__((interrupt, interrupt)) void foo7() {} // expected-warning {{repeated RISC-V 'interrupt' attribute}} \ + // expected-note {{repeated RISC-V 'interrupt' attribute is here}} +__attribute__((interrupt(""))) void foo8() {} // expected-warning {{'interrupt' attribute argument not supported}} + +__attribute__((interrupt("user"))) void foo9(); +__attribute__((interrupt("supervisor"))) void foo9(); +__attribute__((interrupt("machine"))) void foo9(); + +__attribute__((interrupt("user"))) void foo10() {} +__attribute__((interrupt("supervisor"))) void foo11() {} +__attribute__((interrupt("machine"))) void foo12() {} +__attribute__((interrupt())) void foo13() {} +__attribute__((interrupt)) void foo14() {} + Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5266,6 +5266,63 @@ handleSimpleAttribute(S, D, AL); } +static void handleRISCVInterruptAttr(Sema , Decl *D, + const AttributeList ) { + // Warn about repeated attributes. + if (const auto *A = D->getAttr()) { +S.Diag(AL.getRange().getBegin(), + diag::warn_riscv_repeated_interrupt_attribute); +S.Diag(A->getLocation(), diag::note_riscv_repeated_interrupt_attribute); +return; + } + + // Check the attribute argument. Argument is optional. + if (!checkAttributeAtMostNumArgs(S, AL, 1)) +return; + + StringRef Str; + SourceLocation ArgLoc; + + // 'machine'is the default interrupt mode. + if (AL.getNumArgs() == 0) +Str = "machine"; + else if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, )) +return; + + // Semantic checks for a function with the 'interrupt' attribute: + // - Must be a function. + // - Must have no parameters. + // - Must have the 'void' return type. + // - The attribute itself must either have no argument or one of the + // valid interrupt types, see [RISCVInterruptDocs]. + + if (D->getFunctionType() == nullptr) { +S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) + << "'interrupt'" << ExpectedFunction; +return; + } + + if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 0; +return; + } + + if (!getFunctionOrMethodResultType(D)->isVoidType()) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 1; +return; + } + + RISCVInterruptAttr::InterruptType Kind; + if
[PATCH] D48412: [RISCV] Add support for interrupt attribute
apazos added inline comments. Comment at: lib/Sema/SemaDeclAttr.cpp:5305 + + if (hasFunctionProto(D) && getFunctionOrMethodNumParams(D) != 0) { +S.Diag(D->getLocation(), diag::warn_riscv_interrupt_attribute) << 0; aaron.ballman wrote: > I would have assumed this would be: `!hasFunctionProto(D) || > getFunctionOrMethodNumParams(D) != 0`, but it depends on whether you want to > support K C functions. hasFunctionProto also returns true for a function definition like this one __attribute__((interrupt)) void foo1(int) {}. Comment at: lib/Sema/SemaDeclAttr.cpp:5301 + + if (!isFunctionOrMethod(D)) { +S.Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type) aaron.ballman wrote: > apazos wrote: > > aaron.ballman wrote: > > > apazos wrote: > > > > aaron.ballman wrote: > > > > > I don't think you need to perform this check -- I believe it's > > > > > handled automatically (because you don't have custom parsing enabled). > > > > I think need it. Will double check in the test. > > > See `handleCommonAttributeFeatures()` -- it calls > > > `diagnoseAppertainsTo()` which handles this for you. As it is, your check > > > here does not match the subject list on the attribute. The declarative > > > bit says it only appertains to a function and this check is for a > > > function or Obj-C method. > > > > > > Which brings up my next question: should this appertain to an ObjC method? > > It looks like handleCommonAttributeFeatures should take care of the check, > > but I do not see it happening, it returns true in > > AL.diagnoseAppertainsTo(S, D) even when we have > > struct a test __attribute__((interrupt)); > > > > I will remove the Subjects in Attr.td and keep the checks as they are in > > handleRISCVInterruptAttr. > > > > Several other targets do the same thing, they are reusing the helper > > functions that apply to both Function or Method. We would have to create > > helper functions just for function types. > Ah, the reason is because the parsed attributes that share a `ParseKind` can > have different subject lists, so there's no way to do the semantic checking > at that point -- we don't know which semantic attribute to check the subjects > against until later. > > Please put the `Subjects` list back in to Attr.td; it's still useful > declarative information and I may solve this problem someday in the future. > > I am not tied to whether the attribute appertains to a function and an obj-c > method as that depends on the attribute in question, but the code as it > stands is wrong. It checks whether the declaration is a function or a method > and then tells the user the attribute can only appertain to a function and > not a method. Which is correct? Sure I can add Subjects back in. I will remove the helper function and use the simple check D->getFunctionType() == nullptr. Comment at: test/Sema/riscv-interrupt-attr.c:18 + +__attribute__((interrupt("user"), interrupt("supervisor"))) void foo6() { } // expected-warning {{repeated RISC-V 'interrupt' attribute}} \ +// expected-note {{repeated RISC-V 'interrupt' attribute is here}} aaron.ballman wrote: > apazos wrote: > > aaron.ballman wrote: > > > apazos wrote: > > > > aaron.ballman wrote: > > > > > You should also add tests for: > > > > > ``` > > > > > __attribute__((interrupt("user"))) void f(void); > > > > > __attribute__((interrupt("machine"))) void f(void); > > > > > > > > > > void f(void) { } > > > > > > > > > > [[gnu::interrupt("user") gnu::interrupt("machine")]] void g() {} > > > > > > > > > > [[gnu::interrupt("user")]] [[gnu::interrupt("machine")]] void h() {} > > > > > ``` > > > > For this test case tt seems LLVM honors the last setting, "machine". > > > > But gcc is honoring the first. > > > > I think the last setting should prevail. Will check with GCC folks. > > > Do all of these cases get diagnosed as being a repeated interrupt > > > attribute? Should add them as test cases. > > The warning for repeated attribute is when it occurs more than once in the > > same declaration. If you have repeated declarations, the last one prevails. > Please document this in AttrDocs.td. Sure, I can add that info to the description. Comment at: test/Sema/riscv-interrupt-attr.c:23 + // expected-note {{repeated RISC-V 'interrupt' attribute is here}} +__attribute__((interrupt("user"))) void foo8() {} +__attribute__((interrupt("supervisor"))) void foo9() {} aaron.ballman wrote: > aaron.ballman wrote: > > Do you intend for functions without a prototype to be accepted? foo8() can > > be passed an arbitrary number of arguments, which is a bit different than > > what I thought you wanted the semantic check to be. > This question remains outstanding. The checks are
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
srhines added a comment. Thanks for picking this up again and updating the change to add llvm_gcov_flush(). Comment at: test/profile/Inputs/instrprof-dlopen-dlclose-main.c:20 + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); Should also clear dlerror() before this call and check that dlerror() returned a non-NULL pointer indicating that this search failed. https://reviews.llvm.org/D45454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48781: [ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.
thakis added a comment. For your convenience: https://godbolt.org/g/KXxbKb https://reviews.llvm.org/D48781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48781: [ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.
thakis created this revision. thakis added a reviewer: majnemer. MSVC limits char16_t and char32_t string literal names to 32 bytes of character data, not to 32 characters. wchar_t string literal names on the other hand can get up to 64 bytes of character data. https://reviews.llvm.org/D48781 Files: clang/lib/AST/MicrosoftMangle.cpp clang/test/CodeGenCXX/mangle-ms-string-literals.cpp Index: clang/test/CodeGenCXX/mangle-ms-string-literals.cpp === --- clang/test/CodeGenCXX/mangle-ms-string-literals.cpp +++ clang/test/CodeGenCXX/mangle-ms-string-literals.cpp @@ -719,9 +719,35 @@ // CHECK: @"??_C@_1EK@KFPEBLPK@?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AAA?$AAB@" const wchar_t *UnicodeLiteral = L"\ud7ff"; // CHECK: @"??_C@_13IIHIAFKH@?W?$PP?$AA?$AA@" + const char *U8Literal = u8"hi"; // CHECK: @"??_C@_02PCEFGMJL@hi?$AA@" +const char *LongU8Literal = u8"012345678901234567890123456789ABCDEF"; +// CHECK: @"??_C@_0CF@LABBIIMO@012345678901234567890123456789AB@" + const char16_t *U16Literal = u"hi"; // CHECK: @"??_C@_05OMLEGLOC@h?$AAi?$AA?$AA?$AA@" +// Note this starts with o instead of 0. Else LongWideString would have +// the same initializer and CodeGenModule::ConstantStringMap would map them +// to the same global with a shared mangling. +// FIXME: ConstantStringMap probably shouldn't map things with the same data +// but different manglings to the same variable. +const char16_t *LongU16Literal = u"o12345678901234567890123456789ABCDEF"; +// CHECK: @"??_C@_0EK@FEAOBHPP@o?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA@" + const char32_t *U32Literal = U"hi"; // CHECK: @"??_C@_0M@GFNAJIPG@h?$AA?$AA?$AAi?$AA?$AA?$AA?$AA?$AA?$AA?$AA@" +const char32_t *LongU32Literal = U"012345678901234567890123456789ABCDEF"; +// CHECK: @"??_C@_0JE@IMHFEDAA@0?$AA?$AA?$AA1?$AA?$AA?$AA2?$AA?$AA?$AA3?$AA?$AA?$AA4?$AA?$AA?$AA5?$AA?$AA?$AA6?$AA?$AA?$AA7?$AA?$AA?$AA@" + +// These all have just the right length that the trailing 0 just fits. +const char *MaxASCIIString = "012345678901234567890123456789A"; +// CHECK: @"??_C@_0CA@NMANGEKF@012345678901234567890123456789A?$AA@" +const wchar_t *MaxWideString = L"012345678901234567890123456789A"; +// CHECK: @"??_C@_1EA@LJAFPILO@?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AAA?$AA?$AA@" +const char *MaxU8String = u8"012345678901234567890123456789A"; +// CHECK: @"??_C@_0CA@NMANGEKF@012345678901234567890123456789A?$AA@" +const char16_t *MaxU16String = u"012345678901234"; +// CHECK: @"??_C@_0CA@NFEFHIFO@0?$AA1?$AA2?$AA3?$AA4?$AA5?$AA6?$AA7?$AA8?$AA9?$AA0?$AA1?$AA2?$AA3?$AA4?$AA?$AA?$AA@" +const char32_t *MaxU32String = U"0123456"; +// CHECK: @"??_C@_0CA@KFPHPCC@0?$AA?$AA?$AA1?$AA?$AA?$AA2?$AA?$AA?$AA3?$AA?$AA?$AA4?$AA?$AA?$AA5?$AA?$AA?$AA6?$AA?$AA?$AA?$AA?$AA?$AA?$AA@" Index: clang/lib/AST/MicrosoftMangle.cpp === --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -3164,9 +3164,9 @@ void MicrosoftMangleContextImpl::mangleStringLiteral(const StringLiteral *SL, raw_ostream ) { - // ::= 0 # char - // ::= 1 # wchar_t - // ::= ??? # char16_t/char32_t will need a mangling too... + // ::= 0 # char, char16_t, char32_t + // # (little endian char data in mangling) + // ::= 1 # wchar_t (big endian char data in mangling) // // ::= # the length of the literal // @@ -3228,8 +3228,8 @@ // scheme. Mangler.mangleNumber(JC.getCRC()); - // : The mangled name also contains the first 32 _characters_ - // (including null-terminator bytes) of the StringLiteral. + // : The mangled name also contains the first 32 bytes + // (including null-terminator bytes) of the encoded StringLiteral. // Each character is encoded by splitting them into bytes and then encoding // the constituent bytes. auto MangleByte = [](char Byte) { @@ -3258,17 +3258,17 @@ } }; - // Enforce our 32 character max. - unsigned NumCharsToMangle = std::min(32U, SL->getLength()); - for (unsigned I = 0, E = NumCharsToMangle * SL->getCharByteWidth(); I != E; - ++I) + // Enforce our 32 bytes max, except wchar_t which gets 32 chars instead. + unsigned MaxBytesToWrite = SL->isWide() ? 64U : 32U; + unsigned NumBytesToWrite = std::min(MaxBytesToWrite, SL->getByteLength()); + for (unsigned I = 0; I != NumBytesToWrite; ++I) if (SL->isWide()) MangleByte(GetBigEndianByte(I)); else MangleByte(GetLittleEndianByte(I)); // Encode the NUL terminator if there is room. - if (NumCharsToMangle < 32) + if (NumBytesToWrite < MaxBytesToWrite) for
[PATCH] D45454: Add llvm_gcov_flush to be called outside a shared library
chh updated this revision to Diff 153532. chh retitled this revision from "Make __gcov_flush visible outside a shared library" to "Add llvm_gcov_flush to be called outside a shared library". chh edited the summary of this revision. chh added a comment. Now keep __gcov_flush hidden as libgcov; add llvm_gcov_flush to call from outside of .so files. https://reviews.llvm.org/D45454 Files: lib/profile/GCDAProfiling.c test/profile/Inputs/instrprof-dlopen-dlclose-main.c Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -16,6 +16,31 @@ return EXIT_FAILURE; } + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared'\n"); +return EXIT_FAILURE; + } + f1_flush(); + + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared'\n"); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that case, it dumps profile data of a .so file. +// If it is called directly inside a .so file, the unified copy of +// llvm_gcov_flush might dump data of other .so file or the main module. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { Index: test/profile/Inputs/instrprof-dlopen-dlclose-main.c === --- test/profile/Inputs/instrprof-dlopen-dlclose-main.c +++ test/profile/Inputs/instrprof-dlopen-dlclose-main.c @@ -16,6 +16,31 @@ return EXIT_FAILURE; } + void (*gcov_flush)() = (void (*)())dlsym(f1_handle, "__gcov_flush"); + if (gcov_flush != NULL) { +fprintf(stderr, "__gcov_flush should not be visible in func.shared'\n"); +return EXIT_FAILURE; + } + + void (*f1_flush)() = (void (*)())dlsym(f1_handle, "llvm_gcov_flush"); + if (f1_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func.shared'\n"); +return EXIT_FAILURE; + } + f1_flush(); + + void (*f2_flush)() = (void (*)())dlsym(f2_handle, "llvm_gcov_flush"); + if (f2_flush == NULL) { +fprintf(stderr, "unable to find llvm_gcov_flush in func2.shared'\n"); +return EXIT_FAILURE; + } + f2_flush(); + + if (f1_flush == f2_flush) { +fprintf(stderr, "Same llvm_gcov_flush found in func.shared and func2.shared\n"); +return EXIT_FAILURE; + } + if (dlclose(f2_handle) != 0) { fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror()); return EXIT_FAILURE; Index: lib/profile/GCDAProfiling.c === --- lib/profile/GCDAProfiling.c +++ lib/profile/GCDAProfiling.c @@ -527,6 +527,10 @@ } } +// __gcov_flush is hidden. When called in a .so file, +// it dumps profile data of the calling .so file. +// If a main program needs to dump profile data of each linked +// .so files, it should use dlsym to find and call llvm_gcov_flush. COMPILER_RT_VISIBILITY void __gcov_flush() { struct flush_fn_node *curr = flush_fn_head; @@ -537,6 +541,14 @@ } } +// llvm_gcov_flush is not hidden for a program to use dlsym to +// find and call. In that case, it dumps profile data of a .so file. +// If it is called directly inside a .so file, the unified copy of +// llvm_gcov_flush might dump data of other .so file or the main module. +void llvm_gcov_flush() { + __gcov_flush(); +} + COMPILER_RT_VISIBILITY void llvm_delete_flush_function_list(void) { while (flush_fn_head) { ___ cfe-commits mailing list
[PATCH] D48764: [Analyzer] Hotfix for iterator checkers: Mark left-hand side of `SymIntExpr` objects as live in the program state maps.
NoQ added a comment. That's right. You only need to mark "atomic" symbols (`SymbolData`) as live, and expressions that contain them would automatically become live. So i think you should just iterate through a `symbol_iterator` and mark all `SymbolData` symbols you encounter as live. Is this a hotfix for a test failure? Otherwise it'd be great to have tests. https://reviews.llvm.org/D48764 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
arphaman added inline comments. Comment at: lib/Sema/SemaDeclObjC.cpp:1208 +// serialize something meaningful. +if (getLangOpts().Modules) + PushOnScopeChains(PDecl, TUScope); Is this a problem only for modules or does this show up in PCHs too? What would be the cost of using PushOnScopeChains unconditionally? Repository: rC Clang https://reviews.llvm.org/D47297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48712: [X86] Lowering integer truncation intrinsics to native IR
RKSimon added a comment. Please can you create a llvm side parallel patch that updates the relevant fast-isel tests Comment at: clang/lib/Headers/avx512vlbwintrin.h:1501 + (__v8qi){0, 0, 0, 0, 0, 0, 0, 0}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15); } mike.dvoretsky wrote: > RKSimon wrote: > > Are we happy with using illegal types like this? What about flipping the > > shuffle and convert? > > > > ``` > > return (__m128i)__builtin_convertvector( > > __builtin_shufflevector((__v8hi)__A, > > (__v8hi){0, 0, 0, 0, 0, 0, 0, > > 0}, > > 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, > > 10, 11, 12, 13, 14, 15), __v16qi); > > ``` > This would bring its own issues, since in the cvtepi64_epi8 cases the inner > shuffle would produce vectors of 16 64-bit values. There would be no extra > typedef, but in the back-end these would be split in type legalization, > making it harder to fold them into VPMOV instructions. Yeah, neither solution is particularly clean. Please keep it as is. https://reviews.llvm.org/D48712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48727: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag
This revision was automatically updated to reflect the committed changes. Closed by commit rC335993: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag (authored by leonardchan, committed by ). Repository: rC Clang https://reviews.llvm.org/D48727 Files: include/clang/Basic/LangOptions.def include/clang/Basic/TargetInfo.h include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Basic/TargetInfo.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaExpr.cpp test/Frontend/fixed_point_same_fbits.c Index: lib/Basic/TargetInfo.cpp === --- lib/Basic/TargetInfo.cpp +++ lib/Basic/TargetInfo.cpp @@ -53,7 +53,7 @@ // We give the _Accum 1 fewer fractional bits than their corresponding _Fract // types by default to have the same number of fractional bits between _Accum // and _Fract types. - SameFBits = false; + PaddingOnUnsignedFixedPoint = false; ShortAccumScale = 7; AccumScale = 15; LongAccumScale = 31; @@ -377,7 +377,7 @@ // Each unsigned fixed point type has the same number of fractional bits as // its corresponding signed type. - SameFBits |= Opts.SameFBits; + PaddingOnUnsignedFixedPoint |= Opts.PaddingOnUnsignedFixedPoint; CheckFixedPointBits(); } Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -2338,8 +2338,9 @@ Opts.FixedPoint = Args.hasFlag(OPT_ffixed_point, OPT_fno_fixed_point, /*Default=*/false) && !Opts.CPlusPlus; - Opts.SameFBits = - Args.hasFlag(OPT_fsame_fbits, OPT_fno_same_fbits, + Opts.PaddingOnUnsignedFixedPoint = + Args.hasFlag(OPT_fpadding_on_unsigned_fixed_point, + OPT_fno_padding_on_unsigned_fixed_point, /*Default=*/false) && Opts.FixedPoint; Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -3765,11 +3765,6 @@ /*Default=*/false)) Args.AddLastArg(CmdArgs, options::OPT_ffixed_point); - if (Args.hasFlag(options::OPT_fsame_fbits, - options::OPT_fno_same_fbits, - /*Default=*/false)) -Args.AddLastArg(CmdArgs, options::OPT_fsame_fbits); - // Handle -{std, ansi, trigraphs} -- take the last of -{std, ansi} // (-ansi is equivalent to -std=c89 or -std=c++98). // Index: lib/Sema/SemaExpr.cpp === --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -3358,7 +3358,7 @@ bool Overflowed = Literal.GetFixedPointValue(Val, scale); // Do not use bit_width since some types may have padding like _Fract or -// unsigned _Accums if SameFBits is set. +// unsigned _Accums if PaddingOnUnsignedFixedPoint is set. auto MaxVal = llvm::APInt::getMaxValue(ibits + scale).zextOrSelf(bit_width); if (Literal.isFract && Val == MaxVal + 1) // Clause 6.4.4 - The value of a constant shall be in the range of Index: include/clang/Driver/CC1Options.td === --- include/clang/Driver/CC1Options.td +++ include/clang/Driver/CC1Options.td @@ -36,6 +36,10 @@ def mfpmath : Separate<["-"], "mfpmath">, HelpText<"Which unit to use for fp math">; +def fpadding_on_unsigned_fixed_point : Flag<["-"], "fpadding-on-unsigned-fixed-point">, + HelpText<"Force each unsigned fixed point type to have an extra bit of padding to align their scales with those of signed fixed point types">; +def fno_padding_on_unsigned_fixed_point : Flag<["-"], "fno-padding-on-unsigned-fixed-point">; + //===--===// // Analyzer Options //===--===// Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -893,10 +893,6 @@ Flags<[CC1Option]>, HelpText<"Enable fixed point types">; def fno_fixed_point : Flag<["-"], "fno-fixed-point">, Group, HelpText<"Disable fixed point types">; -def fsame_fbits : Flag<["-"], "fsame-fbits">, Group, - Flags<[CC1Option]>, - HelpText<"Force each unsigned fixed point type to have the same number of fractional bits as its corresponding signed type">; -def fno_same_fbits : Flag<["-"], "fno-same-fbits">, Group; // Begin sanitizer flags. These should all be core options exposed in all driver // modes. Index: include/clang/Basic/TargetInfo.h === --- include/clang/Basic/TargetInfo.h +++
r335993 - [Fixed Point Arithmetic] Rename `-fsame-fbits` flag
Author: leonardchan Date: Fri Jun 29 10:08:19 2018 New Revision: 335993 URL: http://llvm.org/viewvc/llvm-project?rev=335993=rev Log: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag - Rename the `-fsame-fbits` flag to `-fpadding-on-unsigned-fixed-point` - Move the flag from a driver option to a cc1 option - Rename the `SameFBits` member in TargetInfo to `PaddingOnUnsignedFixedPoint` - Updated descriptions Differential Revision: https://reviews.llvm.org/D48727 Modified: cfe/trunk/include/clang/Basic/LangOptions.def cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/include/clang/Driver/CC1Options.td cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Basic/TargetInfo.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/test/Frontend/fixed_point_same_fbits.c Modified: cfe/trunk/include/clang/Basic/LangOptions.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=335993=335992=335993=diff == --- cfe/trunk/include/clang/Basic/LangOptions.def (original) +++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Jun 29 10:08:19 2018 @@ -306,8 +306,8 @@ ENUM_LANGOPT(ClangABICompat, ClangABI, 4 COMPATIBLE_VALUE_LANGOPT(FunctionAlignment, 5, 0, "Default alignment for functions") LANGOPT(FixedPoint, 1, 0, "fixed point types") -LANGOPT(SameFBits, 1, 0, -"unsigned and signed fixed point type having the same number of fractional bits") +LANGOPT(PaddingOnUnsignedFixedPoint, 1, 0, +"unsigned fixed point types having one extra padding bit") #undef LANGOPT #undef COMPATIBLE_LANGOPT Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=335993=335992=335993=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Fri Jun 29 10:08:19 2018 @@ -84,10 +84,11 @@ protected: unsigned char LongFractWidth, LongFractAlign; // If true, unsigned fixed point types have the same number of fractional bits - // as their signed counterparts. Otherwise, unsigned fixed point types have + // as their signed counterparts, forcing the unsigned types to have one extra + // bit of padding. Otherwise, unsigned fixed point types have // one more fractional bit than its corresponding signed type. This is false // by default. - bool SameFBits; + bool PaddingOnUnsignedFixedPoint; // Fixed point integral and fractional bit sizes // Saturated types share the same integral/fractional bits as their @@ -95,7 +96,7 @@ protected: // For simplicity, the fractional bits in a _Fract type will be one less the // width of that _Fract type. This leaves all signed _Fract types having no // padding and unsigned _Fract types will only have 1 bit of padding after the - // sign if SameFBits is set. + // sign if PaddingOnUnsignedFixedPoint is set. unsigned char ShortAccumScale; unsigned char AccumScale; unsigned char LongAccumScale; @@ -436,30 +437,33 @@ public: /// getUnsignedShortAccumScale/IBits - Return the number of /// fractional/integral bits in a 'unsigned short _Accum' type. unsigned getUnsignedShortAccumScale() const { -return SameFBits ? ShortAccumScale : ShortAccumScale + 1; +return PaddingOnUnsignedFixedPoint ? ShortAccumScale : ShortAccumScale + 1; } unsigned getUnsignedShortAccumIBits() const { -return SameFBits ? getShortAccumIBits() - : ShortAccumWidth - getUnsignedShortAccumScale(); +return PaddingOnUnsignedFixedPoint + ? getShortAccumIBits() + : ShortAccumWidth - getUnsignedShortAccumScale(); } /// getUnsignedAccumScale/IBits - Return the number of fractional/integral /// bits in a 'unsigned _Accum' type. unsigned getUnsignedAccumScale() const { -return SameFBits ? AccumScale : AccumScale + 1; +return PaddingOnUnsignedFixedPoint ? AccumScale : AccumScale + 1; } unsigned getUnsignedAccumIBits() const { -return SameFBits ? getAccumIBits() : AccumWidth - getUnsignedAccumScale(); +return PaddingOnUnsignedFixedPoint ? getAccumIBits() + : AccumWidth - getUnsignedAccumScale(); } /// getUnsignedLongAccumScale/IBits - Return the number of fractional/integral /// bits in a 'unsigned long _Accum' type. unsigned getUnsignedLongAccumScale() const { -return SameFBits ? LongAccumScale : LongAccumScale + 1; +return PaddingOnUnsignedFixedPoint ? LongAccumScale : LongAccumScale + 1; } unsigned getUnsignedLongAccumIBits() const { -return SameFBits ? getLongAccumIBits() - : LongAccumWidth - getUnsignedLongAccumScale(); +return
[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
bruno added a comment. Herald added a subscriber: dexonsmith. Ping! Repository: rC Clang https://reviews.llvm.org/D47297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
paulsemel updated this revision to Diff 153511. paulsemel added a comment. Fixed version problem. Now building. Repository: rC Clang https://reviews.llvm.org/D47953 Files: lib/CodeGen/CGBuiltin.cpp Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -1170,6 +1170,7 @@ RecordDecl *RD = RT->getDecl()->getDefinition(); ASTContext = RD->getASTContext(); const ASTRecordLayout = Ctx.getASTRecordLayout(RD); + const CGRecordLayout = CGF.getTypes().getCGRecordLayout(RD); std::string Pad = std::string(Lvl * 4, ' '); Value *GString = @@ -1208,7 +1209,7 @@ FieldPtr, CGF.ConvertType(Context.getPointerType(FD->getType(; else FieldPtr = CGF.Builder.CreateStructGEP(CGF.ConvertType(RType), FieldPtr, - FD->getFieldIndex()); + CGRL.getLLVMFieldNo(FD)); GString = CGF.Builder.CreateGlobalStringPtr( llvm::Twine(Pad) @@ -1236,10 +1237,37 @@ ? Types[Context.VoidPtrTy] : Types[CanonicalType]; +if (FD->isBitField()) + FieldPtr = CGF.Builder.CreatePointerCast( + FieldPtr, CGF.ConvertType(Context.getPointerType(CanonicalType))); + Address FieldAddress = Address(FieldPtr, Align); FieldPtr = CGF.Builder.CreateLoad(FieldAddress); -// FIXME Need to handle bitfield here +if (FD->isBitField()) { + const CGBitFieldInfo = CGRL.getBitFieldInfo(FD); + if (Info.IsSigned) { +unsigned HighBits = Info.StorageSize - Info.Offset - Info.Size; +if (HighBits) + FieldPtr = CGF.Builder.CreateShl(FieldPtr, HighBits); +if (Info.Offset + HighBits) + FieldPtr = CGF.Builder.CreateAShr(FieldPtr, Info.Offset + HighBits); + } else { +if (Info.Offset) + FieldPtr = CGF.Builder.CreateLShr(FieldPtr, Info.Offset); +if (static_cast(Info.Offset) + Info.Size < Info.StorageSize) + FieldPtr = CGF.Builder.CreateAnd( + FieldPtr, + ConstantInt::get(CGF.ConvertType(CanonicalType), + llvm::APInt::getLowBitsSet( + CGF.CGM.getDataLayout().getTypeSizeInBits( + CGF.ConvertType(CanonicalType)), + Info.Size))); + } + FieldPtr = CGF.Builder.CreateIntCast( + FieldPtr, CGF.ConvertType(CanonicalType), Info.IsSigned); +} + GString = CGF.Builder.CreateGlobalStringPtr( Format.concat(llvm::Twine('\n')).str()); TmpRes = CGF.Builder.CreateCall(Func, {GString, FieldPtr}); Index: lib/CodeGen/CGBuiltin.cpp === --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -1170,6 +1170,7 @@ RecordDecl *RD = RT->getDecl()->getDefinition(); ASTContext = RD->getASTContext(); const ASTRecordLayout = Ctx.getASTRecordLayout(RD); + const CGRecordLayout = CGF.getTypes().getCGRecordLayout(RD); std::string Pad = std::string(Lvl * 4, ' '); Value *GString = @@ -1208,7 +1209,7 @@ FieldPtr, CGF.ConvertType(Context.getPointerType(FD->getType(; else FieldPtr = CGF.Builder.CreateStructGEP(CGF.ConvertType(RType), FieldPtr, - FD->getFieldIndex()); + CGRL.getLLVMFieldNo(FD)); GString = CGF.Builder.CreateGlobalStringPtr( llvm::Twine(Pad) @@ -1236,10 +1237,37 @@ ? Types[Context.VoidPtrTy] : Types[CanonicalType]; +if (FD->isBitField()) + FieldPtr = CGF.Builder.CreatePointerCast( + FieldPtr, CGF.ConvertType(Context.getPointerType(CanonicalType))); + Address FieldAddress = Address(FieldPtr, Align); FieldPtr = CGF.Builder.CreateLoad(FieldAddress); -// FIXME Need to handle bitfield here +if (FD->isBitField()) { + const CGBitFieldInfo = CGRL.getBitFieldInfo(FD); + if (Info.IsSigned) { +unsigned HighBits = Info.StorageSize - Info.Offset - Info.Size; +if (HighBits) + FieldPtr = CGF.Builder.CreateShl(FieldPtr, HighBits); +if (Info.Offset + HighBits) + FieldPtr = CGF.Builder.CreateAShr(FieldPtr, Info.Offset + HighBits); + } else { +if (Info.Offset) + FieldPtr = CGF.Builder.CreateLShr(FieldPtr, Info.Offset); +if (static_cast(Info.Offset) + Info.Size < Info.StorageSize) + FieldPtr = CGF.Builder.CreateAnd( + FieldPtr, + ConstantInt::get(CGF.ConvertType(CanonicalType), + llvm::APInt::getLowBitsSet( + CGF.CGM.getDataLayout().getTypeSizeInBits( +
[PATCH] D47953: [builtin] Add bitfield support for __builtin_dump_struct
paulsemel added a comment. In https://reviews.llvm.org/D47953#1143044, @dblaikie wrote: > This doesn't seem to build for me - so hard to debug/probe it: > > llvm/src/tools/clang/lib/CodeGen/CGBuiltin.cpp:1264:65: error: no viable > conversion from 'clang::QualType' to 'llvm::Type *' > > CGF.CGM.getDataLayout().getTypeSizeInBits(CanonicalType), > ^ > > llvm/src/include/llvm/IR/DataLayout.h:560:53: note: passing argument to > parameter 'Ty' here > inline uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const { > > ^ > > 1 error generated. Very sorry about it, I should have paid more attention.. Repository: rC Clang https://reviews.llvm.org/D47953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48712: [X86] Lowering integer truncation intrinsics to native IR
mike.dvoretsky added inline comments. Comment at: clang/lib/Headers/avx512vlbwintrin.h:1501 + (__v8qi){0, 0, 0, 0, 0, 0, 0, 0}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15); } RKSimon wrote: > Are we happy with using illegal types like this? What about flipping the > shuffle and convert? > > ``` > return (__m128i)__builtin_convertvector( > __builtin_shufflevector((__v8hi)__A, > (__v8hi){0, 0, 0, 0, 0, 0, 0, 0}, > 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, > 11, 12, 13, 14, 15), __v16qi); > ``` This would bring its own issues, since in the cvtepi64_epi8 cases the inner shuffle would produce vectors of 16 64-bit values. There would be no extra typedef, but in the back-end these would be split in type legalization, making it harder to fold them into VPMOV instructions. https://reviews.llvm.org/D48712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48441: [clangd] Incorporate transitive #includes into code complete proximity scoring.
sammccall updated this revision to Diff 153504. sammccall marked 2 inline comments as done. sammccall added a comment. Address review comments. Most notably: limit the up-traversals from some sources. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48441 Files: clangd/CMakeLists.txt clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/CodeComplete.cpp clangd/CodeComplete.h clangd/FileDistance.cpp clangd/FileDistance.h clangd/Headers.cpp clangd/Headers.h clangd/Quality.cpp clangd/Quality.h clangd/XRefs.cpp unittests/clangd/CMakeLists.txt unittests/clangd/FileDistanceTests.cpp unittests/clangd/HeadersTests.cpp unittests/clangd/QualityTests.cpp Index: unittests/clangd/QualityTests.cpp === --- unittests/clangd/QualityTests.cpp +++ unittests/clangd/QualityTests.cpp @@ -17,6 +17,7 @@ // //===--===// +#include "FileDistance.h" #include "Quality.h" #include "TestFS.h" #include "TestTU.h" @@ -157,9 +158,22 @@ PoorNameMatch.NameMatch = 0.2f; EXPECT_LT(PoorNameMatch.evaluate(), Default.evaluate()); - SymbolRelevanceSignals WithProximity; - WithProximity.SemaProximityScore = 0.2f; - EXPECT_GT(WithProximity.evaluate(), Default.evaluate()); + SymbolRelevanceSignals WithSemaProximity; + WithSemaProximity.SemaProximityScore = 0.2f; + EXPECT_GT(WithSemaProximity.evaluate(), Default.evaluate()); + + SymbolRelevanceSignals IndexProximate; + IndexProximate.SymbolURI = "unittest:/foo/bar.h"; + llvm::StringMap ProxSources; + ProxSources.try_emplace(testPath("foo/baz.h")); + URIDistance Distance(ProxSources); + IndexProximate.FileProximityMatch = + EXPECT_GT(IndexProximate.evaluate(), Default.evaluate()); + SymbolRelevanceSignals IndexDistant = IndexProximate; + IndexDistant.SymbolURI = "unittest:/elsewhere/path.h"; + EXPECT_GT(IndexProximate.evaluate(), IndexDistant.evaluate()) + << IndexProximate << IndexDistant; + EXPECT_GT(IndexDistant.evaluate(), Default.evaluate()); SymbolRelevanceSignals Scoped; Scoped.Scope = SymbolRelevanceSignals::FileScope; @@ -180,59 +194,6 @@ EXPECT_LT(sortText(0, "a"), sortText(0, "z")); } -// {a,b,c} becomes /clangd-test/a/b/c -std::string joinPaths(llvm::ArrayRef Parts) { - return testPath( - llvm::join(Parts.begin(), Parts.end(), llvm::sys::path::get_separator())); -} - -static constexpr float ProximityBase = 0.7; - -// Calculates a proximity score for an index symbol with declaration file -// SymPath with the given URI scheme. -float URIProximity(const FileProximityMatcher , StringRef SymPath, - StringRef Scheme = "file") { - auto U = URI::create(SymPath, Scheme); - EXPECT_TRUE(static_cast(U)) << llvm::toString(U.takeError()); - return Matcher.uriProximity(U->toString()); -} - -TEST(QualityTests, URIProximityScores) { - FileProximityMatcher Matcher( - /*ProximityPaths=*/{joinPaths({"a", "b", "c", "d", "x"})}); - - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"a", "b", "c", "d", "x"})), - 1); - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"a", "b", "c", "d", "y"})), - ProximityBase); - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"a", "y", "z"})), - std::pow(ProximityBase, 5)); - EXPECT_FLOAT_EQ( - URIProximity(Matcher, joinPaths({"a", "b", "c", "d", "e", "y"})), - std::pow(ProximityBase, 2)); - EXPECT_FLOAT_EQ( - URIProximity(Matcher, joinPaths({"a", "b", "m", "n", "o", "y"})), - std::pow(ProximityBase, 5)); - EXPECT_FLOAT_EQ( - URIProximity(Matcher, joinPaths({"a", "t", "m", "n", "o", "y"})), - std::pow(ProximityBase, 6)); - // Note the common directory is /clang-test/ - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"m", "n", "o", "p", "y"})), - std::pow(ProximityBase, 7)); -} - -TEST(QualityTests, URIProximityScoresWithTestURI) { - FileProximityMatcher Matcher( - /*ProximityPaths=*/{joinPaths({"b", "c", "x"})}); - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"b", "c", "x"}), "unittest"), - 1); - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"b", "y"}), "unittest"), - std::pow(ProximityBase, 2)); - // unittest:///b/c/x vs unittest:///m/n/y. No common directory. - EXPECT_FLOAT_EQ(URIProximity(Matcher, joinPaths({"m", "n", "y"}), "unittest"), - std::pow(ProximityBase, 4)); -} - } // namespace } // namespace clangd } // namespace clang Index: unittests/clangd/HeadersTests.cpp === --- unittests/clangd/HeadersTests.cpp +++ unittests/clangd/HeadersTests.cpp @@ -64,18 +64,17 @@ } protected: - std::vector collectIncludes() { + IncludeStructure collectIncludes() { auto Clang = setupClang(); PreprocessOnlyAction Action; EXPECT_TRUE(
[PATCH] D47632: [ASTImporter] Refactor Decl creation
martong added a comment. I realized that, this patch brakes 3 lldb tests ATM: - `TestTopLevelExprs.py`. If https://reviews.llvm.org/D48722 was merged then this test would not be broken. - `TestPersistentTypes.py` If https://reviews.llvm.org/D48773 was merged then this test would not be broken. - `TestRecursiveTypes.py`. I am still working on this. The newly introduced assert fires: `Assertion `(Pos == ImportedDecls.end() || Pos->second == To) && "Try to import an already imported Decl"' failed.`. Repository: rC Clang https://reviews.llvm.org/D47632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48721: Patch to fix pragma metadata for do-while loops
deepak2427 added a comment. Do I need to add specific reviewers? Repository: rC Clang https://reviews.llvm.org/D48721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48679: [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl
This revision was automatically updated to reflect the committed changes. Closed by commit rL335983: [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48679 Files: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTestObjC.cpp Index: cfe/trunk/lib/Format/TokenAnnotator.cpp === --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -698,13 +698,19 @@ Line.startsWith(TT_ObjCMethodSpecifier)) { Tok->Type = TT_ObjCMethodExpr; const FormatToken *BeforePrevious = Tok->Previous->Previous; +// Ensure we tag all identifiers in method declarations as +// TT_SelectorName. +bool UnknownIdentifierInMethodDeclaration = +Line.startsWith(TT_ObjCMethodSpecifier) && +Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); if (!BeforePrevious || // FIXME(bug 36976): ObjC return types shouldn't use TT_CastRParen. !(BeforePrevious->is(TT_CastRParen) || (BeforePrevious->is(TT_ObjCMethodExpr) && BeforePrevious->is(tok::colon))) || BeforePrevious->is(tok::r_square) || -Contexts.back().LongestObjCSelectorName == 0) { +Contexts.back().LongestObjCSelectorName == 0 || +UnknownIdentifierInMethodDeclaration) { Tok->Previous->Type = TT_SelectorName; if (!Contexts.back().FirstObjCSelectorName) Contexts.back().FirstObjCSelectorName = Tok->Previous; Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp === --- cfe/trunk/unittests/Format/FormatTestObjC.cpp +++ cfe/trunk/unittests/Format/FormatTestObjC.cpp @@ -923,6 +923,14 @@ verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;"); verifyFormat("@property(assign, getter=isEditable) BOOL editable;"); + Style.ColumnLimit = 50; + verifyFormat("@interface Foo\n" + "- (void)doStuffWithFoo:(id)name\n" + " bar:(id)bar\n" + " baz:(id)baz\n" + "NS_SWIFT_NAME(doStuff(withFoo:bar:baz:));\n" + "@end"); + Style = getMozillaStyle(); verifyFormat("@property (assign, getter=isEditable) BOOL editable;"); verifyFormat("@property BOOL editable;"); Index: cfe/trunk/lib/Format/TokenAnnotator.cpp === --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -698,13 +698,19 @@ Line.startsWith(TT_ObjCMethodSpecifier)) { Tok->Type = TT_ObjCMethodExpr; const FormatToken *BeforePrevious = Tok->Previous->Previous; +// Ensure we tag all identifiers in method declarations as +// TT_SelectorName. +bool UnknownIdentifierInMethodDeclaration = +Line.startsWith(TT_ObjCMethodSpecifier) && +Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); if (!BeforePrevious || // FIXME(bug 36976): ObjC return types shouldn't use TT_CastRParen. !(BeforePrevious->is(TT_CastRParen) || (BeforePrevious->is(TT_ObjCMethodExpr) && BeforePrevious->is(tok::colon))) || BeforePrevious->is(tok::r_square) || -Contexts.back().LongestObjCSelectorName == 0) { +Contexts.back().LongestObjCSelectorName == 0 || +UnknownIdentifierInMethodDeclaration) { Tok->Previous->Type = TT_SelectorName; if (!Contexts.back().FirstObjCSelectorName) Contexts.back().FirstObjCSelectorName = Tok->Previous; Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp === --- cfe/trunk/unittests/Format/FormatTestObjC.cpp +++ cfe/trunk/unittests/Format/FormatTestObjC.cpp @@ -923,6 +923,14 @@ verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;"); verifyFormat("@property(assign, getter=isEditable) BOOL editable;"); + Style.ColumnLimit = 50; + verifyFormat("@interface Foo\n" + "- (void)doStuffWithFoo:(id)name\n" + " bar:(id)bar\n" + " baz:(id)baz\n" + "NS_SWIFT_NAME(doStuff(withFoo:bar:baz:));\n" + "@end"); + Style = getMozillaStyle(); verifyFormat("@property (assign, getter=isEditable) BOOL editable;"); verifyFormat("@property BOOL editable;"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335983 - [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl
Author: benhamilton Date: Fri Jun 29 08:26:37 2018 New Revision: 335983 URL: http://llvm.org/viewvc/llvm-project?rev=335983=rev Log: [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl Summary: In D44638, I partially fixed `NS_SWIFT_NAME(foo(bar:baz:))`-style annotations on C functions, but didn't add a test for Objective-C method declarations. For ObjC method declarations which are annotated with `NS_SWIFT_NAME(...)`, we currently fail to annotate the final component of the selector name as `TT_SelectorName`. Because the token type is left unknown, clang-format will happily cause a compilation error when it changes the following: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz:)); @end ``` to: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz :)); @end ``` (note the linebreak before the final `:`). The logic which decides whether or not to annotate the token before a `:` with `TT_SelectorName` is pretty fragile, and has to handle some pretty odd cases like pair-parameters: ``` [I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd]; ``` So, to minimize the effect of this change, I decided to only annotate unknown identifiers before a `:` as `TT_SelectorName` for Objective-C declaration lines. Test Plan: New tests included. Confirmed tests failed before change and passed after change. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, krasimir, jolesiak Reviewed By: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48679 Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/FormatTestObjC.cpp Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=335983=335982=335983=diff == --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 29 08:26:37 2018 @@ -698,13 +698,19 @@ private: Line.startsWith(TT_ObjCMethodSpecifier)) { Tok->Type = TT_ObjCMethodExpr; const FormatToken *BeforePrevious = Tok->Previous->Previous; +// Ensure we tag all identifiers in method declarations as +// TT_SelectorName. +bool UnknownIdentifierInMethodDeclaration = +Line.startsWith(TT_ObjCMethodSpecifier) && +Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); if (!BeforePrevious || // FIXME(bug 36976): ObjC return types shouldn't use TT_CastRParen. !(BeforePrevious->is(TT_CastRParen) || (BeforePrevious->is(TT_ObjCMethodExpr) && BeforePrevious->is(tok::colon))) || BeforePrevious->is(tok::r_square) || -Contexts.back().LongestObjCSelectorName == 0) { +Contexts.back().LongestObjCSelectorName == 0 || +UnknownIdentifierInMethodDeclaration) { Tok->Previous->Type = TT_SelectorName; if (!Contexts.back().FirstObjCSelectorName) Contexts.back().FirstObjCSelectorName = Tok->Previous; Modified: cfe/trunk/unittests/Format/FormatTestObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestObjC.cpp?rev=335983=335982=335983=diff == --- cfe/trunk/unittests/Format/FormatTestObjC.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestObjC.cpp Fri Jun 29 08:26:37 2018 @@ -923,6 +923,14 @@ TEST_F(FormatTestObjC, ObjCSnippets) { verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;"); verifyFormat("@property(assign, getter=isEditable) BOOL editable;"); + Style.ColumnLimit = 50; + verifyFormat("@interface Foo\n" + "- (void)doStuffWithFoo:(id)name\n" + " bar:(id)bar\n" + " baz:(id)baz\n" + "NS_SWIFT_NAME(doStuff(withFoo:bar:baz:));\n" + "@end"); + Style = getMozillaStyle(); verifyFormat("@property (assign, getter=isEditable) BOOL editable;"); verifyFormat("@property BOOL editable;"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48773: [ASTImporter] Fix import of objects with anonymous types
martong created this revision. martong added reviewers: a.sidorin, balazske, r.stahl. Herald added subscribers: cfe-commits, dkrupp, rnkovacs. Currently, anonymous types are merged into the same redecl chain even if they are structurally inequivalent. This results that global objects are not imported, if there are at least two global objects with different anonymous types. This patch provides a fix. Repository: rC Clang https://reviews.llvm.org/D48773 Files: lib/AST/ASTImporter.cpp unittests/AST/ASTImporterTest.cpp Index: unittests/AST/ASTImporterTest.cpp === --- unittests/AST/ASTImporterTest.cpp +++ unittests/AST/ASTImporterTest.cpp @@ -1622,6 +1622,35 @@ .match(ToTU, classTemplateSpecializationDecl())); } +TEST_P(ASTImporterTestBase, ObjectsWithUnnamedStructType) { + Decl *FromTU = getTuDecl( + R"( + struct { int a; int b; } object0 = { 2, 3 }; + struct { int x; int y; int z; } object1; + )", + Lang_CXX, "input0.cc"); + + auto getRecordDecl = [](VarDecl *VD) { +auto *ET = cast(VD->getType().getTypePtr()); +return cast(ET->getNamedType().getTypePtr())->getDecl(); + }; + + auto *Obj0 = + FirstDeclMatcher().match(FromTU, varDecl(hasName("object0"))); + auto *From0 = getRecordDecl(Obj0); + auto *Obj1 = + FirstDeclMatcher().match(FromTU, varDecl(hasName("object1"))); + auto *From1 = getRecordDecl(Obj1); + + auto *To0 = Import(From0, Lang_CXX); + auto *To1 = Import(From1, Lang_CXX); + + EXPECT_TRUE(To0); + EXPECT_TRUE(To1); + EXPECT_NE(To0, To1); + EXPECT_NE(To0->getCanonicalDecl(), To1->getCanonicalDecl()); +} + struct ImportFunctions : ASTImporterTestBase {}; TEST_P(ImportFunctions, Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -2082,6 +2082,9 @@ if (*Index1 != *Index2) continue; } + } else { +if (!IsStructuralMatch(D, FoundRecord, false)) + continue; } } Index: unittests/AST/ASTImporterTest.cpp === --- unittests/AST/ASTImporterTest.cpp +++ unittests/AST/ASTImporterTest.cpp @@ -1622,6 +1622,35 @@ .match(ToTU, classTemplateSpecializationDecl())); } +TEST_P(ASTImporterTestBase, ObjectsWithUnnamedStructType) { + Decl *FromTU = getTuDecl( + R"( + struct { int a; int b; } object0 = { 2, 3 }; + struct { int x; int y; int z; } object1; + )", + Lang_CXX, "input0.cc"); + + auto getRecordDecl = [](VarDecl *VD) { +auto *ET = cast(VD->getType().getTypePtr()); +return cast(ET->getNamedType().getTypePtr())->getDecl(); + }; + + auto *Obj0 = + FirstDeclMatcher().match(FromTU, varDecl(hasName("object0"))); + auto *From0 = getRecordDecl(Obj0); + auto *Obj1 = + FirstDeclMatcher().match(FromTU, varDecl(hasName("object1"))); + auto *From1 = getRecordDecl(Obj1); + + auto *To0 = Import(From0, Lang_CXX); + auto *To1 = Import(From1, Lang_CXX); + + EXPECT_TRUE(To0); + EXPECT_TRUE(To1); + EXPECT_NE(To0, To1); + EXPECT_NE(To0->getCanonicalDecl(), To1->getCanonicalDecl()); +} + struct ImportFunctions : ASTImporterTestBase {}; TEST_P(ImportFunctions, Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -2082,6 +2082,9 @@ if (*Index1 != *Index2) continue; } + } else { +if (!IsStructuralMatch(D, FoundRecord, false)) + continue; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48762: [clangd] codeComplete returns more structured completion items, LSP. NFC.
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE335980: [clangd] codeComplete returns more structured completion items, LSP. NFC. (authored by sammccall, committed by ). Changed prior to commit: https://reviews.llvm.org/D48762?vs=153493=153495#toc Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48762 Files: clangd/ClangdServer.cpp clangd/CodeComplete.cpp clangd/CodeComplete.h clangd/Protocol.h Index: clangd/ClangdServer.cpp === --- clangd/ClangdServer.cpp +++ clangd/ClangdServer.cpp @@ -165,11 +165,15 @@ // FIXME(ibiryukov): even if Preamble is non-null, we may want to check // both the old and the new version in case only one of them matches. -CompletionList Result = clangd::codeComplete( +CodeCompleteResult Result = clangd::codeComplete( File, IP->Command, PreambleData ? >Preamble : nullptr, PreambleData ? PreambleData->Inclusions : std::vector(), IP->Contents, Pos, FS, PCHs, CodeCompleteOpts); -CB(std::move(Result)); +CompletionList LSPResult; +LSPResult.isIncomplete = Result.HasMore; +for (const auto : Result.Completions) + LSPResult.items.push_back(Completion.render(CodeCompleteOpts)); +CB(std::move(LSPResult)); }; WorkScheduler.runWithPreamble("CodeComplete", File, Index: clangd/Protocol.h === --- clangd/Protocol.h +++ clangd/Protocol.h @@ -668,20 +668,6 @@ Snippet = 2, }; -/// Provides details for how a completion item was scored. -/// This can be used for client-side filtering of completion items as the -/// user keeps typing. -/// This is a clangd extension. -struct CompletionItemScores { - /// The score that items are ranked by. - /// This is filterScore * symbolScore. - float finalScore = 0.f; - /// How the partial identifier matched filterText. [0-1] - float filterScore = 0.f; - /// How the symbol fits, ignoring the partial identifier. - float symbolScore = 0.f; -}; - struct CompletionItem { /// The label of this completion item. By default also the text that is /// inserted when selecting this completion. @@ -702,9 +688,6 @@ /// When `falsy` the label is used. std::string sortText; - /// Details about the quality of this completion item. (clangd extension) - llvm::Optional scoreInfo; - /// A string that should be used when filtering a set of completion items. /// When `falsy` the label is used. std::string filterText; Index: clangd/CodeComplete.cpp === --- clangd/CodeComplete.cpp +++ clangd/CodeComplete.cpp @@ -43,7 +43,7 @@ #include // We log detailed candidate here if you run with -debug-only=codecomplete. -#define DEBUG_TYPE "codecomplete" +#define DEBUG_TYPE "CodeComplete" namespace clang { namespace clangd { @@ -237,138 +237,154 @@ return IndexResult->Detail->IncludeHeader; } - // Builds an LSP completion item. - CompletionItem build(StringRef FileName, const CompletionItemScores , - const CodeCompleteOptions , - CodeCompletionString *SemaCCS, - const IncludeInserter , - llvm::StringRef SemaDocComment) const { -assert(bool(SemaResult) == bool(SemaCCS)); -assert(SemaResult || IndexResult); - -CompletionItem I; -bool InsertingInclude = false; // Whether a new #include will be added. -if (SemaResult) { - llvm::StringRef Name(SemaCCS->getTypedText()); - std::string Signature, SnippetSuffix, Qualifiers; - getSignature(*SemaCCS, , , ); - I.label = (Qualifiers + Name + Signature).str(); - I.filterText = Name; - I.insertText = (Qualifiers + Name).str(); - if (Opts.EnableSnippets) -I.insertText += SnippetSuffix; - I.documentation = formatDocumentation(*SemaCCS, SemaDocComment); - I.detail = getReturnType(*SemaCCS); - if (SemaResult->Kind == CodeCompletionResult::RK_Declaration) -if (const auto *D = SemaResult->getDeclaration()) - if (const auto *ND = llvm::dyn_cast(D)) -I.SymbolScope = splitQualifiedName(printQualifiedName(*ND)).first; - I.kind = toCompletionItemKind(SemaResult->Kind, SemaResult->Declaration); -} -if (IndexResult) { - if (I.SymbolScope.empty()) -I.SymbolScope = IndexResult->Scope; - if (I.kind == CompletionItemKind::Missing) -I.kind = toCompletionItemKind(IndexResult->SymInfo.Kind); - // FIXME: reintroduce a way to show the index source for debugging. - if (I.label.empty()) -I.label = (IndexResult->Name + IndexResult->Signature).str(); - if (I.filterText.empty()) -I.filterText = IndexResult->Name; - - // FIXME(ioeric): support inserting/replacing scope qualifiers. - if (I.insertText.empty()) { -
[clang-tools-extra] r335980 - [clangd] codeComplete returns more structured completion items, LSP. NFC.
Author: sammccall Date: Fri Jun 29 07:47:57 2018 New Revision: 335980 URL: http://llvm.org/viewvc/llvm-project?rev=335980=rev Log: [clangd] codeComplete returns more structured completion items, LSP. NFC. Summary: LSP has some presentational fields with limited semantics (e.g. 'detail') and doesn't provide a good place to return information like namespace. Some places where more detailed information is useful: - tools like quality analysis - alternate frontends that aren't strictly LSP - code completion unit tests In this patch, ClangdServer::codeComplete still return LSP CompletionList, but I plan to switch that soon (should be a no-op for ClangdLSPServer). Deferring this makes it clear that we don't change behavior (tests stay the same) and also keeps the API break to a small patch which can be reverted. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, cfe-commits, jkorous Differential Revision: https://reviews.llvm.org/D48762 Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/clangd/CodeComplete.h clang-tools-extra/trunk/clangd/Protocol.h Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=335980=335979=335980=diff == --- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original) +++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Fri Jun 29 07:47:57 2018 @@ -165,11 +165,15 @@ void ClangdServer::codeComplete(PathRef // FIXME(ibiryukov): even if Preamble is non-null, we may want to check // both the old and the new version in case only one of them matches. -CompletionList Result = clangd::codeComplete( +CodeCompleteResult Result = clangd::codeComplete( File, IP->Command, PreambleData ? >Preamble : nullptr, PreambleData ? PreambleData->Inclusions : std::vector(), IP->Contents, Pos, FS, PCHs, CodeCompleteOpts); -CB(std::move(Result)); +CompletionList LSPResult; +LSPResult.isIncomplete = Result.HasMore; +for (const auto : Result.Completions) + LSPResult.items.push_back(Completion.render(CodeCompleteOpts)); +CB(std::move(LSPResult)); }; WorkScheduler.runWithPreamble("CodeComplete", File, Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=335980=335979=335980=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Fri Jun 29 07:47:57 2018 @@ -43,7 +43,7 @@ #include // We log detailed candidate here if you run with -debug-only=codecomplete. -#define DEBUG_TYPE "codecomplete" +#define DEBUG_TYPE "CodeComplete" namespace clang { namespace clangd { @@ -237,138 +237,154 @@ struct CompletionCandidate { return IndexResult->Detail->IncludeHeader; } - // Builds an LSP completion item. - CompletionItem build(StringRef FileName, const CompletionItemScores , - const CodeCompleteOptions , - CodeCompletionString *SemaCCS, - const IncludeInserter , - llvm::StringRef SemaDocComment) const { -assert(bool(SemaResult) == bool(SemaCCS)); -assert(SemaResult || IndexResult); - -CompletionItem I; -bool InsertingInclude = false; // Whether a new #include will be added. -if (SemaResult) { - llvm::StringRef Name(SemaCCS->getTypedText()); - std::string Signature, SnippetSuffix, Qualifiers; - getSignature(*SemaCCS, , , ); - I.label = (Qualifiers + Name + Signature).str(); - I.filterText = Name; - I.insertText = (Qualifiers + Name).str(); - if (Opts.EnableSnippets) -I.insertText += SnippetSuffix; - I.documentation = formatDocumentation(*SemaCCS, SemaDocComment); - I.detail = getReturnType(*SemaCCS); - if (SemaResult->Kind == CodeCompletionResult::RK_Declaration) -if (const auto *D = SemaResult->getDeclaration()) - if (const auto *ND = llvm::dyn_cast(D)) -I.SymbolScope = splitQualifiedName(printQualifiedName(*ND)).first; - I.kind = toCompletionItemKind(SemaResult->Kind, SemaResult->Declaration); -} -if (IndexResult) { - if (I.SymbolScope.empty()) -I.SymbolScope = IndexResult->Scope; - if (I.kind == CompletionItemKind::Missing) -I.kind = toCompletionItemKind(IndexResult->SymInfo.Kind); - // FIXME: reintroduce a way to show the index source for debugging. - if (I.label.empty()) -I.label = (IndexResult->Name + IndexResult->Signature).str(); - if (I.filterText.empty()) -I.filterText = IndexResult->Name; - - // FIXME(ioeric): support inserting/replacing
[PATCH] D48762: [clangd] codeComplete returns more structured completion items, LSP. NFC.
ioeric accepted this revision. ioeric added a comment. This revision is now accepted and ready to land. lgtm Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits