summaryrefslogtreecommitdiffstats
path: root/include/clang
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-05-03 16:53:59 +0000
committerdim <dim@FreeBSD.org>2012-05-03 16:53:59 +0000
commit822bde9df508e0b9afac5e581b0d6ab403417a28 (patch)
tree2e51705e103e92c7be1b21e8bd8ffd5b5d0e4d52 /include/clang
parent50b73317314e889cf39c7b1d6cbf419fa7502f22 (diff)
downloadFreeBSD-src-822bde9df508e0b9afac5e581b0d6ab403417a28.zip
FreeBSD-src-822bde9df508e0b9afac5e581b0d6ab403417a28.tar.gz
Vendor import of clang release_31 branch r155985:
http://llvm.org/svn/llvm-project/cfe/branches/release_31@155985
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/AST/Decl.h7
-rw-r--r--include/clang/AST/DeclBase.h1
-rw-r--r--include/clang/AST/DeclLookups.h4
-rw-r--r--include/clang/AST/Expr.h14
-rw-r--r--include/clang/AST/ExternalASTSource.h6
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h1
-rw-r--r--include/clang/AST/Stmt.h42
-rw-r--r--include/clang/AST/Type.h34
-rw-r--r--include/clang/AST/VTableBuilder.h12
-rw-r--r--include/clang/Analysis/ProgramPoint.h2
-rw-r--r--include/clang/Basic/BuiltinsX86.def6
-rw-r--r--include/clang/Basic/ConvertUTF.h2
-rw-r--r--include/clang/Basic/DelayedCleanupPool.h110
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td2
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td23
-rw-r--r--include/clang/Basic/ExceptionSpecificationType.h18
-rw-r--r--include/clang/Basic/OnDiskHashTable.h33
-rw-r--r--include/clang/Basic/StmtNodes.td1
-rw-r--r--include/clang/Basic/TargetInfo.h15
-rw-r--r--include/clang/Basic/TokenKinds.def1
-rw-r--r--include/clang/Config/config.h.cmake9
-rw-r--r--include/clang/Config/config.h.in9
-rw-r--r--include/clang/Driver/CC1Options.td3
-rw-r--r--include/clang/Driver/Compilation.h3
-rw-r--r--include/clang/Frontend/ASTUnit.h10
-rw-r--r--include/clang/Frontend/FrontendActions.h9
-rw-r--r--include/clang/Frontend/FrontendOptions.h1
-rw-r--r--include/clang/Frontend/TextDiagnostic.h11
-rw-r--r--include/clang/Index/ASTLocation.h173
-rw-r--r--include/clang/Index/Analyzer.h56
-rw-r--r--include/clang/Index/DeclReferenceMap.h50
-rw-r--r--include/clang/Index/Entity.h149
-rw-r--r--include/clang/Index/GlobalCallGraph.h149
-rw-r--r--include/clang/Index/GlobalSelector.h100
-rw-r--r--include/clang/Index/Handlers.h82
-rw-r--r--include/clang/Index/IndexProvider.h38
-rw-r--r--include/clang/Index/Indexer.h71
-rw-r--r--include/clang/Index/Program.h45
-rw-r--r--include/clang/Index/STLExtras.h63
-rw-r--r--include/clang/Index/SelectorMap.h57
-rw-r--r--include/clang/Index/TranslationUnit.h41
-rw-r--r--include/clang/Parse/Parser.h84
-rw-r--r--include/clang/Sema/DeclSpec.h7
-rw-r--r--include/clang/Sema/ParsedTemplate.h8
-rw-r--r--include/clang/Sema/Scope.h7
-rw-r--r--include/clang/Sema/Sema.h119
-rw-r--r--include/clang/Serialization/ASTBitCodes.h2
-rw-r--r--include/clang/Serialization/ASTReader.h9
-rw-r--r--include/clang/Serialization/ASTWriter.h1
-rw-r--r--include/clang/Serialization/Module.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h17
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h2
-rw-r--r--include/clang/Tooling/CompilationDatabase.h76
53 files changed, 441 insertions, 1364 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 11696db..ac7ab0f 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -64,6 +64,9 @@ public:
/// \brief Return the TypeLoc wrapper for the type source info.
TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
+
+ /// \brief Override the type stored in this TypeSourceInfo. Use with caution!
+ void overrideType(QualType T) { Ty = T; }
};
/// TranslationUnitDecl - The top declaration context.
@@ -242,11 +245,7 @@ public:
bool visibilityExplicit() const { return explicit_; }
void setLinkage(Linkage L) { linkage_ = L; }
- void setVisibility(Visibility V) { visibility_ = V; }
void setVisibility(Visibility V, bool E) { visibility_ = V; explicit_ = E; }
- void setVisibility(LinkageInfo Other) {
- setVisibility(Other.visibility(), Other.visibilityExplicit());
- }
void mergeLinkage(Linkage L) {
setLinkage(minLinkage(linkage(), L));
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 4c675aed..22328912 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -861,7 +861,6 @@ public:
void dumpXML(raw_ostream &OS) const;
private:
- const Attr *getAttrsImpl() const;
void setAttrsImpl(const AttrVec& Attrs, ASTContext &Ctx);
void setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
ASTContext &Ctx);
diff --git a/include/clang/AST/DeclLookups.h b/include/clang/AST/DeclLookups.h
index 66d190f..b8abe97 100644
--- a/include/clang/AST/DeclLookups.h
+++ b/include/clang/AST/DeclLookups.h
@@ -67,6 +67,8 @@ public:
DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
+ if (hasExternalVisibleStorage())
+ getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
if (StoredDeclsMap *Map = Primary->buildLookup())
return all_lookups_iterator(Map->begin(), Map->end());
return all_lookups_iterator();
@@ -74,6 +76,8 @@ DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
DeclContext::all_lookups_iterator DeclContext::lookups_end() const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
+ if (hasExternalVisibleStorage())
+ getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
if (StoredDeclsMap *Map = Primary->buildLookup())
return all_lookups_iterator(Map->end(), Map->end());
return all_lookups_iterator();
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 558bd00..b0b9b0f 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -581,16 +581,6 @@ public:
/// member expression.
static QualType findBoundMemberType(const Expr *expr);
- /// \brief Result type of CanThrow().
- enum CanThrowResult {
- CT_Cannot,
- CT_Dependent,
- CT_Can
- };
- /// \brief Test if this expression, if evaluated, might throw, according to
- /// the rules of C++ [expr.unary.noexcept].
- CanThrowResult CanThrow(ASTContext &C) const;
-
/// IgnoreImpCasts - Skip past any implicit casts which might
/// surround this expression. Only skips ImplicitCastExprs.
Expr *IgnoreImpCasts() LLVM_READONLY;
@@ -3608,6 +3598,10 @@ public:
return LBraceLoc.isValid() && RBraceLoc.isValid();
}
+ // Is this an initializer for an array of characters, initialized by a string
+ // literal or an @encode?
+ bool isStringLiteralInit() const;
+
SourceLocation getLBraceLoc() const { return LBraceLoc; }
void setLBraceLoc(SourceLocation Loc) { LBraceLoc = Loc; }
SourceLocation getRBraceLoc() const { return RBraceLoc; }
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index 18a1432..e2a60d5 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -126,6 +126,12 @@ public:
virtual DeclContextLookupResult
FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name);
+ /// \brief Ensures that the table of all visible declarations inside this
+ /// context is up to date.
+ ///
+ /// The default implementation of this functino is a no-op.
+ virtual void completeVisibleDeclsMap(const DeclContext *DC);
+
/// \brief Finds all declarations lexically contained within the given
/// DeclContext, after applying an optional filter predicate.
///
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index a4ad525..f1b5171 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -1870,6 +1870,7 @@ DEF_TRAVERSE_STMT(GotoStmt, { })
DEF_TRAVERSE_STMT(IfStmt, { })
DEF_TRAVERSE_STMT(IndirectGotoStmt, { })
DEF_TRAVERSE_STMT(LabelStmt, { })
+DEF_TRAVERSE_STMT(AttributedStmt, { })
DEF_TRAVERSE_STMT(NullStmt, { })
DEF_TRAVERSE_STMT(ObjCAtCatchStmt, { })
DEF_TRAVERSE_STMT(ObjCAtFinallyStmt, { })
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 84bdfb8..1b0f576 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -20,6 +20,7 @@
#include "clang/AST/StmtIterator.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/Attr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
@@ -794,6 +795,47 @@ public:
};
+/// \brief Represents an attribute applied to a statement.
+///
+/// Represents an attribute applied to a statement. For example:
+/// [[omp::for(...)]] for (...) { ... }
+///
+class AttributedStmt : public Stmt {
+ Stmt *SubStmt;
+ SourceLocation AttrLoc;
+ AttrVec Attrs;
+ // TODO: It can be done as Attr *Attrs[1]; and variable size array as in
+ // StringLiteral
+
+ friend class ASTStmtReader;
+
+public:
+ AttributedStmt(SourceLocation loc, const AttrVec &attrs, Stmt *substmt)
+ : Stmt(AttributedStmtClass), SubStmt(substmt), AttrLoc(loc), Attrs(attrs) {
+ }
+
+ // \brief Build an empty attributed statement.
+ explicit AttributedStmt(EmptyShell Empty)
+ : Stmt(AttributedStmtClass, Empty) {
+ }
+
+ SourceLocation getAttrLoc() const { return AttrLoc; }
+ const AttrVec &getAttrs() const { return Attrs; }
+ Stmt *getSubStmt() { return SubStmt; }
+ const Stmt *getSubStmt() const { return SubStmt; }
+
+ SourceRange getSourceRange() const LLVM_READONLY {
+ return SourceRange(AttrLoc, SubStmt->getLocEnd());
+ }
+ child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == AttributedStmtClass;
+ }
+ static bool classof(const AttributedStmt *) { return true; }
+};
+
+
/// IfStmt - This represents an if/then/else.
///
class IfStmt : public Stmt {
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 7bd367c..7b615c1 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -79,6 +79,7 @@ namespace clang {
class CXXRecordDecl;
class EnumDecl;
class FieldDecl;
+ class FunctionDecl;
class ObjCInterfaceDecl;
class ObjCProtocolDecl;
class ObjCMethodDecl;
@@ -2700,7 +2701,9 @@ public:
ExtProtoInfo() :
Variadic(false), HasTrailingReturn(false), TypeQuals(0),
ExceptionSpecType(EST_None), RefQualifier(RQ_None),
- NumExceptions(0), Exceptions(0), NoexceptExpr(0), ConsumedArguments(0) {}
+ NumExceptions(0), Exceptions(0), NoexceptExpr(0),
+ ExceptionSpecDecl(0), ExceptionSpecTemplate(0),
+ ConsumedArguments(0) {}
FunctionType::ExtInfo ExtInfo;
bool Variadic : 1;
@@ -2711,6 +2714,8 @@ public:
unsigned NumExceptions;
const QualType *Exceptions;
Expr *NoexceptExpr;
+ FunctionDecl *ExceptionSpecDecl;
+ FunctionDecl *ExceptionSpecTemplate;
const bool *ConsumedArguments;
};
@@ -2756,6 +2761,11 @@ private:
// NoexceptExpr - Instead of Exceptions, there may be a single Expr* pointing
// to the expression in the noexcept() specifier.
+ // ExceptionSpecDecl, ExceptionSpecTemplate - Instead of Exceptions, there may
+ // be a pair of FunctionDecl* pointing to the function which should be used to
+ // instantiate this function type's exception specification, and the function
+ // from which it should be instantiated.
+
// ConsumedArgs - A variable size array, following Exceptions
// and of length NumArgs, holding flags indicating which arguments
// are consumed. This only appears if HasAnyConsumedArgs is true.
@@ -2795,6 +2805,9 @@ public:
EPI.Exceptions = exception_begin();
} else if (EPI.ExceptionSpecType == EST_ComputedNoexcept) {
EPI.NoexceptExpr = getNoexceptExpr();
+ } else if (EPI.ExceptionSpecType == EST_Uninstantiated) {
+ EPI.ExceptionSpecDecl = getExceptionSpecDecl();
+ EPI.ExceptionSpecTemplate = getExceptionSpecTemplate();
}
if (hasAnyConsumedArgs())
EPI.ConsumedArguments = getConsumedArgsBuffer();
@@ -2838,9 +2851,26 @@ public:
// NoexceptExpr sits where the arguments end.
return *reinterpret_cast<Expr *const *>(arg_type_end());
}
+ /// \brief If this function type has an uninstantiated exception
+ /// specification, this is the function whose exception specification
+ /// is represented by this type.
+ FunctionDecl *getExceptionSpecDecl() const {
+ if (getExceptionSpecType() != EST_Uninstantiated)
+ return 0;
+ return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[0];
+ }
+ /// \brief If this function type has an uninstantiated exception
+ /// specification, this is the function whose exception specification
+ /// should be instantiated to find the exception specification for
+ /// this type.
+ FunctionDecl *getExceptionSpecTemplate() const {
+ if (getExceptionSpecType() != EST_Uninstantiated)
+ return 0;
+ return reinterpret_cast<FunctionDecl * const *>(arg_type_end())[1];
+ }
bool isNothrow(ASTContext &Ctx) const {
ExceptionSpecificationType EST = getExceptionSpecType();
- assert(EST != EST_Delayed);
+ assert(EST != EST_Delayed && EST != EST_Uninstantiated);
if (EST == EST_DynamicNone || EST == EST_BasicNoexcept)
return true;
if (EST != EST_ComputedNoexcept)
diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h
index 2aa9a3d..392dad9 100644
--- a/include/clang/AST/VTableBuilder.h
+++ b/include/clang/AST/VTableBuilder.h
@@ -205,11 +205,11 @@ public:
typedef llvm::DenseMap<BaseSubobject, uint64_t> AddressPointsMapTy;
private:
uint64_t NumVTableComponents;
- VTableComponent *VTableComponents;
+ llvm::OwningArrayPtr<VTableComponent> VTableComponents;
/// VTableThunks - Contains thunks needed by vtables.
uint64_t NumVTableThunks;
- VTableThunkTy *VTableThunks;
+ llvm::OwningArrayPtr<VTableThunkTy> VTableThunks;
/// Address points - Address points for all vtables.
AddressPointsMapTy AddressPoints;
@@ -227,11 +227,11 @@ public:
}
vtable_component_iterator vtable_component_begin() const {
- return VTableComponents;
+ return VTableComponents.get();
}
vtable_component_iterator vtable_component_end() const {
- return VTableComponents+NumVTableComponents;
+ return VTableComponents.get()+NumVTableComponents;
}
uint64_t getNumVTableThunks() const {
@@ -239,11 +239,11 @@ public:
}
vtable_thunk_iterator vtable_thunk_begin() const {
- return VTableThunks;
+ return VTableThunks.get();
}
vtable_thunk_iterator vtable_thunk_end() const {
- return VTableThunks+NumVTableThunks;
+ return VTableThunks.get()+NumVTableThunks;
}
uint64_t getAddressPoint(BaseSubobject Base) const {
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index b2200c6..aa7a33c 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -129,7 +129,7 @@ public:
static bool classof(const ProgramPoint*) { return true; }
bool operator==(const ProgramPoint & RHS) const {
- return Data1 == Data1 &&
+ return Data1 == RHS.Data1 &&
Data2 == RHS.Data2 &&
L == RHS.L &&
Tag == RHS.Tag;
diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def
index f44aed6..4aea980 100644
--- a/include/clang/Basic/BuiltinsX86.def
+++ b/include/clang/Basic/BuiltinsX86.def
@@ -412,6 +412,9 @@ BUILTIN(__builtin_ia32_cvtps2pd256, "V4dV4f", "")
BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "")
BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "")
BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "")
+BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "")
+BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "")
+BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "")
BUILTIN(__builtin_ia32_vinsertf128_pd256, "V4dV4dV2dIc", "")
BUILTIN(__builtin_ia32_vinsertf128_ps256, "V8fV8fV4fIc", "")
BUILTIN(__builtin_ia32_vinsertf128_si256, "V8iV8iV4iIc", "")
@@ -560,9 +563,8 @@ BUILTIN(__builtin_ia32_pbroadcastw128, "V8sV8s", "")
BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "")
BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "")
BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "")
-BUILTIN(__builtin_ia32_permdf256, "V4dV4dIc", "")
BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "")
-BUILTIN(__builtin_ia32_permdi256, "V4LLiV4LLiIc", "")
+BUILTIN(__builtin_ia32_permti256, "V4LLiV4LLiV4LLiIc", "")
BUILTIN(__builtin_ia32_extract128i256, "V2LLiV4LLiIc", "")
BUILTIN(__builtin_ia32_insert128i256, "V4LLiV4LLiV2LLiIc", "")
BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "")
diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h
index ec6b973..7fb5874 100644
--- a/include/clang/Basic/ConvertUTF.h
+++ b/include/clang/Basic/ConvertUTF.h
@@ -151,9 +151,9 @@ ConversionResult ConvertUTF16toUTF32 (
ConversionResult ConvertUTF32toUTF16 (
const UTF32** sourceStart, const UTF32* sourceEnd,
UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+#endif
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
-#endif
Boolean isLegalUTF8String(const UTF8 *source, const UTF8 *sourceEnd);
diff --git a/include/clang/Basic/DelayedCleanupPool.h b/include/clang/Basic/DelayedCleanupPool.h
deleted file mode 100644
index 8575bc2..0000000
--- a/include/clang/Basic/DelayedCleanupPool.h
+++ /dev/null
@@ -1,110 +0,0 @@
-//=== DelayedCleanupPool.h - Delayed Clean-up Pool Implementation *- C++ -*===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines a facility to delay calling cleanup methods until specific
-// points.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_BASIC_DELAYEDCLEANUPPOOL_H
-#define LLVM_CLANG_BASIC_DELAYEDCLEANUPPOOL_H
-
-#include "clang/Basic/LLVM.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
-
-namespace clang {
-
-/// \brief Gathers pairs of pointer-to-object/pointer-to-cleanup-function
-/// allowing the cleanup functions to get called (with the pointer as parameter)
-/// at specific points.
-///
-/// The use case is to simplify clean-up of certain resources that, while their
-/// lifetime is well-known and restricted, cleaning them up manually is easy to
-/// miss and cause a leak.
-///
-/// The same pointer can be added multiple times; its clean-up function will
-/// only be called once.
-class DelayedCleanupPool {
-public:
- typedef void (*CleanupFn)(void *ptr);
-
- /// \brief Adds a pointer and its associated cleanup function to be called
- /// at a later point.
- ///
- /// \returns false if the pointer is already added, true otherwise.
- bool delayCleanup(void *ptr, CleanupFn fn) {
- assert(ptr && "Expected valid pointer to object");
- assert(fn && "Expected valid pointer to function");
-
- CleanupFn &mapFn = Ptrs[ptr];
- assert((!mapFn || mapFn == fn) &&
- "Adding a pointer with different cleanup function!");
-
- if (!mapFn) {
- mapFn = fn;
- Cleanups.push_back(std::make_pair(ptr, fn));
- return true;
- }
-
- return false;
- }
-
- template <typename T>
- bool delayDelete(T *ptr) {
- return delayCleanup(ptr, cleanupWithDelete<T>);
- }
-
- template <typename T, void (T::*Fn)()>
- bool delayMemberFunc(T *ptr) {
- return delayCleanup(ptr, cleanupWithMemberFunc<T, Fn>);
- }
-
- void doCleanup() {
- for (SmallVector<std::pair<void *, CleanupFn>, 8>::reverse_iterator
- I = Cleanups.rbegin(), E = Cleanups.rend(); I != E; ++I)
- I->second(I->first);
- Cleanups.clear();
- Ptrs.clear();
- }
-
- ~DelayedCleanupPool() {
- doCleanup();
- }
-
-private:
- llvm::DenseMap<void *, CleanupFn> Ptrs;
- SmallVector<std::pair<void *, CleanupFn>, 8> Cleanups;
-
- template <typename T>
- static void cleanupWithDelete(void *ptr) {
- delete static_cast<T *>(ptr);
- }
-
- template <typename T, void (T::*Fn)()>
- static void cleanupWithMemberFunc(void *ptr) {
- (static_cast<T *>(ptr)->*Fn)();
- }
-};
-
-/// \brief RAII object for triggering a cleanup of a DelayedCleanupPool.
-class DelayedCleanupPoint {
- DelayedCleanupPool &Pool;
-
-public:
- DelayedCleanupPoint(DelayedCleanupPool &pool) : Pool(pool) { }
-
- ~DelayedCleanupPoint() {
- Pool.doCleanup();
- }
-};
-
-} // end namespace clang
-
-#endif
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index c183da7..957f05b 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -410,6 +410,8 @@ def ext_ellipsis_exception_spec : Extension<
"exception specification of '...' is a Microsoft extension">;
def err_dynamic_and_noexcept_specification : Error<
"cannot have both throw() and noexcept() clause on the same function">;
+def err_except_spec_unparsed : Error<
+ "unexpected end of exception specification">;
def warn_cxx98_compat_noexcept_decl : Warning<
"noexcept specifications are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index e553740..0614ade 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -231,9 +231,13 @@ def err_using_decl_can_not_refer_to_namespace : Error<
"using declaration can not refer to namespace">;
def err_using_decl_constructor : Error<
"using declaration can not refer to a constructor">;
-def warn_cxx98_compat_using_decl_constructor : Warning<
- "inherited constructors are incompatible with C++98">,
- InGroup<CXX98Compat>, DefaultIgnore;
+def err_using_decl_constructor_unsupported : Error<
+ "inheriting constructors are not supported">;
+// FIXME: Replace the above error with this warning if support for
+// inheriting constructors is implemented.
+//def warn_cxx98_compat_using_decl_constructor : Warning<
+// "inheriting constructors are incompatible with C++98">,
+// InGroup<CXX98Compat>, DefaultIgnore;
def err_using_decl_destructor : Error<
"using declaration can not refer to a destructor">;
def err_using_decl_template_id : Error<
@@ -1547,9 +1551,6 @@ def warn_objc_redundant_literal_use : Warning<
"using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
}
-def warn_bool_for_boolean_literal : Warning<
- "BOOL of type %0 is non-intergal and unsuitable for a "
- "boolean literal - ignored">, InGroup<DiagGroup<"numeric-literals">>;
def err_only_annotate_after_access_spec : Error<
"access specifier can only have annotation attributes">;
def err_attribute_section_invalid_for_target : Error<
@@ -1563,6 +1564,9 @@ def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
def warn_unknown_attribute_ignored : Warning<
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
+def warn_attribute_invalid_on_stmt : Warning<
+ "attribute %0 cannot be specified on a statement">,
+ InGroup<IgnoredAttributes>;
def warn_declspec_attribute_ignored : Warning<
"attribute %0 is ignored, place it after \"%select{class|struct|union|enum}1\" to apply attribute to type declaration">, InGroup<IgnoredAttributes>;
def warn_attribute_precede_definition : Warning<
@@ -2583,6 +2587,8 @@ def note_template_enum_def_here : Note<
"in instantiation of enumeration %q0 requested here">;
def note_template_type_alias_instantiation_here : Note<
"in instantiation of template type alias %0 requested here">;
+def note_template_exception_spec_instantiation_here : Note<
+ "in instantiation of exception specification for %0 requested here">;
def note_default_arg_instantiation_here : Note<
"in instantiation of default argument for '%0' required here">;
@@ -3798,6 +3804,9 @@ def warn_null_in_comparison_operation : Warning<
def err_invalid_this_use : Error<
"invalid use of 'this' outside of a non-static member function">;
+def err_this_static_member_func : Error<
+ "'this' cannot be%select{| implicitly}0 used in a static member function "
+ "declaration">;
def err_invalid_member_use_in_static_method : Error<
"invalid use of member %0 in static member function">;
def err_invalid_qualified_function_type : Error<
@@ -3907,7 +3916,7 @@ def err_nosetter_property_incdec : Error<
def err_nogetter_property_compound_assignment : Error<
"a getter method is needed to perform a compound assignment on a property">;
def err_nogetter_property_incdec : Error<
- "no getter method %1 for %select{increment|decrement} of property">;
+ "no getter method %1 for %select{increment|decrement}0 of property">;
def error_no_subobject_property_setting : Error<
"expression is not assignable">;
def err_qualified_objc_access : Error<
diff --git a/include/clang/Basic/ExceptionSpecificationType.h b/include/clang/Basic/ExceptionSpecificationType.h
index 98cfd29..e911bde 100644
--- a/include/clang/Basic/ExceptionSpecificationType.h
+++ b/include/clang/Basic/ExceptionSpecificationType.h
@@ -16,7 +16,7 @@
namespace clang {
-/// \brief The various types of exception specifications that exist in C++0x.
+/// \brief The various types of exception specifications that exist in C++11.
enum ExceptionSpecificationType {
EST_None, ///< no exception specification
EST_DynamicNone, ///< throw()
@@ -24,7 +24,8 @@ enum ExceptionSpecificationType {
EST_MSAny, ///< Microsoft throw(...) extension
EST_BasicNoexcept, ///< noexcept
EST_ComputedNoexcept, ///< noexcept(expression)
- EST_Delayed ///< not known yet
+ EST_Delayed, ///< not known yet
+ EST_Uninstantiated ///< not instantiated yet
};
inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
@@ -35,6 +36,19 @@ inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept;
}
+/// \brief Possible results from evaluation of a noexcept expression.
+enum CanThrowResult {
+ CT_Cannot,
+ CT_Dependent,
+ CT_Can
+};
+
+inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
+ // CanThrowResult constants are ordered so that the maximum is the correct
+ // merge result.
+ return CT1 > CT2 ? CT1 : CT2;
+}
+
} // end namespace clang
#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h
index 8028a73..b92f1cf 100644
--- a/include/clang/Basic/OnDiskHashTable.h
+++ b/include/clang/Basic/OnDiskHashTable.h
@@ -132,7 +132,7 @@ class OnDiskChainedHashTableGenerator {
class Bucket {
public:
io::Offset off;
- Item* head;
+ Item* head;
unsigned length;
Bucket() {}
@@ -201,6 +201,7 @@ public:
// Write out the number of items in the bucket.
Emit16(out, B.length);
+ assert(B.length != 0 && "Bucket has a head but zero length?");
// Write out the entries in the bucket.
for (Item *I = B.head; I ; I = I->next) {
@@ -398,31 +399,30 @@ public:
}
key_iterator key_end() { return key_iterator(); }
- /// \brief Iterates over all the entries in the table, returning
- /// a key/data pair.
- class item_iterator {
+ /// \brief Iterates over all the entries in the table, returning the data.
+ class data_iterator {
const unsigned char* Ptr;
unsigned NumItemsInBucketLeft;
unsigned NumEntriesLeft;
Info *InfoObj;
public:
- typedef std::pair<external_key_type, data_type> value_type;
+ typedef data_type value_type;
- item_iterator(const unsigned char* const Ptr, unsigned NumEntries,
+ data_iterator(const unsigned char* const Ptr, unsigned NumEntries,
Info *InfoObj)
: Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries),
InfoObj(InfoObj) { }
- item_iterator()
+ data_iterator()
: Ptr(0), NumItemsInBucketLeft(0), NumEntriesLeft(0), InfoObj(0) { }
- bool operator==(const item_iterator& X) const {
+ bool operator==(const data_iterator& X) const {
return X.NumEntriesLeft == NumEntriesLeft;
}
- bool operator!=(const item_iterator& X) const {
+ bool operator!=(const data_iterator& X) const {
return X.NumEntriesLeft != NumEntriesLeft;
}
- item_iterator& operator++() { // Preincrement
+ data_iterator& operator++() { // Preincrement
if (!NumItemsInBucketLeft) {
// 'Items' starts with a 16-bit unsigned integer representing the
// number of items in this bucket.
@@ -438,8 +438,8 @@ public:
--NumEntriesLeft;
return *this;
}
- item_iterator operator++(int) { // Postincrement
- item_iterator tmp = *this; ++*this; return tmp;
+ data_iterator operator++(int) { // Postincrement
+ data_iterator tmp = *this; ++*this; return tmp;
}
value_type operator*() const {
@@ -454,15 +454,14 @@ public:
// Read the key.
const internal_key_type& Key =
InfoObj->ReadKey(LocalPtr, L.first);
- return std::make_pair(InfoObj->GetExternalKey(Key),
- InfoObj->ReadData(Key, LocalPtr + L.first, L.second));
+ return InfoObj->ReadData(Key, LocalPtr + L.first, L.second);
}
};
- item_iterator item_begin() {
- return item_iterator(Base + 4, getNumEntries(), &InfoObj);
+ data_iterator data_begin() {
+ return data_iterator(Base + 4, getNumEntries(), &InfoObj);
}
- item_iterator item_end() { return item_iterator(); }
+ data_iterator data_end() { return data_iterator(); }
Info &getInfoObj() { return InfoObj; }
diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td
index 67d71e4..e7718cd 100644
--- a/include/clang/Basic/StmtNodes.td
+++ b/include/clang/Basic/StmtNodes.td
@@ -12,6 +12,7 @@ class DStmt<Stmt base, bit abstract = 0> : Stmt<abstract> {
def NullStmt : Stmt;
def CompoundStmt : Stmt;
def LabelStmt : Stmt;
+def AttributedStmt : Stmt;
def IfStmt : Stmt;
def SwitchStmt : Stmt;
def WhileStmt : Stmt;
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index bbd376a..a03cf83 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -132,6 +132,11 @@ protected:
IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType;
+ /// Flag whether the Objective-C built-in boolean type should be signed char.
+ /// Otherwise, when this flag is not set, the normal built-in boolean type is
+ /// used.
+ unsigned UseSignedCharForObjCBool : 1;
+
/// Control whether the alignment of bit-field types is respected when laying
/// out structures. If true, then the alignment of the bit-field type will be
/// used to (a) impact the alignment of the containing structure, and (b)
@@ -299,6 +304,16 @@ public:
return MCountName;
}
+ /// useSignedCharForObjCBool - Check if the Objective-C built-in boolean
+ /// type should be signed char. Otherwise, if this returns false, the
+ /// normal built-in boolean type should also be used for Objective-C.
+ bool useSignedCharForObjCBool() const {
+ return UseSignedCharForObjCBool;
+ }
+ void noSignedCharForObjCBool() {
+ UseSignedCharForObjCBool = false;
+ }
+
/// useBitFieldTypeAlignment() - Check whether the alignment of bit-field
/// types is respected when laying out structures.
bool useBitFieldTypeAlignment() const {
diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def
index 2e4d34d..fe0ef30 100644
--- a/include/clang/Basic/TokenKinds.def
+++ b/include/clang/Basic/TokenKinds.def
@@ -105,6 +105,7 @@ TOK(eod) // End of preprocessing directive (end of line inside a
// directive).
TOK(code_completion) // Code completion marker
TOK(cxx_defaultarg_end) // C++ default argument end marker
+TOK(cxx_exceptspec_end) // C++ exception-specification end marker
// C99 6.4.9: Comments.
TOK(comment) // Comment (only in -E -C[C] mode)
diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
index bd5dc31..c18c4cc 100644
--- a/include/clang/Config/config.h.cmake
+++ b/include/clang/Config/config.h.cmake
@@ -4,8 +4,11 @@
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
-/* Directory where gcc is installed. */
-#define GCC_INSTALL_PREFIX "${GCC_INSTALL_PREFIX}"
-
/* Directories clang will search for headers */
#define C_INCLUDE_DIRS "${C_INCLUDE_DIRS}"
+
+/* Default <path> to all compiler invocations for --sysroot=<path>. */
+#define DEFAULT_SYSROOT "${DEFAULT_SYSROOT}"
+
+/* Directory where gcc is installed. */
+#define GCC_INSTALL_PREFIX "${GCC_INSTALL_PREFIX}"
diff --git a/include/clang/Config/config.h.in b/include/clang/Config/config.h.in
index 86d5b09..8ff9417 100644
--- a/include/clang/Config/config.h.in
+++ b/include/clang/Config/config.h.in
@@ -9,13 +9,16 @@
/* Relative directory for resource files */
#undef CLANG_RESOURCE_DIR
-/* Directory where gcc is installed. */
-#undef GCC_INSTALL_PREFIX
-
/* Directories clang will search for headers */
#undef C_INCLUDE_DIRS
/* Linker version detected at compile time. */
#undef HOST_LINK_VERSION
+/* Default <path> to all compiler invocations for --sysroot=<path>. */
+#undef DEFAULT_SYSROOT
+
+/* Directory where gcc is installed. */
+#undef GCC_INSTALL_PREFIX
+
#endif
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 3ab8f83..83c988a 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -428,9 +428,6 @@ def ast_view : Flag<"-ast-view">,
HelpText<"Build ASTs and view them with GraphViz">;
def print_decl_contexts : Flag<"-print-decl-contexts">,
HelpText<"Print DeclContexts and their Decls">;
-def pubnames_dump : Flag<"-pubnames-dump">,
- HelpText<"Print all of the public (global) names in the source, e.g., the "
- "names of all global declarations and macros">;
def emit_module : Flag<"-emit-module">,
HelpText<"Generate pre-compiled module file from a module map">;
def emit_pth : Flag<"-emit-pth">,
diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h
index fd88c3a..6f1a221 100644
--- a/include/clang/Driver/Compilation.h
+++ b/include/clang/Driver/Compilation.h
@@ -92,6 +92,9 @@ public:
return FailureResultFiles;
}
+ /// Returns the sysroot path.
+ StringRef getSysRoot() const;
+
/// getArgsForToolChain - Return the derived argument list for the
/// tool chain \arg TC (or the default tool chain, if TC is not
/// specified).
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 5e4ecad..041eabb 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_FRONTEND_ASTUNIT_H
#define LLVM_CLANG_FRONTEND_ASTUNIT_H
-#include "clang/Index/ASTLocation.h"
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/CodeCompleteConsumer.h"
@@ -57,8 +56,6 @@ class SourceManager;
class TargetInfo;
class ASTFrontendAction;
-using namespace idx;
-
/// \brief Utility class for loading a ASTContext from an AST file.
///
class ASTUnit : public ModuleLoader {
@@ -134,9 +131,6 @@ private:
/// The name of the original source file used to generate this ASTUnit.
std::string OriginalSourceFile;
- // Critical optimization when using clang_getCursor().
- ASTLocation LastLoc;
-
/// \brief The set of diagnostics produced when creating the preamble.
SmallVector<StoredDiagnostic, 4> PreambleDiagnostics;
@@ -474,10 +468,6 @@ public:
bool getOwnsRemappedFileBuffers() const { return OwnsRemappedFileBuffers; }
void setOwnsRemappedFileBuffers(bool val) { OwnsRemappedFileBuffers = val; }
- void setLastASTLocation(ASTLocation ALoc) { LastLoc = ALoc; }
- ASTLocation getLastASTLocation() const { return LastLoc; }
-
-
StringRef getMainFileName() const;
typedef std::vector<Decl *>::iterator top_level_iterator;
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 8817c5a..8f7fe87 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -173,15 +173,6 @@ protected:
virtual bool usesPreprocessorOnly() const { return true; }
};
-class PubnamesDumpAction : public ASTFrontendAction {
-protected:
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile);
-
-public:
- virtual bool hasCodeCompletionSupport() const { return false; }
-};
-
//===----------------------------------------------------------------------===//
// Preprocessor Actions
//===----------------------------------------------------------------------===//
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index a051d7f..888388c 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -42,7 +42,6 @@ namespace frontend {
PrintDeclContext, ///< Print DeclContext and their Decls.
PrintPreamble, ///< Print the "preamble" of the input file
PrintPreprocessedInput, ///< -E mode.
- PubnamesDump, ///< Print all of the "public" names in the source.
RewriteMacros, ///< Expand macros but not #includes.
RewriteObjC, ///< ObjC->C Rewriter.
RewriteTest, ///< Rewriter playground
diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h
index 519d3b6..314003b 100644
--- a/include/clang/Frontend/TextDiagnostic.h
+++ b/include/clang/Frontend/TextDiagnostic.h
@@ -18,6 +18,8 @@
#include "clang/Frontend/DiagnosticRenderer.h"
+struct SourceColumnMap;
+
namespace clang {
/// \brief Class to encapsulate the logic for formatting and printing a textual
@@ -103,15 +105,16 @@ private:
SmallVectorImpl<CharSourceRange>& Ranges,
ArrayRef<FixItHint> Hints);
+ void emitSnippet(StringRef SourceLine);
+
void highlightRange(const CharSourceRange &R,
unsigned LineNo, FileID FID,
- const std::string &SourceLine,
+ const SourceColumnMap &map,
std::string &CaretLine);
+
std::string buildFixItInsertionLine(unsigned LineNo,
- const char *LineStart,
- const char *LineEnd,
+ const SourceColumnMap &map,
ArrayRef<FixItHint> Hints);
- void expandTabs(std::string &SourceLine, std::string &CaretLine);
void emitParseableFixits(ArrayRef<FixItHint> Hints);
};
diff --git a/include/clang/Index/ASTLocation.h b/include/clang/Index/ASTLocation.h
deleted file mode 100644
index 45097cc..0000000
--- a/include/clang/Index/ASTLocation.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//===--- ASTLocation.h - A <Decl, Stmt> pair --------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// ASTLocation is Decl or a Stmt and its immediate Decl parent.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_ASTLOCATION_H
-#define LLVM_CLANG_INDEX_ASTLOCATION_H
-
-#include "clang/AST/TypeLoc.h"
-#include "llvm/ADT/PointerIntPair.h"
-#include "llvm/Support/Compiler.h"
-
-namespace clang {
- class Decl;
- class Stmt;
- class NamedDecl;
-
-namespace idx {
- class TranslationUnit;
-
-/// \brief Represents a Decl or a Stmt and its immediate Decl parent. It's
-/// immutable.
-///
-/// ASTLocation is intended to be used as a "pointer" into the AST. It is either
-/// just a Decl, or a Stmt and its Decl parent. Since a single Stmt is devoid
-/// of context, its parent Decl provides all the additional missing information
-/// like the declaration context, ASTContext, etc.
-///
-class ASTLocation {
-public:
- enum NodeKind {
- N_Decl, N_NamedRef, N_Stmt, N_Type
- };
-
- struct NamedRef {
- NamedDecl *ND;
- SourceLocation Loc;
-
- NamedRef() : ND(0) { }
- NamedRef(NamedDecl *nd, SourceLocation loc) : ND(nd), Loc(loc) { }
- };
-
-private:
- llvm::PointerIntPair<Decl *, 2, NodeKind> ParentDecl;
-
- union {
- Decl *D;
- Stmt *Stm;
- struct {
- NamedDecl *ND;
- unsigned RawLoc;
- } NDRef;
- struct {
- void *TyPtr;
- void *Data;
- } Ty;
- };
-
-public:
- ASTLocation() { }
-
- explicit ASTLocation(const Decl *d)
- : ParentDecl(const_cast<Decl*>(d), N_Decl), D(const_cast<Decl*>(d)) { }
-
- ASTLocation(const Decl *parentDecl, const Stmt *stm)
- : ParentDecl(const_cast<Decl*>(parentDecl), N_Stmt),
- Stm(const_cast<Stmt*>(stm)) {
- if (!stm) ParentDecl.setPointer(0);
- }
-
- ASTLocation(const Decl *parentDecl, NamedDecl *ndRef, SourceLocation loc)
- : ParentDecl(const_cast<Decl*>(parentDecl), N_NamedRef) {
- if (ndRef) {
- NDRef.ND = ndRef;
- NDRef.RawLoc = loc.getRawEncoding();
- } else
- ParentDecl.setPointer(0);
- }
-
- ASTLocation(const Decl *parentDecl, TypeLoc tyLoc)
- : ParentDecl(const_cast<Decl*>(parentDecl), N_Type) {
- if (tyLoc) {
- Ty.TyPtr = tyLoc.getType().getAsOpaquePtr();
- Ty.Data = tyLoc.getOpaqueData();
- } else
- ParentDecl.setPointer(0);
- }
-
- bool isValid() const { return ParentDecl.getPointer() != 0; }
- bool isInvalid() const { return !isValid(); }
-
- NodeKind getKind() const {
- assert(isValid());
- return (NodeKind)ParentDecl.getInt();
- }
-
- Decl *getParentDecl() const { return ParentDecl.getPointer(); }
-
- Decl *AsDecl() const {
- assert(getKind() == N_Decl);
- return D;
- }
- Stmt *AsStmt() const {
- assert(getKind() == N_Stmt);
- return Stm;
- }
- NamedRef AsNamedRef() const {
- assert(getKind() == N_NamedRef);
- return NamedRef(NDRef.ND, SourceLocation::getFromRawEncoding(NDRef.RawLoc));
- }
- TypeLoc AsTypeLoc() const {
- assert(getKind() == N_Type);
- return TypeLoc(QualType::getFromOpaquePtr(Ty.TyPtr), Ty.Data);
- }
-
- Decl *dyn_AsDecl() const { return isValid() && getKind() == N_Decl ? D : 0; }
- Stmt *dyn_AsStmt() const {
- return isValid() && getKind() == N_Stmt ? Stm : 0;
- }
- NamedRef dyn_AsNamedRef() const {
- return getKind() == N_Type ? AsNamedRef() : NamedRef();
- }
- TypeLoc dyn_AsTypeLoc() const {
- return getKind() == N_Type ? AsTypeLoc() : TypeLoc();
- }
-
- bool isDecl() const { return isValid() && getKind() == N_Decl; }
- bool isStmt() const { return isValid() && getKind() == N_Stmt; }
- bool isNamedRef() const { return isValid() && getKind() == N_NamedRef; }
- bool isType() const { return isValid() && getKind() == N_Type; }
-
- /// \brief Returns the declaration that this ASTLocation references.
- ///
- /// If this points to a Decl, that Decl is returned.
- /// If this points to an Expr that references a Decl, that Decl is returned,
- /// otherwise it returns NULL.
- Decl *getReferencedDecl();
- const Decl *getReferencedDecl() const {
- return const_cast<ASTLocation*>(this)->getReferencedDecl();
- }
-
- SourceRange getSourceRange() const LLVM_READONLY;
-
- void print(raw_ostream &OS) const;
-};
-
-/// \brief Like ASTLocation but also contains the TranslationUnit that the
-/// ASTLocation originated from.
-class TULocation : public ASTLocation {
- TranslationUnit *TU;
-
-public:
- TULocation(TranslationUnit *tu, ASTLocation astLoc)
- : ASTLocation(astLoc), TU(tu) {
- assert(tu && "Passed null translation unit");
- }
-
- TranslationUnit *getTU() const { return TU; }
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/Analyzer.h b/include/clang/Index/Analyzer.h
deleted file mode 100644
index f6b5465..0000000
--- a/include/clang/Index/Analyzer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===--- Analyzer.h - Analysis for indexing information ---------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the Analyzer interface.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_ANALYZER_H
-#define LLVM_CLANG_INDEX_ANALYZER_H
-
-namespace clang {
- class Decl;
- class ObjCMessageExpr;
-
-namespace idx {
- class Program;
- class IndexProvider;
- class TULocationHandler;
-
-/// \brief Provides indexing information, like finding all references of an
-/// Entity across translation units.
-class Analyzer {
- Program &Prog;
- IndexProvider &Idxer;
-
- Analyzer(const Analyzer&); // do not implement
- Analyzer &operator=(const Analyzer &); // do not implement
-
-public:
- explicit Analyzer(Program &prog, IndexProvider &idxer)
- : Prog(prog), Idxer(idxer) { }
-
- /// \brief Find all TULocations for declarations of the given Decl and pass
- /// them to Handler.
- void FindDeclarations(Decl *D, TULocationHandler &Handler);
-
- /// \brief Find all TULocations for references of the given Decl and pass
- /// them to Handler.
- void FindReferences(Decl *D, TULocationHandler &Handler);
-
- /// \brief Find methods that may respond to the given message and pass them
- /// to Handler.
- void FindObjCMethods(ObjCMessageExpr *MsgE, TULocationHandler &Handler);
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/DeclReferenceMap.h b/include/clang/Index/DeclReferenceMap.h
deleted file mode 100644
index 73f2fe5..0000000
--- a/include/clang/Index/DeclReferenceMap.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//===--- DeclReferenceMap.h - Map Decls to their references -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// DeclReferenceMap creates a mapping from Decls to the ASTLocations that
-// reference them.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_DECLREFERENCEMAP_H
-#define LLVM_CLANG_INDEX_DECLREFERENCEMAP_H
-
-#include "clang/Index/ASTLocation.h"
-#include "clang/Index/STLExtras.h"
-#include <map>
-
-namespace clang {
- class ASTContext;
- class NamedDecl;
-
-namespace idx {
-
-/// \brief Maps NamedDecls with the ASTLocations that reference them.
-///
-/// References are mapped and retrieved using the canonical decls.
-class DeclReferenceMap {
-public:
- explicit DeclReferenceMap(ASTContext &Ctx);
-
- typedef std::multimap<NamedDecl*, ASTLocation> MapTy;
- typedef pair_value_iterator<MapTy::iterator> astlocation_iterator;
-
- astlocation_iterator refs_begin(NamedDecl *D) const;
- astlocation_iterator refs_end(NamedDecl *D) const;
- bool refs_empty(NamedDecl *D) const;
-
-private:
- mutable MapTy Map;
-};
-
-} // end idx namespace
-
-} // end clang namespace
-
-#endif
diff --git a/include/clang/Index/Entity.h b/include/clang/Index/Entity.h
deleted file mode 100644
index d104458..0000000
--- a/include/clang/Index/Entity.h
+++ /dev/null
@@ -1,149 +0,0 @@
-//===--- Entity.h - Cross-translation-unit "token" for decls ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Entity is a ASTContext-independent way to refer to declarations that are
-// visible across translation units.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_ENTITY_H
-#define LLVM_CLANG_INDEX_ENTITY_H
-
-#include "clang/Basic/LLVM.h"
-#include "llvm/ADT/PointerUnion.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/StringRef.h"
-#include <string>
-
-namespace clang {
- class ASTContext;
- class Decl;
-
-namespace idx {
- class Program;
- class EntityImpl;
-
-/// \brief A ASTContext-independent way to refer to declarations.
-///
-/// Entity is basically the link for declarations that are semantically the same
-/// in multiple ASTContexts. A client will convert a Decl into an Entity and
-/// later use that Entity to find the "same" Decl into another ASTContext.
-/// Declarations that are semantically the same and visible across translation
-/// units will be associated with the same Entity.
-///
-/// An Entity may also refer to declarations that cannot be visible across
-/// translation units, e.g. static functions with the same name in multiple
-/// translation units will be associated with different Entities.
-///
-/// Entities can be checked for equality but note that the same Program object
-/// should be used when getting Entities.
-///
-class Entity {
- /// \brief Stores the Decl directly if it is not visible outside of its own
- /// translation unit, otherwise it stores the associated EntityImpl.
- llvm::PointerUnion<Decl *, EntityImpl *> Val;
-
- explicit Entity(Decl *D);
- explicit Entity(EntityImpl *impl) : Val(impl) { }
- friend class EntityGetter;
-
-public:
- Entity() { }
-
- /// \brief Find the Decl that can be referred to by this entity.
- Decl *getDecl(ASTContext &AST) const;
-
- /// \brief If this Entity represents a declaration that is internal to its
- /// translation unit, getInternalDecl() returns it.
- Decl *getInternalDecl() const {
- assert(isInternalToTU() && "This Entity is not internal!");
- return Val.get<Decl *>();
- }
-
- /// \brief Get a printable name for debugging purpose.
- std::string getPrintableName() const;
-
- /// \brief Get an Entity associated with the given Decl.
- /// \returns invalid Entity if an Entity cannot refer to this Decl.
- static Entity get(Decl *D, Program &Prog);
-
- /// \brief Get an Entity associated with a name in the global namespace.
- static Entity get(StringRef Name, Program &Prog);
-
- /// \brief true if the Entity is not visible outside the trasnlation unit.
- bool isInternalToTU() const {
- assert(isValid() && "This Entity is not valid!");
- return Val.is<Decl *>();
- }
-
- bool isValid() const { return !Val.isNull(); }
- bool isInvalid() const { return !isValid(); }
-
- void *getAsOpaquePtr() const { return Val.getOpaqueValue(); }
- static Entity getFromOpaquePtr(void *Ptr) {
- Entity Ent;
- Ent.Val = llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue(Ptr);
- return Ent;
- }
-
- friend bool operator==(const Entity &LHS, const Entity &RHS) {
- return LHS.getAsOpaquePtr() == RHS.getAsOpaquePtr();
- }
-
- // For use in a std::map.
- friend bool operator < (const Entity &LHS, const Entity &RHS) {
- return LHS.getAsOpaquePtr() < RHS.getAsOpaquePtr();
- }
-
- // For use in DenseMap/DenseSet.
- static Entity getEmptyMarker() {
- Entity Ent;
- Ent.Val =
- llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue((void*)-1);
- return Ent;
- }
- static Entity getTombstoneMarker() {
- Entity Ent;
- Ent.Val =
- llvm::PointerUnion<Decl *, EntityImpl *>::getFromOpaqueValue((void*)-2);
- return Ent;
- }
-};
-
-} // namespace idx
-
-} // namespace clang
-
-namespace llvm {
-/// Define DenseMapInfo so that Entities can be used as keys in DenseMap and
-/// DenseSets.
-template<>
-struct DenseMapInfo<clang::idx::Entity> {
- static inline clang::idx::Entity getEmptyKey() {
- return clang::idx::Entity::getEmptyMarker();
- }
-
- static inline clang::idx::Entity getTombstoneKey() {
- return clang::idx::Entity::getTombstoneMarker();
- }
-
- static unsigned getHashValue(clang::idx::Entity);
-
- static inline bool
- isEqual(clang::idx::Entity LHS, clang::idx::Entity RHS) {
- return LHS == RHS;
- }
-};
-
-template <>
-struct isPodLike<clang::idx::Entity> { static const bool value = true; };
-
-} // end namespace llvm
-
-#endif
diff --git a/include/clang/Index/GlobalCallGraph.h b/include/clang/Index/GlobalCallGraph.h
deleted file mode 100644
index 7ba1cce..0000000
--- a/include/clang/Index/GlobalCallGraph.h
+++ /dev/null
@@ -1,149 +0,0 @@
-//== GlobalCallGraph.h - Call graph building --------------------*- C++ -*--==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defined the CallGraph and CallGraphNode classes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_CALLGRAPH
-#define LLVM_CLANG_INDEX_CALLGRAPH
-
-#include "clang/Index/ASTLocation.h"
-#include "clang/Index/Entity.h"
-#include "clang/Index/Program.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/STLExtras.h"
-#include <vector>
-#include <map>
-
-using namespace clang;
-
-namespace clang {
-namespace idx {
-
-class CallGraphNode {
- Entity F;
- typedef std::pair<ASTLocation, CallGraphNode*> CallRecord;
- std::vector<CallRecord> CalledFunctions;
-
-public:
- CallGraphNode(Entity f) : F(f) {}
-
- typedef std::vector<CallRecord>::iterator iterator;
- typedef std::vector<CallRecord>::const_iterator const_iterator;
-
- iterator begin() { return CalledFunctions.begin(); }
- iterator end() { return CalledFunctions.end(); }
- const_iterator begin() const { return CalledFunctions.begin(); }
- const_iterator end() const { return CalledFunctions.end(); }
-
- void addCallee(ASTLocation L, CallGraphNode *Node) {
- CalledFunctions.push_back(std::make_pair(L, Node));
- }
-
- bool hasCallee() const { return begin() != end(); }
-
- std::string getName() const { return F.getPrintableName(); }
-
- Decl *getDecl(ASTContext &Ctx) const { return F.getDecl(Ctx); }
-};
-
-class CallGraph {
- /// Program manages all Entities.
- Program &Prog;
-
- typedef std::map<Entity, CallGraphNode *> FunctionMapTy;
-
- /// FunctionMap owns all CallGraphNodes.
- FunctionMapTy FunctionMap;
-
- /// CallerCtx maps a caller to its ASTContext.
- llvm::DenseMap<CallGraphNode *, ASTContext *> CallerCtx;
-
- /// Root node is the 'main' function or 0.
- CallGraphNode *Root;
-
- /// ExternalCallingNode has edges to all external functions.
- CallGraphNode *ExternalCallingNode;
-
-public:
- CallGraph(Program &P);
- ~CallGraph();
-
- typedef FunctionMapTy::iterator iterator;
- typedef FunctionMapTy::const_iterator const_iterator;
-
- iterator begin() { return FunctionMap.begin(); }
- iterator end() { return FunctionMap.end(); }
- const_iterator begin() const { return FunctionMap.begin(); }
- const_iterator end() const { return FunctionMap.end(); }
-
- CallGraphNode *getRoot() { return Root; }
-
- CallGraphNode *getExternalCallingNode() { return ExternalCallingNode; }
-
- void addTU(ASTContext &AST);
-
- Program &getProgram() { return Prog; }
-
- CallGraphNode *getOrInsertFunction(idx::Entity F);
-
- Decl *getDecl(CallGraphNode *Node);
-
- void print(raw_ostream &os);
- void dump();
-
- void ViewCallGraph() const;
-};
-
-}} // end clang idx namespace
-
-namespace llvm {
-
-template <> struct GraphTraits<clang::idx::CallGraph> {
- typedef clang::idx::CallGraph GraphType;
- typedef clang::idx::CallGraphNode NodeType;
-
- typedef std::pair<clang::idx::ASTLocation, NodeType*> CGNPairTy;
- typedef std::pointer_to_unary_function<CGNPairTy, NodeType*> CGNDerefFun;
-
- typedef mapped_iterator<NodeType::iterator, CGNDerefFun> ChildIteratorType;
-
- static NodeType *getEntryNode(GraphType *CG) {
- return CG->getExternalCallingNode();
- }
-
- static ChildIteratorType child_begin(NodeType *N) {
- return map_iterator(N->begin(), CGNDerefFun(CGNDeref));
- }
- static ChildIteratorType child_end(NodeType *N) {
- return map_iterator(N->end(), CGNDerefFun(CGNDeref));
- }
-
- typedef std::pair<clang::idx::Entity, NodeType*> PairTy;
- typedef std::pointer_to_unary_function<PairTy, NodeType*> DerefFun;
-
- typedef mapped_iterator<GraphType::const_iterator, DerefFun> nodes_iterator;
-
- static nodes_iterator nodes_begin(const GraphType &CG) {
- return map_iterator(CG.begin(), DerefFun(CGDeref));
- }
- static nodes_iterator nodes_end(const GraphType &CG) {
- return map_iterator(CG.end(), DerefFun(CGDeref));
- }
-
- static NodeType *CGNDeref(CGNPairTy P) { return P.second; }
-
- static NodeType *CGDeref(PairTy P) { return P.second; }
-};
-
-} // end llvm namespace
-
-#endif
diff --git a/include/clang/Index/GlobalSelector.h b/include/clang/Index/GlobalSelector.h
deleted file mode 100644
index 9cd83a8..0000000
--- a/include/clang/Index/GlobalSelector.h
+++ /dev/null
@@ -1,100 +0,0 @@
-//===--- GlobalSelector.h - Cross-translation-unit "token" for selectors --===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// GlobalSelector is a ASTContext-independent way to refer to selectors.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_GLOBALSELECTOR_H
-#define LLVM_CLANG_INDEX_GLOBALSELECTOR_H
-
-#include "llvm/ADT/DenseMap.h"
-#include <string>
-
-namespace clang {
- class ASTContext;
- class Selector;
-
-namespace idx {
- class Program;
-
-/// \brief A ASTContext-independent way to refer to selectors.
-class GlobalSelector {
- void *Val;
-
- explicit GlobalSelector(void *val) : Val(val) { }
-
-public:
- GlobalSelector() : Val(0) { }
-
- /// \brief Get the ASTContext-specific selector.
- Selector getSelector(ASTContext &AST) const;
-
- bool isValid() const { return Val != 0; }
- bool isInvalid() const { return !isValid(); }
-
- /// \brief Get a printable name for debugging purpose.
- std::string getPrintableName() const;
-
- /// \brief Get a GlobalSelector for the ASTContext-specific selector.
- static GlobalSelector get(Selector Sel, Program &Prog);
-
- void *getAsOpaquePtr() const { return Val; }
-
- static GlobalSelector getFromOpaquePtr(void *Ptr) {
- return GlobalSelector(Ptr);
- }
-
- friend bool operator==(const GlobalSelector &LHS, const GlobalSelector &RHS) {
- return LHS.getAsOpaquePtr() == RHS.getAsOpaquePtr();
- }
-
- // For use in a std::map.
- friend bool operator< (const GlobalSelector &LHS, const GlobalSelector &RHS) {
- return LHS.getAsOpaquePtr() < RHS.getAsOpaquePtr();
- }
-
- // For use in DenseMap/DenseSet.
- static GlobalSelector getEmptyMarker() { return GlobalSelector((void*)-1); }
- static GlobalSelector getTombstoneMarker() {
- return GlobalSelector((void*)-2);
- }
-};
-
-} // namespace idx
-
-} // namespace clang
-
-namespace llvm {
-/// Define DenseMapInfo so that GlobalSelectors can be used as keys in DenseMap
-/// and DenseSets.
-template<>
-struct DenseMapInfo<clang::idx::GlobalSelector> {
- static inline clang::idx::GlobalSelector getEmptyKey() {
- return clang::idx::GlobalSelector::getEmptyMarker();
- }
-
- static inline clang::idx::GlobalSelector getTombstoneKey() {
- return clang::idx::GlobalSelector::getTombstoneMarker();
- }
-
- static unsigned getHashValue(clang::idx::GlobalSelector);
-
- static inline bool
- isEqual(clang::idx::GlobalSelector LHS, clang::idx::GlobalSelector RHS) {
- return LHS == RHS;
- }
-};
-
-template <>
-struct isPodLike<clang::idx::GlobalSelector> { static const bool value = true;};
-
-} // end namespace llvm
-
-#endif
diff --git a/include/clang/Index/Handlers.h b/include/clang/Index/Handlers.h
deleted file mode 100644
index 1e017f8..0000000
--- a/include/clang/Index/Handlers.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===--- Handlers.h - Interfaces for receiving information ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Abstract interfaces for receiving information.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_HANDLERS_H
-#define LLVM_CLANG_INDEX_HANDLERS_H
-
-#include "clang/Basic/LLVM.h"
-#include "llvm/ADT/SmallVector.h"
-
-namespace clang {
-
-namespace idx {
- class Entity;
- class TranslationUnit;
- class TULocation;
-
-/// \brief Abstract interface for receiving Entities.
-class EntityHandler {
-public:
- typedef Entity receiving_type;
-
- virtual ~EntityHandler();
- virtual void Handle(Entity Ent) = 0;
-};
-
-/// \brief Abstract interface for receiving TranslationUnits.
-class TranslationUnitHandler {
-public:
- typedef TranslationUnit* receiving_type;
-
- virtual ~TranslationUnitHandler();
- virtual void Handle(TranslationUnit *TU) = 0;
-};
-
-/// \brief Abstract interface for receiving TULocations.
-class TULocationHandler {
-public:
- typedef TULocation receiving_type;
-
- virtual ~TULocationHandler();
- virtual void Handle(TULocation TULoc) = 0;
-};
-
-/// \brief Helper for the Handler classes. Stores the objects into a vector.
-/// example:
-/// @code
-/// Storing<TranslationUnitHandler> TURes;
-/// IndexProvider.GetTranslationUnitsFor(Entity, TURes);
-/// for (Storing<TranslationUnitHandler>::iterator
-/// I = TURes.begin(), E = TURes.end(); I != E; ++I) { ....
-/// @endcode
-template <typename handler_type>
-class Storing : public handler_type {
- typedef typename handler_type::receiving_type receiving_type;
- typedef SmallVector<receiving_type, 8> StoreTy;
- StoreTy Store;
-
-public:
- virtual void Handle(receiving_type Obj) {
- Store.push_back(Obj);
- }
-
- typedef typename StoreTy::const_iterator iterator;
- iterator begin() const { return Store.begin(); }
- iterator end() const { return Store.end(); }
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/IndexProvider.h b/include/clang/Index/IndexProvider.h
deleted file mode 100644
index 187dd93..0000000
--- a/include/clang/Index/IndexProvider.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//===--- IndexProvider.h - Maps information to translation units -*- C++ -*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Maps information to TranslationUnits.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_INDEXPROVIDER_H
-#define LLVM_CLANG_INDEX_INDEXPROVIDER_H
-
-namespace clang {
-
-namespace idx {
- class Entity;
- class TranslationUnitHandler;
- class GlobalSelector;
-
-/// \brief Maps information to TranslationUnits.
-class IndexProvider {
-public:
- virtual ~IndexProvider();
- virtual void GetTranslationUnitsFor(Entity Ent,
- TranslationUnitHandler &Handler) = 0;
- virtual void GetTranslationUnitsFor(GlobalSelector Sel,
- TranslationUnitHandler &Handler) = 0;
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/Indexer.h b/include/clang/Index/Indexer.h
deleted file mode 100644
index 96c585d..0000000
--- a/include/clang/Index/Indexer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//===--- Indexer.h - IndexProvider implementation ---------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// IndexProvider implementation.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_INDEXER_H
-#define LLVM_CLANG_INDEX_INDEXER_H
-
-#include "clang/Index/IndexProvider.h"
-#include "clang/Index/Entity.h"
-#include "clang/Index/GlobalSelector.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/DenseMap.h"
-#include <map>
-
-namespace clang {
- class ASTContext;
- class FunctionDecl;
-
-namespace idx {
- class Program;
- class TranslationUnit;
-
-/// \brief Maps information to TranslationUnits.
-class Indexer : public IndexProvider {
-public:
- typedef llvm::SmallPtrSet<TranslationUnit *, 4> TUSetTy;
- typedef llvm::DenseMap<ASTContext *, TranslationUnit *> CtxTUMapTy;
- typedef std::map<Entity, TUSetTy> MapTy;
- typedef std::map<GlobalSelector, TUSetTy> SelMapTy;
- typedef std::map<Entity, std::pair<FunctionDecl*,TranslationUnit*> > DefMapTy;
-
- explicit Indexer(Program &prog) :
- Prog(prog) { }
-
- Program &getProgram() const { return Prog; }
-
- /// \brief Find all Entities and map them to the given translation unit.
- void IndexAST(TranslationUnit *TU);
-
- virtual void GetTranslationUnitsFor(Entity Ent,
- TranslationUnitHandler &Handler);
- virtual void GetTranslationUnitsFor(GlobalSelector Sel,
- TranslationUnitHandler &Handler);
-
- std::pair<FunctionDecl*, TranslationUnit*> getDefinitionFor(Entity Ent);
-
-private:
- Program &Prog;
-
- MapTy Map;
- // Map a function Entity to the its definition.
- DefMapTy DefMap;
-
- CtxTUMapTy CtxTUMap;
- SelMapTy SelMap;
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/Program.h b/include/clang/Index/Program.h
deleted file mode 100644
index 8039192..0000000
--- a/include/clang/Index/Program.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//===--- Program.h - Cross-translation unit information ---------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the idx::Program interface.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_PROGRAM_H
-#define LLVM_CLANG_INDEX_PROGRAM_H
-
-namespace clang {
- class ASTContext;
-
-namespace idx {
- class EntityHandler;
-
-/// \brief Top level object that owns and maintains information
-/// that is common across translation units.
-class Program {
- void *Impl;
-
- Program(const Program&); // do not implement
- Program &operator=(const Program &); // do not implement
- friend class Entity;
- friend class GlobalSelector;
-
-public:
- Program();
- ~Program();
-
- /// \brief Traverses the AST and passes all the entities to the Handler.
- void FindEntities(ASTContext &Ctx, EntityHandler &Handler);
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Index/STLExtras.h b/include/clang/Index/STLExtras.h
deleted file mode 100644
index a3693c6..0000000
--- a/include/clang/Index/STLExtras.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//===--- STLExtras.h - Helper STL related templates -------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Helper templates for using with the STL.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_STLEXTRAS_H
-#define LLVM_CLANG_INDEX_STLEXTRAS_H
-
-namespace clang {
-
-namespace idx {
-
-/// \brief Wraps an iterator whose value_type is a pair, and provides
-/// pair's second object as the value.
-template <typename iter_type>
-class pair_value_iterator {
- iter_type I;
-
-public:
- typedef typename iter_type::value_type::second_type value_type;
- typedef value_type& reference;
- typedef value_type* pointer;
- typedef typename iter_type::iterator_category iterator_category;
- typedef typename iter_type::difference_type difference_type;
-
- pair_value_iterator() { }
- pair_value_iterator(iter_type i) : I(i) { }
-
- reference operator*() const { return I->second; }
- pointer operator->() const { return &I->second; }
-
- pair_value_iterator& operator++() {
- ++I;
- return *this;
- }
-
- pair_value_iterator operator++(int) {
- pair_value_iterator tmp(*this);
- ++(*this);
- return tmp;
- }
-
- friend bool operator==(pair_value_iterator L, pair_value_iterator R) {
- return L.I == R.I;
- }
- friend bool operator!=(pair_value_iterator L, pair_value_iterator R) {
- return L.I != R.I;
- }
-};
-
-} // end idx namespace
-
-} // end clang namespace
-
-#endif
diff --git a/include/clang/Index/SelectorMap.h b/include/clang/Index/SelectorMap.h
deleted file mode 100644
index be01702..0000000
--- a/include/clang/Index/SelectorMap.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//===--- SelectorMap.h - Maps selectors to methods and messages -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// SelectorMap creates a mapping from selectors to ObjC method declarations
-// and ObjC message expressions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_SELECTORMAP_H
-#define LLVM_CLANG_INDEX_SELECTORMAP_H
-
-#include "clang/Index/ASTLocation.h"
-#include "clang/Index/STLExtras.h"
-#include "clang/Basic/IdentifierTable.h"
-#include <map>
-
-namespace clang {
- class ASTContext;
- class ObjCMethodDecl;
-
-namespace idx {
-
-/// \brief Maps NamedDecls with the ASTLocations that reference them.
-///
-/// References are mapped and retrieved using the canonical decls.
-class SelectorMap {
-public:
- explicit SelectorMap(ASTContext &Ctx);
-
- typedef std::multimap<Selector, ObjCMethodDecl *> SelMethMapTy;
- typedef std::multimap<Selector, ASTLocation> SelRefMapTy;
-
- typedef pair_value_iterator<SelMethMapTy::iterator> method_iterator;
- typedef pair_value_iterator<SelRefMapTy::iterator> astlocation_iterator;
-
- method_iterator methods_begin(Selector Sel) const;
- method_iterator methods_end(Selector Sel) const;
-
- astlocation_iterator refs_begin(Selector Sel) const;
- astlocation_iterator refs_end(Selector Sel) const;
-
-private:
- mutable SelMethMapTy SelMethMap;
- mutable SelRefMapTy SelRefMap;
-};
-
-} // end idx namespace
-
-} // end clang namespace
-
-#endif
diff --git a/include/clang/Index/TranslationUnit.h b/include/clang/Index/TranslationUnit.h
deleted file mode 100644
index ba5d48d..0000000
--- a/include/clang/Index/TranslationUnit.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===--- TranslationUnit.h - Interface for a translation unit ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Abstract interface for a translation unit.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_INDEX_TRANSLATIONUNIT_H
-#define LLVM_CLANG_INDEX_TRANSLATIONUNIT_H
-
-namespace clang {
- class ASTContext;
- class DiagnosticsEngine;
- class Preprocessor;
-
-namespace idx {
- class DeclReferenceMap;
- class SelectorMap;
-
-/// \brief Abstract interface for a translation unit.
-class TranslationUnit {
-public:
- virtual ~TranslationUnit();
- virtual ASTContext &getASTContext() = 0;
- virtual Preprocessor &getPreprocessor() = 0;
- virtual DiagnosticsEngine &getDiagnostic() = 0;
- virtual DeclReferenceMap &getDeclReferenceMap() = 0;
- virtual SelectorMap &getSelectorMap() = 0;
-};
-
-} // namespace idx
-
-} // namespace clang
-
-#endif
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 0e5e8c7..de62ed2 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -15,7 +15,6 @@
#define LLVM_CLANG_PARSE_PARSER_H
#include "clang/Basic/Specifiers.h"
-#include "clang/Basic/DelayedCleanupPool.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Sema/Sema.h"
@@ -192,9 +191,9 @@ class Parser : public CodeCompletionHandler {
/// Factory object for creating AttributeList objects.
AttributeFactory AttrFactory;
- /// \brief Gathers and cleans up objects when parsing of a top-level
- /// declaration is finished.
- DelayedCleanupPool TopLevelDeclCleanupPool;
+ /// \brief Gathers and cleans up TemplateIdAnnotations when parsing of a
+ /// top-level declaration is finished.
+ SmallVector<TemplateIdAnnotation *, 16> TemplateIds;
IdentifierInfo *getSEHExceptKeyword();
@@ -568,9 +567,7 @@ private:
const char *&PrevSpec, unsigned &DiagID,
bool &isInvalid);
- /// \brief Get the TemplateIdAnnotation from the token and put it in the
- /// cleanup pool so that it gets destroyed when parsing the current top level
- /// declaration is finished.
+ /// \brief Get the TemplateIdAnnotation from the token.
TemplateIdAnnotation *takeTemplateIdAnnotation(const Token &tok);
/// TentativeParsingAction - An object that is used as a kind of "tentative
@@ -858,7 +855,7 @@ private:
/// argument (C++ [class.mem]p2).
struct LateParsedMethodDeclaration : public LateParsedDeclaration {
explicit LateParsedMethodDeclaration(Parser *P, Decl *M)
- : Self(P), Method(M), TemplateScope(false) { }
+ : Self(P), Method(M), TemplateScope(false), ExceptionSpecTokens(0) { }
virtual void ParseLexedMethodDeclarations();
@@ -878,6 +875,10 @@ private:
/// method will be stored so that they can be reintroduced into
/// scope at the appropriate times.
SmallVector<LateParsedDefaultArgument, 8> DefaultArgs;
+
+ /// \brief The set of tokens that make up an exception-specification that
+ /// has not yet been parsed.
+ CachedTokens *ExceptionSpecTokens;
};
/// LateParsedMemberInitializer - An initializer for a non-static class data
@@ -1420,11 +1421,13 @@ private:
// C++ 15: C++ Throw Expression
ExprResult ParseThrowExpression();
- ExceptionSpecificationType MaybeParseExceptionSpecification(
+ ExceptionSpecificationType tryParseExceptionSpecification(
+ bool Delayed,
SourceRange &SpecificationRange,
SmallVectorImpl<ParsedType> &DynamicExceptions,
SmallVectorImpl<SourceRange> &DynamicExceptionRanges,
- ExprResult &NoexceptExpr);
+ ExprResult &NoexceptExpr,
+ CachedTokens *&ExceptionSpecTokens);
// EndLoc is filled with the location of the last token of the specification.
ExceptionSpecificationType ParseDynamicExceptionSpecification(
@@ -1517,42 +1520,40 @@ private:
//===--------------------------------------------------------------------===//
// C99 6.8: Statements and Blocks.
- StmtResult ParseStatement(SourceLocation *TrailingElseLoc = NULL) {
+ StmtResult ParseStatement(SourceLocation *TrailingElseLoc = 0) {
StmtVector Stmts(Actions);
return ParseStatementOrDeclaration(Stmts, true, TrailingElseLoc);
}
- StmtResult ParseStatementOrDeclaration(StmtVector& Stmts,
+ StmtResult ParseStatementOrDeclaration(StmtVector &Stmts,
+ bool OnlyStatement,
+ SourceLocation *TrailingElseLoc = 0);
+ StmtResult ParseStatementOrDeclarationAfterAttributes(
+ StmtVector &Stmts,
bool OnlyStatement,
- SourceLocation *TrailingElseLoc = NULL);
- StmtResult ParseExprStatement(ParsedAttributes &Attrs);
- StmtResult ParseLabeledStatement(ParsedAttributes &Attr);
- StmtResult ParseCaseStatement(ParsedAttributes &Attr,
- bool MissingCase = false,
+ SourceLocation *TrailingElseLoc,
+ ParsedAttributesWithRange &Attrs);
+ StmtResult ParseExprStatement();
+ StmtResult ParseLabeledStatement(ParsedAttributesWithRange &attrs);
+ StmtResult ParseCaseStatement(bool MissingCase = false,
ExprResult Expr = ExprResult());
- StmtResult ParseDefaultStatement(ParsedAttributes &Attr);
- StmtResult ParseCompoundStatement(ParsedAttributes &Attr,
- bool isStmtExpr = false);
- StmtResult ParseCompoundStatement(ParsedAttributes &Attr,
- bool isStmtExpr,
+ StmtResult ParseDefaultStatement();
+ StmtResult ParseCompoundStatement(bool isStmtExpr = false);
+ StmtResult ParseCompoundStatement(bool isStmtExpr,
unsigned ScopeFlags);
StmtResult ParseCompoundStatementBody(bool isStmtExpr = false);
bool ParseParenExprOrCondition(ExprResult &ExprResult,
Decl *&DeclResult,
SourceLocation Loc,
bool ConvertToBoolean);
- StmtResult ParseIfStatement(ParsedAttributes &Attr,
- SourceLocation *TrailingElseLoc);
- StmtResult ParseSwitchStatement(ParsedAttributes &Attr,
- SourceLocation *TrailingElseLoc);
- StmtResult ParseWhileStatement(ParsedAttributes &Attr,
- SourceLocation *TrailingElseLoc);
- StmtResult ParseDoStatement(ParsedAttributes &Attr);
- StmtResult ParseForStatement(ParsedAttributes &Attr,
- SourceLocation *TrailingElseLoc);
- StmtResult ParseGotoStatement(ParsedAttributes &Attr);
- StmtResult ParseContinueStatement(ParsedAttributes &Attr);
- StmtResult ParseBreakStatement(ParsedAttributes &Attr);
- StmtResult ParseReturnStatement(ParsedAttributes &Attr);
+ StmtResult ParseIfStatement(SourceLocation *TrailingElseLoc);
+ StmtResult ParseSwitchStatement(SourceLocation *TrailingElseLoc);
+ StmtResult ParseWhileStatement(SourceLocation *TrailingElseLoc);
+ StmtResult ParseDoStatement();
+ StmtResult ParseForStatement(SourceLocation *TrailingElseLoc);
+ StmtResult ParseGotoStatement();
+ StmtResult ParseContinueStatement();
+ StmtResult ParseBreakStatement();
+ StmtResult ParseReturnStatement();
StmtResult ParseAsmStatement(bool &msAsm);
StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc);
@@ -1586,7 +1587,7 @@ private:
/// \brief The behavior of this __if_exists or __if_not_exists block
/// should.
IfExistsBehavior Behavior;
-};
+ };
bool ParseMicrosoftIfExistsCondition(IfExistsCondition& Result);
void ParseMicrosoftIfExistsStatement(StmtVector &Stmts);
@@ -1602,14 +1603,14 @@ private:
//===--------------------------------------------------------------------===//
// C++ 6: Statements and Blocks
- StmtResult ParseCXXTryBlock(ParsedAttributes &Attr);
+ StmtResult ParseCXXTryBlock();
StmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc);
StmtResult ParseCXXCatchBlock();
//===--------------------------------------------------------------------===//
// MS: SEH Statements and Blocks
- StmtResult ParseSEHTryBlock(ParsedAttributes &Attr);
+ StmtResult ParseSEHTryBlock();
StmtResult ParseSEHTryBlockCommon(SourceLocation Loc);
StmtResult ParseSEHExceptBlock(SourceLocation Loc);
StmtResult ParseSEHFinallyBlock(SourceLocation Loc);
@@ -1883,6 +1884,7 @@ private:
void ProhibitAttributes(ParsedAttributesWithRange &attrs) {
if (!attrs.Range.isValid()) return;
DiagnoseProhibitedAttributes(attrs);
+ attrs.clear();
}
void DiagnoseProhibitedAttributes(ParsedAttributesWithRange &attrs);
@@ -1967,7 +1969,7 @@ private:
void ParseTypeofSpecifier(DeclSpec &DS);
SourceLocation ParseDecltypeSpecifier(DeclSpec &DS);
- void AnnotateExistingDecltypeSpecifier(const DeclSpec &DS,
+ void AnnotateExistingDecltypeSpecifier(const DeclSpec &DS,
SourceLocation StartLoc,
SourceLocation EndLoc);
void ParseUnderlyingTypeSpecifier(DeclSpec &DS);
@@ -2106,8 +2108,8 @@ private:
ParsingDeclRAIIObject *DiagsFromTParams = 0);
void ParseConstructorInitializer(Decl *ConstructorDecl);
MemInitResult ParseMemInitializer(Decl *ConstructorDecl);
- void HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
- Decl *ThisDecl);
+ void HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo,
+ Decl *ThisDecl);
//===--------------------------------------------------------------------===//
// C++ 10: Derived classes [class.derived]
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 67fd393..2f3dda4 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -1150,6 +1150,10 @@ struct DeclaratorChunk {
/// \brief Pointer to the expression in the noexcept-specifier of this
/// function, if it has one.
Expr *NoexceptExpr;
+
+ /// \brief Pointer to the cached tokens for an exception-specification
+ /// that has not yet been parsed.
+ CachedTokens *ExceptionSpecTokens;
};
/// TrailingReturnType - If this isn't null, it's the trailing return type
@@ -1172,6 +1176,8 @@ struct DeclaratorChunk {
delete[] ArgInfo;
if (getExceptionSpecType() == EST_Dynamic)
delete[] Exceptions;
+ else if (getExceptionSpecType() == EST_Delayed)
+ delete ExceptionSpecTokens;
}
/// isKNRPrototype - Return true if this is a K&R style identifier list,
@@ -1347,6 +1353,7 @@ struct DeclaratorChunk {
SourceRange *ExceptionRanges,
unsigned NumExceptions,
Expr *NoexceptExpr,
+ CachedTokens *ExceptionSpecTokens,
SourceLocation LocalRangeBegin,
SourceLocation LocalRangeEnd,
Declarator &TheDeclarator,
diff --git a/include/clang/Sema/ParsedTemplate.h b/include/clang/Sema/ParsedTemplate.h
index 3ff0459..c1b4710 100644
--- a/include/clang/Sema/ParsedTemplate.h
+++ b/include/clang/Sema/ParsedTemplate.h
@@ -178,8 +178,11 @@ namespace clang {
ParsedTemplateArgument *getTemplateArgs() {
return reinterpret_cast<ParsedTemplateArgument *>(this + 1);
}
-
- static TemplateIdAnnotation* Allocate(unsigned NumArgs) {
+
+ /// \brief Creates a new TemplateIdAnnotation with NumArgs arguments and
+ /// appends it to List.
+ static TemplateIdAnnotation *
+ Allocate(unsigned NumArgs, SmallVectorImpl<TemplateIdAnnotation*> &List) {
TemplateIdAnnotation *TemplateId
= (TemplateIdAnnotation *)std::malloc(sizeof(TemplateIdAnnotation) +
sizeof(ParsedTemplateArgument) * NumArgs);
@@ -193,6 +196,7 @@ namespace clang {
for (unsigned I = 0; I != NumArgs; ++I)
new (TemplateArgs + I) ParsedTemplateArgument();
+ List.push_back(TemplateId);
return TemplateId;
}
diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h
index e9aa173..48f5417 100644
--- a/include/clang/Sema/Scope.h
+++ b/include/clang/Sema/Scope.h
@@ -81,13 +81,8 @@ public:
/// SwitchScope - This is a scope that corresponds to a switch statement.
SwitchScope = 0x800,
- /// ThisScope - This is the scope of a struct/union/class definition,
- /// outside of any member function definition, where 'this' is nonetheless
- /// usable.
- ThisScope = 0x1000,
-
/// TryScope - This is the scope of a C++ try statement.
- TryScope = 0x2000
+ TryScope = 0x1000
};
private:
/// The parent scope for this scope. This is null for the translation-unit
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 31c410a..8ac7c3e 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -446,11 +446,13 @@ public:
Sema &S;
DeclContext *SavedContext;
ProcessingContextState SavedContextState;
-
+ QualType SavedCXXThisTypeOverride;
+
public:
ContextRAII(Sema &S, DeclContext *ContextToPush)
: S(S), SavedContext(S.CurContext),
- SavedContextState(S.DelayedDiagnostics.pushContext())
+ SavedContextState(S.DelayedDiagnostics.pushContext()),
+ SavedCXXThisTypeOverride(S.CXXThisTypeOverride)
{
assert(ContextToPush && "pushing null context");
S.CurContext = ContextToPush;
@@ -460,6 +462,7 @@ public:
if (!SavedContext) return;
S.CurContext = SavedContext;
S.DelayedDiagnostics.popContext(SavedContextState);
+ S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
SavedContext = 0;
}
@@ -646,7 +649,7 @@ public:
/// A stack of expression evaluation contexts.
SmallVector<ExpressionEvaluationContextRecord, 8> ExprEvalContexts;
-
+
/// SpecialMemberOverloadResult - The overloading result for a special member
/// function.
///
@@ -898,11 +901,15 @@ public:
TypeSourceInfo *GetTypeForDeclaratorCast(Declarator &D, QualType FromTy);
TypeSourceInfo *GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
TypeSourceInfo *ReturnTypeInfo);
+
/// \brief Package the given type and TSI into a ParsedType.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo);
DeclarationNameInfo GetNameForDeclarator(Declarator &D);
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name);
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo = 0);
+ CanThrowResult canThrow(const Expr *E);
+ const FunctionProtoType *ResolveExceptionSpec(SourceLocation Loc,
+ const FunctionProtoType *FPT);
bool CheckSpecifiedExceptionType(QualType T, const SourceRange &Range);
bool CheckDistantExceptionSpec(QualType T);
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New);
@@ -1974,6 +1981,10 @@ public:
bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC);
bool CheckNoReturnAttr(const AttributeList &attr);
+ /// \brief Stmt attributes - this routine is the top level dispatcher.
+ StmtResult ProcessStmtAttributes(Stmt *Stmt, AttributeList *Attrs,
+ SourceRange Range);
+
void WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
bool &IncompleteImpl, unsigned DiagID);
void WarnConflictingTypedMethods(ObjCMethodDecl *Method,
@@ -2251,6 +2262,9 @@ public:
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl,
SourceLocation ColonLoc, Stmt *SubStmt);
+ StmtResult ActOnAttributedStmt(SourceLocation AttrLoc, const AttrVec &Attrs,
+ Stmt *SubStmt);
+
StmtResult ActOnIfStmt(SourceLocation IfLoc,
FullExprArg CondVal, Decl *CondVar,
Stmt *ThenVal,
@@ -3039,7 +3053,7 @@ public:
/// implicitly-declared special member functions.
class ImplicitExceptionSpecification {
// Pointer to allow copying
- ASTContext *Context;
+ Sema *Self;
// We order exception specifications thus:
// noexcept is the most restrictive, but is only used in C++0x.
// throw() comes next.
@@ -3063,9 +3077,9 @@ public:
}
public:
- explicit ImplicitExceptionSpecification(ASTContext &Context)
- : Context(&Context), ComputedEST(EST_BasicNoexcept) {
- if (!Context.getLangOpts().CPlusPlus0x)
+ explicit ImplicitExceptionSpecification(Sema &Self)
+ : Self(&Self), ComputedEST(EST_BasicNoexcept) {
+ if (!Self.Context.getLangOpts().CPlusPlus0x)
ComputedEST = EST_DynamicNone;
}
@@ -3083,7 +3097,7 @@ public:
const QualType *data() const { return Exceptions.data(); }
/// \brief Integrate another called method into the collected data.
- void CalledDecl(CXXMethodDecl *Method);
+ void CalledDecl(SourceLocation CallLoc, CXXMethodDecl *Method);
/// \brief Integrate an invoked expression into the collected data.
void CalledExpr(Expr *E);
@@ -3135,6 +3149,25 @@ public:
ImplicitExceptionSpecification
ComputeDefaultedDtorExceptionSpec(CXXRecordDecl *ClassDecl);
+ /// \brief Check the given exception-specification and update the
+ /// extended prototype information with the results.
+ void checkExceptionSpecification(ExceptionSpecificationType EST,
+ ArrayRef<ParsedType> DynamicExceptions,
+ ArrayRef<SourceRange> DynamicExceptionRanges,
+ Expr *NoexceptExpr,
+ llvm::SmallVectorImpl<QualType> &Exceptions,
+ FunctionProtoType::ExtProtoInfo &EPI);
+
+ /// \brief Add an exception-specification to the given member function
+ /// (or member function template). The exception-specification was parsed
+ /// after the method itself was declared.
+ void actOnDelayedExceptionSpecification(Decl *Method,
+ ExceptionSpecificationType EST,
+ SourceRange SpecificationRange,
+ ArrayRef<ParsedType> DynamicExceptions,
+ ArrayRef<SourceRange> DynamicExceptionRanges,
+ Expr *NoexceptExpr);
+
/// \brief Determine if a special member function should have a deleted
/// definition when it is defaulted.
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
@@ -3240,6 +3273,22 @@ public:
/// special member function.
bool isImplicitlyDeleted(FunctionDecl *FD);
+ /// \brief Check whether 'this' shows up in the type of a static member
+ /// function after the (naturally empty) cv-qualifier-seq would be.
+ ///
+ /// \returns true if an error occurred.
+ bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method);
+
+ /// \brief Whether this' shows up in the exception specification of a static
+ /// member function.
+ bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method);
+
+ /// \brief Check whether 'this' shows up in the attributes of the given
+ /// static member function.
+ ///
+ /// \returns true if an error occurred.
+ bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method);
+
/// MaybeBindToTemporary - If the passed in expression has a record type with
/// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
/// it simply returns the passed in expression.
@@ -3321,6 +3370,29 @@ public:
/// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
QualType getCurrentThisType();
+ /// \brief When non-NULL, the C++ 'this' expression is allowed despite the
+ /// current context not being a non-static member function. In such cases,
+ /// this provides the type used for 'this'.
+ QualType CXXThisTypeOverride;
+
+ /// \brief RAII object used to temporarily allow the C++ 'this' expression
+ /// to be used, with the given qualifiers on the current class type.
+ class CXXThisScopeRAII {
+ Sema &S;
+ QualType OldCXXThisTypeOverride;
+ bool Enabled;
+
+ public:
+ /// \brief Introduce a new scope where 'this' may be allowed (when enabled),
+ /// using the given declaration (which is either a class template or a
+ /// class) along with the given qualifiers.
+ /// along with the qualifiers placed on '*this'.
+ CXXThisScopeRAII(Sema &S, Decl *ContextDecl, unsigned CXXThisTypeQuals,
+ bool Enabled = true);
+
+ ~CXXThisScopeRAII();
+ };
+
/// \brief Make sure the value of 'this' is actually available in the current
/// context, if it is a potentially evaluated context.
///
@@ -3330,6 +3402,11 @@ public:
/// capture list.
void CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false);
+ /// \brief Determine whether the given type is the type of *this that is used
+ /// outside of the body of a member function for a type that is currently
+ /// being defined.
+ bool isThisOutsideMemberFunctionBody(QualType BaseType);
+
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind);
@@ -5120,7 +5197,11 @@ public:
/// We are checking the validity of a default template argument that
/// has been used when naming a template-id.
- DefaultTemplateArgumentChecking
+ DefaultTemplateArgumentChecking,
+
+ /// We are instantiating the exception specification for a function
+ /// template which was deferred until it was needed.
+ ExceptionSpecInstantiation
} Kind;
/// \brief The point of instantiation within the source code.
@@ -5168,6 +5249,7 @@ public:
switch (X.Kind) {
case TemplateInstantiation:
+ case ExceptionSpecInstantiation:
return true;
case PriorTemplateArgumentSubstitution:
@@ -5285,6 +5367,13 @@ public:
Decl *Entity,
SourceRange InstantiationRange = SourceRange());
+ struct ExceptionSpecification {};
+ /// \brief Note that we are instantiating an exception specification
+ /// of a function template.
+ InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
+ FunctionDecl *Entity, ExceptionSpecification,
+ SourceRange InstantiationRange = SourceRange());
+
/// \brief Note that we are instantiating a default argument in a
/// template-id.
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
@@ -5474,7 +5563,9 @@ public:
TypeSourceInfo *SubstFunctionDeclType(TypeSourceInfo *T,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation Loc,
- DeclarationName Entity);
+ DeclarationName Entity,
+ CXXRecordDecl *ThisContext,
+ unsigned ThisTypeQuals);
ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D,
const MultiLevelTemplateArgumentList &TemplateArgs,
int indexAdjustment,
@@ -5582,6 +5673,8 @@ public:
TemplateArgumentListInfo &Result,
const MultiLevelTemplateArgumentList &TemplateArgs);
+ void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
+ FunctionDecl *Function);
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
FunctionDecl *Function,
bool Recursive = false,
@@ -6463,11 +6556,11 @@ public:
/// and reports the appropriate diagnostics. Returns false on success.
/// Can optionally return the value of the expression.
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
- PartialDiagnostic Diag,
+ const PartialDiagnostic &Diag,
bool AllowFold,
- PartialDiagnostic FoldDiag);
+ const PartialDiagnostic &FoldDiag);
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
- PartialDiagnostic Diag,
+ const PartialDiagnostic &Diag,
bool AllowFold = true) {
return VerifyIntegerConstantExpression(E, Result, Diag, AllowFold,
PDiag(0));
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 4591630..f9bb892 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -964,6 +964,8 @@ namespace clang {
STMT_DEFAULT,
/// \brief A LabelStmt record.
STMT_LABEL,
+ /// \brief An AttributedStmt record.
+ STMT_ATTRIBUTED,
/// \brief An IfStmt record.
STMT_IF,
/// \brief A SwitchStmt record.
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 9baaf4b..a9d0fc3 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -170,6 +170,9 @@ class ReadMethodPoolVisitor;
namespace reader {
class ASTIdentifierLookupTrait;
+ /// \brief The on-disk hash table used for the DeclContext's Name lookup table.
+ typedef OnDiskChainedHashTable<ASTDeclContextNameLookupTrait>
+ ASTDeclContextNameLookupTable;
}
} // end namespace serialization
@@ -323,7 +326,9 @@ private:
// TU, and when we read those update records, the actual context will not
// be available yet (unless it's the TU), so have this pending map using the
// ID as a key. It will be realized when the context is actually loaded.
- typedef SmallVector<std::pair<void *, ModuleFile*>, 1> DeclContextVisibleUpdates;
+ typedef
+ SmallVector<std::pair<serialization::reader::ASTDeclContextNameLookupTable *,
+ ModuleFile*>, 1> DeclContextVisibleUpdates;
typedef llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
DeclContextVisibleUpdatesPending;
@@ -1467,7 +1472,7 @@ public:
llvm::DenseMap<IdentifierInfo *, uint64_t>::iterator Pos);
/// \brief Load all external visible decls in the given DeclContext.
- void completeVisibleDeclsMap(DeclContext *DC);
+ void completeVisibleDeclsMap(const DeclContext *DC);
/// \brief Retrieve the AST context that this AST reader supplements.
ASTContext &getContext() { return Context; }
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 4c62385..e693f17 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -76,6 +76,7 @@ public:
typedef SmallVectorImpl<uint64_t> RecordDataImpl;
friend class ASTDeclWriter;
+ friend class ASTStmtWriter;
private:
/// \brief Map that provides the ID numbers of each type within the
/// output stream, plus those deserialized from a chained PCH.
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index 4c93c33..786ecd3 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -27,9 +27,14 @@ namespace clang {
class DeclContext;
class Module;
-
+template<typename Info> class OnDiskChainedHashTable;
+
namespace serialization {
+namespace reader {
+ class ASTDeclContextNameLookupTrait;
+}
+
/// \brief Specifies the kind of module that has been loaded.
enum ModuleKind {
MK_Module, ///< File is a module proper.
@@ -43,7 +48,8 @@ struct DeclContextInfo {
DeclContextInfo()
: NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
- void *NameLookupTableData; // an ASTDeclContextNameLookupTable.
+ OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait>
+ *NameLookupTableData; // an ASTDeclContextNameLookupTable.
const KindDeclIDPair *LexicalDecls;
unsigned NumLexicalDecls;
};
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
index 3cbecf7..d01644ba 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
@@ -22,11 +22,6 @@
namespace clang {
-namespace idx {
- class Indexer;
- class TranslationUnit;
-}
-
namespace ento {
class CheckerManager;
@@ -46,11 +41,6 @@ class AnalysisManager : public BugReporterData {
CheckerManager *CheckerMgr;
- /// \brief Provide function definitions in other translation units. This is
- /// NULL if we don't have multiple translation units. AnalysisManager does
- /// not own the Indexer.
- idx::Indexer *Idxer;
-
enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
/// \brief The maximum number of exploded nodes the analyzer will generate.
@@ -99,7 +89,6 @@ public:
StoreManagerCreator storemgr,
ConstraintManagerCreator constraintmgr,
CheckerManager *checkerMgr,
- idx::Indexer *idxer,
unsigned maxnodes, unsigned maxvisit,
bool vizdot, bool vizubi, AnalysisPurgeMode purge,
bool eager, bool trim,
@@ -137,8 +126,6 @@ public:
CheckerManager *getCheckerManager() const { return CheckerMgr; }
- idx::Indexer *getIndexer() const { return Idxer; }
-
virtual ASTContext &getASTContext() {
return Ctx;
}
@@ -186,10 +173,6 @@ public:
bool shouldInlineCall() const { return (IPAMode == Inlining); }
- bool hasIndexer() const { return Idxer != 0; }
-
- AnalysisDeclContext *getAnalysisDeclContextInAnotherTU(const Decl *D);
-
CFG *getCFG(Decl const *D) {
return AnaCtxMgr.getContext(D)->getCFG();
}
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index ed01db2..ce3eb1d 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -425,10 +425,12 @@ class MemRegionVal : public Loc {
public:
explicit MemRegionVal(const MemRegion* r) : Loc(MemRegionKind, r) {}
+ /// \brief Get the underlining region.
const MemRegion* getRegion() const {
return static_cast<const MemRegion*>(Data);
}
+ /// \brief Get the underlining region and strip casts.
const MemRegion* stripCasts() const;
template <typename REGION>
diff --git a/include/clang/Tooling/CompilationDatabase.h b/include/clang/Tooling/CompilationDatabase.h
index 3430320..625c8ec 100644
--- a/include/clang/Tooling/CompilationDatabase.h
+++ b/include/clang/Tooling/CompilationDatabase.h
@@ -33,22 +33,21 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/YAMLParser.h"
#include <string>
#include <vector>
-namespace llvm {
-class MemoryBuffer;
-} // end namespace llvm
-
namespace clang {
namespace tooling {
/// \brief Specifies the working directory and command of a compilation.
struct CompileCommand {
CompileCommand() {}
- CompileCommand(StringRef Directory, ArrayRef<std::string> CommandLine)
- : Directory(Directory), CommandLine(CommandLine) {}
+ CompileCommand(Twine Directory, ArrayRef<std::string> CommandLine)
+ : Directory(Directory.str()), CommandLine(CommandLine) {}
/// \brief The working directory the command was executed from.
std::string Directory;
@@ -95,6 +94,59 @@ public:
StringRef FilePath) const = 0;
};
+/// \brief A compilation database that returns a single compile command line.
+///
+/// Useful when we want a tool to behave more like a compiler invocation.
+class FixedCompilationDatabase : public CompilationDatabase {
+public:
+ /// \brief Creates a FixedCompilationDatabase from the arguments after "--".
+ ///
+ /// Parses the given command line for "--". If "--" is found, the rest of
+ /// the arguments will make up the command line in the returned
+ /// FixedCompilationDatabase.
+ /// The arguments after "--" must not include positional parameters or the
+ /// argv[0] of the tool. Those will be added by the FixedCompilationDatabase
+ /// when a CompileCommand is requested. The argv[0] of the returned command
+ /// line will be "clang-tool".
+ ///
+ /// Returns NULL in case "--" is not found.
+ ///
+ /// The argument list is meant to be compatible with normal llvm command line
+ /// parsing in main methods.
+ /// int main(int argc, char **argv) {
+ /// llvm::OwningPtr<FixedCompilationDatabase> Compilations(
+ /// FixedCompilationDatabase::loadFromCommandLine(argc, argv));
+ /// cl::ParseCommandLineOptions(argc, argv);
+ /// ...
+ /// }
+ ///
+ /// \param Argc The number of command line arguments - will be changed to
+ /// the number of arguments before "--", if "--" was found in the argument
+ /// list.
+ /// \param Argv Points to the command line arguments.
+ /// \param Directory The base directory used in the FixedCompilationDatabase.
+ static FixedCompilationDatabase *loadFromCommandLine(int &Argc,
+ const char **Argv,
+ Twine Directory = ".");
+
+ /// \brief Constructs a compilation data base from a specified directory
+ /// and command line.
+ FixedCompilationDatabase(Twine Directory, ArrayRef<std::string> CommandLine);
+
+ /// \brief Returns the given compile command.
+ ///
+ /// Will always return a vector with one entry that contains the directory
+ /// and command line specified at construction with "clang-tool" as argv[0]
+ /// and 'FilePath' as positional argument.
+ virtual std::vector<CompileCommand> getCompileCommands(
+ StringRef FilePath) const;
+
+private:
+ /// This is built up to contain a single entry vector to be returned from
+ /// getCompileCommands after adding the positional argument.
+ std::vector<CompileCommand> CompileCommands;
+};
+
/// \brief A JSON based compilation database.
///
/// JSON compilation database files must contain a list of JSON objects which
@@ -114,7 +166,6 @@ public:
/// by setting the flag -DCMAKE_EXPORT_COMPILE_COMMANDS.
class JSONCompilationDatabase : public CompilationDatabase {
public:
-
/// \brief Loads a JSON compilation database from the specified file.
///
/// Returns NULL and sets ErrorMessage if the database could not be
@@ -139,7 +190,7 @@ public:
private:
/// \brief Constructs a JSON compilation database on a memory buffer.
JSONCompilationDatabase(llvm::MemoryBuffer *Database)
- : Database(Database) {}
+ : Database(Database), YAMLStream(Database->getBuffer(), SM) {}
/// \brief Parses the database file and creates the index.
///
@@ -147,14 +198,17 @@ private:
/// failed.
bool parse(std::string &ErrorMessage);
- // Tuple (directory, commandline) where 'commandline' is a JSON escaped bash
- // escaped command line.
- typedef std::pair<StringRef, StringRef> CompileCommandRef;
+ // Tuple (directory, commandline) where 'commandline' pointing to the
+ // corresponding nodes in the YAML stream.
+ typedef std::pair<llvm::yaml::ScalarNode*,
+ llvm::yaml::ScalarNode*> CompileCommandRef;
// Maps file paths to the compile command lines for that file.
llvm::StringMap< std::vector<CompileCommandRef> > IndexByFile;
llvm::OwningPtr<llvm::MemoryBuffer> Database;
+ llvm::SourceMgr SM;
+ llvm::yaml::Stream YAMLStream;
};
} // end namespace tooling
OpenPOWER on IntegriCloud