Skip to content

Commit d7705f2

Browse files
committed
Improve documentation, use ternary
1 parent 326df77 commit d7705f2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,13 @@ class ASTWriter : public ASTDeserializationListener,
659659
/// include timestamps in the output file.
660660
time_t getTimestampForOutput(const FileEntry *E) const;
661661

662-
/// Write a precompiled header for the given semantic analysis.
662+
/// Write a precompiled header or a module with the AST produced by the
663+
/// \c Sema object, or a dependency scanner module with the preprocessor state
664+
/// produced by the \c Preprocessor object.
663665
///
664-
/// \param Subject The object that processed the input to be written into the
665-
/// AST file.
666+
/// \param Subject The \c Sema object that processed the AST to be written, or
667+
/// in the case of a dependency scanner module the \c Preprocessor that holds
668+
/// the state.
666669
///
667670
/// \param WritingModule The module that we are writing. If null, we are
668671
/// writing a precompiled header.

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4868,11 +4868,8 @@ ASTWriter::WriteAST(llvm::PointerUnion<Sema *, Preprocessor *> Subject,
48684868
WritingAST = true;
48694869

48704870
Sema *SemaPtr = Subject.dyn_cast<Sema *>();
4871-
Preprocessor &PPRef = [&]() -> Preprocessor & {
4872-
if (SemaPtr)
4873-
return SemaPtr->getPreprocessor();
4874-
return *Subject.get<Preprocessor *>();
4875-
}();
4871+
Preprocessor &PPRef =
4872+
SemaPtr ? SemaPtr->getPreprocessor() : *Subject.get<Preprocessor *>();
48764873

48774874
ASTHasCompilerErrors = PPRef.getDiagnostics().hasUncompilableErrorOccurred();
48784875

0 commit comments

Comments
 (0)