Re: [clang-tools-extra] r328270 - [clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"

2018-03-26 Thread Mikael Holmén via cfe-commits

Hi Julie

If I compile without asserts this patch gives me

../tools/clang/tools/extra/clang-doc/BitcodeWriter.cpp:260:15: error: 
unused variable 'BlockIdName' [-Werror,-Wunused-variable]

  const auto  = BlockIdNameMap[BID];
  ^
1 error generated.

Regards,
Mikael

On 03/23/2018 12:34 AM, Julie Hockett via cfe-commits wrote:

Author: juliehockett
Date: Thu Mar 22 16:34:46 2018
New Revision: 328270

URL: http://llvm.org/viewvc/llvm-project?rev=328270=rev
Log:
[clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"

Fixed windows release build tests.

Added:
 clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
 clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
 clang-tools-extra/trunk/clang-doc/CMakeLists.txt
 clang-tools-extra/trunk/clang-doc/ClangDoc.cpp
 clang-tools-extra/trunk/clang-doc/ClangDoc.h
 clang-tools-extra/trunk/clang-doc/Mapper.cpp
 clang-tools-extra/trunk/clang-doc/Mapper.h
 clang-tools-extra/trunk/clang-doc/Representation.h
 clang-tools-extra/trunk/clang-doc/Serialize.cpp
 clang-tools-extra/trunk/clang-doc/Serialize.h
 clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt
 clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-class-in-class.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-class-in-function.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-class.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-comments.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-enum.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-function.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-method.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-namespace.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-struct.cpp
 clang-tools-extra/trunk/test/clang-doc/mapper-union.cpp
Modified:
 clang-tools-extra/trunk/CMakeLists.txt
 clang-tools-extra/trunk/test/CMakeLists.txt

Modified: clang-tools-extra/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/CMakeLists.txt?rev=328270=328269=328270=diff
==
--- clang-tools-extra/trunk/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/CMakeLists.txt Thu Mar 22 16:34:46 2018
@@ -7,6 +7,7 @@ add_subdirectory(clang-tidy-vs)
  endif()
  
  add_subdirectory(change-namespace)

+add_subdirectory(clang-doc)
  add_subdirectory(clang-query)
  add_subdirectory(clang-move)
  add_subdirectory(clangd)

Added: clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp?rev=328270=auto
==
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp (added)
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp Thu Mar 22 16:34:46 2018
@@ -0,0 +1,510 @@
+//===--  BitcodeWriter.cpp - ClangDoc Bitcode Writer *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "BitcodeWriter.h"
+#include "llvm/ADT/IndexedMap.h"
+#include 
+
+namespace clang {
+namespace doc {
+
+// Since id enums are not zero-indexed, we need to transform the given id into
+// its associated index.
+struct BlockIdToIndexFunctor {
+  using argument_type = unsigned;
+  unsigned operator()(unsigned ID) const { return ID - BI_FIRST; }
+};
+
+struct RecordIdToIndexFunctor {
+  using argument_type = unsigned;
+  unsigned operator()(unsigned ID) const { return ID - RI_FIRST; }
+};
+
+using AbbrevDsc = void (*)(std::shared_ptr );
+
+static void AbbrevGen(std::shared_ptr ,
+  const std::initializer_list Ops) {
+  for (const auto  : Ops)
+Abbrev->Add(Op);
+}
+
+static void BoolAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Boolean
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::BoolSize)});
+}
+
+static void IntAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Fixed-size integer
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::IntSize)});
+}
+
+static void SymbolIDAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Fixed-size integer (length of the sha1'd USR)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::USRLengthSize),
+ // 1. Fixed-size array of Char6 (USR)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Array),
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   

[clang-tools-extra] r328270 - [clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"

2018-03-22 Thread Julie Hockett via cfe-commits
Author: juliehockett
Date: Thu Mar 22 16:34:46 2018
New Revision: 328270

URL: http://llvm.org/viewvc/llvm-project?rev=328270=rev
Log:
[clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework"

Fixed windows release build tests.

Added:
clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
clang-tools-extra/trunk/clang-doc/CMakeLists.txt
clang-tools-extra/trunk/clang-doc/ClangDoc.cpp
clang-tools-extra/trunk/clang-doc/ClangDoc.h
clang-tools-extra/trunk/clang-doc/Mapper.cpp
clang-tools-extra/trunk/clang-doc/Mapper.h
clang-tools-extra/trunk/clang-doc/Representation.h
clang-tools-extra/trunk/clang-doc/Serialize.cpp
clang-tools-extra/trunk/clang-doc/Serialize.h
clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt
clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-class-in-class.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-class-in-function.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-class.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-comments.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-enum.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-function.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-method.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-namespace.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-struct.cpp
clang-tools-extra/trunk/test/clang-doc/mapper-union.cpp
Modified:
clang-tools-extra/trunk/CMakeLists.txt
clang-tools-extra/trunk/test/CMakeLists.txt

Modified: clang-tools-extra/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/CMakeLists.txt?rev=328270=328269=328270=diff
==
--- clang-tools-extra/trunk/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/CMakeLists.txt Thu Mar 22 16:34:46 2018
@@ -7,6 +7,7 @@ add_subdirectory(clang-tidy-vs)
 endif()
 
 add_subdirectory(change-namespace)
+add_subdirectory(clang-doc)
 add_subdirectory(clang-query)
 add_subdirectory(clang-move)
 add_subdirectory(clangd)

Added: clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp?rev=328270=auto
==
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp (added)
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.cpp Thu Mar 22 16:34:46 2018
@@ -0,0 +1,510 @@
+//===--  BitcodeWriter.cpp - ClangDoc Bitcode Writer *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "BitcodeWriter.h"
+#include "llvm/ADT/IndexedMap.h"
+#include 
+
+namespace clang {
+namespace doc {
+
+// Since id enums are not zero-indexed, we need to transform the given id into
+// its associated index.
+struct BlockIdToIndexFunctor {
+  using argument_type = unsigned;
+  unsigned operator()(unsigned ID) const { return ID - BI_FIRST; }
+};
+
+struct RecordIdToIndexFunctor {
+  using argument_type = unsigned;
+  unsigned operator()(unsigned ID) const { return ID - RI_FIRST; }
+};
+
+using AbbrevDsc = void (*)(std::shared_ptr );
+
+static void AbbrevGen(std::shared_ptr ,
+  const std::initializer_list Ops) {
+  for (const auto  : Ops)
+Abbrev->Add(Op);
+}
+
+static void BoolAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Boolean
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::BoolSize)});
+}
+
+static void IntAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Fixed-size integer
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::IntSize)});
+}
+
+static void SymbolIDAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Fixed-size integer (length of the sha1'd USR)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::USRLengthSize),
+ // 1. Fixed-size array of Char6 (USR)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Array),
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::USRBitLengthSize)});
+}
+
+static void StringAbbrev(std::shared_ptr ) {
+  AbbrevGen(Abbrev,
+{// 0. Fixed-size integer (length of the following string)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+   BitCodeConstants::StringLengthSize),
+ // 1. The string blob
+