summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
commit8aaf5818a64e9f7687798852af5945b053c68a54 (patch)
treed6a70c3518b8dea8be7062438d7e8676820ed17f /include/clang/Frontend
parent71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (diff)
downloadFreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.zip
FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.tar.gz
Update clang to r103004.
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r--include/clang/Frontend/ASTConsumers.h4
-rw-r--r--include/clang/Frontend/Analyses.def25
-rw-r--r--include/clang/Frontend/AnalysisConsumer.h1
-rw-r--r--include/clang/Frontend/DiagnosticOptions.h5
-rw-r--r--include/clang/Frontend/FixItRewriter.h59
-rw-r--r--include/clang/Frontend/FrontendActions.h8
-rw-r--r--include/clang/Frontend/FrontendOptions.h9
-rw-r--r--include/clang/Frontend/PCHBitCodes.h6
-rw-r--r--include/clang/Frontend/PCHReader.h5
-rw-r--r--include/clang/Frontend/StmtXML.def9
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h2
-rw-r--r--include/clang/Frontend/VerifyDiagnosticsClient.h19
12 files changed, 94 insertions, 58 deletions
diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h
index b5b09f5..9163a20 100644
--- a/include/clang/Frontend/ASTConsumers.h
+++ b/include/clang/Frontend/ASTConsumers.h
@@ -57,10 +57,6 @@ ASTConsumer *CreateASTViewer();
// to stderr; this is intended for debugging.
ASTConsumer *CreateDeclContextPrinter();
-// RecordLayout dumper: prints out the record layout information for all records
-// in the translation unit; this is intended for debugging.
-ASTConsumer *CreateRecordLayoutDumper();
-
// ObjC rewriter: attempts tp rewrite ObjC constructs into pure C code.
// This is considered experimental, and only works with Apple's ObjC runtime.
ASTConsumer *CreateObjCRewriter(const std::string &InFile,
diff --git a/include/clang/Frontend/Analyses.def b/include/clang/Frontend/Analyses.def
index 287c67e..aaa3920 100644
--- a/include/clang/Frontend/Analyses.def
+++ b/include/clang/Frontend/Analyses.def
@@ -15,22 +15,21 @@
#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE)
#endif
-ANALYSIS(CFGDump, "cfg-dump",
+ANALYSIS(CFGDump, "cfg-dump",
"Display Control-Flow Graphs", Code)
-ANALYSIS(CFGView, "cfg-view",
+ANALYSIS(CFGView, "cfg-view",
"View Control-Flow Graphs using GraphViz", Code)
ANALYSIS(DisplayLiveVariables, "dump-live-variables",
"Print results of live variable analysis", Code)
ANALYSIS(SecuritySyntacticChecks, "analyzer-check-security-syntactic",
- "Perform quick security checks that require no data flow",
- Code)
+ "Perform quick security checks that require no data flow", Code)
ANALYSIS(LLVMConventionChecker, "analyzer-check-llvm-conventions",
- "Check code for LLVM codebase conventions (domain-specific)",
- TranslationUnit)
+ "Check code for LLVM codebase conventions (domain-specific)",
+ TranslationUnit)
ANALYSIS(WarnDeadStores, "analyzer-check-dead-stores",
"Warn about stores to dead variables", Code)
@@ -39,15 +38,15 @@ ANALYSIS(WarnUninitVals, "warn-uninit-values",
"Warn about uses of uninitialized variables", Code)
ANALYSIS(WarnObjCMethSigs, "analyzer-check-objc-methodsigs",
- "Warn about Objective-C method signatures with type incompatibilities",
- ObjCImplementation)
+ "Warn about Objective-C method signatures with type incompatibilities",
+ ObjCImplementation)
ANALYSIS(WarnObjCDealloc, "analyzer-check-objc-missing-dealloc",
- "Warn about Objective-C classes that lack a correct implementation of -dealloc",
- ObjCImplementation)
+"Warn about Objective-C classes that lack a correct implementation of -dealloc",
+ ObjCImplementation)
ANALYSIS(WarnObjCUnusedIvars, "analyzer-check-objc-unused-ivars",
- "Warn about private ivars that are never used", ObjCImplementation)
+ "Warn about private ivars that are never used", ObjCImplementation)
ANALYSIS(ObjCMemChecker, "analyzer-check-objc-mem",
"Run the [Core] Foundation reference count checker", Code)
@@ -55,10 +54,6 @@ ANALYSIS(ObjCMemChecker, "analyzer-check-objc-mem",
ANALYSIS(WarnSizeofPointer, "warn-sizeof-pointer",
"Warn about unintended use of sizeof() on pointer expressions", Code)
-ANALYSIS(InlineCall, "inline-call",
- "Experimental transfer function inling callees when its definition"
- " is available.", TranslationUnit)
-
#ifndef ANALYSIS_STORE
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN)
#endif
diff --git a/include/clang/Frontend/AnalysisConsumer.h b/include/clang/Frontend/AnalysisConsumer.h
index f55e5dc..3341bb0 100644
--- a/include/clang/Frontend/AnalysisConsumer.h
+++ b/include/clang/Frontend/AnalysisConsumer.h
@@ -60,6 +60,7 @@ public:
AnalysisConstraints AnalysisConstraintsOpt;
AnalysisDiagClients AnalysisDiagOpt;
std::string AnalyzeSpecificFunction;
+ unsigned MaxNodes;
unsigned AnalyzeAll : 1;
unsigned AnalyzerDisplayProgress : 1;
unsigned AnalyzeNestedBlocks : 1;
diff --git a/include/clang/Frontend/DiagnosticOptions.h b/include/clang/Frontend/DiagnosticOptions.h
index b37c180..797cb34 100644
--- a/include/clang/Frontend/DiagnosticOptions.h
+++ b/include/clang/Frontend/DiagnosticOptions.h
@@ -38,6 +38,9 @@ public:
/// binary serialization mechanism, to be
/// deserialized by, e.g., the CIndex library.
+ unsigned ErrorLimit; /// Limit # errors emitted.
+ unsigned TemplateBacktraceLimit; /// Limit depth of instantiation backtrace.
+
/// The distance between tab stops.
unsigned TabStop;
enum { DefaultTabStop = 8, MaxTabStop = 100 };
@@ -70,6 +73,8 @@ public:
ShowSourceRanges = 0;
VerifyDiagnostics = 0;
BinaryOutput = 0;
+ ErrorLimit = 0;
+ TemplateBacktraceLimit = 0;
}
};
diff --git a/include/clang/Frontend/FixItRewriter.h b/include/clang/Frontend/FixItRewriter.h
index fac87af..b432d74 100644
--- a/include/clang/Frontend/FixItRewriter.h
+++ b/include/clang/Frontend/FixItRewriter.h
@@ -16,23 +16,24 @@
#define LLVM_CLANG_FRONTEND_FIX_IT_REWRITER_H
#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/SourceLocation.h"
#include "clang/Rewrite/Rewriter.h"
#include "llvm/ADT/SmallVector.h"
+namespace llvm { class raw_ostream; }
+
namespace clang {
class SourceManager;
class FileEntry;
-/// \brief Stores a source location in the form that it shows up on
-/// the Clang command line, e.g., file:line:column.
-///
-/// FIXME: Would prefer to use real SourceLocations, but I don't see a
-/// good way to resolve them during parsing.
-struct RequestedSourceLocation {
- const FileEntry *File;
- unsigned Line;
- unsigned Column;
+class FixItPathRewriter {
+public:
+ virtual ~FixItPathRewriter();
+
+ /// \brief This file is about to be rewritten. Return the name of the file
+ /// that is okay to write to.
+ virtual std::string RewriteFilename(const std::string &Filename) = 0;
};
class FixItRewriter : public DiagnosticClient {
@@ -47,38 +48,46 @@ class FixItRewriter : public DiagnosticClient {
/// of error messages.
DiagnosticClient *Client;
+ /// \brief Turn an input path into an output path. NULL implies overwriting
+ /// the original.
+ FixItPathRewriter *PathRewriter;
+
/// \brief The number of rewriter failures.
unsigned NumFailures;
- /// \brief Locations at which we should perform fix-its.
- ///
- /// When empty, perform fix-it modifications everywhere.
- llvm::SmallVector<RequestedSourceLocation, 4> FixItLocations;
-
public:
+ typedef Rewriter::buffer_iterator iterator;
+
/// \brief Initialize a new fix-it rewriter.
FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr,
- const LangOptions &LangOpts);
+ const LangOptions &LangOpts, FixItPathRewriter *PathRewriter);
/// \brief Destroy the fix-it rewriter.
~FixItRewriter();
- /// \brief Add a location where fix-it modifications should be
- /// performed.
- void addFixItLocation(RequestedSourceLocation Loc) {
- FixItLocations.push_back(Loc);
+ /// \brief Check whether there are modifications for a given file.
+ bool IsModified(FileID ID) const {
+ return Rewrite.getRewriteBufferFor(ID) != NULL;
}
- /// \brief Write the modified source file.
+ // Iteration over files with changes.
+ iterator buffer_begin() { return Rewrite.buffer_begin(); }
+ iterator buffer_end() { return Rewrite.buffer_end(); }
+
+ /// \brief Write a single modified source file.
+ ///
+ /// \returns true if there was an error, false otherwise.
+ bool WriteFixedFile(FileID ID, llvm::raw_ostream &OS);
+
+ /// \brief Write the modified source files.
///
/// \returns true if there was an error, false otherwise.
- bool WriteFixedFile(const std::string &InFileName,
- const std::string &OutFileName = std::string());
+ bool WriteFixedFiles();
/// IncludeInDiagnosticCounts - This method (whose default implementation
- /// returns true) indicates whether the diagnostics handled by this
- /// DiagnosticClient should be included in the number of diagnostics
- /// reported by Diagnostic.
+ /// returns true) indicates whether the diagnostics handled by this
+ /// DiagnosticClient should be included in the number of diagnostics
+ /// reported by Diagnostic.
virtual bool IncludeInDiagnosticCounts() const;
/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index a7b6aa7..3ddd77d 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -16,6 +16,7 @@
namespace clang {
class FixItRewriter;
+class FixItPathRewriter;
//===----------------------------------------------------------------------===//
// Custom Consumer Actions
@@ -73,15 +74,10 @@ protected:
llvm::StringRef InFile);
};
-class DumpRecordAction : public ASTFrontendAction {
-protected:
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile);
-};
-
class FixItAction : public ASTFrontendAction {
private:
llvm::OwningPtr<FixItRewriter> Rewriter;
+ llvm::OwningPtr<FixItPathRewriter> PathRewriter;
protected:
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index ee3811a..60512ed 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -24,7 +24,6 @@ namespace frontend {
ASTPrintXML, ///< Parse ASTs and print them in XML.
ASTView, ///< Parse ASTs and view them in Graphviz.
DumpRawTokens, ///< Dump out raw tokens.
- DumpRecordLayouts, ///< Dump record layout information.
DumpTokens, ///< Dump out preprocessed tokens.
EmitAssembly, ///< Emit a .s file.
EmitBC, ///< Emit a .bc file.
@@ -93,8 +92,8 @@ public:
/// If given, the name for a C++ class to view the inheritance of.
std::string ViewClassInheritance;
- /// A list of locations to apply fix-its at.
- std::vector<ParsedSourceLocation> FixItLocations;
+ /// If given, the new suffix for fix-it rewritten files.
+ std::string FixItSuffix;
/// If given, enable code completion at the provided location.
ParsedSourceLocation CodeCompletionAt;
@@ -111,6 +110,10 @@ public:
/// \brief The list of AST files to merge.
std::vector<std::string> ASTMergeFiles;
+ /// \brief A list of arguments to forward to LLVM's option processing; this
+ /// should only be used for debugging and experimental features.
+ std::vector<std::string> LLVMArgs;
+
public:
FrontendOptions() {
DebugCodeCompletionPrinter = 1;
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index f975c49..1640afb 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -453,7 +453,9 @@ namespace clang {
/// \brief Block extedned descriptor type for Blocks CodeGen
SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR = 13,
/// \brief Objective-C "SEL" redefinition type
- SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14
+ SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14,
+ /// \brief NSConstantString type
+ SPECIAL_TYPE_NS_CONSTANT_STRING = 15
};
/// \brief Record codes for each kind of declaration.
@@ -601,6 +603,8 @@ namespace clang {
EXPR_PAREN,
/// \brief A UnaryOperator record.
EXPR_UNARY_OPERATOR,
+ /// \brief An OffsetOfExpr record.
+ EXPR_OFFSETOF,
/// \brief A SizefAlignOfExpr record.
EXPR_SIZEOF_ALIGN_OF,
/// \brief An ArraySubscriptExpr record.
diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h
index 73c1bf4..c235230 100644
--- a/include/clang/Frontend/PCHReader.h
+++ b/include/clang/Frontend/PCHReader.h
@@ -436,7 +436,7 @@ private:
std::deque<PendingIdentifierInfo> PendingIdentifierInfos;
/// \brief FIXME: document!
- llvm::SmallVector<uint64_t, 4> SpecialTypes;
+ llvm::SmallVector<uint64_t, 16> SpecialTypes;
/// \brief Contains declarations and definitions that will be
/// "interesting" to the ASTConsumer, when we get that AST consumer.
@@ -688,6 +688,9 @@ public:
Selector DecodeSelector(unsigned Idx);
+ virtual Selector GetSelector(uint32_t ID);
+ virtual uint32_t GetNumKnownSelectors();
+
Selector GetSelector(const RecordData &Record, unsigned &Idx) {
return DecodeSelector(Record[Idx++]);
}
diff --git a/include/clang/Frontend/StmtXML.def b/include/clang/Frontend/StmtXML.def
index 2f0da9e..f63761a 100644
--- a/include/clang/Frontend/StmtXML.def
+++ b/include/clang/Frontend/StmtXML.def
@@ -254,7 +254,7 @@ NODE_XML(UnaryOperator, "UnaryOperator") // op(expr) or (expr)op
ENUM_XML(UnaryOperator::Real, "__real")
ENUM_XML(UnaryOperator::Imag, "__imag")
ENUM_XML(UnaryOperator::Extension, "__extension__")
- ENUM_XML(UnaryOperator::OffsetOf, "__builtin_offsetof")
+ ENUM_XML(UnaryOperator::OffsetOf, "__builtin_offsetof")
END_ENUM_XML
SUB_NODE_XML(Expr) // expr
END_NODE_XML
@@ -311,6 +311,13 @@ NODE_XML(ConditionalOperator, "ConditionalOperator") // expr1 ? expr2 : expr3
SUB_NODE_XML(Expr) // expr3
END_NODE_XML
+NODE_XML(OffsetOfExpr, "OffsetOfExpr") // offsetof(basetype, components)
+ ATTRIBUTE_FILE_LOCATION_XML
+ TYPE_ATTRIBUTE_XML(getTypeSourceInfo()->getType())
+ ATTRIBUTE_XML(getNumComponents(), "num_components")
+ SUB_NODE_SEQUENCE_XML(OffsetOfExpr::OffsetOfNode)
+END_NODE_XML
+
NODE_XML(SizeOfAlignOfExpr, "SizeOfAlignOfExpr") // sizeof(expr) or alignof(expr)
ATTRIBUTE_FILE_LOCATION_XML
TYPE_ATTRIBUTE_XML(getType())
diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h
index 157876b..3367136 100644
--- a/include/clang/Frontend/TextDiagnosticPrinter.h
+++ b/include/clang/Frontend/TextDiagnosticPrinter.h
@@ -68,7 +68,7 @@ public:
void EmitCaretDiagnostic(SourceLocation Loc,
SourceRange *Ranges, unsigned NumRanges,
- SourceManager &SM,
+ const SourceManager &SM,
const FixItHint *Hints,
unsigned NumHints,
unsigned Columns);
diff --git a/include/clang/Frontend/VerifyDiagnosticsClient.h b/include/clang/Frontend/VerifyDiagnosticsClient.h
index 08adbb0..6f45e49 100644
--- a/include/clang/Frontend/VerifyDiagnosticsClient.h
+++ b/include/clang/Frontend/VerifyDiagnosticsClient.h
@@ -25,7 +25,10 @@ class TextDiagnosticBuffer;
/// USING THE DIAGNOSTIC CHECKER:
///
/// Indicating that a line expects an error or a warning is simple. Put a
-/// comment on the line that has the diagnostic, use "expected-{error,warning}"
+/// comment on the line that has the diagnostic, use:
+///
+/// expected-{error,warning,note}
+///
/// to tag if it's an expected error or warning, and place the expected text
/// between {{ and }} markers. The full text doesn't have to be included, only
/// enough to ensure that the correct diagnostic was emitted.
@@ -45,6 +48,20 @@ class TextDiagnosticBuffer;
///
/// void f(); // expected-note 2 {{previous declaration is here}}
///
+/// Regex matching mode may be selected by appending '-re' to type. Example:
+///
+/// expected-error-re
+///
+/// Examples matching error: "variable has incomplete type 'struct s'"
+///
+/// // expected-error {{variable has incomplete type 'struct s'}}
+/// // expected-error {{variable has incomplete type}}
+///
+/// // expected-error-re {{variable has has type 'struct .'}}
+/// // expected-error-re {{variable has has type 'struct .*'}}
+/// // expected-error-re {{variable has has type 'struct (.*)'}}
+/// // expected-error-re {{variable has has type 'struct[[:space:]](.*)'}}
+///
class VerifyDiagnosticsClient : public DiagnosticClient {
public:
Diagnostic &Diags;
OpenPOWER on IntegriCloud