From: Reid Kleckner Date: Thu, 27 Feb 2020 01:24:52 +0000 (-0800) Subject: Forward declare special case lists X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04da3dfecc199a7fdd262b06eeb399fc8ce0d1f6;p=platform%2Fupstream%2Fllvm.git Forward declare special case lists This avoids pulling in unordered_map from TrigramIndex.h: $ diff -u thedeps-before.txt thedeps-after.txt | \ grep '^[-+] ' | sort | uniq -c | sort -nr 976 - ../llvm/include/llvm/Support/TrigramIndex.h 976 - ../llvm/include/llvm/Support/SpecialCaseList.h 976 - ../clang/include/clang/Basic/SanitizerSpecialCaseList.h 502 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/unordered_map 467 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xhash 467 - ../../../PROGRA~2/MIB055~1/2019/PROFES~1/VC/Tools/MSVC/14.24.28314/include/xbit_ops.h 212 - ../llvm/include/llvm/ADT/StringSet.h --- diff --git a/clang/include/clang/Basic/SanitizerBlacklist.h b/clang/include/clang/Basic/SanitizerBlacklist.h index 29af28b..c874ff2 100644 --- a/clang/include/clang/Basic/SanitizerBlacklist.h +++ b/clang/include/clang/Basic/SanitizerBlacklist.h @@ -14,15 +14,17 @@ #define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H #include "clang/Basic/LLVM.h" -#include "clang/Basic/SanitizerSpecialCaseList.h" -#include "clang/Basic/Sanitizers.h" #include "clang/Basic/SourceLocation.h" -#include "clang/Basic/SourceManager.h" #include "llvm/ADT/StringRef.h" #include +#include namespace clang { +class SanitizerMask; +class SourceManager; +class SanitizerSpecialCaseList; + class SanitizerBlacklist { std::unique_ptr SSCL; SourceManager &SM; @@ -30,6 +32,7 @@ class SanitizerBlacklist { public: SanitizerBlacklist(const std::vector &BlacklistPaths, SourceManager &SM); + ~SanitizerBlacklist(); bool isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category = StringRef()) const; bool isBlacklistedType(SanitizerMask Mask, StringRef MangledTypeName, diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h index 88d31a6..c84894d 100644 --- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h +++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h @@ -10,6 +10,7 @@ // SanitizerMask. // //===----------------------------------------------------------------------===// + #ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H #define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H @@ -17,8 +18,14 @@ #include "clang/Basic/Sanitizers.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/SpecialCaseList.h" -#include "llvm/Support/VirtualFileSystem.h" #include +#include + +namespace llvm { +namespace vfs { +class FileSystem; +} +} // namespace llvm namespace clang { diff --git a/clang/include/clang/Basic/XRayLists.h b/clang/include/clang/Basic/XRayLists.h index cf464f9..7ea9d97 100644 --- a/clang/include/clang/Basic/XRayLists.h +++ b/clang/include/clang/Basic/XRayLists.h @@ -14,14 +14,18 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" -#include "clang/Basic/SourceManager.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/SpecialCaseList.h" #include +namespace llvm { +class SpecialCaseList; +} + namespace clang { +class SourceManager; + class XRayFunctionFilter { std::unique_ptr AlwaysInstrument; std::unique_ptr NeverInstrument; @@ -32,6 +36,7 @@ public: XRayFunctionFilter(ArrayRef AlwaysInstrumentPaths, ArrayRef NeverInstrumentPaths, ArrayRef AttrListPaths, SourceManager &SM); + ~XRayFunctionFilter(); enum class ImbueAttribute { NONE, diff --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h index c5d12fc..c490bb3 100644 --- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h +++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h @@ -19,8 +19,8 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/raw_ostream.h" - #include +#include namespace clang { namespace tooling { diff --git a/clang/lib/Basic/SanitizerBlacklist.cpp b/clang/lib/Basic/SanitizerBlacklist.cpp index 4f71349..48cc229 100644 --- a/clang/lib/Basic/SanitizerBlacklist.cpp +++ b/clang/lib/Basic/SanitizerBlacklist.cpp @@ -10,7 +10,11 @@ // sanitizers. // //===----------------------------------------------------------------------===// + #include "clang/Basic/SanitizerBlacklist.h" +#include "clang/Basic/SanitizerSpecialCaseList.h" +#include "clang/Basic/Sanitizers.h" +#include "clang/Basic/SourceManager.h" using namespace clang; @@ -20,6 +24,8 @@ SanitizerBlacklist::SanitizerBlacklist( BlacklistPaths, SM.getFileManager().getVirtualFileSystem())), SM(SM) {} +SanitizerBlacklist::~SanitizerBlacklist() = default; + bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category) const { diff --git a/clang/lib/Basic/XRayLists.cpp b/clang/lib/Basic/XRayLists.cpp index 222a28f..f9827be 100644 --- a/clang/lib/Basic/XRayLists.cpp +++ b/clang/lib/Basic/XRayLists.cpp @@ -9,7 +9,10 @@ // User-provided filters for always/never XRay instrumenting certain functions. // //===----------------------------------------------------------------------===// + #include "clang/Basic/XRayLists.h" +#include "clang/Basic/SourceManager.h" +#include "llvm/Support/SpecialCaseList.h" using namespace clang; @@ -25,6 +28,8 @@ XRayFunctionFilter::XRayFunctionFilter( AttrListPaths, SM.getFileManager().getVirtualFileSystem())), SM(SM) {} +XRayFunctionFilter::~XRayFunctionFilter() = default; + XRayFunctionFilter::ImbueAttribute XRayFunctionFilter::shouldImbueFunction(StringRef FunctionName) const { // First apply the always instrument list, than if it isn't an "always" see diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 7fe3213..ffe620b 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -47,6 +47,7 @@ #include #include #include +#include using namespace clang; using namespace sema; @@ -17570,9 +17571,11 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef Elements, typedef SmallVector, 3> DuplicatesVector; typedef llvm::PointerUnion DeclOrVector; + + // DenseMaps cannot contain the all ones int64_t value, so use unordered_map. typedef std::unordered_map ValueToVectorMap; - // Use int64_t as a key to avoid needing special handling for DenseMap keys. + // Use int64_t as a key to avoid needing special handling for map keys. auto EnumConstantToKey = [](const EnumConstantDecl *D) { llvm::APSInt Val = D->getInitVal(); return Val.isSigned() ? Val.getSExtValue() : Val.getZExtValue();