Author: rsmith Date: Fri Jun 30 13:57:39 2017 New Revision: 306881 URL: http://llvm.org/viewvc/llvm-project?rev=306881&view=rev Log: Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
This is a short-term fix for PR33650 aimed to get the modules build bots green again. Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR macros to try to locally specialize a global template for a global type. That's not how C++ works. Instead, we now centrally define how to format vectors of fundamental types and of string (std::string and StringRef). We use flow formatting for the former cases, since that's the obvious right thing to do; in the latter case, it's less clear what the right choice is, but flow formatting is really bad for some cases (due to very long strings), so we pick block formatting. (Many of the cases that were using flow formatting for strings are improved by this change.) Other than the flow -> block formatting change for some vectors of strings, this should result in no functionality change. Differential Revision: https://reviews.llvm.org/D34907 Corresponding LLVM change is r306878. Modified: cfe/trunk/lib/Format/Format.cpp cfe/trunk/lib/Tooling/Refactoring/AtomicChange.cpp cfe/trunk/unittests/Tooling/RefactoringTest.cpp Modified: cfe/trunk/lib/Format/Format.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=306881&r1=306880&r2=306881&view=diff ============================================================================== --- cfe/trunk/lib/Format/Format.cpp (original) +++ cfe/trunk/lib/Format/Format.cpp Fri Jun 30 13:57:39 2017 @@ -44,7 +44,6 @@ using clang::format::FormatStyle; -LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string) LLVM_YAML_IS_SEQUENCE_VECTOR(clang::format::FormatStyle::IncludeCategory) namespace llvm { Modified: cfe/trunk/lib/Tooling/Refactoring/AtomicChange.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Refactoring/AtomicChange.cpp?rev=306881&r1=306880&r2=306881&view=diff ============================================================================== --- cfe/trunk/lib/Tooling/Refactoring/AtomicChange.cpp (original) +++ cfe/trunk/lib/Tooling/Refactoring/AtomicChange.cpp Fri Jun 30 13:57:39 2017 @@ -12,7 +12,6 @@ #include "llvm/Support/YAMLTraits.h" #include <string> -LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string) LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::AtomicChange) namespace { Modified: cfe/trunk/unittests/Tooling/RefactoringTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringTest.cpp?rev=306881&r1=306880&r2=306881&view=diff ============================================================================== --- cfe/trunk/unittests/Tooling/RefactoringTest.cpp (original) +++ cfe/trunk/unittests/Tooling/RefactoringTest.cpp Fri Jun 30 13:57:39 2017 @@ -1123,8 +1123,10 @@ TEST_F(AtomicChangeTest, AtomicChangeToY "Key: 'input.cpp:20'\n" "FilePath: input.cpp\n" "Error: ''\n" - "InsertedHeaders: [ a.h ]\n" - "RemovedHeaders: [ b.h ]\n" + "InsertedHeaders: \n" // Extra whitespace here! + " - a.h\n" + "RemovedHeaders: \n" // Extra whitespace here! + " - b.h\n" "Replacements: \n" // Extra whitespace here! " - FilePath: input.cpp\n" " Offset: 20\n" @@ -1143,8 +1145,10 @@ TEST_F(AtomicChangeTest, YAMLToAtomicCha "Key: 'input.cpp:20'\n" "FilePath: input.cpp\n" "Error: 'ok'\n" - "InsertedHeaders: [ a.h ]\n" - "RemovedHeaders: [ b.h ]\n" + "InsertedHeaders: \n" // Extra whitespace here! + " - a.h\n" + "RemovedHeaders: \n" // Extra whitespace here! + " - b.h\n" "Replacements: \n" // Extra whitespace here! " - FilePath: input.cpp\n" " Offset: 20\n" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits