[AST] Remove DeclCXX.h dep on ASTContext.h
authorReid Kleckner <rnk@google.com>
Mon, 6 Apr 2020 16:55:33 +0000 (09:55 -0700)
committerReid Kleckner <rnk@google.com>
Mon, 6 Apr 2020 17:09:01 +0000 (10:09 -0700)
commitb36c19bc4f2110a8e33f8d93751ef28b6dcd0292
tree34bbf0492c13810a01598eb31733842dd0b43f52
parent2c31aa2de13a23a00ced87123b92e905f2929c7b
[AST] Remove DeclCXX.h dep on ASTContext.h

Saves only 36 includes of ASTContext.h and related headers.

There are two deps on ASTContext.h:
- C++ method overrides iterator types (TinyPtrVector)
- getting LangOptions

For #1, duplicate the iterator type, which is
TinyPtrVector<>::const_iterator.

For #2, add an out-of-line accessor to get the language options. Getting
the ASTContext from a Decl is already an out of line method that loops
over the parent DeclContexts, so if it is ever performance critical, the
proper fix is to pass the context (or LangOpts) into the predicate in
question.

Other changes are just header fixups.
clang/include/clang/AST/DeclBase.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/GlobalDecl.h
clang/include/clang/Serialization/ASTRecordReader.h
clang/lib/AST/CommentSema.cpp
clang/lib/AST/ComparisonCategories.cpp
clang/lib/AST/DeclBase.cpp
clang/lib/Analysis/PathDiagnostic.cpp
clang/lib/Analysis/ProgramPoint.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/Tooling/Core/Lookup.cpp