Skip to content

Commit 941fb2b

Browse files
committed
[lldb] Build the API unittests with -Wdocumentation
The LLDB SB API headers should be -Wdocumentation clean as they might get included by projects building with -Wdocumentation. Although I'd love for all of LLDB to be clean, we're pretty far removed from that goal. Until that changes, this PR will detect issues in the SB API headers by including all the headers in the unittests (by including LLDB/API.h) and building that with the warning, if the compiler supports it. rdar://143597614
1 parent f6a3002 commit 941fb2b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

lldb/include/lldb/API/SBSaveCoreOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class LLDB_API SBSaveCoreOptions {
5454
/// Set the output file path
5555
///
5656
/// \param
57-
/// output_file a \class SBFileSpec object that describes the output file.
57+
/// output_file a \ref SBFileSpec object that describes the output file.
5858
void SetOutputFile(SBFileSpec output_file);
5959

6060
/// Get the output file spec

lldb/unittests/API/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ add_lldb_unittest(APITests
55
liblldb
66
)
77

8+
# Build with -Wdocumentation. This relies on the tests including all the API
9+
# headers through API/LLDB.h.
10+
check_cxx_compiler_flag("-Wdocumentation"
11+
CXX_SUPPORTS_DOCUMENTATION)
12+
if (CXX_SUPPORTS_DOCUMENTATION)
13+
target_compile_options(APITests
14+
PRIVATE -Wdocumentation)
15+
endif()
16+
17+
818
if(Python3_RPATH)
919
set_property(TARGET APITests APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
1020
endif()

lldb/unittests/API/SBCommandInterpreterTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
#include "gtest/gtest.h"
1010

11-
#include "lldb/API/SBCommandInterpreter.h"
12-
#include "lldb/API/SBCommandReturnObject.h"
13-
#include "lldb/API/SBDebugger.h"
11+
// Use the umbrella header for -Wdocumentation.
12+
#include "lldb/API/LLDB.h"
1413

1514
#include <cstring>
1615
#include <string>

0 commit comments

Comments
 (0)