[libcxx] r300530 - Update google benchmark
Author: ericwf Date: Tue Apr 18 02:17:20 2017 New Revision: 300530 URL: http://llvm.org/viewvc/llvm-project?rev=300530&view=rev Log: Update google benchmark Added: libcxx/trunk/utils/google-benchmark/cmake/Config.cmake.in libcxx/trunk/utils/google-benchmark/docs/ libcxx/trunk/utils/google-benchmark/docs/tools.md libcxx/trunk/utils/google-benchmark/mingw.py libcxx/trunk/utils/google-benchmark/src/counter.cc libcxx/trunk/utils/google-benchmark/src/counter.h Modified: libcxx/trunk/utils/google-benchmark/AUTHORS libcxx/trunk/utils/google-benchmark/CMakeLists.txt libcxx/trunk/utils/google-benchmark/CONTRIBUTORS libcxx/trunk/utils/google-benchmark/README.md libcxx/trunk/utils/google-benchmark/cmake/AddCXXCompilerFlag.cmake libcxx/trunk/utils/google-benchmark/cmake/CXXFeatureCheck.cmake libcxx/trunk/utils/google-benchmark/include/benchmark/benchmark_api.h libcxx/trunk/utils/google-benchmark/include/benchmark/reporter.h libcxx/trunk/utils/google-benchmark/src/CMakeLists.txt libcxx/trunk/utils/google-benchmark/src/benchmark.cc libcxx/trunk/utils/google-benchmark/src/benchmark_api_internal.h libcxx/trunk/utils/google-benchmark/src/benchmark_register.cc libcxx/trunk/utils/google-benchmark/src/complexity.cc libcxx/trunk/utils/google-benchmark/src/console_reporter.cc libcxx/trunk/utils/google-benchmark/src/csv_reporter.cc libcxx/trunk/utils/google-benchmark/src/cycleclock.h libcxx/trunk/utils/google-benchmark/src/internal_macros.h libcxx/trunk/utils/google-benchmark/src/json_reporter.cc libcxx/trunk/utils/google-benchmark/src/re.h libcxx/trunk/utils/google-benchmark/src/sleep.cc libcxx/trunk/utils/google-benchmark/src/sleep.h libcxx/trunk/utils/google-benchmark/src/string_util.cc libcxx/trunk/utils/google-benchmark/src/sysinfo.cc libcxx/trunk/utils/google-benchmark/src/timers.cc libcxx/trunk/utils/google-benchmark/test/CMakeLists.txt libcxx/trunk/utils/google-benchmark/test/benchmark_test.cc libcxx/trunk/utils/google-benchmark/test/cxx03_test.cc libcxx/trunk/utils/google-benchmark/test/diagnostics_test.cc libcxx/trunk/utils/google-benchmark/test/options_test.cc libcxx/trunk/utils/google-benchmark/test/output_test_helper.cc libcxx/trunk/utils/google-benchmark/test/reporter_output_test.cc libcxx/trunk/utils/google-benchmark/tools/compare_bench.py libcxx/trunk/utils/google-benchmark/tools/gbench/Inputs/test1_run1.json libcxx/trunk/utils/google-benchmark/tools/gbench/Inputs/test1_run2.json libcxx/trunk/utils/google-benchmark/tools/gbench/report.py libcxx/trunk/utils/google-benchmark/tools/gbench/util.py Modified: libcxx/trunk/utils/google-benchmark/AUTHORS URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/google-benchmark/AUTHORS?rev=300530&r1=300529&r2=300530&view=diff == --- libcxx/trunk/utils/google-benchmark/AUTHORS (original) +++ libcxx/trunk/utils/google-benchmark/AUTHORS Tue Apr 18 02:17:20 2017 @@ -18,12 +18,15 @@ Eugene Zhuk Evgeny Safronov Felix Homann Google Inc. +International Business Machines Corporation Ismael Jimenez Martinez +Joao Paulo Magalhaes JianXiong Zhou Jussi Knuuttila Kaito Udagawa Lei Xu Matt Clarkson +Maxim Vafin Nick Hutchinson Oleksandr Sochka Paul Redmond Modified: libcxx/trunk/utils/google-benchmark/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/google-benchmark/CMakeLists.txt?rev=300530&r1=300529&r2=300530&view=diff == --- libcxx/trunk/utils/google-benchmark/CMakeLists.txt (original) +++ libcxx/trunk/utils/google-benchmark/CMakeLists.txt Tue Apr 18 02:17:20 2017 @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.11) +cmake_minimum_required (VERSION 2.8.12) project (benchmark) foreach(p @@ -11,8 +11,11 @@ foreach(p endforeach() option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON) +option(BENCHMARK_ENABLE_EXCEPTIONS "Enable the use of exceptions in the benchmark library." ON) option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark library." OFF) option(BENCHMARK_USE_LIBCXX "Build and test using libc++ as the standard library." OFF) +option(BENCHMARK_BUILD_32_BITS "Build a 32 bit version of the library" OFF) + # Make sure we can import out CMake functions list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -33,12 +36,20 @@ include(CheckCXXCompilerFlag) include(AddCXXCompilerFlag) include(CXXFeatureCheck) +if (BENCHMARK_BUILD_32_BITS) + add_required_cxx_compiler_flag(-m32) +endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Turn compiler warnings up to 11 string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") add_definitions(-D_CRT_SECURE_
[PATCH] D30863: [clang-format] make docs/tools/{dump_format_style.py, dump_ast_matchers.py} flake8 compliant
sylvestre.ledru added a comment. Manuel, ping? https://reviews.llvm.org/D30863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300533 - Emit benchmark tests into the benchmarks build directory, not lib/
Author: ericwf Date: Tue Apr 18 02:40:22 2017 New Revision: 300533 URL: http://llvm.org/viewvc/llvm-project?rev=300533&view=rev Log: Emit benchmark tests into the benchmarks build directory, not lib/ Modified: libcxx/trunk/benchmarks/CMakeLists.txt Modified: libcxx/trunk/benchmarks/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/benchmarks/CMakeLists.txt?rev=300533&r1=300532&r2=300533&view=diff == --- libcxx/trunk/benchmarks/CMakeLists.txt (original) +++ libcxx/trunk/benchmarks/CMakeLists.txt Tue Apr 18 02:40:22 2017 @@ -63,7 +63,7 @@ endif() # Benchmark tests configuration #== add_custom_target(cxx-benchmarks) - +set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) set(BENCHMARK_TEST_COMPILE_FLAGS @@ -111,6 +111,7 @@ macro(add_benchmark_test name source_fil set_target_properties(${libcxx_target} PROPERTIES OUTPUT_NAME "${name}.libcxx.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}") if (LIBCXX_BENCHMARK_NATIVE_STDLIB) @@ -131,6 +132,7 @@ macro(add_benchmark_test name source_fil set_target_properties(${native_target} PROPERTIES OUTPUT_NAME "${name}.native.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" INCLUDE_DIRECTORIES "" COMPILE_FLAGS "${BENCHMARK_TEST_NATIVE_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_NATIVE_LINK_FLAGS}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31976: Avoid assert when a non-static member function is qualified with __unaligned
rogfer01 added a comment. `clang::Sema::IsOverload` explicitly forbids the `__restrict` case for the qualifier of non-static member functions. I assume `__unaligned` is not forbidden because the MSVC ABI does encode this qualifier while the Itanium ABI currently does not. This patch just makes the attached test case fail like the one below: // Compile with"-target x86_64-unknown-linux-gnu -x c++ -fms-extensions" // and compare it with "-target x86_64-pc-windows-msvc -x c++ -fms-extensions" void foo(__unaligned int* a) { } void foo(int *a) { } Regards. https://reviews.llvm.org/D31976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r300534 - [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
Author: hokein Date: Tue Apr 18 02:46:39 2017 New Revision: 300534 URL: http://llvm.org/viewvc/llvm-project?rev=300534&view=rev Log: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations Summary: The "performance-inefficient-vector-operation" check finds vector oprations in for-loop statements which may cause multiple memory reallocations. This is the first version, only detects typical for-loop: ``` std::vector v; for (int i = 0; i < n; ++i) { v.push_back(i); } // or for (int i = 0; i < v2.size(); ++i) { v.push_back(v2[i]); } ``` We can extend it to handle more cases like for-range loop in the future. Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: zaks.anna, Eugene.Zelenko, mgorny, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D31757 Added: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Modified: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt?rev=300534&r1=300533&r2=300534&view=diff == --- clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt Tue Apr 18 02:46:39 2017 @@ -5,6 +5,7 @@ add_clang_library(clangTidyPerformanceMo ForRangeCopyCheck.cpp ImplicitCastInLoopCheck.cpp InefficientStringConcatenationCheck.cpp + InefficientVectorOperationCheck.cpp PerformanceTidyModule.cpp TypePromotionInMathFnCheck.cpp UnnecessaryCopyInitialization.cpp Added: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp?rev=300534&view=auto == --- clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp Tue Apr 18 02:46:39 2017 @@ -0,0 +1,149 @@ +//===--- InefficientVectorOperationCheck.cpp - clang-tidy--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "InefficientVectorOperationCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Lexer.h" +#include "../utils/DeclRefExprUtils.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace performance { + +namespace { + +// Matcher names. Given the code: +// +// \code +// void f() { +// vector v; +// for (int i = 0; i < 10 + 1; ++i) { +// v.push_back(i); +// } +// } +// \endcode +// +// The matcher names are bound to following parts of the AST: +// - LoopName: The entire for loop (as ForStmt). +// - LoopParentName: The body of function f (as CompoundStmt). +// - VectorVarDeclName: 'v' in (as VarDecl). +// - VectorVarDeclStmatName: The entire 'std::vector v;' statement (as +// DeclStmt). +// - PushBackCallName: 'v.push_back(i)' (as cxxMemberCallExpr). +// - LoopInitVarName: 'i' (as VarDecl). +// - LoopEndExpr: '10+1' (as Expr). +static const char LoopCounterName[] = "for_loop_counter"; +static const char LoopParentName[] = "loop_parent"; +static const char VectorVarDeclName[] = "vector_var_decl"; +static const char VectorVarDeclStmtName[] = "vector_var_decl_stmt"; +static const char PushBackCallName[] = "push_back_call"; + +static const char LoopInitVarName[] = "loop_init_var"; +static const char LoopEndExprName[] = "loop_end_expr"; + +} // namespace + +void InefficientVectorOperationCheck::registerMatchers(MatchFinder *Finder) { + const auto VectorDecl = cxxRecordDecl(hasName("::std::vector")); + const auto VectorDefaultConstructorCall = cxxConstructExpr( + hasType(VectorDecl), + hasDeclaration(cxxConstructorDecl(isDefaultConstructor(; + const auto VectorVarDecl = + varDecl(hasInitializer(VectorDefaultConstructorCall)) + .bind(VectorVarDeclName); + const auto PushBackCallExpr = +
[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
This revision was automatically updated to reflect the committed changes. Closed by commit rL300534: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations (authored by hokein). Changed prior to commit: https://reviews.llvm.org/D31757?vs=95338&id=95534#toc Repository: rL LLVM https://reviews.llvm.org/D31757 Files: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.h clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst clang-tools-extra/trunk/docs/clang-tidy/checks/performance-inefficient-vector-operation.rst clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Index: clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp === --- clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp +++ clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp @@ -0,0 +1,183 @@ +// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm -- + +typedef int size_t; + +namespace std { +template +class vector { + public: + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef size_t size_type; + + explicit vector(); + explicit vector(size_type n); + + void push_back(const T& val); + void reserve(size_t n); + void resize(size_t n); + + size_t size(); + const_reference operator[] (size_type) const; + reference operator[] (size_type); +}; +} // namespace std + +void f(std::vector& t) { + { +std::vector v; +// CHECK-FIXES: v.reserve(10); +for (int i = 0; i < 10; ++i) + v.push_back(i); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called inside a loop; consider pre-allocating the vector capacity before the loop + } + { +std::vector v; +// CHECK-FIXES: v.reserve(10); +for (int i = 0; i < 10; i++) + v.push_back(i); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called + } + { +std::vector v; +// CHECK-FIXES: v.reserve(10); +for (int i = 0; i < 10; ++i) + v.push_back(0); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called + } + { +std::vector v; +// CHECK-FIXES: v.reserve(5); +for (int i = 0; i < 5; ++i) { + v.push_back(i); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called +} +// CHECK-FIXES-NOT: v.reserve(10); +for (int i = 0; i < 10; ++i) { + // No fix for this loop as we encounter the prior loops. + v.push_back(i); +} + } + { +std::vector v; +std::vector v2; +v2.reserve(3); +// CHECK-FIXES: v.reserve(10); +for (int i = 0; i < 10; ++i) + v.push_back(i); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called + } + { +std::vector v; +// CHECK-FIXES: v.reserve(t.size()); +for (size_t i = 0; i < t.size(); ++i) { + v.push_back(t[i]); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called +} + } + { +std::vector v; +// CHECK-FIXES: v.reserve(t.size() - 1); +for (size_t i = 0; i < t.size() - 1; ++i) { + v.push_back(t[i]); +} // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called + } + + // Non-fixed Cases + { +std::vector v; +v.reserve(20); +// CHECK-FIXES-NOT: v.reserve(10); +// There is a "reserve" call already. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v; +v.reserve(5); +// CHECK-FIXES-NOT: v.reserve(10); +// There is a "reserve" call already. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v; +v.resize(5); +// CHECK-FIXES-NOT: v.reserve(10); +// There is a ref usage of v before the loop. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v; +v.push_back(0); +// CHECK-FIXES-NOT: v.reserve(10); +// There is a ref usage of v before the loop. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v; +f(v); +// CHECK-FIXES-NOT: v.reserve(10); +// There is a ref usage of v before the loop. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v(20); +// CHECK-FIXES-NOT: v.reserve(10); +// v is not constructed with default constructor. +for (int i = 0; i < 10; ++i) { + v.push_back(i); +} + } + { +std::vector v; +// CHECK-FIXES-NOT: v.reserve(10); +// For-loop is not started with 0. +
[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
hokein added a comment. @alexfh, I'm submitting the patch now. If you have following comments, I'm happy to address them afterwards. Repository: rL LLVM https://reviews.llvm.org/D31757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32144: [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
adamf added a comment. !MD->getParent()->getDescribedClassTemplate() looks like redundant now. This check is already done in isDependentContext. https://reviews.llvm.org/D32144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width
danielmarjamaki added a comment. Ping Repository: rL LLVM https://reviews.llvm.org/D31029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls
danielmarjamaki added a comment. I would recommend that this is either fixed soon or that we commit my changes so it can be implemented more properly later. Right now users will see false positives. Repository: rL LLVM https://reviews.llvm.org/D31097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
xiangzhai added a comment. Hi Artem, If it looks good to you, I want to try commit by myself for testing commit, thanks! Regards, Leslie Zhai Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32144: [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
arphaman accepted this revision. arphaman added a comment. This revision is now accepted and ready to land. I agree with Adam, the old check is now redundant. LGTM after removing it. Comment at: test/CoverageMapping/pr32679.cpp:2 +// RUN: %clang_cc1 -cc1 -triple i686-pc-windows-msvc19.0.0 -emit-obj -fprofile-instrument=clang -std=c++14 -fdelayed-template-parsing -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name pr32679.cpp -o - %s | FileCheck %s -check-prefix=MSABI -implicit-check-not=f2 +// RUN: %clang_cc1 -cc1 -triple %itanium_abi_triple -emit-obj -fprofile-instrument=clang -std=c++14 -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name pr32679.cpp -o - %s | FileCheck %s -check-prefix=ITANIUM -implicit-check-not=f2 + Interesting, I didn't know about `-implicit-check-not`. Looks useful though. https://reviews.llvm.org/D32144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30489: [analyzer] catch out of bounds for VLA
danielmarjamaki added a comment. I would propose that I rename and cleanup RangeConstraintManager::uglyEval() and add it. When I tested it, the Z3 does not seem to handle this. Repository: rL LLVM https://reviews.llvm.org/D30489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r299226 - [Modules][PCH] Serialize #pragma pack
Thanks Duncan! On 15 April 2017 at 01:25, Duncan P. N. Exon Smith wrote: > FYI, I reverted the modules side of this in r300380. For details, see the > commit message. TL;DR: this didn't actually make modules builds closer to > matching non-modules builds, thanks to how submodules work; on the > contrary, it made them diverge. > > > On 2017-Mar-31, at 08:36, Alex Lorenz via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > > Author: arphaman > > Date: Fri Mar 31 10:36:21 2017 > > New Revision: 299226 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=299226&view=rev > > Log: > > [Modules][PCH] Serialize #pragma pack > > > > This patch serializes the state of #pragma pack. It preserves the state > of the > > pragma from a PCH/from modules in a file that uses that PCH/those > modules. > > > > > rdar://21359084 > > > > Differential Revision: https://reviews.llvm.org/D31241 > > > > Added: > >cfe/trunk/test/Modules/Inputs/pragma_pack_push.h > >cfe/trunk/test/Modules/Inputs/pragma_pack_reset_push.h > >cfe/trunk/test/Modules/Inputs/pragma_pack_set.h > >cfe/trunk/test/Modules/pragma-pack.c > >cfe/trunk/test/PCH/pragma-pack.c > > Modified: > >cfe/trunk/include/clang/Serialization/ASTBitCodes.h > >cfe/trunk/include/clang/Serialization/ASTReader.h > >cfe/trunk/include/clang/Serialization/ASTWriter.h > >cfe/trunk/lib/Sema/SemaAttr.cpp > >cfe/trunk/lib/Serialization/ASTReader.cpp > >cfe/trunk/lib/Serialization/ASTWriter.cpp > >cfe/trunk/test/Modules/Inputs/module.map > > > > Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Serialization/ASTBitCodes.h?rev=299226&r1=299225&r2=299226&view=diff > > > == > > --- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original) > > +++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Fri Mar 31 > 10:36:21 2017 > > @@ -604,6 +604,9 @@ namespace clang { > > OPENCL_EXTENSION_DECLS = 59, > > > > MODULAR_CODEGEN_DECLS = 60, > > + > > + /// \brief Record code for \#pragma pack options. > > + PACK_PRAGMA_OPTIONS = 61, > > }; > > > > /// \brief Record types used within a source manager block. > > > > Modified: cfe/trunk/include/clang/Serialization/ASTReader.h > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Serialization/ASTReader.h?rev=299226&r1=299225&r2=299226&view=diff > > > == > > --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) > > +++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Mar 31 > 10:36:21 2017 > > @@ -811,6 +811,17 @@ private: > > int PragmaMSPointersToMembersState = -1; > > SourceLocation PointersToMembersPragmaLocation; > > > > + /// \brief The pragma pack state. > > + Optional PragmaPackCurrentValue; > > + SourceLocation PragmaPackCurrentLocation; > > + struct PragmaPackStackEntry { > > +unsigned Value; > > +SourceLocation Location; > > +StringRef SlotLabel; > > + }; > > + llvm::SmallVector PragmaPackStack; > > + llvm::SmallVector PragmaPackStrings; > > + > > /// \brief The OpenCL extension settings. > > OpenCLOptions OpenCLExtensions; > > > > > > Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Serialization/ASTWriter.h?rev=299226&r1=299225&r2=299226&view=diff > > > == > > --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) > > +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Mar 31 > 10:36:21 2017 > > @@ -485,6 +485,7 @@ private: > > void WriteOptimizePragmaOptions(Sema &SemaRef); > > void WriteMSStructPragmaOptions(Sema &SemaRef); > > void WriteMSPointersToMembersPragmaOptions(Sema &SemaRef); > > + void WritePackPragmaOptions(Sema &SemaRef); > > void WriteModuleFileExtension(Sema &SemaRef, > > ModuleFileExtensionWriter &Writer); > > > > > > Modified: cfe/trunk/lib/Sema/SemaAttr.cpp > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ > SemaAttr.cpp?rev=299226&r1=299225&r2=299226&view=diff > > > == > > --- cfe/trunk/lib/Sema/SemaAttr.cpp (original) > > +++ cfe/trunk/lib/Sema/SemaAttr.cpp Fri Mar 31 10:36:21 2017 > > @@ -215,6 +215,7 @@ void Sema::PragmaStack::Act(S > >ValueType Value) { > > if (Action == PSK_Reset) { > > CurrentValue = DefaultValue; > > +CurrentPragmaLocation = PragmaLocation; > > return; > > } > > if (Action & PSK_Push) > > > > Modified: cfe/trunk/lib/Serialization/ASTReader.cpp > > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ > Serialization/ASTReader.cpp?rev=299226&r1=2992
[PATCH] D31739: Add markup for libc++ dylib availability
arphaman added inline comments. Comment at: include/__config:1160 + +#endif // _LIBCPP_CONFIG Redundant whitespace added? Comment at: utils/libcxx/test/config.py:358 +def add_deployement_feature(self, feature): +(arch, name, version) = self.config.deployment Typo: `add_deployment_feature` https://reviews.llvm.org/D31739 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc
sanwou01 updated this revision to Diff 95541. sanwou01 added a comment. Rebased and clang-formatted. https://reviews.llvm.org/D31709 Files: include/clang/Basic/SourceLocation.h include/clang/Frontend/DiagnosticRenderer.h include/clang/Frontend/TextDiagnostic.h lib/Basic/SourceLocation.cpp lib/Frontend/DiagnosticRenderer.cpp lib/Frontend/SerializedDiagnosticPrinter.cpp lib/Frontend/TextDiagnostic.cpp lib/Frontend/TextDiagnosticPrinter.cpp tools/libclang/CIndexDiagnostic.cpp Index: tools/libclang/CIndexDiagnostic.cpp === --- tools/libclang/CIndexDiagnostic.cpp +++ tools/libclang/CIndexDiagnostic.cpp @@ -110,40 +110,34 @@ CurrentSet = &CD.getChildDiagnostics(); } - void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, + void emitDiagnosticMessage(FullSourceLoc Loc, PresumedLoc PLoc, + DiagnosticsEngine::Level Level, StringRef Message, ArrayRef Ranges, - const SourceManager *SM, DiagOrStoredDiag D) override { if (!D.isNull()) return; CXSourceLocation L; -if (SM) - L = translateSourceLocation(*SM, LangOpts, Loc); +if (Loc.hasManager()) + L = translateSourceLocation(Loc.getManager(), LangOpts, Loc); else L = clang_getNullLocation(); CurrentSet->appendDiagnostic( llvm::make_unique(Message, L)); } - void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, + void emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level, - ArrayRef Ranges, - const SourceManager &SM) override {} + ArrayRef Ranges) override {} - void emitCodeContext(SourceLocation Loc, - DiagnosticsEngine::Level Level, - SmallVectorImpl& Ranges, - ArrayRef Hints, - const SourceManager &SM) override {} + void emitCodeContext(FullSourceLoc Loc, DiagnosticsEngine::Level Level, + SmallVectorImpl &Ranges, + ArrayRef Hints) override {} - void emitNote(SourceLocation Loc, StringRef Message, -const SourceManager *SM) override { + void emitNote(FullSourceLoc Loc, StringRef Message) override { CXSourceLocation L; -if (SM) - L = translateSourceLocation(*SM, LangOpts, Loc); +if (Loc.hasManager()) + L = translateSourceLocation(Loc.getManager(), LangOpts, Loc); else L = clang_getNullLocation(); CurrentSet->appendDiagnostic( Index: lib/Frontend/TextDiagnosticPrinter.cpp === --- lib/Frontend/TextDiagnosticPrinter.cpp +++ lib/Frontend/TextDiagnosticPrinter.cpp @@ -150,10 +150,9 @@ "Unexpected diagnostic with no source manager"); assert(TextDiag && "Unexpected diagnostic outside source file processing"); - TextDiag->emitDiagnostic(Info.getLocation(), Level, DiagMessageStream.str(), - Info.getRanges(), - Info.getFixItHints(), - &Info.getSourceManager()); + TextDiag->emitDiagnostic( + FullSourceLoc(Info.getLocation(), Info.getSourceManager()), Level, + DiagMessageStream.str(), Info.getRanges(), Info.getFixItHints()); OS.flush(); } Index: lib/Frontend/TextDiagnostic.cpp === --- lib/Frontend/TextDiagnostic.cpp +++ lib/Frontend/TextDiagnostic.cpp @@ -672,20 +672,16 @@ TextDiagnostic::~TextDiagnostic() {} -void -TextDiagnostic::emitDiagnosticMessage(SourceLocation Loc, - PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, - ArrayRef Ranges, - const SourceManager *SM, - DiagOrStoredDiag D) { +void TextDiagnostic::emitDiagnosticMessage( +FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level, +StringRef Message, ArrayRef Ranges, +DiagOrStoredDiag D) { uint64_t StartOfLocationInfo = OS.tell(); // Emit the location of this particular diagnostic. if (Loc.isValid()) -emitDiagnosticLoc(Loc, PLoc, Level, Ranges, *SM); - +emitDiagnosticLoc(Loc, PLoc, Level, Ranges); + if (DiagOpts->ShowColors) OS.resetColor(); @@ -787,17 +783,16 @@ /// This includes extracting as much location information as is present for /// the diagnostic and printing it, as well as any include stack or source /// ranges necessary. -void TextDiagnosti
[PATCH] D32132: [AArch64][clang] Pass cpu/arch information to assembler for AArch64.
rengolin accepted this revision. rengolin added a comment. This revision is now accepted and ready to land. Silly omission. LGTM. Thanks! https://reviews.llvm.org/D32132 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32159: [NFC] Move ParseDiagnosticArgs into Frontend
sanwou01 created this revision. Herald added subscribers: mgorny, klimek. https://reviews.llvm.org/D32159 Files: include/clang/Frontend/CompilerInvocation.h include/clang/Frontend/DiagnosticOptions.h lib/Frontend/CMakeLists.txt lib/Frontend/CompilerInvocation.cpp lib/Frontend/DiagnosticOptions.cpp lib/Tooling/Tooling.cpp tools/driver/cc1as_main.cpp tools/driver/driver.cpp Index: tools/driver/driver.cpp === --- tools/driver/driver.cpp +++ tools/driver/driver.cpp @@ -20,6 +20,7 @@ #include "clang/Driver/ToolChain.h" #include "clang/Frontend/ChainedDiagnosticConsumer.h" #include "clang/Frontend/CompilerInvocation.h" +#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/SerializedDiagnosticPrinter.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -16,6 +16,7 @@ #include "clang/Basic/DiagnosticOptions.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" +#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" @@ -209,6 +210,8 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); + ParseDiagnosticArgs(Diags.getDiagnosticOptions(), Args, &Diags, false, false); + // Frontend Options if (Args.hasArg(OPT_INPUT)) { bool First = true; Index: lib/Tooling/Tooling.cpp === --- lib/Tooling/Tooling.cpp +++ lib/Tooling/Tooling.cpp @@ -20,6 +20,7 @@ #include "clang/Driver/ToolChain.h" #include "clang/Frontend/ASTUnit.h" #include "clang/Frontend/CompilerInstance.h" +#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Lex/PreprocessorOptions.h" Index: lib/Frontend/DiagnosticOptions.cpp === --- /dev/null +++ lib/Frontend/DiagnosticOptions.cpp @@ -0,0 +1,230 @@ +//===--- DiagnosticOptions.cpp - Diagnostic option handling ---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "clang/Frontend/DiagnosticOptions.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticOptions.h" +#include "clang/Driver/DriverDiagnostic.h" +#include "clang/Driver/Options.h" +#include "clang/Frontend/Utils.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" +#include "llvm/Option/Option.h" +#include "llvm/Support/Process.h" + +using namespace clang::driver; +using namespace llvm::opt; +using namespace clang::driver; +using namespace clang::driver::options; + +namespace { +using namespace clang; + +static void addDiagnosticArgs(const ArgList &Args, OptSpecifier Group, + OptSpecifier GroupWithValue, + std::vector &Diagnostics) { + for (Arg *A : Args.filtered(Group)) { +if (A->getOption().getKind() == Option::FlagClass) { + // The argument is a pure flag (such as OPT_Wall or OPT_Wdeprecated). Add + // its name (minus the "W" or "R" at the beginning) to the warning list. + Diagnostics.push_back(A->getOption().getName().drop_front(1)); +} else if (A->getOption().matches(GroupWithValue)) { + // This is -Wfoo= or -Rfoo=, where foo is the name of the diagnostic + // group. + Diagnostics.push_back(A->getOption().getName().drop_front(1).rtrim("=-")); +} else { + // Otherwise, add its value (for OPT_W_Joined and similar). + for (const char *Arg : A->getValues()) +Diagnostics.emplace_back(Arg); +} + } +} + +static bool parseDiagnosticLevelMask(StringRef FlagName, + const std::vector &Levels, + DiagnosticsEngine *Diags, + DiagnosticLevelMask &M) { + bool Success = true; + for (const auto &Level : Levels) { +DiagnosticLevelMask const PM = +llvm::StringSwitch(Level) +.Case("note", DiagnosticLevelMask::Note) +.Case("remark", DiagnosticLevelMask::Remark) +.Case("warning", DiagnosticLevelMask::Warning) +.Case("error", DiagnosticLevelMask::Error) +.Default(DiagnosticLevelMask::None); +if (PM == DiagnosticLevelMask::None) { +
r300540 - [TableGen] Fix MSVC warning that occurs in TableGen generated function
Author: arphaman Date: Tue Apr 18 04:59:27 2017 New Revision: 300540 URL: http://llvm.org/viewvc/llvm-project?rev=300540&view=rev Log: [TableGen] Fix MSVC warning that occurs in TableGen generated function This should fix the Windows buildbot failure that happened after r300539. Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=300540&r1=300539&r2=300540&view=diff == --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original) +++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Apr 18 04:59:27 2017 @@ -3167,7 +3167,9 @@ emitAttributeMatchRules(PragmaClangAttri } OS << ";\n"; } - OS << " }\n}\n\n"; + OS << " }\n"; + OS << " llvm_unreachable(\"Invalid match rule\");\n"; + OS << "}\n\n"; } static void GenerateDefaultLangOptRequirements(raw_ostream &OS) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300542 - Fix one more 'not all control paths return a value' MSVC warning
Author: arphaman Date: Tue Apr 18 05:17:41 2017 New Revision: 300542 URL: http://llvm.org/viewvc/llvm-project?rev=300542&view=rev Log: Fix one more 'not all control paths return a value' MSVC warning The warning was caused by r300539. Modified: cfe/trunk/lib/Parse/ParsePragma.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Modified: cfe/trunk/lib/Parse/ParsePragma.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=300542&r1=300541&r2=300542&view=diff == --- cfe/trunk/lib/Parse/ParsePragma.cpp (original) +++ cfe/trunk/lib/Parse/ParsePragma.cpp Tue Apr 18 05:17:41 2017 @@ -1014,6 +1014,8 @@ static bool isAbstractAttrMatcherRule(at return IsAbstract; #include "clang/Basic/AttrSubMatchRulesList.inc" } + llvm_unreachable("Invalid attribute subject match rule"); + return false; } static void diagnoseExpectedAttributeSubjectSubRule( Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=300542&r1=300541&r2=300542&view=diff == --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original) +++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Apr 18 05:17:41 2017 @@ -3168,7 +3168,7 @@ emitAttributeMatchRules(PragmaClangAttri OS << ";\n"; } OS << " }\n"; - OS << " llvm_unreachable(\"Invalid match rule\");\n"; + OS << " llvm_unreachable(\"Invalid match rule\");\nreturn false;\n"; OS << "}\n\n"; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23610: [ARM] Add pre-defined macros for ROPI and RWPI
olista01 added a comment. Ping. Repository: rL LLVM https://reviews.llvm.org/D23610 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31501: [RFC] Integrate clang -cc1as diagnostics into DiagnosticsEngine
sanwou01 updated this revision to Diff 95548. sanwou01 added a comment. Herald added subscribers: mgorny, klimek. Rebase on top of https://reviews.llvm.org/D31709 and https://reviews.llvm.org/D32159 https://reviews.llvm.org/D31501 Files: include/clang/Basic/Diagnostic.h include/clang/Basic/SourceLocation.h include/clang/Driver/Options.h include/clang/Driver/Options.td include/clang/Frontend/CompilerInvocation.h include/clang/Frontend/DiagnosticOptions.h include/clang/Frontend/DiagnosticRenderer.h include/clang/Frontend/TextDiagnostic.h lib/Basic/SourceLocation.cpp lib/Driver/DriverOptions.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/CMakeLists.txt lib/Frontend/CompilerInvocation.cpp lib/Frontend/DiagnosticOptions.cpp lib/Frontend/DiagnosticRenderer.cpp lib/Frontend/SerializedDiagnosticPrinter.cpp lib/Frontend/TextDiagnostic.cpp lib/Frontend/TextDiagnosticPrinter.cpp lib/Tooling/Tooling.cpp test/Driver/asm-diags.s tools/driver/cc1as_main.cpp tools/driver/driver.cpp tools/libclang/CIndexDiagnostic.cpp Index: tools/libclang/CIndexDiagnostic.cpp === --- tools/libclang/CIndexDiagnostic.cpp +++ tools/libclang/CIndexDiagnostic.cpp @@ -110,40 +110,34 @@ CurrentSet = &CD.getChildDiagnostics(); } - void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc, - DiagnosticsEngine::Level Level, - StringRef Message, + void emitDiagnosticMessage(UnifiedSourceLoc Loc, UnifiedPLoc PLoc, + DiagnosticsEngine::Level Level, StringRef Message, ArrayRef Ranges, - const SourceManager *SM, DiagOrStoredDiag D) override { if (!D.isNull()) return; CXSourceLocation L; -if (SM) - L = translateSourceLocation(*SM, LangOpts, Loc); +if (Loc.hasManager()) + L = translateSourceLocation(Loc.getManager(), LangOpts, Loc); else L = clang_getNullLocation(); CurrentSet->appendDiagnostic( llvm::make_unique(Message, L)); } - void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, + void emitDiagnosticLoc(UnifiedSourceLoc Loc, UnifiedPLoc PLoc, DiagnosticsEngine::Level Level, - ArrayRef Ranges, - const SourceManager &SM) override {} + ArrayRef Ranges) override {} - void emitCodeContext(SourceLocation Loc, - DiagnosticsEngine::Level Level, - SmallVectorImpl& Ranges, - ArrayRef Hints, - const SourceManager &SM) override {} + void emitCodeContext(UnifiedSourceLoc Loc, DiagnosticsEngine::Level Level, + SmallVectorImpl &Ranges, + ArrayRef Hints) override {} - void emitNote(SourceLocation Loc, StringRef Message, -const SourceManager *SM) override { + void emitNote(UnifiedSourceLoc Loc, StringRef Message) override { CXSourceLocation L; -if (SM) - L = translateSourceLocation(*SM, LangOpts, Loc); +if (Loc.hasManager()) + L = translateSourceLocation(Loc.getManager(), LangOpts, Loc); else L = clang_getNullLocation(); CurrentSet->appendDiagnostic( Index: tools/driver/driver.cpp === --- tools/driver/driver.cpp +++ tools/driver/driver.cpp @@ -20,6 +20,7 @@ #include "clang/Driver/ToolChain.h" #include "clang/Frontend/ChainedDiagnosticConsumer.h" #include "clang/Frontend/CompilerInvocation.h" +#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/SerializedDiagnosticPrinter.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -14,8 +14,13 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticOptions.h" +#include "clang/Basic/FileManager.h" +#include "clang/Basic/FileSystemOptions.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/SourceManager.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" +#include "clang/Frontend/DiagnosticOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/Utils.h" @@ -45,6 +50,7 @@ #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetRegistry.h" @@ -209,6 +215,8 @@ Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); Opts.Main
[PATCH] D31501: [diagnostics] Integrate clang -cc1as diagnostics into DiagnosticsEngine
sanwou01 updated this revision to Diff 95549. sanwou01 added a comment. Don't include the changes from https://reviews.llvm.org/D31709 and https://reviews.llvm.org/D32159 in this patch (oops). https://reviews.llvm.org/D31501 Files: include/clang/Basic/Diagnostic.h include/clang/Basic/SourceLocation.h include/clang/Driver/Options.h include/clang/Driver/Options.td include/clang/Frontend/DiagnosticRenderer.h include/clang/Frontend/TextDiagnostic.h lib/Basic/SourceLocation.cpp lib/Driver/DriverOptions.cpp lib/Driver/ToolChains/Clang.cpp lib/Frontend/DiagnosticRenderer.cpp lib/Frontend/SerializedDiagnosticPrinter.cpp lib/Frontend/TextDiagnostic.cpp lib/Frontend/TextDiagnosticPrinter.cpp test/Driver/asm-diags.s tools/driver/cc1as_main.cpp tools/libclang/CIndexDiagnostic.cpp Index: tools/libclang/CIndexDiagnostic.cpp === --- tools/libclang/CIndexDiagnostic.cpp +++ tools/libclang/CIndexDiagnostic.cpp @@ -110,7 +110,7 @@ CurrentSet = &CD.getChildDiagnostics(); } - void emitDiagnosticMessage(FullSourceLoc Loc, PresumedLoc PLoc, + void emitDiagnosticMessage(UnifiedSourceLoc Loc, UnifiedPLoc PLoc, DiagnosticsEngine::Level Level, StringRef Message, ArrayRef Ranges, DiagOrStoredDiag D) override { @@ -126,15 +126,15 @@ llvm::make_unique(Message, L)); } - void emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc, + void emitDiagnosticLoc(UnifiedSourceLoc Loc, UnifiedPLoc PLoc, DiagnosticsEngine::Level Level, ArrayRef Ranges) override {} - void emitCodeContext(FullSourceLoc Loc, DiagnosticsEngine::Level Level, + void emitCodeContext(UnifiedSourceLoc Loc, DiagnosticsEngine::Level Level, SmallVectorImpl &Ranges, ArrayRef Hints) override {} - void emitNote(FullSourceLoc Loc, StringRef Message) override { + void emitNote(UnifiedSourceLoc Loc, StringRef Message) override { CXSourceLocation L; if (Loc.hasManager()) L = translateSourceLocation(Loc.getManager(), LangOpts, Loc); Index: tools/driver/cc1as_main.cpp === --- tools/driver/cc1as_main.cpp +++ tools/driver/cc1as_main.cpp @@ -14,6 +14,10 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticOptions.h" +#include "clang/Basic/FileManager.h" +#include "clang/Basic/FileSystemOptions.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/SourceManager.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" #include "clang/Frontend/DiagnosticOptions.h" @@ -46,6 +50,7 @@ #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetRegistry.h" @@ -284,6 +289,29 @@ return Out; } +struct DiagsHandlerContext { + DiagnosticsEngine &Diags; + const SourceMgr *SrcMgr; +}; + +static void AssemblerDiagsHandler(const SMDiagnostic &D, void *Context) { + auto &Diags = *static_cast(Context); + unsigned DiagID; + switch (D.getKind()) { + case llvm::SourceMgr::DK_Error: +DiagID = diag::err_fe_inline_asm; +break; + case llvm::SourceMgr::DK_Warning: +DiagID = diag::warn_fe_inline_asm; +break; + case llvm::SourceMgr::DK_Note: +DiagID = diag::note_fe_inline_asm; +break; + } + + Diags.Report(D.getSourceMgr(), D.getLoc(), DiagID) << D.getMessage(); +} + static bool ExecuteAssembler(AssemblerInvocation &Opts, DiagnosticsEngine &Diags) { // Get the target specific parser. @@ -309,6 +337,8 @@ // it later. SrcMgr.setIncludeDirs(Opts.IncludePaths); + SrcMgr.setDiagHandler(AssemblerDiagsHandler, &Diags); + std::unique_ptr MRI(TheTarget->createMCRegInfo(Opts.Triple)); assert(MRI && "Unable to create target register info!"); @@ -475,7 +505,6 @@ IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter *DiagClient = new TextDiagnosticPrinter(errs(), &*DiagOpts); - DiagClient->setPrefix("clang -cc1as"); IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); @@ -517,9 +546,35 @@ llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args); } + ProcessWarningOptions(Diags, Diags.getDiagnosticOptions(), true); + + LangOptions LangOpts; + DiagClient->BeginSourceFile(LangOpts, nullptr); + // Execute the invocation, unless there were parsing errors. bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags); + DiagClient->EndSourceFile(); + + // Notify the diagnostic client that all files were processed. + Diags.getClient()->finish(); + + if (Diags.getDiagnosticOptions().ShowC
[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
danielmarjamaki added a comment. Please click "Done" on fixed review comments. Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2038 + // If the size can be nonzero, we have to check the other arguments. + if (StateNonZeroSize) { +State = StateNonZeroSize; This "if (StateNonZeroSize)" condition is useless now since you added a early return Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2039 + if (StateNonZeroSize) { +State = StateNonZeroSize; + I suggest code cleanup: ``` State = StateNonZeroSize; State = checkNonNull(C, State, Mem, MemVal); ``` Change that to: ``` State = checkNonNull(C, StateNonZeroSize, Mem, MemVal); ``` Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2063 +if (!State) +return; + } indentation. I personally like the clang-format-diff script also. That would cleanup all your changes. cd llvm/tools/clang svn diff | python tools/clang-format/clang-format-diff.py -i It should work with git diff also but I have not tried that. Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31830: Emit invariant.group.barrier when using union field
Prazek added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:3517 +CGM.getCodeGenOpts().StrictVTablePointers && +CGM.getCodeGenOpts().OptimizationLevel > 0) + addr = Address(Builder.CreateInvariantGroupBarrier(addr.getPointer()), rjmccall wrote: > Prazek wrote: > > rjmccall wrote: > > > Prazek wrote: > > > > rjmccall wrote: > > > > > Checking for v-table pointers recursively isn't really that > > > > > difficult, but if you really don't want to do that, please at least > > > > > check for non-POD-ness or something so that this isn't kicking in for > > > > > literally every struct type. > > > > ok, I am also planning to fix this in the later patch, because the same > > > > problem arise when comparing 2 pointers to dynamic classe. > > > > I would like to have a bit in CXXRecordDecl to remember if it has any > > > > vptr inside that would calculate durring the construction. > > > > My biggest fear is that if I won't cache it then it will be very slow. > > > We could repeat this work from scratch on every single union field access > > > done by IRGen and it would still be way, way faster than doing anything > > > extra on every record definition in the program. The latter is done > > > orders of magnitude more frequently than the former. > > This is a good point, and actually I don't need to check if class holds any > > vptrs for the example I refered (comparing 2 pointers). > > Hovewer I still need to do it when someone casts pointer to class holding > > vptrs to something that doesn't hold vptrs, and any pointer casts are much > > more frequent than Record declarations. > What are you planning to do if someone casts to a pointer to incomplete type? > > I am concerned that what these problems are really telling us is that this > representation is not very good. In this case we also need to add the barrier. I might be wrong, but I think this in general should be pretty rare and even more rare if it would limit the devirtualization. For example cases like: Derived *d; (Base*)d; will not limit devirtualization if Derived is complete type (because base will be also). The other thing is that with my recent patches, adding more barriers will not limit any memory optimizations. https://reviews.llvm.org/D31830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls
baloghadamsoftware added a comment. OK, please create a patch where implicit casts are disabled by default. You can also find a new name for the checker. Repository: rL LLVM https://reviews.llvm.org/D31097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls
baloghadamsoftware added a comment. Or I can do it for you if you wish. Repository: rL LLVM https://reviews.llvm.org/D31097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32161: Testing commit access.
manojgupta created this revision. Test commit access. https://reviews.llvm.org/D32161 Files: unittests/Driver/ToolChainTest.cpp Index: unittests/Driver/ToolChainTest.cpp === --- unittests/Driver/ToolChainTest.cpp +++ unittests/Driver/ToolChainTest.cpp @@ -142,4 +142,4 @@ EXPECT_TRUE(CLDriver.IsCLMode()); } -} // end anonymous namespace +} // end anonymous namespace. Index: unittests/Driver/ToolChainTest.cpp === --- unittests/Driver/ToolChainTest.cpp +++ unittests/Driver/ToolChainTest.cpp @@ -142,4 +142,4 @@ EXPECT_TRUE(CLDriver.IsCLMode()); } -} // end anonymous namespace +} // end anonymous namespace. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r300545 - clang-tools-extra/test/clang-tidy/performance-inefficient-vector-operation.cpp: Appease targeting msvc with -fno-ms-extensions.
Author: chapuni Date: Tue Apr 18 07:13:30 2017 New Revision: 300545 URL: http://llvm.org/viewvc/llvm-project?rev=300545&view=rev Log: clang-tools-extra/test/clang-tidy/performance-inefficient-vector-operation.cpp: Appease targeting msvc with -fno-ms-extensions. FIXME: This may work with -target x86_64-win32. Modified: clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp?rev=300545&r1=300544&r2=300545&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Tue Apr 18 07:13:30 2017 @@ -1,4 +1,5 @@ -// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm -- +// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm -- -fno-ms-extensions +// FIXME: This may work with -target x86_64-win32. typedef int size_t; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31097: [clang-tidy] don't warn about implicit widening casts in function calls
danielmarjamaki added a comment. > Or I can do it for you if you wish. yes please Repository: rL LLVM https://reviews.llvm.org/D31097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25866: [Sema] Support implicit scalar to vector conversions
sdardis added a comment. Realised I've some comments to submit. Comment at: lib/Sema/SemaExpr.cpp:8032 + + return InvalidOperands(Loc, LHS, RHS); +} bruno wrote: > Double checking here: are there tests for the `InvalidOperands` case above? Yes, this case is covered in the new diff in test/Sema/vector-ops.c and in test/Sema/vector-gcc-compat.c . Comment at: lib/Sema/SemaExpr.cpp:10024 + // FIXME: The check for C++ here is for GCC compatibility. GCC rejects the + //usage of logical operators with vectors in C. This check could be + //notionally dropped. bruno wrote: > Please mention in the comment the list of logical ops that this applies to: > "!, &&, ||" I've updated the relevant Check* functions with FIXME:s noting that they should handle vector types for compatibility with GCC. Comment at: test/Sema/vector-gcc-compat.c:101 + + v2i64_r = v2i64_a && 1; // expected-error {{invalid vector operand to binary expression ('v2i64' (vector of 2 'long long' values))}} + v2i64_r = v2i64_a || 1; // expected-error {{invalid vector operand to binary expression ('v2i64' (vector of 2 'long long' values))}} bruno wrote: > Is this because of && and others only working in C++? If so, we need a better > error message here, along the lines of "logical expression with vector only > support in C++". If later on we decide to support it in non-C++, we then get > rid of the warning. > > > Yes, these operators are oddly only available in C++. I've changed the error message to "logical expression with vector type[s] '' (vector of '' values) [and ''] is only supported in C++". https://reviews.llvm.org/D25866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
chapuni added a comment. Does it work for targeting msvc? See also; http://bb.pgr.jp/builders/test-clang-tools-msc-x64-on-i686-linux-RA/builds/1043 Appeased in r300545. Would it be happier if it worked with "-target x86_64-win32"? Repository: rL LLVM https://reviews.llvm.org/D31757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300549 - [ARM, AArch64] Define __ELF__ for arm-none-eabihf and AArch64
Author: olista01 Date: Tue Apr 18 08:12:36 2017 New Revision: 300549 URL: http://llvm.org/viewvc/llvm-project?rev=300549&view=rev Log: [ARM,AArch64] Define __ELF__ for arm-none-eabihf and AArch64 This macro is defined for arm-none-eabi as of r266625, but it should also be defined for eabihf and aarch64. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=300549&r1=300548&r2=300549&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Tue Apr 18 08:12:36 2017 @@ -5467,9 +5467,11 @@ public: Builder.defineMacro("__arm__"); // For bare-metal none-eabi. if (getTriple().getOS() == llvm::Triple::UnknownOS && -getTriple().getEnvironment() == llvm::Triple::EABI) +(getTriple().getEnvironment() == llvm::Triple::EABI || + getTriple().getEnvironment() == llvm::Triple::EABIHF)) Builder.defineMacro("__ELF__"); + // Target properties. Builder.defineMacro("__REGISTER_PREFIX__", ""); @@ -6118,6 +6120,11 @@ public: MacroBuilder &Builder) const override { // Target identification. Builder.defineMacro("__aarch64__"); +// For bare-metal none-eabi. +if (getTriple().getOS() == llvm::Triple::UnknownOS && +(getTriple().getEnvironment() == llvm::Triple::EABI || + getTriple().getEnvironment() == llvm::Triple::EABIHF)) + Builder.defineMacro("__ELF__"); // Target properties. Builder.defineMacro("_LP64"); Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=300549&r1=300548&r2=300549&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Tue Apr 18 08:12:36 2017 @@ -2378,6 +2378,9 @@ // ARM-NETBSD:#define __arm__ 1 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabihf < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-eabihf < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s // ARM-NONE-EABI: #define __ELF__ 1 // No MachO targets use the full EABI, even if AAPCS is used. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300550 - [ARM] Add hardware build attributes in assembler
Author: olista01 Date: Tue Apr 18 08:21:05 2017 New Revision: 300550 URL: http://llvm.org/viewvc/llvm-project?rev=300550&view=rev Log: [ARM] Add hardware build attributes in assembler This passes an option to the ARM assembly parser to emit build attributes for the hardware selected by command line options, when assembling an assembly file. This is not enabled for C/C++, as this would result in duplicate build attribute directives being emitted in each inline assembly block, when emitting assembly. This also adds an option to allow disabling this behaviour for assembly files, for users who were relying on the old behaviour. Differential revision: https://reviews.llvm.org/D31813 Added: cfe/trunk/test/Driver/arm-default-build-attributes.s Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=300550&r1=300549&r2=300550&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Tue Apr 18 08:21:05 2017 @@ -1646,6 +1646,8 @@ def march_EQ : Joined<["-"], "march=">, def masm_EQ : Joined<["-"], "masm=">, Group, Flags<[DriverOption]>; def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group; def mimplicit_it_EQ : Joined<["-"], "mimplicit-it=">, Group; +def mdefault_build_attributes : Joined<["-"], "mdefault-build-attributes">, Group; +def mno_default_build_attributes : Joined<["-"], "mno-default-build-attributes">, Group; def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group; def mconsole : Joined<["-"], "mconsole">, Group, Flags<[DriverOption]>; def mwindows : Joined<["-"], "mwindows">, Group, Flags<[DriverOption]>; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=300550&r1=300549&r2=300550&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Apr 18 08:21:05 2017 @@ -4996,6 +4996,19 @@ void ClangAs::ConstructJob(Compilation & case llvm::Triple::x86_64: AddX86TargetArgs(Args, CmdArgs); break; + + case llvm::Triple::arm: + case llvm::Triple::armeb: + case llvm::Triple::thumb: + case llvm::Triple::thumbeb: +// This isn't in AddARMTargetArgs because we want to do this for assembly +// only, not C/C++. +if (Args.hasFlag(options::OPT_mdefault_build_attributes, + options::OPT_mno_default_build_attributes, true)) { +CmdArgs.push_back("-mllvm"); +CmdArgs.push_back("-arm-add-build-attributes"); +} +break; } // Consume all the warning flags. Usually this would be handled more Added: cfe/trunk/test/Driver/arm-default-build-attributes.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-default-build-attributes.s?rev=300550&view=auto == --- cfe/trunk/test/Driver/arm-default-build-attributes.s (added) +++ cfe/trunk/test/Driver/arm-default-build-attributes.s Tue Apr 18 08:21:05 2017 @@ -0,0 +1,20 @@ +// Enabled by default for assembly +// RUN: %clang -target armv7--none-eabi -### %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-ENABLED + +// Can be forced on or off for assembly. +// RUN: %clang -target armv7--none-eabi -### %s 2>&1 -mno-default-build-attributes \ +// RUN:| FileCheck %s -check-prefix CHECK-DISABLED +// RUN: %clang -target armv7--none-eabi -### %s 2>&1 -mdefault-build-attributes \ +// RUN:| FileCheck %s -check-prefix CHECK-ENABLED + +// Option ignored C/C++ (since we always emit hardware and ABI build attributes +// during codegen). +// RUN: %clang -target armv7--none-eabi -### -x c %s -mdefault-build-attributes -verify 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-DISABLED +// RUN: %clang -target armv7--none-eabi -### -x c++ %s -mdefault-build-attributes -verify 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-DISABLED + +// CHECK-DISABLED-NOT: "-arm-add-build-attributes" +// CHECK-ENABLED: "-arm-add-build-attributes" +// expected-warning {{argument unused during compilation: '-mno-default-build-attributes'}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM Repository: rL LLVM https://reviews.llvm.org/D31542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30909: [Analyzer] Finish taint propagation to derived symbols of tainted regions
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:494 + SymbolManager &SM = C.getSymbolManager(); + return SM.getDerivedSymbol(Sym, LCV.getRegion()); } vlad.tsyrklevich wrote: > NoQ wrote: > > vlad.tsyrklevich wrote: > > > NoQ wrote: > > > > I'd think about this a bit more and come back. > > > > > > > > I need to understand how come that constructing a symbol manually is > > > > the right thing to do; that doesn't happen very often, but it seems > > > > correct here. > > > Indeed it is odd. The best justification I could come up with: LCVs are > > > meant to be optimizations, their 'purpose' is to expose an SVal that > > > hides SymbolRef values so that we can have a split store. We don't have > > > to copy all of a compound values SymbolRef mappings because LCVs are kept > > > distinct. Hence to set/query/constrain region values you use SVals so > > > that RegionStore can differentiate between LCVs and SymbolRef backed > > > SVals for the two different stores it contains. > > > > > > The taint interface however requires you taint a SymbolRef, not an SVal. > > > If we wanted, instead of doing this logic here, we could change > > > getPointedToSymbol() to return an SVal and update usages of it > > > accordingly since that value is only passed on to > > > ProgramState.isTainted()/ProgramState.addTaint() anyway. Then we could > > > update addTaint/isTainted to perform this logic, hiding it from the > > > checker. > > > > > > This still requires manually constructing a symbol, now it's just > > > performed in the analyzer instead of in a checker. Not sure if that > > > addresses the issue you were considering, but the idea that we need to > > > 'undo' the LCV optimization hiding the SymbolRef to have a value to taint > > > seems somewhat convincing to me. What do you think? > > Hmm (!) I suggest adding a new function to the program state, that we'd > > call `addPartialTaint()` or something like that, and this function would > > accept a symbol and a region and would act identically to passing a derived > > symbol (from this symbol and that region) to `addTaint()` (but we wouldn't > > need to actually construct a derived symbol here). > > > > Such API would be easier to understand and use than the current approach > > that forces the user to construct a derived symbol manually in the checker > > code. Unfortunately, this checker's `getLCVSymbol()` would become a bit > > more complicated (having various return types depending on circumstances), > > but this misfortune seems more random than systematic to me. > > > > Since we're having this new kind of partial taint, why don't we expose it > > in the API. > I'm happy to implement it this way, but figured I'd ask why you prefer this > approach first in the interest of keeping the TaintChecker simple! The > optimal approach to me seems to be changing `getPointedToSymbol()` to > `getPointedToSVal()` and having `addTaint(SVal)` call `addPartialTaint()` > when it's passed an LCV sub-region. That way users of the taint interface > like the TaintChecker have a clean way to add & check regardless of whether > it's a SymbolRef or an LCV but the partial taint functionality is still > exposed and documented for those who might want to use it in new ways. > > Just curious to understand your rationale. Thanks for the feedback! Your idea actually looks good to me! I'd approve going this way. With this change to `addTaint(SVal)`, i suspect it'd need some extra documentation to explain what it does now. Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:676 + if (const SymbolDerived *SD = dyn_cast(Sym)) { +TaintedSymRegionsRef SymRegions(0, TSRFactory.getTreeFactory()); + The `SymRegions` name is a bit confusing because we often shorten `SymbolicRegion` to `SymRegion` (eg. in dumps), which is not what we mean. Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:682 + +SymRegions = SymRegions.add(SD->getRegion()); +NewState = NewState->set(SD->getParentSymbol(), SymRegions); I wonder if it's worth it to check if a super-region of this region is already tainted, and avoid adding the region in this scenario. I guess in practice it won't happen very often, because this code would most likely be executed just once per taint source. This probably deserves a comment though. https://reviews.llvm.org/D30909 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
NoQ added a comment. Wow, so you're doing the binding thing now? Thanks! It was not critical for landing this patch, so you could have fixed comments here, allowing us to commit what's already done, and then proceed with further improvements. It's also easier to review and aligns with the LLVM's policy of incremental development. Could you add test cases for the new feature? For instance, void foo() { int *x = malloc(sizeof(int)); memset(x, 0, sizeof(int)); 1 / *x; // expected-warning{{Division by zero}} } void bar() { int *x = malloc(sizeof(int)); memset(x, 0, 1); 1 / *x; // no-warning } Tests that involve setting memory to anything but 0 are also welcome! Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2066 + + if (StateSameSize) { +SVal ConstVal = State->getSVal(Const, LCtx); I believe that if the size is not the same, you'd still need to do invalidation. Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32164: [clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening casts by default
baloghadamsoftware created this revision. Herald added a subscriber: whisperity. Users reported some false positives using this check. This patch sets the default value of the option for checking implicit widening casts to false. We also suggest renaming the check to something like missing-or-misplaced-widening cast so the name also covers the implicit case. This patch supersedes https://reviews.llvm.org/D31097. https://reviews.llvm.org/D32164 Files: clang-tidy/misc/MisplacedWideningCastCheck.cpp test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp test/clang-tidy/misc-misplaced-widening-cast.cpp Index: test/clang-tidy/misc-misplaced-widening-cast.cpp === --- test/clang-tidy/misc-misplaced-widening-cast.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: misc-misplaced-widening-cast.CheckImplicitCasts, value: 1}]}" -- - -void func(long arg) {} - -void assign(int a, int b) { - long l; - - l = a * b; - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [misc-misplaced-widening-cast] - l = (long)(a * b); - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' - l = (long)a * b; - - l = a << 8; - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' - l = (long)(a << 8); - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' - l = (long)b << 8; - - l = static_cast(a * b); - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' -} - -void compare(int a, int b, long c) { - bool l; - - l = a * b == c; - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' - l = c == a * b; - // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: either cast from 'int' to 'long' - l = (long)(a * b) == c; - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' - l = c == (long)(a * b); - // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: either cast from 'int' to 'long' - l = (long)a * b == c; - l = c == (long)a * b; -} - -void init(unsigned int n) { - long l1 = n << 8; - // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: either cast from 'unsigned int' to 'long' - long l2 = (long)(n << 8); - // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: either cast from 'unsigned int' to 'long' - long l3 = (long)n << 8; -} - -void call(unsigned int n) { - func(n << 8); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: either cast from 'unsigned int' to 'long' - func((long)(n << 8)); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: either cast from 'unsigned int' to 'long' - func((long)n << 8); -} - -long ret(int a) { - if (a < 0) { -return a * 1000; -// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: either cast from 'int' to 'long' - } else if (a > 0) { -return (long)(a * 1000); -// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: either cast from 'int' to 'long' - } else { -return (long)a * 1000; - } -} - -void dontwarn1(unsigned char a, int i, unsigned char *p) { - long l; - // The result is a 9 bit value, there is no truncation in the implicit cast. - l = (long)(a + 15); - // The result is a 12 bit value, there is no truncation in the implicit cast. - l = (long)(a << 4); - // The result is a 3 bit value, there is no truncation in the implicit cast. - l = (long)((i % 5) + 1); - // The result is a 16 bit value, there is no truncation in the implicit cast. - l = (long)(((*p) << 8) + *(p + 1)); -} - -template struct DontWarn2 { - void assign(T a, T b) { -long l; -l = (long)(a * b); - } -}; -DontWarn2 DW2; - -// Cast is not suspicious when casting macro. -#define A (X<<2) -long macro1(int X) { - return (long)A; -} - -// Don't warn about cast in macro. -#define B(X,Y) (long)(X*Y) -long macro2(int x, int y) { - return B(x,y); -} - -void floatingpoint(float a, float b) { - double d = (double)(a * b); // Currently we don't warn for this. -} Index: test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp === --- /dev/null +++ test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp @@ -0,0 +1,101 @@ +// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: misc-misplaced-widening-cast.CheckImplicitCasts, value: 1}]}" -- + +void func(long arg) {} + +void assign(int a, int b) { + long l; + + l = a * b; + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [misc-misplaced-widening-cast] + l = (long)(a * b); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' + l = (long)a * b; + + l = a << 8; + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' + l
r300555 - Driver: Better detection of mingw-gcc
Author: martell Date: Tue Apr 18 09:27:36 2017 New Revision: 300555 URL: http://llvm.org/viewvc/llvm-project?rev=300555&view=rev Log: Driver: Better detection of mingw-gcc Stop blindly searching for "gcc.exe" on windows. Stop assuming "/usr" on unix, fixes cross compiling. Reviewers: mati865, yaron.keren Subscribers: ismail, rnk Differential revision: https://reviews.llvm.org/D15005 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.h Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=300555&r1=300554&r2=300555&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017 @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir() } } +llvm::ErrorOr toolchains::MinGW::findGcc() { + llvm::SmallVector, 2> Gccs; + Gccs.emplace_back(getTriple().getArchName()); + Gccs[0] += "-w64-mingw32-gcc"; + Gccs.emplace_back("mingw32-gcc"); + // Please do not add "gcc" here + for (StringRef CandidateGcc : Gccs) +if (llvm::ErrorOr GPPName = llvm::sys::findProgramByName(CandidateGcc)) + return GPPName; + return make_error_code(std::errc::no_such_file_or_directory); +} + toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { getProgramPaths().push_back(getDriver().getInstalledDir()); -// In Windows there aren't any standard install locations, we search -// for gcc on the PATH. In Linux the base is always /usr. -#ifdef LLVM_ON_WIN32 if (getDriver().SysRoot.size()) Base = getDriver().SysRoot; - else if (llvm::ErrorOr GPPName = - llvm::sys::findProgramByName("gcc")) + else if (llvm::ErrorOr GPPName = findGcc()) Base = llvm::sys::path::parent_path( llvm::sys::path::parent_path(GPPName.get())); else Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); -#else - if (getDriver().SysRoot.size()) -Base = getDriver().SysRoot; - else -Base = "/usr"; -#endif Base += llvm::sys::path::get_separator(); findGccLibDir(); Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=300555&r1=300554&r2=300555&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017 @@ -93,6 +93,7 @@ private: mutable std::unique_ptr Preprocessor; mutable std::unique_ptr Compiler; void findGccLibDir(); + llvm::ErrorOr findGcc(); }; } // end namespace toolchains ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15005: Fix PR8170: Clang does not check constructor declaration that uses a template-id
This revision was automatically updated to reflect the committed changes. Closed by commit rL300555: Driver: Better detection of mingw-gcc (authored by martell). Changed prior to commit: https://reviews.llvm.org/D15005?vs=41206&id=95568#toc Repository: rL LLVM https://reviews.llvm.org/D15005 Files: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.h Index: cfe/trunk/lib/Driver/ToolChains/MinGW.h === --- cfe/trunk/lib/Driver/ToolChains/MinGW.h +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h @@ -93,6 +93,7 @@ mutable std::unique_ptr Preprocessor; mutable std::unique_ptr Compiler; void findGccLibDir(); + llvm::ErrorOr findGcc(); }; } // end namespace toolchains Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp === --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp @@ -285,28 +285,30 @@ } } +llvm::ErrorOr toolchains::MinGW::findGcc() { + llvm::SmallVector, 2> Gccs; + Gccs.emplace_back(getTriple().getArchName()); + Gccs[0] += "-w64-mingw32-gcc"; + Gccs.emplace_back("mingw32-gcc"); + // Please do not add "gcc" here + for (StringRef CandidateGcc : Gccs) +if (llvm::ErrorOr GPPName = llvm::sys::findProgramByName(CandidateGcc)) + return GPPName; + return make_error_code(std::errc::no_such_file_or_directory); +} + toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { getProgramPaths().push_back(getDriver().getInstalledDir()); -// In Windows there aren't any standard install locations, we search -// for gcc on the PATH. In Linux the base is always /usr. -#ifdef LLVM_ON_WIN32 if (getDriver().SysRoot.size()) Base = getDriver().SysRoot; - else if (llvm::ErrorOr GPPName = - llvm::sys::findProgramByName("gcc")) + else if (llvm::ErrorOr GPPName = findGcc()) Base = llvm::sys::path::parent_path( llvm::sys::path::parent_path(GPPName.get())); else Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); -#else - if (getDriver().SysRoot.size()) -Base = getDriver().SysRoot; - else -Base = "/usr"; -#endif Base += llvm::sys::path::get_separator(); findGccLibDir(); Index: cfe/trunk/lib/Driver/ToolChains/MinGW.h === --- cfe/trunk/lib/Driver/ToolChains/MinGW.h +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h @@ -93,6 +93,7 @@ mutable std::unique_ptr Preprocessor; mutable std::unique_ptr Compiler; void findGccLibDir(); + llvm::ErrorOr findGcc(); }; } // end namespace toolchains Index: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp === --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp @@ -285,28 +285,30 @@ } } +llvm::ErrorOr toolchains::MinGW::findGcc() { + llvm::SmallVector, 2> Gccs; + Gccs.emplace_back(getTriple().getArchName()); + Gccs[0] += "-w64-mingw32-gcc"; + Gccs.emplace_back("mingw32-gcc"); + // Please do not add "gcc" here + for (StringRef CandidateGcc : Gccs) +if (llvm::ErrorOr GPPName = llvm::sys::findProgramByName(CandidateGcc)) + return GPPName; + return make_error_code(std::errc::no_such_file_or_directory); +} + toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { getProgramPaths().push_back(getDriver().getInstalledDir()); -// In Windows there aren't any standard install locations, we search -// for gcc on the PATH. In Linux the base is always /usr. -#ifdef LLVM_ON_WIN32 if (getDriver().SysRoot.size()) Base = getDriver().SysRoot; - else if (llvm::ErrorOr GPPName = - llvm::sys::findProgramByName("gcc")) + else if (llvm::ErrorOr GPPName = findGcc()) Base = llvm::sys::path::parent_path( llvm::sys::path::parent_path(GPPName.get())); else Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); -#else - if (getDriver().SysRoot.size()) -Base = getDriver().SysRoot; - else -Base = "/usr"; -#endif Base += llvm::sys::path::get_separator(); findGccLibDir(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15006: Driver: Better detection of mingw-gcc
martell added a comment. Committed as https://reviews.llvm.org/rL300555 Repository: rL LLVM https://reviews.llvm.org/D15006 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r300555 - Driver: Better detection of mingw-gcc
I think you've got the wrong Phabricator link in the commit log. On 18 April 2017 at 15:27, Martell Malone via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: martell > Date: Tue Apr 18 09:27:36 2017 > New Revision: 300555 > > URL: http://llvm.org/viewvc/llvm-project?rev=300555&view=rev > Log: > Driver: Better detection of mingw-gcc > > Stop blindly searching for "gcc.exe" on windows. > Stop assuming "/usr" on unix, fixes cross compiling. > > Reviewers: mati865, yaron.keren > > Subscribers: ismail, rnk > > Differential revision: https://reviews.llvm.org/D15005 > > Modified: > cfe/trunk/lib/Driver/ToolChains/MinGW.cpp > cfe/trunk/lib/Driver/ToolChains/MinGW.h > > Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ > ToolChains/MinGW.cpp?rev=300555&r1=300554&r2=300555&view=diff > > == > --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) > +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017 > @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir() >} > } > > +llvm::ErrorOr toolchains::MinGW::findGcc() { > + llvm::SmallVector, 2> Gccs; > + Gccs.emplace_back(getTriple().getArchName()); > + Gccs[0] += "-w64-mingw32-gcc"; > + Gccs.emplace_back("mingw32-gcc"); > + // Please do not add "gcc" here > + for (StringRef CandidateGcc : Gccs) > +if (llvm::ErrorOr GPPName = llvm::sys::findProgramByName( > CandidateGcc)) > + return GPPName; > + return make_error_code(std::errc::no_such_file_or_directory); > +} > + > toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, > const ArgList &Args) > : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { >getProgramPaths().push_back(getDriver().getInstalledDir()); > > -// In Windows there aren't any standard install locations, we search > -// for gcc on the PATH. In Linux the base is always /usr. > -#ifdef LLVM_ON_WIN32 >if (getDriver().SysRoot.size()) > Base = getDriver().SysRoot; > - else if (llvm::ErrorOr GPPName = > - llvm::sys::findProgramByName("gcc")) > + else if (llvm::ErrorOr GPPName = findGcc()) > Base = llvm::sys::path::parent_path( > llvm::sys::path::parent_path(GPPName.get())); >else > Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); > -#else > - if (getDriver().SysRoot.size()) > -Base = getDriver().SysRoot; > - else > -Base = "/usr"; > -#endif > >Base += llvm::sys::path::get_separator(); >findGccLibDir(); > > Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ > ToolChains/MinGW.h?rev=300555&r1=300554&r2=300555&view=diff > > == > --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) > +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017 > @@ -93,6 +93,7 @@ private: >mutable std::unique_ptr Preprocessor; >mutable std::unique_ptr Compiler; >void findGccLibDir(); > + llvm::ErrorOr findGcc(); > }; > > } // end namespace toolchains > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15005: Fix PR8170: Clang does not check constructor declaration that uses a template-id
martell added a comment. In case anyone comes here looking for https://reviews.llvm.org/rL300555 that should be https://reviews.llvm.org/D15006 no https://reviews.llvm.org/D15005. Thanks Repository: rL LLVM https://reviews.llvm.org/D15005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15005: Fix PR8170: Clang does not check constructor declaration that uses a template-id
martell added a comment. It won't let me revert the automatically updated diff to the previous one because I am not the author. @faisalv are you able todo this and Sorry for the confusion. Repository: rL LLVM https://reviews.llvm.org/D15005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r300555 - Driver: Better detection of mingw-gcc
Yes I do :) I updated https://reviews.llvm.org/D15005 with a comment incase anyone goes there. I also updated https://reviews.llvm.org/D15006 (the correct link) to point to the commit revision. Thanks for pointing that out Alex On Tue, Apr 18, 2017 at 3:49 PM, Alex L wrote: > I think you've got the wrong Phabricator link in the commit log. > > On 18 April 2017 at 15:27, Martell Malone via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: martell >> Date: Tue Apr 18 09:27:36 2017 >> New Revision: 300555 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=300555&view=rev >> Log: >> Driver: Better detection of mingw-gcc >> >> Stop blindly searching for "gcc.exe" on windows. >> Stop assuming "/usr" on unix, fixes cross compiling. >> >> Reviewers: mati865, yaron.keren >> >> Subscribers: ismail, rnk >> >> Differential revision: https://reviews.llvm.org/D15005 >> >> Modified: >> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp >> cfe/trunk/lib/Driver/ToolChains/MinGW.h >> >> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too >> lChains/MinGW.cpp?rev=300555&r1=300554&r2=300555&view=diff >> >> == >> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) >> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017 >> @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir() >>} >> } >> >> +llvm::ErrorOr toolchains::MinGW::findGcc() { >> + llvm::SmallVector, 2> Gccs; >> + Gccs.emplace_back(getTriple().getArchName()); >> + Gccs[0] += "-w64-mingw32-gcc"; >> + Gccs.emplace_back("mingw32-gcc"); >> + // Please do not add "gcc" here >> + for (StringRef CandidateGcc : Gccs) >> +if (llvm::ErrorOr GPPName = >> llvm::sys::findProgramByName(CandidateGcc)) >> + return GPPName; >> + return make_error_code(std::errc::no_such_file_or_directory); >> +} >> + >> toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, >> const ArgList &Args) >> : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { >>getProgramPaths().push_back(getDriver().getInstalledDir()); >> >> -// In Windows there aren't any standard install locations, we search >> -// for gcc on the PATH. In Linux the base is always /usr. >> -#ifdef LLVM_ON_WIN32 >>if (getDriver().SysRoot.size()) >> Base = getDriver().SysRoot; >> - else if (llvm::ErrorOr GPPName = >> - llvm::sys::findProgramByName("gcc")) >> + else if (llvm::ErrorOr GPPName = findGcc()) >> Base = llvm::sys::path::parent_path( >> llvm::sys::path::parent_path(GPPName.get())); >>else >> Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); >> -#else >> - if (getDriver().SysRoot.size()) >> -Base = getDriver().SysRoot; >> - else >> -Base = "/usr"; >> -#endif >> >>Base += llvm::sys::path::get_separator(); >>findGccLibDir(); >> >> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too >> lChains/MinGW.h?rev=300555&r1=300554&r2=300555&view=diff >> >> == >> --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) >> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017 >> @@ -93,6 +93,7 @@ private: >>mutable std::unique_ptr Preprocessor; >>mutable std::unique_ptr Compiler; >>void findGccLibDir(); >> + llvm::ErrorOr findGcc(); >> }; >> >> } // end namespace toolchains >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function
xiangzhai added a comment. Hi All, Thanks for your review! I will update my patch tomorrow! Almost 4+ days no see, I miss you :) Regards, Leslie Zhaii Repository: rL LLVM https://reviews.llvm.org/D31868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r300555 - Driver: Better detection of mingw-gcc
No problem, thanks for the quick update! On 18 April 2017 at 15:56, Martell Malone wrote: > Yes I do :) > I updated https://reviews.llvm.org/D15005 with a comment incase anyone > goes there. > I also updated https://reviews.llvm.org/D15006 (the correct link) to > point to the commit revision. > > Thanks for pointing that out Alex > > On Tue, Apr 18, 2017 at 3:49 PM, Alex L wrote: > >> I think you've got the wrong Phabricator link in the commit log. >> >> On 18 April 2017 at 15:27, Martell Malone via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: martell >>> Date: Tue Apr 18 09:27:36 2017 >>> New Revision: 300555 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=300555&view=rev >>> Log: >>> Driver: Better detection of mingw-gcc >>> >>> Stop blindly searching for "gcc.exe" on windows. >>> Stop assuming "/usr" on unix, fixes cross compiling. >>> >>> Reviewers: mati865, yaron.keren >>> >>> Subscribers: ismail, rnk >>> >>> Differential revision: https://reviews.llvm.org/D15005 >>> >>> Modified: >>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp >>> cfe/trunk/lib/Driver/ToolChains/MinGW.h >>> >>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too >>> lChains/MinGW.cpp?rev=300555&r1=300554&r2=300555&view=diff >>> >>> == >>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) >>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017 >>> @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir() >>>} >>> } >>> >>> +llvm::ErrorOr toolchains::MinGW::findGcc() { >>> + llvm::SmallVector, 2> Gccs; >>> + Gccs.emplace_back(getTriple().getArchName()); >>> + Gccs[0] += "-w64-mingw32-gcc"; >>> + Gccs.emplace_back("mingw32-gcc"); >>> + // Please do not add "gcc" here >>> + for (StringRef CandidateGcc : Gccs) >>> +if (llvm::ErrorOr GPPName = >>> llvm::sys::findProgramByName(CandidateGcc)) >>> + return GPPName; >>> + return make_error_code(std::errc::no_such_file_or_directory); >>> +} >>> + >>> toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, >>> const ArgList &Args) >>> : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { >>>getProgramPaths().push_back(getDriver().getInstalledDir()); >>> >>> -// In Windows there aren't any standard install locations, we search >>> -// for gcc on the PATH. In Linux the base is always /usr. >>> -#ifdef LLVM_ON_WIN32 >>>if (getDriver().SysRoot.size()) >>> Base = getDriver().SysRoot; >>> - else if (llvm::ErrorOr GPPName = >>> - llvm::sys::findProgramByName("gcc")) >>> + else if (llvm::ErrorOr GPPName = findGcc()) >>> Base = llvm::sys::path::parent_path( >>> llvm::sys::path::parent_path(GPPName.get())); >>>else >>> Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); >>> -#else >>> - if (getDriver().SysRoot.size()) >>> -Base = getDriver().SysRoot; >>> - else >>> -Base = "/usr"; >>> -#endif >>> >>>Base += llvm::sys::path::get_separator(); >>>findGccLibDir(); >>> >>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too >>> lChains/MinGW.h?rev=300555&r1=300554&r2=300555&view=diff >>> >>> == >>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) >>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017 >>> @@ -93,6 +93,7 @@ private: >>>mutable std::unique_ptr Preprocessor; >>>mutable std::unique_ptr Compiler; >>>void findGccLibDir(); >>> + llvm::ErrorOr findGcc(); >>> }; >>> >>> } // end namespace toolchains >>> >>> >>> ___ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300560 - [ASTPrinter] Print template parameter lists for out-of-line functions
Author: arphaman Date: Tue Apr 18 10:12:34 2017 New Revision: 300560 URL: http://llvm.org/viewvc/llvm-project?rev=300560&view=rev Log: [ASTPrinter] Print template parameter lists for out-of-line functions Modified: cfe/trunk/lib/AST/DeclPrinter.cpp cfe/trunk/test/Misc/ast-print-out-of-line-func.cpp Modified: cfe/trunk/lib/AST/DeclPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=300560&r1=300559&r2=300560&view=diff == --- cfe/trunk/lib/AST/DeclPrinter.cpp (original) +++ cfe/trunk/lib/AST/DeclPrinter.cpp Tue Apr 18 10:12:34 2017 @@ -478,6 +478,11 @@ void DeclPrinter::VisitFunctionDecl(Func if (D->isFunctionTemplateSpecialization()) Out << "template<> "; + else if (!D->getDescribedFunctionTemplate()) { +for (unsigned I = 0, NumTemplateParams = D->getNumTemplateParameterLists(); + I < NumTemplateParams; ++I) + printTemplateParameters(D->getTemplateParameterList(I)); + } CXXConstructorDecl *CDecl = dyn_cast(D); CXXConversionDecl *ConversionDecl = dyn_cast(D); @@ -1055,6 +1060,12 @@ void DeclPrinter::VisitTemplateDecl(cons void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { prettyPrintPragmas(D->getTemplatedDecl()); + // Print any leading template parameter lists. + if (const FunctionDecl *FD = D->getTemplatedDecl()) { +for (unsigned I = 0, NumTemplateParams = FD->getNumTemplateParameterLists(); + I < NumTemplateParams; ++I) + printTemplateParameters(FD->getTemplateParameterList(I)); + } VisitRedeclarableTemplateDecl(D); // Never print "instantiations" for deduction guides (they don't really Modified: cfe/trunk/test/Misc/ast-print-out-of-line-func.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-print-out-of-line-func.cpp?rev=300560&r1=300559&r2=300560&view=diff == --- cfe/trunk/test/Misc/ast-print-out-of-line-func.cpp (original) +++ cfe/trunk/test/Misc/ast-print-out-of-line-func.cpp Tue Apr 18 10:12:34 2017 @@ -52,3 +52,44 @@ void Wrapper::Inner::staticMember() { } // CHECK: void Wrapper::Inner::staticMember() } + +template +class TemplateRecord { + void function(); + template void functionTemplate(T, U); +}; + +template +void TemplateRecord::function() { } +// CHECK: template void TemplateRecord::function() + +template +template +void TemplateRecord::functionTemplate(T, U) { } +// CHECK: template template void TemplateRecord::functionTemplate(T, U) + +template<> +class TemplateRecord<0, int> { + void function(); + template void functionTemplate(int, U); +}; + +void TemplateRecord<0, int>::function() { } +// CHECK: void TemplateRecord<0, int>::function() + +template +void TemplateRecord<0, int>::functionTemplate(int, U) { } +// CHECK: template void TemplateRecord<0, int>::functionTemplate(int, U) + +template +struct OuterTemplateRecord { + template + struct Inner { +void function(); + }; +}; + +template +template +void OuterTemplateRecord::Inner::function() { } +// CHECK: template template void OuterTemplateRecord::Inner::function() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32081: Add support for editor placeholders to Clang's lexer
benlangmuir added inline comments. Comment at: include/clang/Basic/IdentifierTable.h:358 + /// Return true if this identifier is an editor placeholder. + bool isEditorPlaceholder() const { Nitpick: There should probably be an example in the doc comment. The editor placeholder syntax isn't commonly known. Comment at: include/clang/Driver/Options.td:1478 + "fno-allow-editor-placeholders">, Group, + Flags<[CC1Option]>; + Does the negative -fno- option need to be CC1Option? Later in this patch you seem to canonicalize on the positive form when passing to the frontend. Repository: rL LLVM https://reviews.llvm.org/D32081 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300562 - mingw-w64: enable support for __declspec(selectany)
Author: martell Date: Tue Apr 18 10:56:24 2017 New Revision: 300562 URL: http://llvm.org/viewvc/llvm-project?rev=300562&view=rev Log: mingw-w64: enable support for __declspec(selectany) Add selectany as a GCC spelling for mingw-w64 Reviewers: rnk Differential revision: https://reviews.llvm.org/D32083 Modified: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/test/Sema/attr-selectany.c cfe/trunk/test/SemaCXX/attr-selectany.cpp Modified: cfe/trunk/include/clang/Basic/Attr.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=300562&r1=300561&r2=300562&view=diff == --- cfe/trunk/include/clang/Basic/Attr.td (original) +++ cfe/trunk/include/clang/Basic/Attr.td Tue Apr 18 10:56:24 2017 @@ -2351,9 +2351,8 @@ def DLLImport : InheritableAttr, TargetS let Documentation = [DLLImportDocs]; } -def SelectAny : InheritableAttr { - let Spellings = [Declspec<"selectany">]; - let LangOpts = [MicrosoftExt]; +def SelectAny : InheritableAttr, TargetSpecificAttr { + let Spellings = [Declspec<"selectany">, GCC<"selectany">]; let Documentation = [Undocumented]; } Modified: cfe/trunk/test/Sema/attr-selectany.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-selectany.c?rev=300562&r1=300561&r2=300562&view=diff == --- cfe/trunk/test/Sema/attr-selectany.c (original) +++ cfe/trunk/test/Sema/attr-selectany.c Tue Apr 18 10:56:24 2017 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fms-compatibility -fms-extensions -verify %s +// RUN: %clang_cc1 -triple x86_64-win32 -fdeclspec -verify %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s extern __declspec(selectany) const int x1 = 1; // no warning, const means we need extern in C++ Modified: cfe/trunk/test/SemaCXX/attr-selectany.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-selectany.cpp?rev=300562&r1=300561&r2=300562&view=diff == --- cfe/trunk/test/SemaCXX/attr-selectany.cpp (original) +++ cfe/trunk/test/SemaCXX/attr-selectany.cpp Tue Apr 18 10:56:24 2017 @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple x86_64-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s // MSVC produces similar diagnostics. __declspec(selectany) void foo() { } // expected-error{{'selectany' can only be applied to data items with external linkage}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects
joshz added a comment. Thanks, Aaron! Repository: rL LLVM https://reviews.llvm.org/D31542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects
joshz added a comment. I don't believe I have access to commit this revision myself; can someone please do it for me? Thanks! :-) Repository: rL LLVM https://reviews.llvm.org/D31542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32170: Add a FixItHint for -Wmissing-prototypes to insert 'static '.
alexfh created this revision. Missing 'static' on functions that are intended to be local to a translation unit seems to be the most common cause of -Wmissing-prototypes warnings, so suggesting a fix seems to be convenient and useful. https://reviews.llvm.org/D32170 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/SemaCXX/warn-missing-prototypes.cpp Index: test/SemaCXX/warn-missing-prototypes.cpp === --- test/SemaCXX/warn-missing-prototypes.cpp +++ test/SemaCXX/warn-missing-prototypes.cpp @@ -1,6 +1,22 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -Wmissing-prototypes -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -implicit-check-not=fix-it: -void f() { } // expected-warning {{no previous prototype for function 'f'}} +void f() { } // expected-warning {{no previous prototype for function 'f'; did you mean to mark the function 'static'?}} +// CHECK: fix-it:"{{.*}}":{4:1-4:1}:"static " + +#define F2 void f2() { } + +F2 // expected-warning {{no previous prototype for function 'f2'}} + +extern void f3() {} // expected-warning {{no previous prototype for function 'f3'}} +extern "C" void f4() {} // expected-warning {{no previous prototype for function 'f4'}} +extern "C++" void f5() {} // expected-warning {{no previous prototype for function 'f5'}} +extern "C" { + void f6() {} // expected-warning {{no previous prototype for function 'f6'}} +} +extern "C++" { + void f7() {} // expected-warning {{no previous prototype for function 'f7'}} +} namespace NS { void f() { } // expected-warning {{no previous prototype for function 'f'}} @@ -16,6 +32,7 @@ void f() { } }; + // Don't warn about inline functions. inline void g() { } @@ -32,3 +49,6 @@ // Don't warn on explicitly deleted functions. void j() = delete; + +// Don't warn on static functions. +static void s() {} Index: lib/Sema/SemaDecl.cpp === --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -11649,7 +11649,8 @@ } static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD, - const FunctionDecl*& PossibleZeroParamPrototype) { + const FunctionDecl*& PossibleZeroParamPrototype, + bool *PossibleMissingStatic) { // Don't warn about invalid declarations. if (FD->isInvalidDecl()) return false; @@ -11686,21 +11687,27 @@ if (FD->isDeleted()) return false; - bool MissingPrototype = true; for (const FunctionDecl *Prev = FD->getPreviousDecl(); Prev; Prev = Prev->getPreviousDecl()) { // Ignore any declarations that occur in function or method // scope, because they aren't visible from the header. if (Prev->getLexicalDeclContext()->isFunctionOrMethod()) continue; -MissingPrototype = !Prev->getType()->isFunctionProtoType(); +if (Prev->getType()->isFunctionProtoType()) + return false; + if (FD->getNumParams() == 0) PossibleZeroParamPrototype = Prev; break; } - return MissingPrototype; + // Check whether applying a 'static' could make sense for this function. + *PossibleMissingStatic = FD->getDeclContext() && + FD->getDeclContext()->isTranslationUnit() && + FD->getStorageClass() == SC_None; + + return true; } void @@ -12099,8 +12106,19 @@ // definition itself provides a prototype. The aim is to detect // global functions that fail to be declared in header files. const FunctionDecl *PossibleZeroParamPrototype = nullptr; -if (ShouldWarnAboutMissingPrototype(FD, PossibleZeroParamPrototype)) { - Diag(FD->getLocation(), diag::warn_missing_prototype) << FD; +bool PossibleMissingStatic = false; +if (ShouldWarnAboutMissingPrototype(FD, PossibleZeroParamPrototype, +&PossibleMissingStatic)) { + if (PossibleMissingStatic) { +auto DiagBuilder = +Diag(FD->getLocation(), diag::warn_missing_prototype_maybe_static) +<< FD; +SourceLocation Loc = FD->getLocStart(); +if (Loc.isFileID()) + DiagBuilder << FixItHint::CreateInsertion(Loc, "static "); + } else { +Diag(FD->getLocation(), diag::warn_missing_prototype) << FD; + } if (PossibleZeroParamPrototype) { // We found a declaration that is not a prototype, Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -4545,9 +4545,12 @@ "%select{function|method|block}0 has been explicitly marked sentinel here">; def warn_missing_prototype : Warning< "no previous prototype f
[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
hokein added a comment. @chapuni, thanks for the workaround. It makes sense to make it work for targeting msvc. Will fix it in a follow-up. Repository: rL LLVM https://reviews.llvm.org/D31757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r300563 - Make the test pass on x86_64-win32 target.
Author: hokein Date: Tue Apr 18 11:25:03 2017 New Revision: 300563 URL: http://llvm.org/viewvc/llvm-project?rev=300563&view=rev Log: Make the test pass on x86_64-win32 target. Modified: clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Modified: clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp?rev=300563&r1=300562&r2=300563&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/performance-inefficient-vector-operation.cpp Tue Apr 18 11:25:03 2017 @@ -1,9 +1,9 @@ -// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm -- -fno-ms-extensions -// FIXME: This may work with -target x86_64-win32. +// RUN: %check_clang_tidy %s performance-inefficient-vector-operation %t -- -format-style=llvm -- + +namespace std { typedef int size_t; -namespace std { template class vector { public: @@ -73,7 +73,7 @@ void f(std::vector& t) { { std::vector v; // CHECK-FIXES: v.reserve(t.size()); -for (size_t i = 0; i < t.size(); ++i) { +for (std::size_t i = 0; i < t.size(); ++i) { v.push_back(t[i]); // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called } @@ -81,7 +81,7 @@ void f(std::vector& t) { { std::vector v; // CHECK-FIXES: v.reserve(t.size() - 1); -for (size_t i = 0; i < t.size() - 1; ++i) { +for (std::size_t i = 0; i < t.size() - 1; ++i) { v.push_back(t[i]); } // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: 'push_back' is called } @@ -152,7 +152,7 @@ void f(std::vector& t) { std::vector v; // CHECK-FIXES-NOT: v.reserve(t.size()); // v isn't referenced in for-loop body. -for (size_t i = 0; i < t.size(); ++i) { +for (std::size_t i = 0; i < t.size(); ++i) { t.push_back(i); } } @@ -161,7 +161,7 @@ void f(std::vector& t) { int k; // CHECK-FIXES-NOT: v.reserve(10); // For-loop isn't a fixable loop. -for (size_t i = 0; k < 10; ++i) { +for (std::size_t i = 0; k < 10; ++i) { v.push_back(t[i]); } } @@ -177,7 +177,7 @@ void f(std::vector& t) { int k; // CHECK-FIXES-NOT: v.reserve(10); // For-loop isn't a fixable loop. -for (size_t i = 0; i < 10; ++k) { +for (std::size_t i = 0; i < 10; ++k) { v.push_back(t[i]); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32176: Add #pragma clang attribute support for the external_source_symbol attribute
arphaman created this revision. Right now the `external_source_symbol` attribute isn't supported by `#pragma clang attribute` for the following two reasons: - The `Named` attribute subject isn't supported by TableGen. - There was no way to specify a subject match rule for `#pragma clang attribute` that could operate on a set of attribute subjects (e.g. the ones that derive from `NamedDecl`). This patch fixes the two issues and thus adds `external_source_symbol` support to `#pragma clang attribute`, Repository: rL LLVM https://reviews.llvm.org/D32176 Files: include/clang/Basic/Attr.td lib/Sema/SemaDeclAttr.cpp test/Misc/pragma-attribute-supported-attributes-list.test utils/TableGen/ClangAttrEmitter.cpp Index: utils/TableGen/ClangAttrEmitter.cpp === --- utils/TableGen/ClangAttrEmitter.cpp +++ utils/TableGen/ClangAttrEmitter.cpp @@ -1611,7 +1611,36 @@ struct PragmaClangAttributeSupport { std::vector Rules; - llvm::DenseMap SubjectsToRules; + + class RuleOrAggregateRuleSet { +std::vector Rules; +bool IsRule; +RuleOrAggregateRuleSet(ArrayRef Rules, + bool IsRule) +: Rules(Rules.begin(), Rules.end()), IsRule(IsRule) {} + + public: +bool isRule() const { return IsRule; } + +AttributeSubjectMatchRule &getRule() { + assert(IsRule && "not a rule!"); + return Rules[0]; +} + +ArrayRef getAggregateRuleSet() const { + return Rules; +} + +static RuleOrAggregateRuleSet +getRule(const AttributeSubjectMatchRule &Rule) { + return RuleOrAggregateRuleSet(Rule, /*IsRule=*/true); +} +static RuleOrAggregateRuleSet +getAggregateRuleSet(ArrayRef Rules) { + return RuleOrAggregateRuleSet(Rules, /*IsRule=*/false); +} + }; + llvm::DenseMap SubjectsToRules; PragmaClangAttributeSupport(RecordKeeper &Records); @@ -1626,6 +1655,15 @@ } // end anonymous namespace +static bool doesDeclDeriveFrom(const Record *D, const Record *Base) { + const Record *CurrentBase = D->getValueAsDef("Base"); + if (!CurrentBase) +return false; + if (CurrentBase == Base) +return true; + return doesDeclDeriveFrom(CurrentBase, Base); +} + PragmaClangAttributeSupport::PragmaClangAttributeSupport( RecordKeeper &Records) { std::vector MetaSubjects = @@ -1638,7 +1676,11 @@ SubjectContainer->getValueAsListOfDefs("Subjects"); for (const auto *Subject : ApplicableSubjects) { bool Inserted = - SubjectsToRules.try_emplace(Subject, MetaSubject, Constraint).second; + SubjectsToRules + .try_emplace(Subject, RuleOrAggregateRuleSet::getRule( +AttributeSubjectMatchRule(MetaSubject, + Constraint))) + .second; if (!Inserted) { PrintFatalError("Attribute subject match rules should not represent" "same attribute subjects."); @@ -1652,6 +1694,37 @@ for (const auto *Constraint : Constraints) MapFromSubjectsToRules(Constraint, MetaSubject, Constraint); } + + std::vector Aggregates = + Records.getAllDerivedDefinitions("AttrSubjectMatcherAggregateRule"); + std::vector DeclNodes = Records.getAllDerivedDefinitions("DDecl"); + for (const Record *Aggregate : Aggregates) { +Record *SubjectDecl = Aggregate->getValueAsDef("Subject"); + +// Gather sub-classes of the aggregate subject that act as attribute +// subject rules. +std::vector Rules; +for (const auto *D : DeclNodes) { + if (doesDeclDeriveFrom(D, SubjectDecl)) { +auto It = SubjectsToRules.find(D); +if (It == SubjectsToRules.end()) + continue; +if (!It->second.isRule() || It->second.getRule().isSubRule()) + continue; // Assume that the rule will be included as well. +Rules.push_back(It->second.getRule()); + } +} + +bool Inserted = +SubjectsToRules +.try_emplace(SubjectDecl, + RuleOrAggregateRuleSet::getAggregateRuleSet(Rules)) +.second; +if (!Inserted) { + PrintFatalError("Attribute subject match rules should not represent" + "same attribute subjects."); +} + } } static PragmaClangAttributeSupport & @@ -1738,24 +1811,25 @@ auto It = SubjectsToRules.find(Subject); assert(It != SubjectsToRules.end() && "This attribute is unsupported by #pragma clang attribute"); -AttributeSubjectMatchRule Rule = It->getSecond(); -// The rule might be language specific, so only subtract it from the given -// rules if the specific language options are specified. -std::vector LangOpts = Rule.getLangOpts(); -SS << " MatchRules.push_back(std::make_pair(" << Rule.getEnumValue() - << ", /*IsSupported=*/"; -if (!LangOpts.empty()) { - for (auto I = LangOpts.be
[PATCH] D32176: Add #pragma clang attribute support for the external_source_symbol attribute
arphaman updated this revision to Diff 95593. arphaman added a comment. Avoid a vector copy by using a reference variable. Repository: rL LLVM https://reviews.llvm.org/D32176 Files: include/clang/Basic/Attr.td lib/Sema/SemaDeclAttr.cpp test/Misc/pragma-attribute-supported-attributes-list.test utils/TableGen/ClangAttrEmitter.cpp Index: utils/TableGen/ClangAttrEmitter.cpp === --- utils/TableGen/ClangAttrEmitter.cpp +++ utils/TableGen/ClangAttrEmitter.cpp @@ -1611,7 +1611,36 @@ struct PragmaClangAttributeSupport { std::vector Rules; - llvm::DenseMap SubjectsToRules; + + class RuleOrAggregateRuleSet { +std::vector Rules; +bool IsRule; +RuleOrAggregateRuleSet(ArrayRef Rules, + bool IsRule) +: Rules(Rules.begin(), Rules.end()), IsRule(IsRule) {} + + public: +bool isRule() const { return IsRule; } + +AttributeSubjectMatchRule &getRule() { + assert(IsRule && "not a rule!"); + return Rules[0]; +} + +ArrayRef getAggregateRuleSet() const { + return Rules; +} + +static RuleOrAggregateRuleSet +getRule(const AttributeSubjectMatchRule &Rule) { + return RuleOrAggregateRuleSet(Rule, /*IsRule=*/true); +} +static RuleOrAggregateRuleSet +getAggregateRuleSet(ArrayRef Rules) { + return RuleOrAggregateRuleSet(Rules, /*IsRule=*/false); +} + }; + llvm::DenseMap SubjectsToRules; PragmaClangAttributeSupport(RecordKeeper &Records); @@ -1626,6 +1655,15 @@ } // end anonymous namespace +static bool doesDeclDeriveFrom(const Record *D, const Record *Base) { + const Record *CurrentBase = D->getValueAsDef("Base"); + if (!CurrentBase) +return false; + if (CurrentBase == Base) +return true; + return doesDeclDeriveFrom(CurrentBase, Base); +} + PragmaClangAttributeSupport::PragmaClangAttributeSupport( RecordKeeper &Records) { std::vector MetaSubjects = @@ -1638,7 +1676,11 @@ SubjectContainer->getValueAsListOfDefs("Subjects"); for (const auto *Subject : ApplicableSubjects) { bool Inserted = - SubjectsToRules.try_emplace(Subject, MetaSubject, Constraint).second; + SubjectsToRules + .try_emplace(Subject, RuleOrAggregateRuleSet::getRule( +AttributeSubjectMatchRule(MetaSubject, + Constraint))) + .second; if (!Inserted) { PrintFatalError("Attribute subject match rules should not represent" "same attribute subjects."); @@ -1652,6 +1694,37 @@ for (const auto *Constraint : Constraints) MapFromSubjectsToRules(Constraint, MetaSubject, Constraint); } + + std::vector Aggregates = + Records.getAllDerivedDefinitions("AttrSubjectMatcherAggregateRule"); + std::vector DeclNodes = Records.getAllDerivedDefinitions("DDecl"); + for (const Record *Aggregate : Aggregates) { +Record *SubjectDecl = Aggregate->getValueAsDef("Subject"); + +// Gather sub-classes of the aggregate subject that act as attribute +// subject rules. +std::vector Rules; +for (const auto *D : DeclNodes) { + if (doesDeclDeriveFrom(D, SubjectDecl)) { +auto It = SubjectsToRules.find(D); +if (It == SubjectsToRules.end()) + continue; +if (!It->second.isRule() || It->second.getRule().isSubRule()) + continue; // Assume that the rule will be included as well. +Rules.push_back(It->second.getRule()); + } +} + +bool Inserted = +SubjectsToRules +.try_emplace(SubjectDecl, + RuleOrAggregateRuleSet::getAggregateRuleSet(Rules)) +.second; +if (!Inserted) { + PrintFatalError("Attribute subject match rules should not represent" + "same attribute subjects."); +} + } } static PragmaClangAttributeSupport & @@ -1738,24 +1811,25 @@ auto It = SubjectsToRules.find(Subject); assert(It != SubjectsToRules.end() && "This attribute is unsupported by #pragma clang attribute"); -AttributeSubjectMatchRule Rule = It->getSecond(); -// The rule might be language specific, so only subtract it from the given -// rules if the specific language options are specified. -std::vector LangOpts = Rule.getLangOpts(); -SS << " MatchRules.push_back(std::make_pair(" << Rule.getEnumValue() - << ", /*IsSupported=*/"; -if (!LangOpts.empty()) { - for (auto I = LangOpts.begin(), E = LangOpts.end(); I != E; ++I) { -std::string Part = (*I)->getValueAsString("Name"); -if ((*I)->getValueAsBit("Negated")) - SS << "!"; -SS << "LangOpts." + Part; -if (I + 1 != E) - SS << " || "; - } -} else - SS << "true"; -SS << "));\n"; +for (const auto &Rule : It->getSecond().getAggregateRuleSet()) { +
[PATCH] D32164: [clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening casts by default
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D32164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32081: Add support for editor placeholders to Clang's lexer
arphaman updated this revision to Diff 95596. arphaman marked 2 inline comments as done. arphaman added a comment. Add comments and remove `-fno-allow-editor-placeholders` from CC1 options. Repository: rL LLVM https://reviews.llvm.org/D32081 Files: include/clang/Basic/DiagnosticLexKinds.td include/clang/Basic/IdentifierTable.h include/clang/Basic/LangOptions.def include/clang/Driver/Options.td include/clang/Lex/Lexer.h include/clang/Lex/Token.h lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInvocation.cpp lib/Lex/Lexer.cpp lib/Parse/Parser.cpp lib/Sema/SemaCXXScopeSpec.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp test/Driver/clang_f_opts.c test/Parser/editor-placeholder-recovery.cpp test/Parser/placeholder-recovery.m Index: test/Parser/placeholder-recovery.m === --- test/Parser/placeholder-recovery.m +++ test/Parser/placeholder-recovery.m @@ -1,11 +1,14 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +@protocol NSObject +@end + +@protocol <#protocol name#> // expected-error {{editor placeholder in source file}} +// expected-note@-1 {{protocol started here}} + // FIXME: We could do much better with this, if we recognized // placeholders somehow. However, we're content with not generating // bogus 'archaic' warnings with bad location info. -@protocol <#protocol name#> // expected-error {{expected identifier or '('}} \ -// expected-error 2{{expected identifier}} \ -// expected-warning{{protocol has no object type specified; defaults to qualified 'id'}} -<#methods#> +<#methods#> // expected-error {{editor placeholder in source file}} -@end +@end // expected-error {{prefix attribute must be followed by an interface or protocol}} expected-error {{missing '@end'}} Index: test/Parser/editor-placeholder-recovery.cpp === --- /dev/null +++ test/Parser/editor-placeholder-recovery.cpp @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fallow-editor-placeholders -DSUPPRESS -verify %s + +struct Struct { +public: +void method(Struct &x); +}; + +struct <#struct name#> { + int <#field-name#>; +#ifndef SUPPRESS + // expected-error@-3 {{editor placeholder in source file}} + // expected-error@-3 {{editor placeholder in source file}} +#endif +}; + +typename <#typename#>::<#name#>; +decltype(<#expression#>) foobar; +typedef <#type#> <#name#>; +#ifndef SUPPRESS + // expected-error@-4 2 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 2 {{editor placeholder in source file}} +#endif + +namespace <#identifier#> { + <#declarations#> +#ifndef SUPPRESS + // expected-error@-3 {{editor placeholder in source file}} + // expected-error@-3 {{editor placeholder in source file}} +#endif + +} + +using <#qualifier#>::<#name#>; +#ifndef SUPPRESS + // expected-error@-2 2 {{editor placeholder in source file}} +#endif + +void avoidPlaceholderErrors(Struct &obj) { +static_cast< <#type#> >(<#expression#>); +while (<#condition#>) { +<#statements#> +} +obj.method(<#Struct &x#>); +#ifndef SUPPRESS + // expected-error@-6 2 {{editor placeholder in source file}} + // expected-error@-6 {{editor placeholder in source file}} + // expected-error@-6 {{editor placeholder in source file}} + // expected-error@-5 {{editor placeholder in source file}} +#endif +switch (<#expression#>) { +case <#constant#>: +<#statements#> +#ifndef SUPPRESS + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} +#endif +break; + +default: +break; +} +} + +void Struct::method(<#Struct &x#>, noSupressionHere) { // expected-error {{unknown type name 'noSupressionHere'}} expected-error {{C++ requires a type specifier for all declarations}} +#ifndef SUPPRESS + // expected-error@-2 {{editor placeholder in source file}} +#endif +} Index: test/Driver/clang_f_opts.c === --- test/Driver/clang_f_opts.c +++ test/Driver/clang_f_opts.c @@ -494,3 +494,8 @@ // RUN: %clang -### -S -fdebug-info-for-profiling -fno-debug-info-for-profiling %s 2>&1 | FileCheck -check-prefix=CHECK-NO-PROFILE-DEBUG %s // CHECK-PROFILE-DEBUG: -fdebug-info-for-profiling // CHECK-NO-PROFILE-DEBUG-NOT: -fdebug-info-for-profiling + +// RUN: %clang -### -S -fallow-editor-placeholders %s 2>&1 | FileCheck -check-prefix=CHECK-ALLOW-PLACEHOLDERS %s +// RUN: %clang -### -S -fno-allow-editor-placeholders %s 2>&1 | FileCheck -check-prefix=CHECK-NO-ALLOW-PLACEHOLDERS %s +// CHECK-ALLOW-PLACEHOLDERS: -fallow-editor-placeholders +// CHECK-NO-ALLOW-PLACEHOLDERS-NOT: -fallow-editor-placeholders Index: lib/Sema/SemaExpr.cpp ==
[PATCH] D32178: Delete unstable integration tests
jroelofs created this revision. These tests are breaking when tested under the upstream 3.8.1 release + the 10.12 / 16C58 sdk. They use headers from the host SDKs, so they are not stable with respect to adding new language features, such as class `@properties`. Regression tests should not depend at all on the state of the host system. If these tests are still useful, they ought to live somewhere else (test-suite?). https://reviews.llvm.org/D32178 Files: test/Integration/carbon.c test/Integration/cocoa-pch.m test/Integration/cocoa.m Index: test/Integration/cocoa.m === --- test/Integration/cocoa.m +++ test/Integration/cocoa.m @@ -1,5 +0,0 @@ -// RUN: %clang -arch x86_64 %s -fsyntax-only -Xclang -print-stats -#ifdef __APPLE__ -#include -#endif - Index: test/Integration/cocoa-pch.m === --- test/Integration/cocoa-pch.m +++ test/Integration/cocoa-pch.m @@ -1,7 +0,0 @@ -// RUN: %clang -arch x86_64 -x objective-c-header %s -o %t.h.pch -// RUN: touch %t.empty.m -// RUN: %clang -arch x86_64 -fsyntax-only %t.empty.m -include %t.h -Xclang -ast-dump 2>&1 > /dev/null -#ifdef __APPLE__ -#include -#endif - Index: test/Integration/carbon.c === --- test/Integration/carbon.c +++ test/Integration/carbon.c @@ -1,4 +0,0 @@ -// RUN: %clang -fsyntax-only %s -#ifdef __APPLE__ -#include -#endif Index: test/Integration/cocoa.m === --- test/Integration/cocoa.m +++ test/Integration/cocoa.m @@ -1,5 +0,0 @@ -// RUN: %clang -arch x86_64 %s -fsyntax-only -Xclang -print-stats -#ifdef __APPLE__ -#include -#endif - Index: test/Integration/cocoa-pch.m === --- test/Integration/cocoa-pch.m +++ test/Integration/cocoa-pch.m @@ -1,7 +0,0 @@ -// RUN: %clang -arch x86_64 -x objective-c-header %s -o %t.h.pch -// RUN: touch %t.empty.m -// RUN: %clang -arch x86_64 -fsyntax-only %t.empty.m -include %t.h -Xclang -ast-dump 2>&1 > /dev/null -#ifdef __APPLE__ -#include -#endif - Index: test/Integration/carbon.c === --- test/Integration/carbon.c +++ test/Integration/carbon.c @@ -1,4 +0,0 @@ -// RUN: %clang -fsyntax-only %s -#ifdef __APPLE__ -#include -#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31757: [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
alexfh added a comment. Awesome, thanks! A few late comments inline. Comment at: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp:56 +void InefficientVectorOperationCheck::registerMatchers(MatchFinder *Finder) { + const auto VectorDecl = cxxRecordDecl(hasName("::std::vector")); + const auto VectorDefaultConstructorCall = cxxConstructExpr( It might make sense to make the list of types configurable to support custom vector-like types. Comment at: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp:65 + cxxMemberCallExpr( + callee(cxxMethodDecl(hasName("push_back"))), on(hasType(VectorDecl)), + onImplicitObjectArgument(declRefExpr(to(VectorVarDecl Loops with `emplace_back` would suffer from the same issue. Comment at: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp:131 + + llvm::StringRef LoopEndSource = clang::Lexer::getSourceText( + CharSourceRange::getTokenRange(LoopEndExpr->getSourceRange()), SM, No need to namespace-qualify StringRef and Lexer. Comment at: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp:133 + CharSourceRange::getTokenRange(LoopEndExpr->getSourceRange()), SM, + clang::LangOptions()); + llvm::StringRef VectorVarName = clang::Lexer::getSourceText( Actual LangOptions should be used instead of a default-constructed instance. Same below. Comment at: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp:143 + "'push_back' is called inside a loop; " + "consider pre-allocating the vector capacity before the loop.") + << FixItHint::CreateInsertion(ForLoop->getLocStart(), ReserveStmt); Please remove the trailing period. Repository: rL LLVM https://reviews.llvm.org/D31757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300568 - Mark LWG#2788 as complete - we already do this
Author: marshall Date: Tue Apr 18 12:22:49 2017 New Revision: 300568 URL: http://llvm.org/viewvc/llvm-project?rev=300568&view=rev Log: Mark LWG#2788 as complete - we already do this Modified: libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=300568&r1=300567&r2=300568&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Tue Apr 18 12:22:49 2017 @@ -442,7 +442,7 @@ http://wg21.link/LWG2785";>2785quoted should work with basic_string_viewKonaComplete http://wg21.link/LWG2786";>2786Annex C should mention shared_ptr changes for array supportKonaComplete http://wg21.link/LWG2787";>2787§[file_status.cons] doesn't match class definitionKonaComplete - http://wg21.link/LWG2788";>2788basic_string range mutators unintentionally require a default constructible allocatorKona + http://wg21.link/LWG2788";>2788basic_string range mutators unintentionally require a default constructible allocatorKonaComplete http://wg21.link/LWG2789";>2789Equivalence of contained objectsKonaComplete http://wg21.link/LWG2790";>2790Missing specification of istreambuf_iterator::operator->Kona http://wg21.link/LWG2794";>2794Missing requirements for allocator pointersKona ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r300569 - [clang-tidy] Fix google-explicit-constructor issue with out-of-line conversions
Author: alexfh Date: Tue Apr 18 12:26:00 2017 New Revision: 300569 URL: http://llvm.org/viewvc/llvm-project?rev=300569&view=rev Log: [clang-tidy] Fix google-explicit-constructor issue with out-of-line conversions Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=300569&r1=300568&r2=300569&view=diff == --- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Tue Apr 18 12:26:00 2017 @@ -91,6 +91,8 @@ void ExplicitConstructorCheck::check(con if (const auto *Conversion = Result.Nodes.getNodeAs("conversion")) { +if (Conversion->isOutOfLine()) + return; SourceLocation Loc = Conversion->getLocation(); // Ignore all macros until we learn to ignore specific ones (e.g. used in // gmock to define matchers). Modified: clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp?rev=300569&r1=300568&r2=300569&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp Tue Apr 18 12:26:00 2017 @@ -46,9 +46,9 @@ struct A { // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: copy constructor should not be declared explicit [google-explicit-constructor] // CHECK-FIXES: {{^ }}A(const A& a) {} - A(int x1) {} + A(int x1); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] - // CHECK-FIXES: {{^ }}explicit A(int x1) {} + // CHECK-FIXES: {{^ }}explicit A(int x1); A(double x2, double y = 3.14) {} // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructors that are callable with a single argument must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] @@ -60,6 +60,8 @@ struct A { // CHECK-FIXES: {{^ }}explicit A(T&&... args); }; +inline A::A(int x1) {} + struct B { B(std::initializer_list list1) {} B(const std::initializer_list &list2) {} @@ -69,6 +71,10 @@ struct B { // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator bool' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] // CHECK-FIXES: {{^ }}explicit operator bool() const { return true; } + operator double() const; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'operator double' must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor] + // CHECK-FIXES: {{^ }}explicit operator double() const; + explicit B(::std::initializer_list list4) {} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor should not be declared explicit [google-explicit-constructor] // CHECK-FIXES: {{^ }}B(::std::initializer_list list4) {} @@ -82,6 +88,8 @@ struct B { // CHECK-FIXES: {{^ }}B(::std::initializer_list &&list6) {} }; +inline B::operator double() const { return 0.0; } + struct StructWithFnPointer { void (*f)(); } struct_with_fn_pointer = {[] {}}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300570 - Testing commit access.
Author: manojgupta Date: Tue Apr 18 12:34:46 2017 New Revision: 300570 URL: http://llvm.org/viewvc/llvm-project?rev=300570&view=rev Log: Testing commit access. Summary: Test commit access. Reviewers: gbiv, george.burgess.iv Reviewed By: george.burgess.iv Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32161 Modified: cfe/trunk/unittests/Driver/ToolChainTest.cpp Modified: cfe/trunk/unittests/Driver/ToolChainTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/ToolChainTest.cpp?rev=300570&r1=300569&r2=300570&view=diff == --- cfe/trunk/unittests/Driver/ToolChainTest.cpp (original) +++ cfe/trunk/unittests/Driver/ToolChainTest.cpp Tue Apr 18 12:34:46 2017 @@ -142,4 +142,4 @@ TEST(ToolChainTest, DefaultDriverMode) { EXPECT_TRUE(CLDriver.IsCLMode()); } -} // end anonymous namespace +} // end anonymous namespace. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300571 - [AArch64][clang] Pass cpu/arch information to assembler for AArch64.
Author: manojgupta Date: Tue Apr 18 12:36:10 2017 New Revision: 300571 URL: http://llvm.org/viewvc/llvm-project?rev=300571&view=rev Log: [AArch64][clang] Pass cpu/arch information to assembler for AArch64. Summary: Pass Cpu/Arch options to assembler for AArch64 with no-integrated-as. This fixes PR20019. Reviewers: richard.barton.arm, kristof.beyls, rengolin Reviewed By: rengolin Subscribers: srhines, pirama, aemerson, rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D32132 Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/linux-as.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=300571&r1=300570&r2=300571&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 18 12:36:10 2017 @@ -770,6 +770,12 @@ void tools::gnutools::Assembler::Constru Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ); break; } + case llvm::Triple::aarch64: + case llvm::Triple::aarch64_be: { +Args.AddLastArg(CmdArgs, options::OPT_march_EQ); +Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ); +break; + } case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::mips64: Modified: cfe/trunk/test/Driver/linux-as.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-as.c?rev=300571&r1=300570&r2=300571&view=diff == --- cfe/trunk/test/Driver/linux-as.c (original) +++ cfe/trunk/test/Driver/linux-as.c Tue Apr 18 12:36:10 2017 @@ -100,6 +100,33 @@ // RUN: | FileCheck -check-prefix=CHECK-ARM-HARDFP %s // CHECK-ARM-HARDFP: as{{(.exe)?}}" "-mfloat-abi=hard" // +// RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-MCPU %s +// CHECK-ARM64-MCPU: as{{(.exe)?}}" "-mcpu=cortex-a53" +// +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-MARCH %s +// CHECK-ARM64-MARCH: as{{(.exe)?}}" "-march=armv8-a" +// +// RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-ALL %s +// CHECK-ARM64-ALL: as{{(.exe)?}}" "-march=armv8-a" "-mcpu=cortex-a53" +// +// RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-MCPU %s +// +// RUN: %clang -target aarch64_be-linux-gnu -march=armv8-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-MARCH %s +// +// RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-ALL %s +// // RUN: %clang -target ppc-linux -mcpu=invalid-cpu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-PPC-NO-MCPU %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300572 - Remove unused varible
Author: rnk Date: Tue Apr 18 12:44:41 2017 New Revision: 300572 URL: http://llvm.org/viewvc/llvm-project?rev=300572&view=rev Log: Remove unused varible The Result variable is unused both in Sema::CheckARMBuiltinFunctionCall and Sema::CheckAArch64BuiltinFunctionCall, remove it. Patch by Wei-Ren Chen! Reviewers: craig.topper, rnk Reviewed By: rnk Subscribers: aemerson, cfe-commits, rengolin Differential Revision: https://reviews.llvm.org/D32014 Modified: cfe/trunk/lib/Sema/SemaChecking.cpp Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=300572&r1=300571&r2=300572&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Apr 18 12:44:41 2017 @@ -1391,8 +1391,6 @@ bool Sema::CheckARMBuiltinExclusiveCall( } bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == ARM::BI__builtin_arm_ldrex || BuiltinID == ARM::BI__builtin_arm_ldaex || BuiltinID == ARM::BI__builtin_arm_strex || @@ -1439,8 +1437,6 @@ bool Sema::CheckARMBuiltinFunctionCall(u bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == AArch64::BI__builtin_arm_ldrex || BuiltinID == AArch64::BI__builtin_arm_ldaex || BuiltinID == AArch64::BI__builtin_arm_strex || ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32014: Remove unused varible
This revision was automatically updated to reflect the committed changes. Closed by commit rL300572: Remove unused varible (authored by rnk). Changed prior to commit: https://reviews.llvm.org/D32014?vs=95123&id=95602#toc Repository: rL LLVM https://reviews.llvm.org/D32014 Files: cfe/trunk/lib/Sema/SemaChecking.cpp Index: cfe/trunk/lib/Sema/SemaChecking.cpp === --- cfe/trunk/lib/Sema/SemaChecking.cpp +++ cfe/trunk/lib/Sema/SemaChecking.cpp @@ -1391,8 +1391,6 @@ } bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == ARM::BI__builtin_arm_ldrex || BuiltinID == ARM::BI__builtin_arm_ldaex || BuiltinID == ARM::BI__builtin_arm_strex || @@ -1439,8 +1437,6 @@ bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == AArch64::BI__builtin_arm_ldrex || BuiltinID == AArch64::BI__builtin_arm_ldaex || BuiltinID == AArch64::BI__builtin_arm_strex || Index: cfe/trunk/lib/Sema/SemaChecking.cpp === --- cfe/trunk/lib/Sema/SemaChecking.cpp +++ cfe/trunk/lib/Sema/SemaChecking.cpp @@ -1391,8 +1391,6 @@ } bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == ARM::BI__builtin_arm_ldrex || BuiltinID == ARM::BI__builtin_arm_ldaex || BuiltinID == ARM::BI__builtin_arm_strex || @@ -1439,8 +1437,6 @@ bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - llvm::APSInt Result; - if (BuiltinID == AArch64::BI__builtin_arm_ldrex || BuiltinID == AArch64::BI__builtin_arm_ldaex || BuiltinID == AArch64::BI__builtin_arm_strex || ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects
alexfh accepted this revision. alexfh added a comment. LG with one nit. Comment at: clang-tidy/readability/ContainerSizeEmptyCheck.cpp:209 + "the 'empty' method should be used to check " + "for emptiness instead of comparing to an empty object.") +<< Hint; nit: Please remove the trailing period to follow the style other diagnostic messages use. Repository: rL LLVM https://reviews.llvm.org/D31542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32181: Remove use of coverage-file flag
aaron.ballman created this revision. The -coverage-file flag was removed in r280306, but I believe this part may have been missed. However, since I'm unfamiliar with this feature, I wanted to be sure. https://reviews.llvm.org/D32181 Files: lib/Driver/Job.cpp Index: lib/Driver/Job.cpp === --- lib/Driver/Job.cpp +++ lib/Driver/Job.cpp @@ -49,7 +49,7 @@ // arguments. Therefore, we need to skip the flag and the next argument. bool ShouldSkip = llvm::StringSwitch(Flag) .Cases("-MF", "-MT", "-MQ", "-serialize-diagnostic-file", true) -.Cases("-o", "-coverage-file", "-dependency-file", true) +.Cases("-o", "-dependency-file", true) .Cases("-fdebug-compilation-dir", "-diagnostic-log-file", true) .Cases("-dwarf-debug-flags", "-ivfsoverlay", true) .Default(false); Index: lib/Driver/Job.cpp === --- lib/Driver/Job.cpp +++ lib/Driver/Job.cpp @@ -49,7 +49,7 @@ // arguments. Therefore, we need to skip the flag and the next argument. bool ShouldSkip = llvm::StringSwitch(Flag) .Cases("-MF", "-MT", "-MQ", "-serialize-diagnostic-file", true) -.Cases("-o", "-coverage-file", "-dependency-file", true) +.Cases("-o", "-dependency-file", true) .Cases("-fdebug-compilation-dir", "-diagnostic-log-file", true) .Cases("-dwarf-debug-flags", "-ivfsoverlay", true) .Default(false); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute
alexfh added inline comments. Comment at: cfe/trunk/include/clang/Basic/AttrDocs.td:2792 + namespace N { +[[clang::suppress("type", "bounds")]]; +... Should this be `gsl::suppress` as well? Repository: rL LLVM https://reviews.llvm.org/D24886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32119: Emit warning when umbrella directory does not exists
v.g.vassilev accepted this revision. v.g.vassilev added a comment. This revision is now accepted and ready to land. LGTM! https://reviews.llvm.org/D32119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300575 - [test] Silence unused parameter/typedef warnings
Author: caseycarter Date: Tue Apr 18 13:44:33 2017 New Revision: 300575 URL: http://llvm.org/viewvc/llvm-project?rev=300575&view=rev Log: [test] Silence unused parameter/typedef warnings Modified: libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp Modified: libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp?rev=300575&r1=300574&r2=300575&view=diff == --- libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Tue Apr 18 13:44:33 2017 @@ -113,7 +113,7 @@ int main() std::throw_with_nested("String literal"); assert(false); } -catch (const char * s) +catch (const char *) { } } Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp?rev=300575&r1=300574&r2=300575&view=diff == --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp Tue Apr 18 13:44:33 2017 @@ -81,11 +81,9 @@ void test_sfinae() { using DB = NCConvertingDeleter; using UA = std::unique_ptr; using UAC = std::unique_ptr; - using UB = std::unique_ptr; using UAD = std::unique_ptr; using UACD = std::unique_ptr; - using UBD = std::unique_ptr; { // cannot move from an lvalue static_assert(std::is_assignable::value, ""); static_assert(!std::is_assignable::value, ""); Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp?rev=300575&r1=300574&r2=300575&view=diff == --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp Tue Apr 18 13:44:33 2017 @@ -46,7 +46,7 @@ struct NonDefaultDeleter { template void test_sfinae() { #if TEST_STD_VER >= 11 - { // the constructor does not participate in overload resultion when + { // the constructor does not participate in overload resolution when // the deleter is a pointer type using U = std::unique_ptr; static_assert(!std::is_default_constructible::value, ""); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r300575 - [test] Silence unused parameter/typedef warnings
Sorry I've been meaning to enable `-Wunused-typedef" for a while but I haven't had a chance to clean up the remaining occurrences Thanks for the cleanup. On Tue, Apr 18, 2017 at 12:44 PM, Casey Carter via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: caseycarter > Date: Tue Apr 18 13:44:33 2017 > New Revision: 300575 > > URL: http://llvm.org/viewvc/llvm-project?rev=300575&view=rev > Log: > [test] Silence unused parameter/typedef warnings > > Modified: > libcxx/trunk/test/std/language.support/support. > exception/except.nested/throw_with_nested.pass.cpp > libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp > libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.ctor/default.pass.cpp > > Modified: libcxx/trunk/test/std/language.support/support. > exception/except.nested/throw_with_nested.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ > language.support/support.exception/except.nested/throw_ > with_nested.pass.cpp?rev=300575&r1=300574&r2=300575&view=diff > > == > --- libcxx/trunk/test/std/language.support/support. > exception/except.nested/throw_with_nested.pass.cpp (original) > +++ libcxx/trunk/test/std/language.support/support. > exception/except.nested/throw_with_nested.pass.cpp Tue Apr 18 13:44:33 > 2017 > @@ -113,7 +113,7 @@ int main() > std::throw_with_nested("String literal"); > assert(false); > } > -catch (const char * s) > +catch (const char *) > { > } > } > > Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ > utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr. > asgn/move_convert.runtime.pass.cpp?rev=300575&r1=300574& > r2=300575&view=diff > > == > --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp (original) > +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp Tue Apr 18 > 13:44:33 2017 > @@ -81,11 +81,9 @@ void test_sfinae() { >using DB = NCConvertingDeleter; >using UA = std::unique_ptr; >using UAC = std::unique_ptr; > - using UB = std::unique_ptr; >using UAD = std::unique_ptr; >using UACD = std::unique_ptr; > > - using UBD = std::unique_ptr; >{ // cannot move from an lvalue > static_assert(std::is_assignable::value, ""); > static_assert(!std::is_assignable::value, ""); > > Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.ctor/default.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ > utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr. > ctor/default.pass.cpp?rev=300575&r1=300574&r2=300575&view=diff > > == > --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.ctor/default.pass.cpp (original) > +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/ > unique.ptr.class/unique.ptr.ctor/default.pass.cpp Tue Apr 18 13:44:33 2017 > @@ -46,7 +46,7 @@ struct NonDefaultDeleter { > template > void test_sfinae() { > #if TEST_STD_VER >= 11 > - { // the constructor does not participate in overload resultion when > + { // the constructor does not participate in overload resolution when > // the deleter is a pointer type > using U = std::unique_ptr; > static_assert(!std::is_default_constructible::value, ""); > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32064: [asan] Disable ASan global-GC depending on the target and compiler flags
eugenis added a comment. Ping. I don't really have a preference. Repository: rL LLVM https://reviews.llvm.org/D32064 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300578 - [DOXYGEN] Minor improvements in doxygen comments.
Author: kromanova Date: Tue Apr 18 14:44:07 2017 New Revision: 300578 URL: http://llvm.org/viewvc/llvm-project?rev=300578&view=rev Log: [DOXYGEN] Minor improvements in doxygen comments. - To be consistent with the rest of the intrinsics headers, I removed the tags .. for marking instruction names in italics in in smmintrin.h. - Formatting changes to fit into 80 characters. I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. Modified: cfe/trunk/lib/Headers/smmintrin.h cfe/trunk/lib/Headers/xmmintrin.h Modified: cfe/trunk/lib/Headers/smmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=300578&r1=300577&r2=300578&view=diff == --- cfe/trunk/lib/Headers/smmintrin.h (original) +++ cfe/trunk/lib/Headers/smmintrin.h Tue Apr 18 14:44:07 2017 @@ -56,8 +56,7 @@ /// __m128 _mm_ceil_ps(__m128 X); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPS / ROUNDPS -/// instruction. +/// This intrinsic corresponds to the VROUNDPS / ROUNDPS instruction. /// /// \param X ///A 128-bit vector of [4 x float] values to be rounded up. @@ -74,8 +73,7 @@ /// __m128d _mm_ceil_pd(__m128d X); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPD / ROUNDPD -/// instruction. +/// This intrinsic corresponds to the VROUNDPD / ROUNDPD instruction. /// /// \param X ///A 128-bit vector of [2 x double] values to be rounded up. @@ -94,8 +92,7 @@ /// __m128 _mm_ceil_ss(__m128 X, __m128 Y); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSS / ROUNDSS -/// instruction. +/// This intrinsic corresponds to the VROUNDSS / ROUNDSS instruction. /// /// \param X ///A 128-bit vector of [4 x float]. The values stored in bits [127:32] are @@ -120,8 +117,7 @@ /// __m128d _mm_ceil_sd(__m128d X, __m128d Y); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSD / ROUNDSD -/// instruction. +/// This intrinsic corresponds to the VROUNDSD / ROUNDSD instruction. /// /// \param X ///A 128-bit vector of [2 x double]. The value stored in bits [127:64] is @@ -144,8 +140,7 @@ /// __m128 _mm_floor_ps(__m128 X); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPS / ROUNDPS -/// instruction. +/// This intrinsic corresponds to the VROUNDPS / ROUNDPS instruction. /// /// \param X ///A 128-bit vector of [4 x float] values to be rounded down. @@ -162,8 +157,7 @@ /// __m128d _mm_floor_pd(__m128d X); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPD / ROUNDPD -/// instruction. +/// This intrinsic corresponds to the VROUNDPD / ROUNDPD instruction. /// /// \param X ///A 128-bit vector of [2 x double]. @@ -182,8 +176,7 @@ /// __m128 _mm_floor_ss(__m128 X, __m128 Y); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSS / ROUNDSS -/// instruction. +/// This intrinsic corresponds to the VROUNDSS / ROUNDSS instruction. /// /// \param X ///A 128-bit vector of [4 x float]. The values stored in bits [127:32] are @@ -208,8 +201,7 @@ /// __m128d _mm_floor_sd(__m128d X, __m128d Y); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSD / ROUNDSD -/// instruction. +/// This intrinsic corresponds to the VROUNDSD / ROUNDSD instruction. /// /// \param X ///A 128-bit vector of [2 x double]. The value stored in bits [127:64] is @@ -233,8 +225,7 @@ /// __m128 _mm_round_ps(__m128 X, const int M); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPS / ROUNDPS -/// instruction. +/// This intrinsic corresponds to the VROUNDPS / ROUNDPS instruction. /// /// \param X ///A 128-bit vector of [4 x float]. @@ -269,8 +260,7 @@ /// __m128 _mm_round_ss(__m128 X, __m128 Y, const int M); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSS / ROUNDSS -/// instruction. +/// This intrinsic corresponds to the VROUNDSS / ROUNDSS instruction. /// /// \param X ///A 128-bit vector of [4 x float]. The values stored in bits [127:32] are @@ -310,8 +300,7 @@ /// __m128d _mm_round_pd(__m128d X, const int M); /// \endcode /// -/// This intrinsic corresponds to the VROUNDPD / ROUNDPD -/// instruction. +/// This intrinsic corresponds to the VROUNDPD / ROUNDPD instruction. /// /// \param X ///A 128-bit vector of [2 x double]. @@ -333,7 +322,6 @@ #define _mm_round_pd(X, M) __extension__ ({ \ (__m128d)__builtin_ia32_roundpd((__v2df)(__m128d)(X), (M)); }) - /// \brief Copies the upper element of the first 128-bit vector operand to the ///corresponding upper element of the 128-bit result vector of [2 x double]. ///Rounds the lower element of the second 128-bit vector operand to an @@ -347,8 +335,7 @@ /// __m128d _mm_round_sd(__m128d X, __m128d Y, const int M); /// \endcode /// -/// This intrinsic corresponds to the VROUNDSD / ROUNDSD -/// ins
[libcxx] r300581 - [test] Silence another unused-typedef warning
Author: caseycarter Date: Tue Apr 18 15:04:39 2017 New Revision: 300581 URL: http://llvm.org/viewvc/llvm-project?rev=300581&view=rev Log: [test] Silence another unused-typedef warning Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp?rev=300581&r1=300580&r2=300581&view=diff == --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp Tue Apr 18 15:04:39 2017 @@ -78,7 +78,6 @@ void test_sfinae() { using DA = NCConvertingDeleter;// non-copyable deleters using DAC = NCConvertingDeleter; // non-copyable deleters - using DB = NCConvertingDeleter; using UA = std::unique_ptr; using UAC = std::unique_ptr; using UAD = std::unique_ptr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32046: [Preprocessor]Correct Macro-Arg allocation of StringifiedArguments, correct getNumArguments
erichkeane added a comment. Bump! I'll note that this patch has nothing to do with MSVC and should simply be a memory-usage savings. https://reviews.llvm.org/D32046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32187: [CodeGen][ObjC]
ahatanak created this revision. This fixes a bug in EmitObjCForCollectionStmt which is causing clang to generate malformed IR. When the following code (which I think is legal, at least when it is not compiled with ARC) is compiled: $ cat test1.m @interface Obj @end void bar(void); void foo(Obj *o) { Obj *i; for (i in o) { thing: bar(); } goto thing; } the compilation terminates with the messages "Instruction does not dominate all uses!". This patch fixes the bug by using temporary local variables instead of PHI instructions and moving instructions to locations that dominate their uses. The example I showed still fails to compile (with an assertion) when compiled with -fobjc-arc, but I think that is a separate bug. rdar://problem/31670637 https://reviews.llvm.org/D32187 Files: lib/CodeGen/CGObjC.cpp test/CodeGenObjC/arc-foreach.m Index: test/CodeGenObjC/arc-foreach.m === --- test/CodeGenObjC/arc-foreach.m +++ test/CodeGenObjC/arc-foreach.m @@ -26,6 +26,9 @@ // CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*, // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]], +// CHECK-LP64-NEXT: [[INDEX:%.*]] = alloca [[INDEX_T:.*]], +// CHECK-LP64-NEXT: [[COUNT:%.*]] = alloca [[COUNT_T:.*]], +// CHECK-LP64-NEXT: [[MUTATION:%.*]] = alloca [[MUTATION_T:.*]], // CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], @@ -50,13 +53,29 @@ // CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* // CHECK-LP64-NEXT: [[SIZE:%.*]] = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, [[STATE_T]]*, [16 x i8*]*, i64)*)(i8* [[T1]], i8* [[T0]], [[STATE_T]]* [[STATE]], [16 x i8*]* [[BUFFER]], i64 16) +// CHECK-LP64-NEXT: [[MUTATIONPTRPTR:%.*]] = getelementptr inbounds [[STATE_T]], [[STATE_T]]* [[STATE]] + // Check for a nonzero result. // CHECK-LP64-NEXT: [[T0:%.*]] = icmp eq i64 [[SIZE]], 0 // CHECK-LP64-NEXT: br i1 [[T0]] +// Initialize count, index, and mutation. +// CHECK-LP64: [[MUTATIONPTR:%.*]] = load [[MUTATION_T]]*, [[MUTATION_T]]** [[MUTATIONPTRPTR]] +// CHECK-LP64: [[INITIALMUTATIONVAL:%.*]] = load [[MUTATION_T]], [[MUTATION_T]]* [[MUTATIONPTR]] +// CHECK-LP64: store [[MUTATION_T]] [[INITIALMUTATIONVAL]], [[MUTATION_T]]* [[MUTATION]] +// CHECK-LP64: store [[INDEX_T]] 0, [[INDEX_T]]* [[INDEX]] +// CHECK-LP64: store [[COUNT_T]] [[SIZE]], [[COUNT_T]]* [[COUNT]] + +// Check for mutation. +// CHECK-LP64: [[MUTATIONPTR:%.*]] = load [[MUTATION_T]]*, [[MUTATION_T]]** [[MUTATIONPTRPTR]] +// CHECK-LP64: [[MUTATIONSTATE:%.*]] = load [[MUTATION_T]], [[MUTATION_T]]* [[MUTATIONPTR]] +// CHECK-LP64: [[INITIALMUTATIONVAL:%.*]] = load [[MUTATION_T]], [[MUTATION_T]]* [[MUTATION]] +// CHECK-LP64: icmp eq [[MUTATION_T]] [[MUTATIONSTATE]], [[INITIALMUTATIONVAL]] + // CHECK-LP64: [[T0:%.*]] = getelementptr inbounds [[STATE_T]], [[STATE_T]]* [[STATE]], i32 0, i32 1 // CHECK-LP64-NEXT: [[T1:%.*]] = load i8**, i8*** [[T0]] -// CHECK-LP64-NEXT: [[T2:%.*]] = getelementptr i8*, i8** [[T1]], i64 +// CHECK-LP64-NEXT: [[INDEXVAL:%.*]] = load [[INDEX_T]], [[INDEX_T]]* [[INDEX]] +// CHECK-LP64-NEXT: [[T2:%.*]] = getelementptr i8*, i8** [[T1]], i64 [[INDEXVAL]] // CHECK-LP64-NEXT: [[T3:%.*]] = load i8*, i8** [[T2]] // CHECK-LP64-NEXT: store i8* [[T3]], i8** [[X]] @@ -69,9 +88,18 @@ // CHECK-LP64: call void @use_block( // CHECK-LP64-NEXT: call void @objc_storeStrong(i8** [[D0]], i8* null) +// Increment index. +// CHECK-LP64: [[INDEXVAL:%.*]] = load [[INDEX_T]], [[INDEX_T]]* [[INDEX]] +// CHECK-LP64: [[T0:%.*]] = add [[INDEX_T]] [[INDEXVAL]], 1 +// CHECK-LP64: store [[INDEX_T]] [[T0]], [[INDEX_T]]* [[INDEX]] +// CHECK-LP64: [[COUNTVAL:%.*]] = load [[COUNT_T]], [[COUNT_T]]* [[COUNT]] +// CHECK-LP64: icmp ult [[COUNT_T]] [[T0]], [[COUNTVAL]] + // CHECK-LP64: [[T0:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_ // CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* // CHECK-LP64-NEXT: [[SIZE:%.*]] = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, [[STATE_T]]*, [16 x i8*]*, i64)*)(i8* [[T1]], i8* [[T0]], [[STATE_T]]* [[STATE]], [16 x i8*]* [[BUFFER]], i64 16) +// CHECK-LP64: store [[INDEX_T]] 0, [[INDEX_T]]* [[INDEX]] +// CHECK-LP64: store [[COUNT_T]] [[SIZE]], [[COUNT_T]]* [[COUNT]] // Release the array. // CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* @@ -99,12 +127,16 @@ // CHECK-LP64: alloca [[ARRAY_T:%.*]]*, // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]], +// CHECK-LP64-NEXT: [[INDEX:%.*]] = alloca [[INDEX_T:.*]], +// CHECK-LP64-NEXT: [[COUNT:%.*]] = alloca [[COUNT_T:.*]], +// CHECK-LP64-NEXT: [[MUTATION:%.*]] = alloca [[MUTATION_T:.*]], // CHECK-LP64-NEXT: alloca [16 x i8*], align 8 // CHECK-LP
[PATCH] D31976: Avoid assert when a non-static member function is qualified with __unaligned
ahatanak added a comment. I see, thank you for the explanation. https://reviews.llvm.org/D31976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r300588 - [clang-tidy] Address a few late comments.
Author: hokein Date: Tue Apr 18 15:47:34 2017 New Revision: 300588 URL: http://llvm.org/viewvc/llvm-project?rev=300588&view=rev Log: [clang-tidy] Address a few late comments. Modified: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp?rev=300588&r1=300587&r2=300588&view=diff == --- clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp Tue Apr 18 15:47:34 2017 @@ -99,7 +99,8 @@ void InefficientVectorOperationCheck::re void InefficientVectorOperationCheck::check( const MatchFinder::MatchResult &Result) { - if (Result.Context->getDiagnostics().hasUncompilableErrorOccurred()) + auto* Context = Result.Context; + if (Context->getDiagnostics().hasUncompilableErrorOccurred()) return; const SourceManager &SM = *Result.SourceManager; @@ -113,7 +114,7 @@ void InefficientVectorOperationCheck::ch llvm::SmallPtrSet AllVectorVarRefs = utils::decl_ref_expr::allDeclRefExprs(*VectorVarDecl, *LoopParent, -*Result.Context); +*Context); for (const auto *Ref : AllVectorVarRefs) { // Skip cases where there are usages (defined as DeclRefExpr that refers to // "v") of vector variable `v` before the for loop. We consider these usages @@ -128,19 +129,19 @@ void InefficientVectorOperationCheck::ch } } - llvm::StringRef LoopEndSource = clang::Lexer::getSourceText( + llvm::StringRef LoopEndSource = Lexer::getSourceText( CharSourceRange::getTokenRange(LoopEndExpr->getSourceRange()), SM, - clang::LangOptions()); - llvm::StringRef VectorVarName = clang::Lexer::getSourceText( + Context->getLangOpts()); + llvm::StringRef VectorVarName = Lexer::getSourceText( CharSourceRange::getTokenRange( PushBackCall->getImplicitObjectArgument()->getSourceRange()), - SM, clang::LangOptions()); + SM, Context->getLangOpts()); std::string ReserveStmt = (VectorVarName + ".reserve(" + LoopEndSource + ");\n").str(); diag(PushBackCall->getLocStart(), "'push_back' is called inside a loop; " - "consider pre-allocating the vector capacity before the loop.") + "consider pre-allocating the vector capacity before the loop") << FixItHint::CreateInsertion(ForLoop->getLocStart(), ReserveStmt); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300591 - The SubjectMatchRule enum should not be used as a DenseMap key to avoid
Author: arphaman Date: Tue Apr 18 15:54:23 2017 New Revision: 300591 URL: http://llvm.org/viewvc/llvm-project?rev=300591&view=rev Log: The SubjectMatchRule enum should not be used as a DenseMap key to avoid UBSAN 'invalid value' failures The commit r300556 introduced a UBSAN issue that was caught by http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap. The DenseMap failed to create an empty/tombstone value as the empty/tombstone values for the SubjectMatchRule enum were not valid enum constants. Modified: cfe/trunk/include/clang/Basic/AttrSubjectMatchRules.h cfe/trunk/lib/Sema/SemaAttr.cpp Modified: cfe/trunk/include/clang/Basic/AttrSubjectMatchRules.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrSubjectMatchRules.h?rev=300591&r1=300590&r2=300591&view=diff == --- cfe/trunk/include/clang/Basic/AttrSubjectMatchRules.h (original) +++ cfe/trunk/include/clang/Basic/AttrSubjectMatchRules.h Tue Apr 18 15:54:23 2017 @@ -24,23 +24,9 @@ enum SubjectMatchRule { const char *getSubjectMatchRuleSpelling(SubjectMatchRule Rule); -using ParsedSubjectMatchRuleSet = llvm::DenseMap; +using ParsedSubjectMatchRuleSet = llvm::DenseMap; } // end namespace attr } // end namespace clang -namespace llvm { - -template <> -struct DenseMapInfo : DenseMapInfo { - static inline clang::attr::SubjectMatchRule getEmptyKey() { -return (clang::attr::SubjectMatchRule)DenseMapInfo::getEmptyKey(); - } - static inline clang::attr::SubjectMatchRule getTombstoneKey() { -return (clang::attr::SubjectMatchRule)DenseMapInfo::getTombstoneKey(); - } -}; - -} // end namespace llvm - #endif Modified: cfe/trunk/lib/Sema/SemaAttr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAttr.cpp?rev=300591&r1=300590&r2=300591&view=diff == --- cfe/trunk/lib/Sema/SemaAttr.cpp (original) +++ cfe/trunk/lib/Sema/SemaAttr.cpp Tue Apr 18 15:54:23 2017 @@ -440,12 +440,12 @@ void Sema::ActOnPragmaAttributePush(Attr //variable(is_parameter). // - a sub-rule and a sibling that's negated. E.g. //variable(is_thread_local) and variable(unless(is_parameter)) -llvm::SmallDenseMap, 2> +llvm::SmallDenseMap, 2> RulesToFirstSpecifiedNegatedSubRule; for (const auto &Rule : Rules) { + attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first); Optional ParentRule = - getParentAttrMatcherRule(Rule.first); + getParentAttrMatcherRule(MatchRule); if (!ParentRule) continue; auto It = Rules.find(*ParentRule); @@ -453,7 +453,7 @@ void Sema::ActOnPragmaAttributePush(Attr // A sub-rule contradicts a parent rule. Diag(Rule.second.getBegin(), diag::err_pragma_attribute_matcher_subrule_contradicts_rule) -<< attr::getSubjectMatchRuleSpelling(Rule.first) +<< attr::getSubjectMatchRuleSpelling(MatchRule) << attr::getSubjectMatchRuleSpelling(*ParentRule) << It->second << FixItHint::CreateRemoval( replacementRangeForListElement(*this, Rule.second)); @@ -461,14 +461,15 @@ void Sema::ActOnPragmaAttributePush(Attr // declarations that receive the attribute. continue; } - if (isNegatedAttrMatcherSubRule(Rule.first)) + if (isNegatedAttrMatcherSubRule(MatchRule)) RulesToFirstSpecifiedNegatedSubRule.insert( std::make_pair(*ParentRule, Rule)); } bool IgnoreNegatedSubRules = false; for (const auto &Rule : Rules) { + attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first); Optional ParentRule = - getParentAttrMatcherRule(Rule.first); + getParentAttrMatcherRule(MatchRule); if (!ParentRule) continue; auto It = RulesToFirstSpecifiedNegatedSubRule.find(*ParentRule); @@ -479,8 +480,9 @@ void Sema::ActOnPragmaAttributePush(Attr It->second.second.getBegin(), diag:: err_pragma_attribute_matcher_negated_subrule_contradicts_subrule) -<< attr::getSubjectMatchRuleSpelling(It->second.first) -<< attr::getSubjectMatchRuleSpelling(Rule.first) << Rule.second +<< attr::getSubjectMatchRuleSpelling( + attr::SubjectMatchRule(It->second.first)) +<< attr::getSubjectMatchRuleSpelling(MatchRule) << Rule.second << FixItHint::CreateRemoval( replacementRangeForListElement(*this, It->second.second)); // Keep going but ignore all of the negated sub-rules. @@ -491,11 +493,11 @@ void Sema::ActOnPragmaAttributePush(Attr if (!IgnoreNegatedSubRules) { for (const auto &Rule : Rules) -SubjectMatchRules.push_back(Rule.first); +SubjectMatchRules.push_back(attr::SubjectMatchRule(Rul
[PATCH] D32187: [CodeGen][ObjC]
rjmccall added a comment. I wouldn't mind unconditionally banning this in JumpDiagnostics, actually. https://reviews.llvm.org/D32187 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300594 - PR30508: Downgrade error to warning if the umbrella folder doesn't exist.
Author: vvassilev Date: Tue Apr 18 15:57:29 2017 New Revision: 300594 URL: http://llvm.org/viewvc/llvm-project?rev=300594&view=rev Log: PR30508: Downgrade error to warning if the umbrella folder doesn't exist. Patch by Yuka Takahashi (D32119)! Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td cfe/trunk/lib/Lex/ModuleMap.cpp cfe/trunk/test/Modules/umbrella-header-include-builtin.mm Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=300594&r1=300593&r2=300594&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Tue Apr 18 15:57:29 2017 @@ -594,8 +594,6 @@ def err_mmap_expected_mmap_file : Error< def err_mmap_module_redefinition : Error< "redefinition of module '%0'">; def note_mmap_prev_definition : Note<"previously defined here">; -def err_mmap_umbrella_dir_not_found : Error< - "umbrella directory '%0' not found">; def err_mmap_umbrella_clash : Error< "umbrella for module '%0' already covers this directory">; def err_mmap_module_id : Error< @@ -656,6 +654,9 @@ def note_implicit_top_level_module_impor def warn_uncovered_module_header : Warning< "umbrella header for module '%0' does not include header '%1'">, InGroup; +def warn_mmap_umbrella_dir_not_found : Warning< + "umbrella directory '%0' not found">, + InGroup; def err_expected_id_building_module : Error< "expected a module name in '__building_module' expression">; def warn_use_of_private_header_outside_module : Warning< Modified: cfe/trunk/lib/Lex/ModuleMap.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=300594&r1=300593&r2=300594&view=diff == --- cfe/trunk/lib/Lex/ModuleMap.cpp (original) +++ cfe/trunk/lib/Lex/ModuleMap.cpp Tue Apr 18 15:57:29 2017 @@ -2002,9 +2002,8 @@ void ModuleMapParser::parseUmbrellaDirDe } if (!Dir) { -Diags.Report(DirNameLoc, diag::err_mmap_umbrella_dir_not_found) +Diags.Report(DirNameLoc, diag::warn_mmap_umbrella_dir_not_found) << DirName; -HadError = true; return; } Modified: cfe/trunk/test/Modules/umbrella-header-include-builtin.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/umbrella-header-include-builtin.mm?rev=300594&r1=300593&r2=300594&view=diff == --- cfe/trunk/test/Modules/umbrella-header-include-builtin.mm (original) +++ cfe/trunk/test/Modules/umbrella-header-include-builtin.mm Tue Apr 18 15:57:29 2017 @@ -4,3 +4,11 @@ // RUN: %clang -cc1 -fsyntax-only -nostdinc++ -isysroot %S/Inputs/libc-libcxx/sysroot -isystem %S/Inputs/libc-libcxx/sysroot/usr/include/c++/v1 -F%S/Inputs/libc-libcxx/sysroot/Frameworks -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c++ %s #include + +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "module NonExistent1 { umbrella \"NonExistent\" }" > %t/modules.modulemap +// RUN: echo "" > %t/A.h +// RUN: echo "#include \"A.h\" int i;" > %t/T.cxx +// RUN: %clang -I %t -fmodules -fsyntax-only %t/T.cxx +// expected-warning {{ umbrella directory }} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300595 - Cleanup _LIBCPP_HAS_NO_ for std::set and std::multiset
Author: ericwf Date: Tue Apr 18 15:58:03 2017 New Revision: 300595 URL: http://llvm.org/viewvc/llvm-project?rev=300595&view=rev Log: Cleanup _LIBCPP_HAS_NO_ for std::set and std::multiset Modified: libcxx/trunk/include/set libcxx/trunk/test/std/containers/associative/multiset/emplace.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/insert_rv.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp libcxx/trunk/test/std/containers/associative/set/emplace.pass.cpp libcxx/trunk/test/std/containers/associative/set/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/associative/set/insert_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/set/insert_iter_rv.pass.cpp libcxx/trunk/test/std/containers/associative/set/insert_rv.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/move.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign.pass.cpp Modified: libcxx/trunk/include/set URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=300595&r1=300594&r2=300595&view=diff == --- libcxx/trunk/include/set (original) +++ libcxx/trunk/include/set Tue Apr 18 15:58:03 2017 @@ -486,12 +486,12 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit set(const allocator_type& __a) @@ -504,11 +504,9 @@ public: insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG set(set&& __s, const allocator_type& __a); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY set(initializer_list __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -536,9 +534,7 @@ public: __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -546,7 +542,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -587,7 +583,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -596,23 +592,15 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY pair insert(const value_type& __v) {return __tree_.__insert_unique(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_R
[PATCH] D32119: Emit warning when umbrella directory does not exists
v.g.vassilev closed this revision. v.g.vassilev added a comment. Landed in r300594. https://reviews.llvm.org/D32119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300600 - Cleanup _LIBCPP_HAS_NO_ macros in std::map and std::multimap
Author: ericwf Date: Tue Apr 18 16:08:06 2017 New Revision: 300600 URL: http://llvm.org/viewvc/llvm-project?rev=300600&view=rev Log: Cleanup _LIBCPP_HAS_NO_ macros in std::map and std::multimap Modified: libcxx/trunk/include/map libcxx/trunk/test/std/containers/associative/map/map.access/index_tuple.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/move.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp Modified: libcxx/trunk/include/map URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=300600&r1=300599&r2=300600&view=diff == --- libcxx/trunk/include/map (original) +++ libcxx/trunk/include/map Tue Apr 18 16:08:06 2017 @@ -582,7 +582,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __map_node_destructor(__tree_node_destructor&& __x) _NOEXCEPT : __na_(__x.__na_), @@ -591,7 +591,7 @@ public: { __x.__value_constructed = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -667,7 +667,7 @@ private: ~__value_type(); }; -#endif +#endif // _LIBCPP_CXX03_LANG template struct __extract_key_value_types; @@ -921,7 +921,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY map(map&& __m) @@ -940,10 +940,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY map(initializer_list __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -971,7 +967,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit map(const allocator_type& __a) @@ -1082,6 +1078,10 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));} + +_LIBCPP_INLINE_VISIBILITY +void insert(initializer_list __il) +{insert(__il.begin(), __il.end());} #endif template @@ -1092,14 +1092,6 @@ public: insert(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -_LIBCPP_INLINE_VISIBILITY -void insert(initializer_list __il) -{insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - #if _LIBCPP_STD_VER > 14 template @@ -1194,7 +1186,7 @@ public: return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1307,7 +1299,6 @@ private: #ifndef _LIBCPP_CXX03_LANG - template map<_Key, _Tp, _Compare, _All
[libcxx] r300602 - Cleanup _LIBCPP_HAS_NO_ macro uses in std::stack.
Author: ericwf Date: Tue Apr 18 16:16:26 2017 New Revision: 300602 URL: http://llvm.org/viewvc/llvm-project?rev=300602&view=rev Log: Cleanup _LIBCPP_HAS_NO_ macro uses in std::stack. Modified: libcxx/trunk/include/stack libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp Modified: libcxx/trunk/include/stack URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stack?rev=300602&r1=300601&r2=300602&view=diff == --- libcxx/trunk/include/stack (original) +++ libcxx/trunk/include/stack Tue Apr 18 16:16:26 2017 @@ -126,29 +126,28 @@ public: _LIBCPP_INLINE_VISIBILITY stack(const stack& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +_LIBCPP_INLINE_VISIBILITY +stack& operator=(const stack& __q) {c = __q.c; return *this;} + + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY -stack& operator=(const stack& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -_LIBCPP_INLINE_VISIBILITY stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY -explicit stack(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -_LIBCPP_INLINE_VISIBILITY explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + +_LIBCPP_INLINE_VISIBILITY +explicit stack(const container_type& __c) : c(__c) {} + template _LIBCPP_INLINE_VISIBILITY explicit stack(const _Alloc& __a, @@ -167,7 +166,7 @@ public: typename enable_if::value>::type* = 0) : c(__s.c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY stack(container_type&& __c, const _Alloc& __a, @@ -180,7 +179,7 @@ public: typename enable_if::value>::type* = 0) : c(_VSTD::move(__s.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -193,10 +192,10 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS + template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -206,8 +205,8 @@ public: void emplace(_Args&&... __args) {c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_back();} Modified: libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp?rev=300602&r1=300601&r2=300602&view=diff == --- libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp (original) +++ libcxx/trunk/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp Tue Apr 18 16:16:26 2017 @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" struct test @@ -24,10 +25,10 @@ struct test explicit test(const test_allocator& a) : base(a) {}
[PATCH] D32192: Enable leak sanitizer builds for darwin
fjricci created this revision. Support for leak sanitizer on darwin has been added to compiler-rt, this patch adds compiler support. https://reviews.llvm.org/D32192 Files: lib/Driver/ToolChains/Darwin.cpp Index: lib/Driver/ToolChains/Darwin.cpp === --- lib/Driver/ToolChains/Darwin.cpp +++ lib/Driver/ToolChains/Darwin.cpp @@ -1035,6 +1035,8 @@ const SanitizerArgs &Sanitize = getSanitizerArgs(); if (Sanitize.needsAsanRt()) AddLinkSanitizerLibArgs(Args, CmdArgs, "asan"); + if (Sanitize.needsLsanRt()) +AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan"); if (Sanitize.needsUbsanRt()) AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan"); if (Sanitize.needsTsanRt()) @@ -1896,9 +1898,11 @@ if (!isMacosxVersionLT(10, 9)) Res |= SanitizerKind::Vptr; Res |= SanitizerKind::SafeStack; +Res |= SanitizerKind::Leak; if (IsX86_64) Res |= SanitizerKind::Thread; } else if (isTargetIOSSimulator() || isTargetTvOSSimulator()) { +Res |= SanitizerKind::Leak; if (IsX86_64) Res |= SanitizerKind::Thread; } Index: lib/Driver/ToolChains/Darwin.cpp === --- lib/Driver/ToolChains/Darwin.cpp +++ lib/Driver/ToolChains/Darwin.cpp @@ -1035,6 +1035,8 @@ const SanitizerArgs &Sanitize = getSanitizerArgs(); if (Sanitize.needsAsanRt()) AddLinkSanitizerLibArgs(Args, CmdArgs, "asan"); + if (Sanitize.needsLsanRt()) +AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan"); if (Sanitize.needsUbsanRt()) AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan"); if (Sanitize.needsTsanRt()) @@ -1896,9 +1898,11 @@ if (!isMacosxVersionLT(10, 9)) Res |= SanitizerKind::Vptr; Res |= SanitizerKind::SafeStack; +Res |= SanitizerKind::Leak; if (IsX86_64) Res |= SanitizerKind::Thread; } else if (isTargetIOSSimulator() || isTargetTvOSSimulator()) { +Res |= SanitizerKind::Leak; if (IsX86_64) Res |= SanitizerKind::Thread; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300604 - Cleanup _LIBCPP_HAS_NO_ for std::queue and std::priority_queue.
Author: ericwf Date: Tue Apr 18 16:23:18 2017 New Revision: 300604 URL: http://llvm.org/viewvc/llvm-project?rev=300604&view=rev Log: Cleanup _LIBCPP_HAS_NO_ for std::queue and std::priority_queue. Modified: libcxx/trunk/include/queue libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp libcxx/trunk/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp Modified: libcxx/trunk/include/queue URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/queue?rev=300604&r1=300603&r2=300604&view=diff == --- libcxx/trunk/include/queue (original) +++ libcxx/trunk/include/queue Tue Apr 18 16:23:18 2017 @@ -213,29 +213,27 @@ public: _LIBCPP_INLINE_VISIBILITY queue(const queue& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +_LIBCPP_INLINE_VISIBILITY +queue& operator=(const queue& __q) {c = __q.c; return *this;} + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY -queue& operator=(const queue& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -_LIBCPP_INLINE_VISIBILITY queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY explicit queue(const _Alloc& __a, @@ -254,7 +252,7 @@ public: typename enable_if::value>::type* = 0) : c(__c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY queue(container_type&& __c, const _Alloc& __a, @@ -268,7 +266,7 @@ public: _Alloc>::value>::type* = 0) : c(_VSTD::move(__q.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -286,10 +284,9 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14
[PATCH] D32170: Add a FixItHint for -Wmissing-prototypes to insert 'static '.
djasper added inline comments. Comment at: lib/Sema/SemaDecl.cpp:11652 static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD, - const FunctionDecl*& PossibleZeroParamPrototype) { + const FunctionDecl*& PossibleZeroParamPrototype, + bool *PossibleMissingStatic) { Fix the format while here? Comment at: lib/Sema/SemaDecl.cpp:11653 + const FunctionDecl*& PossibleZeroParamPrototype, + bool *PossibleMissingStatic) { // Don't warn about invalid declarations. Maybe s/Possible/Possibly/ ? Comment at: lib/Sema/SemaDecl.cpp:11708 + FD->getDeclContext()->isTranslationUnit() && + FD->getStorageClass() == SC_None; + Does this exclude templated functions? If not, the "static" might be put into the wrong place. Comment at: lib/Sema/SemaDecl.cpp:12114 +auto DiagBuilder = +Diag(FD->getLocation(), diag::warn_missing_prototype_maybe_static) +<< FD; I wonder whether it is useful to display the changed message here. In the cases I have seen where the function definition is coming from a macro, you'd actually need to surround it with an unnamed namespace to fix. Maybe just add this logic to the outer if statement? https://reviews.llvm.org/D32170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300609 - Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language.
Author: rsmith Date: Tue Apr 18 16:45:04 2017 New Revision: 300609 URL: http://llvm.org/viewvc/llvm-project?rev=300609&view=rev Log: Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language. Modified: cfe/trunk/lib/Lex/Lexer.cpp cfe/trunk/test/Lexer/cxx1z-trigraphs.cpp Modified: cfe/trunk/lib/Lex/Lexer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=300609&r1=300608&r2=300609&view=diff == --- cfe/trunk/lib/Lex/Lexer.cpp (original) +++ cfe/trunk/lib/Lex/Lexer.cpp Tue Apr 18 16:45:04 2017 @@ -1171,6 +1171,8 @@ const char *Lexer::SkipEscapedNewLines(c // If not a trigraph for escape, bail out. if (P[1] != '?' || P[2] != '/') return P; + // FIXME: Take LangOpts into account; the language might not + // support trigraphs. AfterEscape = P+3; } else { return P; @@ -2079,17 +2081,17 @@ bool Lexer::SkipLineComment(Token &Resul HasSpace = true; } - if (*EscapePtr == '\\') // Escaped newline. + if (*EscapePtr == '\\') +// Escaped newline. CurPtr = EscapePtr; else if (EscapePtr[0] == '/' && EscapePtr[-1] == '?' && - EscapePtr[-2] == '?') // Trigraph-escaped newline. + EscapePtr[-2] == '?' && LangOpts.Trigraphs) +// Trigraph-escaped newline. CurPtr = EscapePtr-2; else break; // This is a newline, we're done. // If there was space between the backslash and newline, warn about it. - // FIXME: This warning is bogus if trigraphs are disabled and the line - // ended with '?' '?' '\\' '\n'. if (HasSpace && !isLexingRawMode()) Diag(EscapePtr, diag::backslash_newline_space); } Modified: cfe/trunk/test/Lexer/cxx1z-trigraphs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx1z-trigraphs.cpp?rev=300609&r1=300608&r2=300609&view=diff == --- cfe/trunk/test/Lexer/cxx1z-trigraphs.cpp (original) +++ cfe/trunk/test/Lexer/cxx1z-trigraphs.cpp Tue Apr 18 16:45:04 2017 @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=c++1z %s -verify -// RUN: %clang_cc1 -std=c++1z %s -ftrigraphs -fsyntax-only +// RUN: %clang_cc1 -std=c++1z %s -ftrigraphs -fsyntax-only 2>&1 | FileCheck --check-prefix=TRIGRAPHS %s ??= define foo ; // expected-error {{}} expected-warning {{trigraph ignored}} @@ -7,3 +7,8 @@ static_assert("??="[0] == '#', ""); // e // ??/ error here; // expected-error {{}} + +// Note, there is intentionally trailing whitespace two lines below. +// TRIGRAPHS: :[[@LINE+1]]:{{.*}} backslash and newline separated by space +// ??/ +error here; // expected-error {{}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r300611 - [modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.
Author: rsmith Date: Tue Apr 18 16:55:37 2017 New Revision: 300611 URL: http://llvm.org/viewvc/llvm-project?rev=300611&view=rev Log: [modules-ts] Fold together -x c++ and -x c++-module at -cc1 level. The driver needs to know whether it's building a module interface or implementation unit because it affects which outputs it produces and how it builds the command pipeline. But the frontend doesn't need to know and should not care: all it needs to know is what action it is being asked to perform on the input. (This is in preparation for permitting -emit-obj to be used on a module interface unit to produce object code without going via a "full" PCM file.) Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/Driver/modules-ts.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=300611&r1=300610&r2=300611&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Apr 18 16:55:37 2017 @@ -649,8 +649,24 @@ static void addDashXForInput(const ArgLi CmdArgs.push_back("-x"); if (Args.hasArg(options::OPT_rewrite_objc)) CmdArgs.push_back(types::getTypeName(types::TY_PP_ObjCXX)); - else -CmdArgs.push_back(types::getTypeName(Input.getType())); + else { +// Map the driver type to the frontend type. This is mostly an identity +// mapping, except that the distinction between module interface units +// and other source files does not exist at the frontend layer. +const char *ClangType; +switch (Input.getType()) { +case types::TY_CXXModule: + ClangType = "c++"; + break; +case types::TY_PP_CXXModule: + ClangType = "c++-cpp-output"; + break; +default: + ClangType = types::getTypeName(Input.getType()); + break; +} +CmdArgs.push_back(ClangType); + } } static void appendUserToPath(SmallVectorImpl &Result) { Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=300611&r1=300610&r2=300611&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 18 16:55:37 2017 @@ -1353,13 +1353,11 @@ static InputKind ParseFrontendArgs(Front .Case("cl", IK_OpenCL) .Case("cuda", IK_CUDA) .Case("c++", IK_CXX) - .Case("c++-module", IK_CXX) .Case("objective-c", IK_ObjC) .Case("objective-c++", IK_ObjCXX) .Case("cpp-output", IK_PreprocessedC) .Case("assembler-with-cpp", IK_Asm) .Case("c++-cpp-output", IK_PreprocessedCXX) - .Case("c++-module-cpp-output", IK_PreprocessedCXX) .Case("cuda-cpp-output", IK_PreprocessedCuda) .Case("objective-c-cpp-output", IK_PreprocessedObjC) .Case("objc-cpp-output", IK_PreprocessedObjC) Modified: cfe/trunk/test/Driver/modules-ts.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/modules-ts.cpp?rev=300611&r1=300610&r2=300611&view=diff == --- cfe/trunk/test/Driver/modules-ts.cpp (original) +++ cfe/trunk/test/Driver/modules-ts.cpp Tue Apr 18 16:55:37 2017 @@ -4,7 +4,7 @@ // // CHECK-PRECOMPILE: -cc1 {{.*}} -emit-module-interface // CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm -// CHECK-PRECOMPILE-SAME: -x c++-module +// CHECK-PRECOMPILE-SAME: -x c++ // CHECK-PRECOMPILE-SAME: modules-ts.cpp // Check compiling a .pcm file to a .o file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r300619 - Cleanup _LIBCPP_HAS_NO_ macros in std::unordered_set and std::unordered_multiset
Author: ericwf Date: Tue Apr 18 17:37:32 2017 New Revision: 300619 URL: http://llvm.org/viewvc/llvm-project?rev=300619&view=rev Log: Cleanup _LIBCPP_HAS_NO_ macros in std::unordered_set and std::unordered_multiset Modified: libcxx/trunk/include/unordered_set libcxx/trunk/test/std/containers/unord/unord.multiset/emplace.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/insert_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/emplace.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/insert_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp Modified: libcxx/trunk/include/unordered_set URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_set?rev=300619&r1=300618&r2=300619&view=diff == --- libcxx/trunk/include/unordered_set (original) +++ libcxx/trunk/include/unordered_set Tue Apr 18 17:37:32 2017 @@ -408,13 +408,11 @@ public: explicit unordered_set(const allocator_type& __a); unordered_set(const unordered_set& __u); unordered_set(const unordered_set& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_set(unordered_set&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_set(initializer_list __il); unordered_set(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -432,7 +430,7 @@ public: const hasher& __hf, const allocator_type& __a) : unordered_set(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~unordered_set() = default; _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(const unordered_set& __u) @@ -440,15 +438,13 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -474,7 +470,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_
[libcxx] r300620 - Cleanup _LIBCPP_HAS_NO_ in std::unordered_map and std::unordered_multimap
Author: ericwf Date: Tue Apr 18 17:50:56 2017 New Revision: 300620 URL: http://llvm.org/viewvc/llvm-project?rev=300620&view=rev Log: Cleanup _LIBCPP_HAS_NO_ in std::unordered_map and std::unordered_multimap This completes the cleanup of the containers, at least within the tests. Modified: libcxx/trunk/include/unordered_map libcxx/trunk/test/std/containers/Emplaceable.h libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp Modified: libcxx/trunk/include/unordered_map URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/unordered_map?rev=300620&r1=300619&r2=300620&view=diff == --- libcxx/trunk/include/unordered_map (original) +++ libcxx/trunk/include/unordered_map Tue Apr 18 17:50:56 2017 @@ -547,7 +547,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor&& __x) _NOEXCEPT @@ -557,7 +557,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor& __x) : __na_(__x.__na_), @@ -566,7 +566,7 @@ public: { const_cast(__x.__value_constructed) = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -819,20 +819,18 @@ public: explicit unordered_map(const allocator_type& __a); unordered_map(const unordered_map& __u); unordered_map(const unordered_map& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_map(unordered_map&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_map(initializer_list __il); unordered_map(initializer_list __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(initializer_list __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_map(size_type __n, const allocator_type& __a) @@ -875,15 +873,13 @@ public: #endif return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX
[PATCH] D31542: [clang-tidy] Extend readability-container-size-empty to add comparisons to newly-constructed objects
joshz updated this revision to Diff 95655. joshz added a comment. Updated per some suggestions by sbenza@ on dealing with the parentheses; IsBinaryOrTernary is based on a function he wrote at Google. PTAL. Repository: rL LLVM https://reviews.llvm.org/D31542 Files: clang-tidy/readability/ContainerSizeEmptyCheck.cpp clang-tidy/utils/ASTUtils.cpp clang-tidy/utils/ASTUtils.h test/clang-tidy/readability-container-size-empty.cpp Index: test/clang-tidy/readability-container-size-empty.cpp === --- test/clang-tidy/readability-container-size-empty.cpp +++ test/clang-tidy/readability-container-size-empty.cpp @@ -3,6 +3,8 @@ namespace std { template struct vector { vector(); + bool operator==(const vector& other) const; + bool operator!=(const vector& other) const; unsigned long size() const; bool empty() const; }; @@ -9,6 +11,11 @@ template struct basic_string { basic_string(); + bool operator==(const basic_string& other) const; + bool operator!=(const basic_string& other) const; + bool operator==(const char *) const; + bool operator!=(const char *) const; + basic_string operator+(const basic_string& other) const; unsigned long size() const; bool empty() const; }; @@ -19,6 +26,8 @@ inline namespace __v2 { template struct set { set(); + bool operator==(const set& other) const; + bool operator!=(const set& other) const; unsigned long size() const; bool empty() const; }; @@ -29,6 +38,8 @@ template class TemplatedContainer { public: + bool operator==(const TemplatedContainer& other) const; + bool operator!=(const TemplatedContainer& other) const; int size() const; bool empty() const; }; @@ -36,6 +47,8 @@ template class PrivateEmpty { public: + bool operator==(const PrivateEmpty& other) const; + bool operator!=(const PrivateEmpty& other) const; int size() const; private: bool empty() const; @@ -54,6 +67,7 @@ class Container { public: + bool operator==(const Container& other) const; int size() const; bool empty() const; }; @@ -75,9 +89,21 @@ bool Container3::empty() const { return this->size() == 0; } +class Container4 { +public: + bool operator==(const Container4& rhs) const; + int size() const; + bool empty() const { return *this == Container4(); } +}; + +std::string s_func() { + return std::string(); +} + int main() { std::set intSet; std::string str; + std::string str2; std::wstring wstr; str.size() + 0; str.size() - 0; @@ -87,24 +113,57 @@ ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty] // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}} - // CHECK-MESSAGES: :23:8: note: method 'set'::empty() defined here + // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here + if (intSet == std::set()) +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness + // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}} + // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here + if (s_func() == "") +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if (s_func().empty()){{$}} if (str.size() == 0) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}if (str.empty()){{$}} + if ((str + str2).size() == 0) +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if ((str + str2).empty()){{$}} + if (str == "") +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if (str.empty()){{$}} + if (str + str2 == "") +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if ((str + str2).empty()){{$}} if (wstr.size() == 0) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}if (wstr.empty()){{$}} + if (wstr == "") +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if (wstr.empty()){{$}} std::vector vect; if (vect.size() == 0) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}if (vect.empty()){{$}} + if (vect == std::vector()) +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if (vect.empty()){{$}} if (vect.size() != 0) ; // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}} + if (vect != std::vector()) +; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used + // CHECK-FIXES: {{^ }}if (!vect.empty()
[PATCH] D32199: [TBAASan] A TBAA Sanitizer (Clang)
hfinkel created this revision. Herald added subscribers: mcrosier, emaste. This patch introduces the runtime components of a TBAA sanitizer: a sanitizer for type-based aliasing violations. C/C++ have type-based aliasing rules, and LLVM's optimizer can exploit these given TBAA metadata added by Clang. Roughly, a pointer of given type cannot be used to access an object of a different type (with, of course, certain exceptions). Unfortunately, there's a lot of code in the wild that violates these rules (e.g. for type punning), and such code often must be built with -fno-strict-aliasing. Performance is often sacrificed as a result. Part of the problem is the difficulty of finding TBAA violations. Hopefully, this sanitizer will help. https://reviews.llvm.org/D32197 (Runtime) https://reviews.llvm.org/D32198 (LLVM) The Clang changes seems mostly formulaic, the one specific change being that when the TBAA sanitizer is enabled, TBAA is always generated, even at -O0. Clang's TBAA representation currently has a problem representing unions, as demonstrated by the one XFAIL'd test in the runtime patch. We'll update the TBAA representation to fix this, and at the same time, update the sanitizer. https://reviews.llvm.org/D32199 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/Sanitizers.def include/clang/Driver/SanitizerArgs.h lib/CodeGen/BackendUtil.cpp lib/CodeGen/CGDeclCXX.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenTBAA.cpp lib/Driver/SanitizerArgs.cpp lib/Driver/ToolChains/CommonArgs.cpp lib/Driver/ToolChains/FreeBSD.cpp lib/Driver/ToolChains/Linux.cpp lib/Frontend/CompilerInvocation.cpp lib/Lex/PPMacroExpansion.cpp lib/Sema/SemaDeclAttr.cpp test/CodeGen/sanitize-tbaa-attr.cpp test/Driver/sanitizer-ld.c Index: test/Driver/sanitizer-ld.c === --- test/Driver/sanitizer-ld.c +++ test/Driver/sanitizer-ld.c @@ -181,6 +181,18 @@ // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \ +// RUN: -fsanitize=tbaa \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-TBAASAN-LINUX-CXX %s +// +// CHECK-TBAASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-TBAASAN-LINUX-CXX-NOT: stdc++ +// CHECK-TBAASAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tbaasan-x86_64.a" "-no-whole-archive" +// CHECK-TBAASAN-LINUX-CXX: stdc++ + +// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \ // RUN: -fsanitize=memory \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ Index: test/CodeGen/sanitize-tbaa-attr.cpp === --- /dev/null +++ test/CodeGen/sanitize-tbaa-attr.cpp @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s -fsanitize=tbaa | FileCheck -check-prefix=TBAASAN %s +// RUN: echo "src:%s" | sed -e 's/\\//g' > %t +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s -fsanitize=tbaa -fsanitize-blacklist=%t | FileCheck -check-prefix=BL %s + +// The sanitize_tbaa attribute should be attached to functions +// when TBAASanitizer is enabled, unless no_sanitize_tbaa attribute +// is present. + +// WITHOUT: NoTBAASAN1{{.*}}) [[NOATTR:#[0-9]+]] +// BL: NoTBAASAN1{{.*}}) [[NOATTR:#[0-9]+]] +// TBAASAN: NoTBAASAN1{{.*}}) [[NOATTR:#[0-9]+]] +__attribute__((no_sanitize_tbaa)) +int NoTBAASAN1(int *a) { return *a; } + +// WITHOUT: NoTBAASAN2{{.*}}) [[NOATTR]] +// BL: NoTBAASAN2{{.*}}) [[NOATTR]] +// TBAASAN: NoTBAASAN2{{.*}}) [[NOATTR]] +__attribute__((no_sanitize_tbaa)) +int NoTBAASAN2(int *a); +int NoTBAASAN2(int *a) { return *a; } + +// WITHOUT: NoTBAASAN3{{.*}}) [[NOATTR:#[0-9]+]] +// BL: NoTBAASAN3{{.*}}) [[NOATTR:#[0-9]+]] +// TBAASAN: NoTBAASAN3{{.*}}) [[NOATTR:#[0-9]+]] +__attribute__((no_sanitize("tbaa"))) +int NoTBAASAN3(int *a) { return *a; } + +// WITHOUT: TBAASANOk{{.*}}) [[NOATTR]] +// BL: TBAASANOk{{.*}}) [[NOATTR]] +// TBAASAN: TBAASANOk{{.*}}) [[WITH:#[0-9]+]] +int TBAASANOk(int *a) { return *a; } + +// WITHOUT: TemplateTBAASANOk{{.*}}) [[NOATTR]] +// BL: TemplateTBAASANOk{{.*}}) [[NOATTR]] +// TBAASAN: TemplateTBAASANOk{{.*}}) [[WITH]] +template +int TemplateTBAASANOk() { return i; } + +// WITHOUT: TemplateNoTBAASAN{{.*}}) [[NOATTR]] +// BL: TemplateNoTBAASAN{{.*}}) [[NOATTR]] +// TBAASAN: TemplateNoTBAASAN{{.*}}) [[NOATTR]] +template +__attribute__((no_sanitize_tbaa)) +int TemplateNoTBAASAN() { return i; } + +int force_instance = TemplateTBAASANOk<42>() +
[libcxx] r300622 - Cleanup _LIBCPP_HAS_NO_ macros in thread.
Author: ericwf Date: Tue Apr 18 18:05:08 2017 New Revision: 300622 URL: http://llvm.org/viewvc/llvm-project?rev=300622&view=rev Log: Cleanup _LIBCPP_HAS_NO_ macros in thread. Modified: libcxx/trunk/include/__mutex_base libcxx/trunk/include/mutex libcxx/trunk/include/thread libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp Modified: libcxx/trunk/include/__mutex_base URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__mutex_base?rev=300622&r1=300621&r2=300622&view=diff == --- libcxx/trunk/include/__mutex_base (original) +++ libcxx/trunk/include/__mutex_base Tue Apr 18 18:05:08 2017 @@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; #else __libcpp_mutex_t __m_; @@ -42,7 +42,7 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SA public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG constexpr mutex() _NOEXCEPT = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} @@ -66,7 +66,7 @@ struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX) extern const defer_lock_t defer_lock; extern const try_to_lock_t try_to_lock; @@ -150,7 +150,7 @@ private: unique_lock& operator=(unique_lock const&); // = delete; public: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) @@ -167,7 +167,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG void lock(); bool try_lock(); @@ -279,7 +279,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_st class _LIBCPP_TYPE_VIS condition_variable { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; #else __libcpp_condvar_t __cv_; @@ -287,7 +287,7 @@ class _LIBCPP_TYPE_VIS condition_variabl public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG constexpr condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} Modified: libcxx/trunk/include/mutex URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=300622&r1=300621&r2=300622&view=diff == --- libcxx/trunk/include/mutex (original) +++ libcxx/trunk/include/mutex Tue Apr 18 18:05:08 2017 @@ -191,7 +191,7 @@ template #include <__mutex_base> #include #include -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #include #endif #include <__threading_support> @@ -343,7 +343,7 @@ try_lock(_L0& __l0, _L1& __l1) return 0; } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template int @@ -362,7 +362,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2 return __r; } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG template void @@ -391,7 +391,7 @@ lock(_L0& __l0, _L1& __l1) } } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template void @@ -466,7 +466,7 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& _VSTD::__unlock(__l2, __l3...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template @@ -550,13 +550,13 @@ private: struct _LIBCPP_TEMPLATE_VIS once_flag; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY @@ -566,7 +566,7 @@ template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG struct _LIBCPP_TEMPLATE_VIS once_flag { @@ -580,11 +580,11 @@ private: unsigned long __state_; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template friend void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LI
[libcxx] r300623 - Cleanup _LIBCPP_HAS_NO_ macros for std::initializer_list
Author: ericwf Date: Tue Apr 18 18:09:36 2017 New Revision: 300623 URL: http://llvm.org/viewvc/llvm-project?rev=300623&view=rev Log: Cleanup _LIBCPP_HAS_NO_ macros for std::initializer_list Added: libcxx/trunk/test/std/language.support/support.initlist/include_cxx03.pass.cpp Modified: libcxx/trunk/include/initializer_list libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp libcxx/trunk/test/std/language.support/support.initlist/types.pass.cpp Modified: libcxx/trunk/include/initializer_list URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/initializer_list?rev=300623&r1=300622&r2=300623&view=diff == --- libcxx/trunk/include/initializer_list (original) +++ libcxx/trunk/include/initializer_list Tue Apr 18 18:09:36 2017 @@ -53,7 +53,7 @@ template const E* end(initializ namespace std // purposefully not versioned { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template class _LIBCPP_TEMPLATE_VIS initializer_list @@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEP return __il.end(); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // !defined(_LIBCPP_CXX03_LANG) } // std Added: libcxx/trunk/test/std/language.support/support.initlist/include_cxx03.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/include_cxx03.pass.cpp?rev=300623&view=auto == --- libcxx/trunk/test/std/language.support/support.initlist/include_cxx03.pass.cpp (added) +++ libcxx/trunk/test/std/language.support/support.initlist/include_cxx03.pass.cpp Tue Apr 18 18:09:36 2017 @@ -0,0 +1,18 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// Test that the file can be included in C++03 + +#include + +int main() +{ +} Modified: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp?rev=300623&r1=300622&r2=300623&view=diff == --- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp Tue Apr 18 18:09:36 2017 @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // const E* begin() const; @@ -19,8 +21,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list il) @@ -52,13 +52,9 @@ struct B #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 Modified: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp?rev=300623&r1=300622&r2=300623&view=diff == --- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp Tue Apr 18 18:09:36 2017 @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // initializer_list(); @@ -20,10 +22,9 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::initializer_list il; assert(il.size() == 0); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if TEST_STD_VER > 11 constexpr std::initializer_list il2; static_assert(il2.size() == 0, ""); Modified: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp URL: http:/
[libcxx] r300625 - Cleanup _LIBCPP_HAS_NO_ in algorithm
Author: ericwf Date: Tue Apr 18 18:26:47 2017 New Revision: 300625 URL: http://llvm.org/viewvc/llvm-project?rev=300625&view=rev Log: Cleanup _LIBCPP_HAS_NO_ in algorithm Modified: libcxx/trunk/include/algorithm libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp Modified: libcxx/trunk/include/algorithm URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=300625&r1=300624&r2=300625&view=diff == --- libcxx/trunk/include/algorithm (original) +++ libcxx/trunk/include/algorithm Tue Apr 18 18:26:47 2017 @@ -2548,7 +2548,7 @@ min(const _Tp& __a, const _Tp& __b) return _VSTD::min(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2566,7 +2566,7 @@ min(initializer_list<_Tp> __t) return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // max_element @@ -2613,7 +2613,7 @@ max(const _Tp& __a, const _Tp& __b) return _VSTD::max(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2631,7 +2631,7 @@ max(initializer_list<_Tp> __t) return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 // clamp @@ -2732,7 +2732,7 @@ minmax(const _Tp& __a, const _Tp& __b) return _VSTD::minmax(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2779,7 +2779,7 @@ minmax(initializer_list<_Tp> __t) return _VSTD::minmax(__t, __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // random_shuffle @@ -2837,7 +2837,7 @@ private: _Engine_result_type __mask0_; _Engine_result_type __mask1_; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3080,7 +3080,7 @@ random_shuffle(_RandomAccessIterator __f template void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) @@ -3173,7 +3173,7 @@ _SampleIterator sample(_PopulationIterat template void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _UniformRandomNumberGenerator&& __g) #else _UniformRandomNumberGenerator& __g) Modified: libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp?rev=300625&r1=300624&r2=300625&view=diff == --- libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp Tue Apr 18 18:2
[PATCH] D31561: cmath: Skip Libc for integral types in isinf, etc.
mclow.lists added inline comments. Comment at: libcxx/include/math.h:400 +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT hfinkel wrote: > Maybe we should predicate this, and other infinity-related functions, on > std::numeric_limits<_A1>::has_infinity. That seems more general, and safer > for potential user-defined types. I don't think we need to worry about user-defined types. The standard limits the parameters to "arithmetic types" and in [basic.fundamental] it lists exactly what those types are. https://reviews.llvm.org/D31561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits