aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
commit60bfabcd8ce617297c0d231f77d14ab507e98796 (patch)
tree59c928209f8007777dd96568b026bdfe200691de /include/clang
parent2c56c396ce5990954f85194029eeb391bc3529ff (diff)
downloadsrc-60bfabcd8ce617297c0d231f77d14ab507e98796.tar.gz
src-60bfabcd8ce617297c0d231f77d14ab507e98796.zip
Update clang to r100520.
Notes
Notes: svn path=/vendor/clang/dist/; revision=206275
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/PrettyPrinter.h9
-rw-r--r--include/clang/Basic/Diagnostic.h3
-rw-r--r--include/clang/Frontend/ASTUnit.h47
-rw-r--r--include/clang/Frontend/CompilerInstance.h11
-rw-r--r--include/clang/Parse/Parser.h3
5 files changed, 43 insertions, 30 deletions
diff --git a/include/clang/AST/PrettyPrinter.h b/include/clang/AST/PrettyPrinter.h
index 587b5c2b40f7..70d65d35fef8 100644
--- a/include/clang/AST/PrettyPrinter.h
+++ b/include/clang/AST/PrettyPrinter.h
@@ -37,7 +37,8 @@ struct PrintingPolicy {
PrintingPolicy(const LangOptions &LO)
: Indentation(2), LangOpts(LO), SuppressSpecifiers(false),
SuppressTag(false), SuppressScope(false),
- Dump(false), ConstantArraySizeAsWritten(false) { }
+ Dump(false), ConstantArraySizeAsWritten(false),
+ AnonymousTagLocations(true) { }
/// \brief The number of spaces to use to indent each line.
unsigned Indentation : 8;
@@ -97,7 +98,11 @@ struct PrintingPolicy {
/// char a[9] = "A string";
/// \endcode
bool ConstantArraySizeAsWritten : 1;
-
+
+ /// \brief When printing an anonymous tag name, also print the location of
+ /// that entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just
+ /// prints "<anonymous>" for the name.
+ bool AnonymousTagLocations : 1;
};
} // end namespace clang
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 643868506d8f..57dd6967fc51 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_DIAGNOSTIC_H
#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/type_traits.h"
#include <string>
@@ -150,7 +151,7 @@ public:
/// problems and issues. It massages the diagnostics (e.g. handling things like
/// "report warnings as errors" and passes them off to the DiagnosticClient for
/// reporting to the user.
-class Diagnostic {
+class Diagnostic : public llvm::RefCountedBase<Diagnostic> {
public:
/// Level - The level of the diagnostic, after it has been through mapping.
enum Level {
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 61db323a12bb..9252358f42a6 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -16,6 +16,7 @@
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Basic/SourceManager.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/OwningPtr.h"
#include "clang/Basic/FileManager.h"
#include "clang/Index/ASTLocation.h"
@@ -52,10 +53,9 @@ public:
typedef std::map<FileID, std::vector<PreprocessedEntity *> >
PreprocessedEntitiesByFileMap;
private:
-
- FileManager FileMgr;
-
- SourceManager SourceMgr;
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics;
+ llvm::OwningPtr<FileManager> FileMgr;
+ llvm::OwningPtr<SourceManager> SourceMgr;
llvm::OwningPtr<HeaderSearch> HeaderInfo;
llvm::OwningPtr<TargetInfo> Target;
llvm::OwningPtr<Preprocessor> PP;
@@ -90,7 +90,7 @@ private:
/// \brief The set of diagnostics produced when creating this
/// translation unit.
- llvm::SmallVector<StoredDiagnostic, 4> Diagnostics;
+ llvm::SmallVector<StoredDiagnostic, 4> StoredDiagnostics;
/// \brief Temporary files that should be removed when the ASTUnit is
/// destroyed.
@@ -118,6 +118,8 @@ private:
ASTUnit(const ASTUnit&); // DO NOT IMPLEMENT
ASTUnit &operator=(const ASTUnit &); // DO NOT IMPLEMENT
+ explicit ASTUnit(bool MainFileIsAST);
+
public:
class ConcurrencyCheck {
volatile ASTUnit &Self;
@@ -137,13 +139,15 @@ public:
};
friend class ConcurrencyCheck;
- ASTUnit(Diagnostic &Diag, bool MainFileIsAST);
~ASTUnit();
bool isMainFileAST() const { return MainFileIsAST; }
- const SourceManager &getSourceManager() const { return SourceMgr; }
- SourceManager &getSourceManager() { return SourceMgr; }
+ const Diagnostic &getDiagnostics() const { return *Diagnostics; }
+ Diagnostic &getDiagnostics() { return *Diagnostics; }
+
+ const SourceManager &getSourceManager() const { return *SourceMgr; }
+ SourceManager &getSourceManager() { return *SourceMgr; }
const Preprocessor &getPreprocessor() const { return *PP.get(); }
Preprocessor &getPreprocessor() { return *PP.get(); }
@@ -151,8 +155,8 @@ public:
const ASTContext &getASTContext() const { return *Ctx.get(); }
ASTContext &getASTContext() { return *Ctx.get(); }
- const FileManager &getFileManager() const { return FileMgr; }
- FileManager &getFileManager() { return FileMgr; }
+ const FileManager &getFileManager() const { return *FileMgr; }
+ FileManager &getFileManager() { return *FileMgr; }
const std::string &getOriginalSourceFileName();
const std::string &getPCHFileName();
@@ -185,12 +189,17 @@ public:
}
// Retrieve the diagnostics associated with this AST
- typedef const StoredDiagnostic * diag_iterator;
- diag_iterator diag_begin() const { return Diagnostics.begin(); }
- diag_iterator diag_end() const { return Diagnostics.end(); }
- unsigned diag_size() const { return Diagnostics.size(); }
- llvm::SmallVector<StoredDiagnostic, 4> &getDiagnostics() {
- return Diagnostics;
+ typedef const StoredDiagnostic *stored_diag_iterator;
+ stored_diag_iterator stored_diag_begin() const {
+ return StoredDiagnostics.begin();
+ }
+ stored_diag_iterator stored_diag_end() const {
+ return StoredDiagnostics.end();
+ }
+ unsigned stored_diag_size() const { return StoredDiagnostics.size(); }
+
+ llvm::SmallVector<StoredDiagnostic, 4> &getStoredDiagnostics() {
+ return StoredDiagnostics;
}
/// \brief A mapping from a file name to the memory buffer that stores the
@@ -206,7 +215,7 @@ public:
///
/// \returns - The initialized ASTUnit or null if the PCH failed to load.
static ASTUnit *LoadFromPCHFile(const std::string &Filename,
- Diagnostic &Diags,
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
bool OnlyLocalDecls = false,
RemappedFile *RemappedFiles = 0,
unsigned NumRemappedFiles = 0,
@@ -224,7 +233,7 @@ public:
// FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
// shouldn't need to specify them at construction time.
static ASTUnit *LoadFromCompilerInvocation(CompilerInvocation *CI,
- Diagnostic &Diags,
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
bool OnlyLocalDecls = false,
bool CaptureDiagnostics = false);
@@ -244,7 +253,7 @@ public:
// shouldn't need to specify them at construction time.
static ASTUnit *LoadFromCommandLine(const char **ArgBegin,
const char **ArgEnd,
- Diagnostic &Diags,
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diags,
llvm::StringRef ResourceFilesPath,
bool OnlyLocalDecls = false,
RemappedFile *RemappedFiles = 0,
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index 3444b640f01d..36720c9d1462 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -11,6 +11,7 @@
#define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
#include "clang/Frontend/CompilerInvocation.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/OwningPtr.h"
#include <cassert>
@@ -63,7 +64,7 @@ class CompilerInstance {
llvm::OwningPtr<CompilerInvocation> Invocation;
/// The diagnostics engine instance.
- llvm::OwningPtr<Diagnostic> Diagnostics;
+ llvm::IntrusiveRefCntPtr<Diagnostic> Diagnostics;
/// The diagnostics client instance.
llvm::OwningPtr<DiagnosticClient> DiagClient;
@@ -255,10 +256,6 @@ public:
return *Diagnostics;
}
- /// takeDiagnostics - Remove the current diagnostics engine and give ownership
- /// to the caller.
- Diagnostic *takeDiagnostics() { return Diagnostics.take(); }
-
/// setDiagnostics - Replace the current diagnostics engine; the compiler
/// instance takes ownership of \arg Value.
void setDiagnostics(Diagnostic *Value);
@@ -469,8 +466,8 @@ public:
/// must extend past that of the diagnostic engine.
///
/// \return The new object on success, or null on failure.
- static Diagnostic *createDiagnostics(const DiagnosticOptions &Opts,
- int Argc, char **Argv);
+ static llvm::IntrusiveRefCntPtr<Diagnostic>
+ createDiagnostics(const DiagnosticOptions &Opts, int Argc, char **Argv);
/// Create the file manager and replace any existing one with it.
void createFileManager();
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 411162b18209..9a4634a42085 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -1086,7 +1086,8 @@ private:
CXX0XAttributeList Attr);
DeclGroupPtrTy ParseSimpleDeclaration(unsigned Context,
SourceLocation &DeclEnd,
- AttributeList *Attr);
+ AttributeList *Attr,
+ bool RequireSemi);
DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context,
bool AllowFunctionDefinitions,
SourceLocation *DeclEnd = 0);