diff options
Diffstat (limited to 'include/clang/Frontend')
30 files changed, 166 insertions, 166 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index c2144da054..34958eeb62 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -1,9 +1,8 @@ //===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index d0b532cf2d..750f6c8577 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -1,9 +1,8 @@ //===- ASTUnit.h - ASTUnit utility ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -72,7 +71,7 @@ class FileManager; class FrontendAction; class HeaderSearch; class InputKind; -class MemoryBufferCache; +class InMemoryModuleCache; class PCHContainerOperations; class PCHContainerReader; class Preprocessor; @@ -108,7 +107,7 @@ private: IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics; IntrusiveRefCntPtr<FileManager> FileMgr; IntrusiveRefCntPtr<SourceManager> SourceMgr; - IntrusiveRefCntPtr<MemoryBufferCache> PCMCache; + IntrusiveRefCntPtr<InMemoryModuleCache> ModuleCache; std::unique_ptr<HeaderSearch> HeaderInfo; IntrusiveRefCntPtr<TargetInfo> Target; std::shared_ptr<Preprocessor> PP; diff --git a/include/clang/Frontend/ChainedDiagnosticConsumer.h b/include/clang/Frontend/ChainedDiagnosticConsumer.h index 04c6077dc3..ca28456075 100644 --- a/include/clang/Frontend/ChainedDiagnosticConsumer.h +++ b/include/clang/Frontend/ChainedDiagnosticConsumer.h @@ -1,9 +1,8 @@ //===- ChainedDiagnosticConsumer.h - Chain Diagnostic Clients ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/CommandLineSourceLoc.h b/include/clang/Frontend/CommandLineSourceLoc.h index 7ae98e0792..e95d100f6a 100644 --- a/include/clang/Frontend/CommandLineSourceLoc.h +++ b/include/clang/Frontend/CommandLineSourceLoc.h @@ -1,10 +1,9 @@ //===--- CommandLineSourceLoc.h - Parsing for source locations-*- C++ -*---===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 83ce079d5e..2eb1349f49 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -1,9 +1,8 @@ //===-- CompilerInstance.h - Clang Compiler Instance ------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -45,7 +44,7 @@ class ExternalASTSource; class FileEntry; class FileManager; class FrontendAction; -class MemoryBufferCache; +class InMemoryModuleCache; class Module; class Preprocessor; class Sema; @@ -83,9 +82,6 @@ class CompilerInstance : public ModuleLoader { /// Auxiliary Target info. IntrusiveRefCntPtr<TargetInfo> AuxTarget; - /// The virtual file system. - IntrusiveRefCntPtr<llvm::vfs::FileSystem> VirtualFileSystem; - /// The file manager. IntrusiveRefCntPtr<FileManager> FileMgr; @@ -93,7 +89,7 @@ class CompilerInstance : public ModuleLoader { IntrusiveRefCntPtr<SourceManager> SourceMgr; /// The cache of PCM files. - IntrusiveRefCntPtr<MemoryBufferCache> PCMCache; + IntrusiveRefCntPtr<InMemoryModuleCache> ModuleCache; /// The preprocessor. std::shared_ptr<Preprocessor> PP; @@ -193,7 +189,7 @@ public: explicit CompilerInstance( std::shared_ptr<PCHContainerOperations> PCHContainerOps = std::make_shared<PCHContainerOperations>(), - MemoryBufferCache *SharedPCMCache = nullptr); + InMemoryModuleCache *SharedModuleCache = nullptr); ~CompilerInstance() override; /// @name High-Level Operations @@ -383,20 +379,8 @@ public: /// @name Virtual File System /// { - bool hasVirtualFileSystem() const { return VirtualFileSystem != nullptr; } - llvm::vfs::FileSystem &getVirtualFileSystem() const { - assert(hasVirtualFileSystem() && - "Compiler instance has no virtual file system"); - return *VirtualFileSystem; - } - - /// Replace the current virtual file system. - /// - /// \note Most clients should use setFileManager, which will implicitly reset - /// the virtual file system to the one contained in the file manager. - void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) { - VirtualFileSystem = std::move(FS); + return getFileManager().getVirtualFileSystem(); } /// } @@ -646,7 +630,8 @@ public: /// Create the file manager and replace any existing one with it. /// /// \return The new file manager on success, or null on failure. - FileManager *createFileManager(); + FileManager * + createFileManager(IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr); /// Create the source manager and replace any existing one with it. void createSourceManager(FileManager &FileMgr); @@ -672,7 +657,8 @@ public: /// \return - The new object on success, or null on failure. static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource( StringRef Path, StringRef Sysroot, bool DisablePCHValidation, - bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, + bool AllowPCHWithCompilerErrors, Preprocessor &PP, + InMemoryModuleCache &ModuleCache, ASTContext &Context, const PCHContainerReader &PCHContainerRdr, ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions, DependencyFileGenerator *DependencyFile, @@ -814,7 +800,7 @@ public: void setExternalSemaSource(IntrusiveRefCntPtr<ExternalSemaSource> ESS); - MemoryBufferCache &getPCMCache() const { return *PCMCache; } + InMemoryModuleCache &getModuleCache() const { return *ModuleCache; } }; } // end namespace clang diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h index a1874655b0..413134be4c 100644 --- a/include/clang/Frontend/CompilerInvocation.h +++ b/include/clang/Frontend/CompilerInvocation.h @@ -1,9 +1,8 @@ //===- CompilerInvocation.h - Compiler Invocation Helper Data ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/DependencyOutputOptions.h b/include/clang/Frontend/DependencyOutputOptions.h index f419d26436..7a4f333793 100644 --- a/include/clang/Frontend/DependencyOutputOptions.h +++ b/include/clang/Frontend/DependencyOutputOptions.h @@ -1,9 +1,8 @@ //===--- DependencyOutputOptions.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h index 3bbf37946d..b939ebe979 100644 --- a/include/clang/Frontend/DiagnosticRenderer.h +++ b/include/clang/Frontend/DiagnosticRenderer.h @@ -1,9 +1,8 @@ //===- DiagnosticRenderer.h - Diagnostic Pretty-Printing --------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index 22314386e0..3a107d54d5 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -1,9 +1,8 @@ //===-- FrontendAction.h - Generic Frontend Action Interface ----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// @@ -305,6 +304,7 @@ class WrapperFrontendAction : public FrontendAction { std::unique_ptr<FrontendAction> WrappedAction; protected: + bool PrepareToExecuteAction(CompilerInstance &CI) override; std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override; bool BeginInvocation(CompilerInstance &CI) override; diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h index eb1cd68842..e3b8b46165 100644 --- a/include/clang/Frontend/FrontendActions.h +++ b/include/clang/Frontend/FrontendActions.h @@ -1,9 +1,8 @@ //===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -75,12 +74,6 @@ protected: StringRef InFile) override; }; -class DeclContextPrintAction : public ASTFrontendAction { -protected: - std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) override; -}; - class GeneratePCHAction : public ASTFrontendAction { protected: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, diff --git a/include/clang/Frontend/FrontendDiagnostic.h b/include/clang/Frontend/FrontendDiagnostic.h index 14a28845d4..f41504d802 100644 --- a/include/clang/Frontend/FrontendDiagnostic.h +++ b/include/clang/Frontend/FrontendDiagnostic.h @@ -1,9 +1,8 @@ //===--- DiagnosticFrontend.h - Diagnostics for frontend --------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 92191ebd12..645e9ffe81 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -1,9 +1,8 @@ //===- FrontendOptions.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -203,7 +202,7 @@ class FrontendInputFile { /// The input, if it comes from a buffer rather than a file. This object /// does not own the buffer, and the caller is responsible for ensuring /// that it outlives any users. - llvm::MemoryBuffer *Buffer = nullptr; + const llvm::MemoryBuffer *Buffer = nullptr; /// The kind of input, e.g., C source, AST file, LLVM IR. InputKind Kind; @@ -215,7 +214,7 @@ public: FrontendInputFile() = default; FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false) : File(File.str()), Kind(Kind), IsSystem(IsSystem) {} - FrontendInputFile(llvm::MemoryBuffer *Buffer, InputKind Kind, + FrontendInputFile(const llvm::MemoryBuffer *Buffer, InputKind Kind, bool IsSystem = false) : Buffer(Buffer), Kind(Kind), IsSystem(IsSystem) {} @@ -232,7 +231,7 @@ public: return File; } - llvm::MemoryBuffer *getBuffer() const { + const llvm::MemoryBuffer *getBuffer() const { assert(isBuffer()); return Buffer; } @@ -257,6 +256,9 @@ public: /// Show timers for individual actions. unsigned ShowTimers : 1; + /// Output time trace profile. + unsigned TimeTrace : 1; + /// Show the -version text. unsigned ShowVersion : 1; @@ -438,13 +440,14 @@ public: public: FrontendOptions() : DisableFree(false), RelocatablePCH(false), ShowHelp(false), - ShowStats(false), ShowTimers(false), ShowVersion(false), - FixWhatYouCan(false), FixOnlyWarnings(false), FixAndRecompile(false), - FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false), - SkipFunctionBodies(false), UseGlobalModuleIndex(true), - GenerateGlobalModuleIndex(true), ASTDumpDecls(false), - ASTDumpLookups(false), BuildingImplicitModule(false), - ModulesEmbedAllFiles(false), IncludeTimestamps(true) {} + ShowStats(false), ShowTimers(false), TimeTrace(false), + ShowVersion(false), FixWhatYouCan(false), FixOnlyWarnings(false), + FixAndRecompile(false), FixToTemporaries(false), + ARCMTMigrateEmitARCErrors(false), SkipFunctionBodies(false), + UseGlobalModuleIndex(true), GenerateGlobalModuleIndex(true), + ASTDumpDecls(false), ASTDumpLookups(false), + BuildingImplicitModule(false), ModulesEmbedAllFiles(false), + IncludeTimestamps(true) {} /// getInputKindForExtension - Return the appropriate input kind for a file /// extension. For example, "c" would return InputKind::C. diff --git a/include/clang/Frontend/FrontendPluginRegistry.h b/include/clang/Frontend/FrontendPluginRegistry.h index 9a85e89d90..810578534a 100644 --- a/include/clang/Frontend/FrontendPluginRegistry.h +++ b/include/clang/Frontend/FrontendPluginRegistry.h @@ -1,9 +1,8 @@ //===- FrontendPluginRegistry.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/LangStandard.h b/include/clang/Frontend/LangStandard.h index 83e452d884..406ca56cc3 100644 --- a/include/clang/Frontend/LangStandard.h +++ b/include/clang/Frontend/LangStandard.h @@ -1,9 +1,8 @@ //===--- LangStandard.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def index 0fdd35f320..196cb43e49 100644 --- a/include/clang/Frontend/LangStandards.def +++ b/include/clang/Frontend/LangStandards.def @@ -1,9 +1,8 @@ //===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/LayoutOverrideSource.h b/include/clang/Frontend/LayoutOverrideSource.h index 28e3cf005b..ea1611470a 100644 --- a/include/clang/Frontend/LayoutOverrideSource.h +++ b/include/clang/Frontend/LayoutOverrideSource.h @@ -1,9 +1,8 @@ //===--- LayoutOverrideSource.h --Override Record Layouts -------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h index 3286ecf2cd..4816275cdc 100644 --- a/include/clang/Frontend/LogDiagnosticPrinter.h +++ b/include/clang/Frontend/LogDiagnosticPrinter.h @@ -1,9 +1,8 @@ //===--- LogDiagnosticPrinter.h - Log Diagnostic Client ---------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/MigratorOptions.h b/include/clang/Frontend/MigratorOptions.h index 8eb71b13f8..cf50ffcf0c 100644 --- a/include/clang/Frontend/MigratorOptions.h +++ b/include/clang/Frontend/MigratorOptions.h @@ -1,9 +1,8 @@ //===--- MigratorOptions.h - MigratorOptions Options ------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h index 214fefb219..ca6ed8310a 100644 --- a/include/clang/Frontend/MultiplexConsumer.h +++ b/include/clang/Frontend/MultiplexConsumer.h @@ -1,9 +1,8 @@ //===-- MultiplexConsumer.h - AST Consumer for PCH Generation ---*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/PCHContainerOperations.h b/include/clang/Frontend/PCHContainerOperations.h index 675efbaf56..fa977a63f3 100644 --- a/include/clang/Frontend/PCHContainerOperations.h +++ b/include/clang/Frontend/PCHContainerOperations.h @@ -1,9 +1,8 @@ //===--- Frontend/PCHContainerOperations.h - PCH Containers -----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/PrecompiledPreamble.h b/include/clang/Frontend/PrecompiledPreamble.h index 6c79895ce1..b1d55d8063 100644 --- a/include/clang/Frontend/PrecompiledPreamble.h +++ b/include/clang/Frontend/PrecompiledPreamble.h @@ -1,9 +1,8 @@ //===--- PrecompiledPreamble.h - Build precompiled preambles ----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -284,6 +283,8 @@ public: /// Creates wrapper class for PPCallbacks so we can also process information /// about includes that are inside of a preamble virtual std::unique_ptr<PPCallbacks> createPPCallbacks(); + /// The returned CommentHandler will be added to the preprocessor if not null. + virtual CommentHandler *getCommentHandler(); }; enum class BuildPreambleError { diff --git a/include/clang/Frontend/PreprocessorOutputOptions.h b/include/clang/Frontend/PreprocessorOutputOptions.h index 94afcd06a3..72e5ad1137 100644 --- a/include/clang/Frontend/PreprocessorOutputOptions.h +++ b/include/clang/Frontend/PreprocessorOutputOptions.h @@ -1,9 +1,8 @@ //===--- PreprocessorOutputOptions.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/SerializedDiagnosticPrinter.h b/include/clang/Frontend/SerializedDiagnosticPrinter.h index dc68c32fb1..5c1ff7a031 100644 --- a/include/clang/Frontend/SerializedDiagnosticPrinter.h +++ b/include/clang/Frontend/SerializedDiagnosticPrinter.h @@ -1,9 +1,8 @@ //===--- SerializedDiagnosticPrinter.h - Diagnostics serializer -*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/SerializedDiagnosticReader.h b/include/clang/Frontend/SerializedDiagnosticReader.h index 595bdf1f4d..7b3a6dbac1 100644 --- a/include/clang/Frontend/SerializedDiagnosticReader.h +++ b/include/clang/Frontend/SerializedDiagnosticReader.h @@ -1,9 +1,8 @@ //===- SerializedDiagnosticReader.h - Reads diagnostics ---------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/SerializedDiagnostics.h b/include/clang/Frontend/SerializedDiagnostics.h index dacbc678b7..6ffcf520bc 100644 --- a/include/clang/Frontend/SerializedDiagnostics.h +++ b/include/clang/Frontend/SerializedDiagnostics.h @@ -1,9 +1,8 @@ //===--- SerializedDiagnostics.h - Common data for serialized diagnostics -===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index 9f33b866a1..7cf54839af 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -1,9 +1,8 @@ //===--- TextDiagnostic.h - Text Diagnostic Pretty-Printing -----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h index 2295f9dbf3..5945caf897 100644 --- a/include/clang/Frontend/TextDiagnosticBuffer.h +++ b/include/clang/Frontend/TextDiagnosticBuffer.h @@ -1,9 +1,8 @@ //===- TextDiagnosticBuffer.h - Buffer Text Diagnostics ---------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 3cb4e02edf..ba756fa18c 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -1,9 +1,8 @@ //===--- TextDiagnosticPrinter.h - Text Diagnostic Client -------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 89a6b90f29..124d4a9933 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -1,9 +1,8 @@ //===- Utils.h - Misc utilities for the front-end ---------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -146,18 +145,18 @@ public: ~ModuleDependencyCollector() override { writeFileMap(); } StringRef getDest() { return DestDir; } - bool insertSeen(StringRef Filename) { return Seen.insert(Filename).second; } - void addFile(StringRef Filename, StringRef FileDst = {}); + virtual bool insertSeen(StringRef Filename) { return Seen.insert(Filename).second; } + virtual void addFile(StringRef Filename, StringRef FileDst = {}); - void addFileMapping(StringRef VPath, StringRef RPath) { + virtual void addFileMapping(StringRef VPath, StringRef RPath) { VFSWriter.addFileMapping(VPath, RPath); } void attachToPreprocessor(Preprocessor &PP) override; void attachToASTReader(ASTReader &R) override; - void writeFileMap(); - bool hasErrors() { return HasErrors; } + virtual void writeFileMap(); + virtual bool hasErrors() { return HasErrors; } }; /// AttachDependencyGraphGen - Create a dependency graph generator, and attach diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h index f36970f1eb..965a144108 100644 --- a/include/clang/Frontend/VerifyDiagnosticConsumer.h +++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h @@ -1,9 +1,8 @@ //===- VerifyDiagnosticConsumer.h - Verifying Diagnostic Client -*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -34,7 +33,33 @@ class TextDiagnosticBuffer; /// markers in the input source to check that all the emitted diagnostics match /// those expected. /// -/// USING THE DIAGNOSTIC CHECKER: +/// INVOKING THE DIAGNOSTIC CHECKER: +/// +/// VerifyDiagnosticConsumer is typically invoked via the "-verify" option to +/// "clang -cc1". "-verify" is equivalent to "-verify=expected", so all +/// diagnostics are typically specified with the prefix "expected". For +/// example: +/// +/// \code +/// int A = B; // expected-error {{use of undeclared identifier 'B'}} +/// \endcode +/// +/// Custom prefixes can be specified as a comma-separated sequence. Each +/// prefix must start with a letter and contain only alphanumeric characters, +/// hyphens, and underscores. For example, given just "-verify=foo,bar", +/// the above diagnostic would be ignored, but the following diagnostics would +/// be recognized: +/// +/// \code +/// int A = B; // foo-error {{use of undeclared identifier 'B'}} +/// int C = D; // bar-error {{use of undeclared identifier 'D'}} +/// \endcode +/// +/// Multiple occurrences accumulate prefixes. For example, +/// "-verify -verify=foo,bar -verify=baz" is equivalent to +/// "-verify=expected,foo,bar,baz". +/// +/// SPECIFYING DIAGNOSTICS: /// /// Indicating that a line expects an error or a warning is simple. Put a /// comment on the line that has the diagnostic, use: @@ -82,6 +107,19 @@ class TextDiagnosticBuffer; /// the included file is, for example, a system header where the actual line /// number may change and is not critical). /// +/// As an alternative to specifying a fixed line number, the location of a +/// diagnostic can instead be indicated by a marker of the form "#<marker>". +/// Markers are specified by including them in a comment, and then referenced +/// by appending the marker to the diagnostic with "@#<marker>": +/// +/// \code +/// #warning some text // #1 +/// // expected-warning@#1 {{some text}} +/// \endcode +/// +/// The name of a marker used in a directive must be unique within the +/// compilation. +/// /// The simple syntax above allows each specification to match exactly one /// error. You can use the extended syntax to customize this. The extended /// syntax is "expected-<type> <n> {{diag text}}", where \<type> is one of @@ -213,11 +251,14 @@ public: HasOtherExpectedDirectives }; + class MarkerTracker; + private: DiagnosticsEngine &Diags; DiagnosticConsumer *PrimaryClient; std::unique_ptr<DiagnosticConsumer> PrimaryClientOwner; std::unique_ptr<TextDiagnosticBuffer> Buffer; + std::unique_ptr<MarkerTracker> Markers; const Preprocessor *CurrentPreprocessor = nullptr; const LangOptions *LangOpts = nullptr; SourceManager *SrcManager = nullptr; |