summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-02-16 09:31:36 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-02-16 09:31:36 +0000
commitfd035e6496665b1f1197868e21cb0a4594e8db6e (patch)
tree53010172e19c77ea447bcd89e117cda052ab52e0 /include/clang/Frontend
parent2fce988e86bc01829142e4362d4eff1af0925147 (diff)
downloadFreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.zip
FreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.tar.gz
Update clang to r96341.
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r--include/clang/Frontend/ASTConsumers.h7
-rw-r--r--include/clang/Frontend/ASTUnit.h10
-rw-r--r--include/clang/Frontend/Analyses.def17
-rw-r--r--include/clang/Frontend/CompilerInstance.h74
-rw-r--r--include/clang/Frontend/DiagnosticOptions.h6
-rw-r--r--include/clang/Frontend/FrontendAction.h8
-rw-r--r--include/clang/Frontend/FrontendActions.h44
-rw-r--r--include/clang/Frontend/FrontendOptions.h4
-rw-r--r--include/clang/Frontend/PCHBitCodes.h12
-rw-r--r--include/clang/Frontend/PCHReader.h4
10 files changed, 135 insertions, 51 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index 978b0d2..7ec5063 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -73,10 +73,11 @@ ASTConsumer *CreateObjCRewriter(const std::string &InFile,
// assembly. This runs optimizations depending on the CodeGenOptions
// parameter. The output depends on the Action parameter.
enum BackendAction {
- Backend_EmitAssembly, // Emit native assembly
- Backend_EmitBC, // Emit LLVM bitcode file
+ Backend_EmitAssembly, // Emit native assembly files
+ Backend_EmitBC, // Emit LLVM bitcode files
Backend_EmitLL, // Emit human-readable LLVM assembly
- Backend_EmitNothing // Don't emit anything (benchmarking mode)
+ Backend_EmitNothing, // Don't emit anything (benchmarking mode)
+ Backend_EmitObj // Emit native object files
};
ASTConsumer *CreateBackendConsumer(BackendAction Action,
Diagnostic &Diags,
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 2659dbb..f122dd9 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -53,6 +53,10 @@ class ASTUnit {
llvm::OwningPtr<ASTContext> Ctx;
bool tempFile;
+ /// Optional owned invocation, just used to make the invocation used in
+ /// LoadFromCommandLine available.
+ llvm::OwningPtr<CompilerInvocation> Invocation;
+
// OnlyLocalDecls - when true, walking this AST should only visit declarations
// that come from the AST itself, not from included precompiled headers.
// FIXME: This is temporary; eventually, CIndex will always do this.
@@ -131,7 +135,6 @@ public:
static ASTUnit *LoadFromPCHFile(const std::string &Filename,
Diagnostic &Diags,
bool OnlyLocalDecls = false,
- bool UseBumpAllocator = false,
RemappedFile *RemappedFiles = 0,
unsigned NumRemappedFiles = 0);
@@ -139,14 +142,14 @@ public:
/// CompilerInvocation object.
///
/// \param CI - The compiler invocation to use; it must have exactly one input
- /// source file.
+ /// source file. The ASTUnit takes ownership of the CompilerInvocation object.
///
/// \param Diags - The diagnostics engine to use for reporting errors; its
/// lifetime is expected to extend past that of the returned ASTUnit.
//
// FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
// shouldn't need to specify them at construction time.
- static ASTUnit *LoadFromCompilerInvocation(const CompilerInvocation &CI,
+ static ASTUnit *LoadFromCompilerInvocation(CompilerInvocation *CI,
Diagnostic &Diags,
bool OnlyLocalDecls = false);
@@ -169,7 +172,6 @@ public:
Diagnostic &Diags,
llvm::StringRef ResourceFilesPath,
bool OnlyLocalDecls = false,
- bool UseBumpAllocator = false,
RemappedFile *RemappedFiles = 0,
unsigned NumRemappedFiles = 0);
};
diff --git a/include/clang/Frontend/Analyses.def b/include/clang/Frontend/Analyses.def
index 7d55673..287c67e 100644
--- a/include/clang/Frontend/Analyses.def
+++ b/include/clang/Frontend/Analyses.def
@@ -24,28 +24,32 @@ ANALYSIS(CFGView, "cfg-view",
ANALYSIS(DisplayLiveVariables, "dump-live-variables",
"Print results of live variable analysis", Code)
-ANALYSIS(SecuritySyntacticChecks, "warn-security-syntactic",
+ANALYSIS(SecuritySyntacticChecks, "analyzer-check-security-syntactic",
"Perform quick security checks that require no data flow",
Code)
-ANALYSIS(WarnDeadStores, "warn-dead-stores",
+ANALYSIS(LLVMConventionChecker, "analyzer-check-llvm-conventions",
+ "Check code for LLVM codebase conventions (domain-specific)",
+ TranslationUnit)
+
+ANALYSIS(WarnDeadStores, "analyzer-check-dead-stores",
"Warn about stores to dead variables", Code)
ANALYSIS(WarnUninitVals, "warn-uninit-values",
"Warn about uses of uninitialized variables", Code)
-ANALYSIS(WarnObjCMethSigs, "warn-objc-methodsigs",
+ANALYSIS(WarnObjCMethSigs, "analyzer-check-objc-methodsigs",
"Warn about Objective-C method signatures with type incompatibilities",
ObjCImplementation)
-ANALYSIS(WarnObjCDealloc, "warn-objc-missing-dealloc",
+ANALYSIS(WarnObjCDealloc, "analyzer-check-objc-missing-dealloc",
"Warn about Objective-C classes that lack a correct implementation of -dealloc",
ObjCImplementation)
-ANALYSIS(WarnObjCUnusedIvars, "warn-objc-unused-ivars",
+ANALYSIS(WarnObjCUnusedIvars, "analyzer-check-objc-unused-ivars",
"Warn about private ivars that are never used", ObjCImplementation)
-ANALYSIS(CheckerCFRef, "checker-cfref",
+ANALYSIS(ObjCMemChecker, "analyzer-check-objc-mem",
"Run the [Core] Foundation reference count checker", Code)
ANALYSIS(WarnSizeofPointer, "warn-sizeof-pointer",
@@ -61,6 +65,7 @@ ANALYSIS(InlineCall, "inline-call",
ANALYSIS_STORE(BasicStore, "basic", "Use basic analyzer store", CreateBasicStoreManager)
ANALYSIS_STORE(RegionStore, "region", "Use region-based analyzer store", CreateRegionStoreManager)
+ANALYSIS_STORE(FlatStore, "flat", "Use flat analyzer store", CreateFlatStoreManager)
#ifndef ANALYSIS_CONSTRAINTS
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN)
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index edafe62..1be4118 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -58,11 +58,10 @@ class TargetInfo;
/// and a long form that takes explicit instances of any required objects.
class CompilerInstance {
/// The LLVM context used for this instance.
- llvm::LLVMContext *LLVMContext;
- bool OwnsLLVMContext;
+ llvm::OwningPtr<llvm::LLVMContext> LLVMContext;
/// The options used in this compiler instance.
- CompilerInvocation Invocation;
+ llvm::OwningPtr<CompilerInvocation> Invocation;
/// The diagnostics engine instance.
llvm::OwningPtr<Diagnostic> Diagnostics;
@@ -97,11 +96,10 @@ class CompilerInstance {
/// The list of active output files.
std::list< std::pair<std::string, llvm::raw_ostream*> > OutputFiles;
+ void operator=(const CompilerInstance &); // DO NOT IMPLEMENT
+ CompilerInstance(const CompilerInstance&); // DO NOT IMPLEMENT
public:
- /// Create a new compiler instance with the given LLVM context, optionally
- /// taking ownership of it.
- CompilerInstance(llvm::LLVMContext *_LLVMContext = 0,
- bool _OwnsLLVMContext = true);
+ CompilerInstance();
~CompilerInstance();
/// @name High-Level Operations
@@ -150,93 +148,101 @@ public:
return *LLVMContext;
}
+ llvm::LLVMContext *takeLLVMContext() { return LLVMContext.take(); }
+
/// setLLVMContext - Replace the current LLVM context and take ownership of
/// \arg Value.
- void setLLVMContext(llvm::LLVMContext *Value, bool TakeOwnership = true) {
- LLVMContext = Value;
- OwnsLLVMContext = TakeOwnership;
- }
+ void setLLVMContext(llvm::LLVMContext *Value);
/// }
/// @name Compiler Invocation and Options
/// {
- CompilerInvocation &getInvocation() { return Invocation; }
- const CompilerInvocation &getInvocation() const { return Invocation; }
- void setInvocation(const CompilerInvocation &Value) { Invocation = Value; }
+ bool hasInvocation() const { return Invocation != 0; }
+
+ CompilerInvocation &getInvocation() {
+ assert(Invocation && "Compiler instance has no invocation!");
+ return *Invocation;
+ }
+
+ CompilerInvocation *takeInvocation() { return Invocation.take(); }
+
+ /// setInvocation - Replace the current invocation; the compiler instance
+ /// takes ownership of \arg Value.
+ void setInvocation(CompilerInvocation *Value);
/// }
/// @name Forwarding Methods
/// {
AnalyzerOptions &getAnalyzerOpts() {
- return Invocation.getAnalyzerOpts();
+ return Invocation->getAnalyzerOpts();
}
const AnalyzerOptions &getAnalyzerOpts() const {
- return Invocation.getAnalyzerOpts();
+ return Invocation->getAnalyzerOpts();
}
CodeGenOptions &getCodeGenOpts() {
- return Invocation.getCodeGenOpts();
+ return Invocation->getCodeGenOpts();
}
const CodeGenOptions &getCodeGenOpts() const {
- return Invocation.getCodeGenOpts();
+ return Invocation->getCodeGenOpts();
}
DependencyOutputOptions &getDependencyOutputOpts() {
- return Invocation.getDependencyOutputOpts();
+ return Invocation->getDependencyOutputOpts();
}
const DependencyOutputOptions &getDependencyOutputOpts() const {
- return Invocation.getDependencyOutputOpts();
+ return Invocation->getDependencyOutputOpts();
}
DiagnosticOptions &getDiagnosticOpts() {
- return Invocation.getDiagnosticOpts();
+ return Invocation->getDiagnosticOpts();
}
const DiagnosticOptions &getDiagnosticOpts() const {
- return Invocation.getDiagnosticOpts();
+ return Invocation->getDiagnosticOpts();
}
FrontendOptions &getFrontendOpts() {
- return Invocation.getFrontendOpts();
+ return Invocation->getFrontendOpts();
}
const FrontendOptions &getFrontendOpts() const {
- return Invocation.getFrontendOpts();
+ return Invocation->getFrontendOpts();
}
HeaderSearchOptions &getHeaderSearchOpts() {
- return Invocation.getHeaderSearchOpts();
+ return Invocation->getHeaderSearchOpts();
}
const HeaderSearchOptions &getHeaderSearchOpts() const {
- return Invocation.getHeaderSearchOpts();
+ return Invocation->getHeaderSearchOpts();
}
LangOptions &getLangOpts() {
- return Invocation.getLangOpts();
+ return Invocation->getLangOpts();
}
const LangOptions &getLangOpts() const {
- return Invocation.getLangOpts();
+ return Invocation->getLangOpts();
}
PreprocessorOptions &getPreprocessorOpts() {
- return Invocation.getPreprocessorOpts();
+ return Invocation->getPreprocessorOpts();
}
const PreprocessorOptions &getPreprocessorOpts() const {
- return Invocation.getPreprocessorOpts();
+ return Invocation->getPreprocessorOpts();
}
PreprocessorOutputOptions &getPreprocessorOutputOpts() {
- return Invocation.getPreprocessorOutputOpts();
+ return Invocation->getPreprocessorOutputOpts();
}
const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
- return Invocation.getPreprocessorOutputOpts();
+ return Invocation->getPreprocessorOutputOpts();
}
TargetOptions &getTargetOpts() {
- return Invocation.getTargetOpts();
+ return Invocation->getTargetOpts();
}
const TargetOptions &getTargetOpts() const {
- return Invocation.getTargetOpts();
+ return Invocation->getTargetOpts();
}
/// }
diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h
index 13039bb..b37c180 100644
--- a/include/clang/Frontend/DiagnosticOptions.h
+++ b/include/clang/Frontend/DiagnosticOptions.h
@@ -31,9 +31,12 @@ public:
unsigned ShowOptionNames : 1; /// Show the diagnostic name for mappable
/// diagnostics.
unsigned ShowColors : 1; /// Show diagnostics with ANSI color sequences.
- unsigned VerifyDiagnostics; /// Check that diagnostics match the expected
+ unsigned VerifyDiagnostics: 1; /// Check that diagnostics match the expected
/// diagnostics, indicated by markers in the
/// input source file.
+ unsigned BinaryOutput : 1; /// Emit diagnostics via the diagnostic
+ /// binary serialization mechanism, to be
+ /// deserialized by, e.g., the CIndex library.
/// The distance between tab stops.
unsigned TabStop;
@@ -66,6 +69,7 @@ public:
ShowOptionNames = 0;
ShowSourceRanges = 0;
VerifyDiagnostics = 0;
+ BinaryOutput = 0;
}
};
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index 3042767..7b7db37 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -18,6 +18,7 @@ namespace clang {
class ASTUnit;
class ASTConsumer;
class CompilerInstance;
+class ASTMergeAction;
/// FrontendAction - Abstract base class for actions which can be performed by
/// the frontend.
@@ -25,6 +26,7 @@ class FrontendAction {
std::string CurrentFile;
llvm::OwningPtr<ASTUnit> CurrentASTUnit;
CompilerInstance *Instance;
+ friend class ASTMergeAction;
protected:
/// @name Implementation Action Interface
@@ -104,6 +106,10 @@ public:
return *CurrentASTUnit;
}
+ ASTUnit *takeCurrentASTUnit() {
+ return CurrentASTUnit.take();
+ }
+
void setCurrentFile(llvm::StringRef Value, ASTUnit *AST = 0);
/// @}
@@ -167,7 +173,7 @@ public:
};
/// ASTFrontendAction - Abstract base class to use for AST consumer based
-/// frontend actios.
+/// frontend actions.
class ASTFrontendAction : public FrontendAction {
/// ExecuteAction - Implement the ExecuteAction interface by running Sema on
/// the already initialized AST consumer.
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 33bb8aa..cbb3508 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -11,6 +11,8 @@
#define LLVM_CLANG_FRONTEND_FRONTENDACTIONS_H
#include "clang/Frontend/FrontendAction.h"
+#include <string>
+#include <vector>
namespace clang {
class FixItRewriter;
@@ -119,6 +121,43 @@ public:
virtual bool hasCodeCompletionSupport() const { return true; }
};
+/**
+ * \brief Frontend action adaptor that merges ASTs together.
+ *
+ * This action takes an existing AST file and "merges" it into the AST
+ * context, producing a merged context. This action is an action
+ * adaptor, which forwards most of its calls to another action that
+ * will consume the merged context.
+ */
+class ASTMergeAction : public FrontendAction {
+ /// \brief The action that the merge action adapts.
+ FrontendAction *AdaptedAction;
+
+ /// \brief The set of AST files to merge.
+ std::vector<std::string> ASTFiles;
+
+protected:
+ virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ llvm::StringRef InFile);
+
+ virtual bool BeginSourceFileAction(CompilerInstance &CI,
+ llvm::StringRef Filename);
+
+ virtual void ExecuteAction();
+ virtual void EndSourceFileAction();
+
+public:
+ ASTMergeAction(FrontendAction *AdaptedAction,
+ std::string *ASTFiles, unsigned NumASTFiles);
+ virtual ~ASTMergeAction();
+
+ virtual bool usesPreprocessorOnly() const;
+ virtual bool usesCompleteTranslationUnit();
+ virtual bool hasPCHSupport() const;
+ virtual bool hasASTSupport() const;
+ virtual bool hasCodeCompletionSupport() const;
+};
+
//===----------------------------------------------------------------------===//
// Code Gen AST Actions
//===----------------------------------------------------------------------===//
@@ -154,6 +193,11 @@ public:
EmitLLVMOnlyAction();
};
+class EmitObjAction : public CodeGenAction {
+public:
+ EmitObjAction();
+};
+
//===----------------------------------------------------------------------===//
// Preprocessor Actions
//===----------------------------------------------------------------------===//
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index 735a86a..80ba778 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -31,6 +31,7 @@ namespace frontend {
EmitHTML, ///< Translate input source into HTML.
EmitLLVM, ///< Emit a .ll file.
EmitLLVMOnly, ///< Generate LLVM IR, but do not
+ EmitObj, ///< Emit a .o file.
FixIt, ///< Parse and apply any fixits to the source.
GeneratePCH, ///< Generate pre-compiled header.
GeneratePTH, ///< Generate pre-tokenized header.
@@ -109,6 +110,9 @@ public:
/// The list of plugins to load.
std::vector<std::string> Plugins;
+ /// \brief The list of AST files to merge.
+ std::vector<std::string> ASTMergeFiles;
+
public:
FrontendOptions() {
DebugCodeCompletionPrinter = 1;
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index 1a9f4ce..e22d37b 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -221,7 +221,11 @@ namespace clang {
/// \brief Record code for the version control branch and revision
/// information of the compiler used to build this PCH file.
- VERSION_CONTROL_BRANCH_REVISION = 21
+ VERSION_CONTROL_BRANCH_REVISION = 21,
+
+ /// \brief Record code for the array of unused static functions.
+ UNUSED_STATIC_FUNCS = 22
+
};
/// \brief Record types used within a source manager block.
@@ -686,7 +690,11 @@ namespace clang {
// \brief A CXXConstCastExpr record.
EXPR_CXX_CONST_CAST,
// \brief A CXXFunctionalCastExpr record.
- EXPR_CXX_FUNCTIONAL_CAST
+ EXPR_CXX_FUNCTIONAL_CAST,
+ // \brief A CXXBoolLiteralExpr record.
+ EXPR_CXX_BOOL_LITERAL,
+ // \brief A CXXNullPtrLiteralExpr record.
+ EXPR_CXX_NULL_PTR_LITERAL
};
/// \brief The kinds of designators that can occur in a
diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h
index 9665ce1..065006f 100644
--- a/include/clang/Frontend/PCHReader.h
+++ b/include/clang/Frontend/PCHReader.h
@@ -306,6 +306,10 @@ private:
/// \brief The set of tentative definitions stored in the the PCH
/// file.
llvm::SmallVector<uint64_t, 16> TentativeDefinitions;
+
+ /// \brief The set of tentative definitions stored in the the PCH
+ /// file.
+ llvm::SmallVector<uint64_t, 16> UnusedStaticFuncs;
/// \brief The set of locally-scoped external declarations stored in
/// the the PCH file.
OpenPOWER on IntegriCloud