diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-27 22:01:17 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-27 22:01:17 +0000 |
commit | ee94e2d10728d1b6a87a11aeee122e8759f58c63 (patch) | |
tree | 0a3ee297a9b8fe980de0c7937994b666eef57bc8 /include/clang/CodeGen/BackendUtil.h | |
parent | 0246376203474718e0ec7e4025b1820c6e72a3da (diff) |
Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.
This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/CodeGen/BackendUtil.h')
-rw-r--r-- | include/clang/CodeGen/BackendUtil.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/clang/CodeGen/BackendUtil.h b/include/clang/CodeGen/BackendUtil.h index abcef8130d..193a0fb4d9 100644 --- a/include/clang/CodeGen/BackendUtil.h +++ b/include/clang/CodeGen/BackendUtil.h @@ -19,6 +19,7 @@ namespace clang { class Diagnostic; class CodeGenOptions; class TargetOptions; + class Decl; enum BackendAction { Backend_EmitAssembly, ///< Emit native assembly files @@ -32,6 +33,14 @@ namespace clang { void EmitBackendOutput(Diagnostic &Diags, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, llvm::Module *M, BackendAction Action, llvm::raw_ostream *OS); + + /// \brief Determines if the decl can be CodeGen'ed or deserialized from PCH + /// lazily, only when used; this is only relevant for function or file scoped + /// var definitions. + /// + /// \returns true if the function/var must be CodeGen'ed/deserialized even if + /// it is not used. + bool DeclIsRequiredFunctionOrFileScopedVar(const Decl *D); } #endif |