aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/IdentifierResolver.cpp16
-rw-r--r--lib/Sema/IdentifierResolver.h10
-rw-r--r--lib/Sema/JumpDiagnostics.cpp60
-rw-r--r--lib/Sema/ParseAST.cpp14
-rw-r--r--lib/Sema/Sema.cpp100
-rw-r--r--lib/Sema/Sema.h688
-rw-r--r--lib/Sema/SemaAccess.cpp19
-rw-r--r--lib/Sema/SemaAttr.cpp38
-rw-r--r--lib/Sema/SemaCXXCast.cpp67
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp126
-rw-r--r--lib/Sema/SemaChecking.cpp340
-rw-r--r--lib/Sema/SemaDecl.cpp722
-rw-r--r--lib/Sema/SemaDeclAttr.cpp17
-rw-r--r--lib/Sema/SemaDeclCXX.cpp803
-rw-r--r--lib/Sema/SemaDeclObjC.cpp574
-rw-r--r--lib/Sema/SemaExpr.cpp697
-rw-r--r--lib/Sema/SemaExprCXX.cpp233
-rw-r--r--lib/Sema/SemaExprObjC.cpp161
-rw-r--r--lib/Sema/SemaInherit.cpp40
-rw-r--r--lib/Sema/SemaInherit.h25
-rw-r--r--lib/Sema/SemaInit.cpp300
-rw-r--r--lib/Sema/SemaLookup.cpp256
-rw-r--r--lib/Sema/SemaOverload.cpp743
-rw-r--r--lib/Sema/SemaOverload.h20
-rw-r--r--lib/Sema/SemaStmt.cpp196
-rw-r--r--lib/Sema/SemaTemplate.cpp726
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp544
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp219
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp352
-rw-r--r--lib/Sema/SemaType.cpp213
-rw-r--r--lib/Sema/TreeTransform.h2219
31 files changed, 5238 insertions, 5300 deletions
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index a36b85a87a..0dbf21961f 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -32,7 +32,7 @@ class IdentifierResolver::IdDeclInfoMap {
// New vectors are added when the current one is full.
std::list< std::vector<IdDeclInfo> > IDIVecs;
unsigned int CurIndex;
-
+
public:
IdDeclInfoMap() : CurIndex(VECTOR_SIZE) {}
@@ -75,7 +75,7 @@ void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) {
assert(0 && "Didn't find this decl on its identifier's chain!");
}
-bool
+bool
IdentifierResolver::IdDeclInfo::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
for (DeclsTy::iterator I = Decls.end(); I != Decls.begin(); --I) {
if (Old == *(I-1)) {
@@ -108,7 +108,7 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx,
if (Ctx->isFunctionOrMethod()) {
// Ignore the scopes associated within transparent declaration contexts.
- while (S->getEntity() &&
+ while (S->getEntity() &&
((DeclContext *)S->getEntity())->isTransparentContext())
S = S->getParent();
@@ -200,14 +200,14 @@ void IdentifierResolver::RemoveDecl(NamedDecl *D) {
Name.setFETokenInfo(NULL);
return;
}
-
+
return toIdDeclInfo(Ptr)->RemoveDecl(D);
}
bool IdentifierResolver::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
- assert(Old->getDeclName() == New->getDeclName() &&
+ assert(Old->getDeclName() == New->getDeclName() &&
"Cannot replace a decl with another decl of a different name");
-
+
DeclarationName Name = Old->getDeclName();
void *Ptr = Name.getFETokenInfo<void>();
@@ -222,7 +222,7 @@ bool IdentifierResolver::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
return false;
}
- return toIdDeclInfo(Ptr)->ReplaceDecl(Old, New);
+ return toIdDeclInfo(Ptr)->ReplaceDecl(Old, New);
}
/// begin - Returns an iterator for decls with name 'Name'.
@@ -243,7 +243,7 @@ IdentifierResolver::begin(DeclarationName Name) {
return end();
}
-void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
+void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
NamedDecl *D) {
void *Ptr = II->getFETokenInfo<void>();
diff --git a/lib/Sema/IdentifierResolver.h b/lib/Sema/IdentifierResolver.h
index 0b0e6b388d..65f3256c21 100644
--- a/lib/Sema/IdentifierResolver.h
+++ b/lib/Sema/IdentifierResolver.h
@@ -99,7 +99,7 @@ public:
assert(isIterator() && "Ptr not an iterator!");
return reinterpret_cast<BaseIter>(Ptr & ~0x3);
}
-
+
friend class IdentifierResolver;
public:
iterator() : Ptr(0) {}
@@ -110,14 +110,14 @@ public:
else
return reinterpret_cast<NamedDecl*>(Ptr);
}
-
+
bool operator==(const iterator &RHS) const {
return Ptr == RHS.Ptr;
}
bool operator!=(const iterator &RHS) const {
return Ptr != RHS.Ptr;
}
-
+
// Preincrement.
iterator& operator++() {
if (!isIterator()) // common case.
@@ -127,7 +127,7 @@ public:
void *InfoPtr = D->getDeclName().getFETokenInfo<void>();
assert(!isDeclPtr(InfoPtr) && "Decl with wrong id ?");
IdDeclInfo *Info = toIdDeclInfo(InfoPtr);
-
+
BaseIter I = getIterator();
if (I != Info->decls_begin())
*this = iterator(I-1);
@@ -138,7 +138,7 @@ public:
}
uintptr_t getAsOpaqueValue() const { return Ptr; }
-
+
static iterator getFromOpaqueValue(uintptr_t P) {
iterator Result;
Result.Ptr = P;
diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp
index 853adaa336..a8e31d2cfa 100644
--- a/lib/Sema/JumpDiagnostics.cpp
+++ b/lib/Sema/JumpDiagnostics.cpp
@@ -28,7 +28,7 @@ namespace {
///
class JumpScopeChecker {
Sema &S;
-
+
/// GotoScope - This is a record that we use to keep track of all of the
/// scopes that are introduced by VLAs and other things that scope jumps like
/// gotos. This scope tree has nothing to do with the source scope tree,
@@ -38,17 +38,17 @@ class JumpScopeChecker {
/// ParentScope - The index in ScopeMap of the parent scope. This is 0 for
/// the parent scope is the function body.
unsigned ParentScope;
-
+
/// Diag - The diagnostic to emit if there is a jump into this scope.
unsigned Diag;
-
+
/// Loc - Location to emit the diagnostic.
SourceLocation Loc;
-
+
GotoScope(unsigned parentScope, unsigned diag, SourceLocation L)
: ParentScope(parentScope), Diag(diag), Loc(L) {}
};
-
+
llvm::SmallVector<GotoScope, 48> Scopes;
llvm::DenseMap<Stmt*, unsigned> LabelAndGotoScopes;
llvm::SmallVector<Stmt*, 16> Jumps;
@@ -66,15 +66,15 @@ private:
JumpScopeChecker::JumpScopeChecker(Stmt *Body, Sema &s) : S(s) {
// Add a scope entry for function scope.
Scopes.push_back(GotoScope(~0U, ~0U, SourceLocation()));
-
+
// Build information for the top level compound statement, so that we have a
// defined scope record for every "goto" and label.
BuildScopeInformation(Body, 0);
-
+
// Check that all jumps we saw are kosher.
VerifyJumps();
}
-
+
/// GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a
/// diagnostic that should be emitted if control goes over it. If not, return 0.
static unsigned GetDiagForGotoScopeDecl(const Decl *D) {
@@ -89,7 +89,7 @@ static unsigned GetDiagForGotoScopeDecl(const Decl *D) {
if (TD->getUnderlyingType()->isVariablyModifiedType())
return diag::note_protected_by_vla_typedef;
}
-
+
return 0;
}
@@ -99,7 +99,7 @@ static unsigned GetDiagForGotoScopeDecl(const Decl *D) {
/// statements, adding any labels or gotos to LabelAndGotoScopes and recursively
/// walking the AST as needed.
void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
-
+
// If we found a label, remember that it is in ParentScope scope.
if (isa<LabelStmt>(S) || isa<DefaultStmt>(S) || isa<CaseStmt>(S)) {
LabelAndGotoScopes[S] = ParentScope;
@@ -110,12 +110,12 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
LabelAndGotoScopes[S] = ParentScope;
Jumps.push_back(S);
}
-
+
for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end(); CI != E;
++CI) {
Stmt *SubStmt = *CI;
if (SubStmt == 0) continue;
-
+
// FIXME: diagnose jumps past initialization: required in C++, warning in C.
// goto L; int X = 4; L: ;
@@ -131,7 +131,7 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
Scopes.push_back(GotoScope(ParentScope, Diag, (*I)->getLocation()));
ParentScope = Scopes.size()-1;
}
-
+
// If the decl has an initializer, walk it with the potentially new
// scope we just installed.
if (VarDecl *VD = dyn_cast<VarDecl>(*I))
@@ -156,10 +156,10 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
Scopes.push_back(GotoScope(ParentScope,
diag::note_protected_by_objc_catch,
AC->getAtCatchLoc()));
- // @catches are nested and it isn't
+ // @catches are nested and it isn't
BuildScopeInformation(AC->getCatchBody(), Scopes.size()-1);
}
-
+
// Jump from the finally to the try or catch is not valid.
if (ObjCAtFinallyStmt *AF = AT->getFinallyStmt()) {
Scopes.push_back(GotoScope(ParentScope,
@@ -167,17 +167,17 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
AF->getAtFinallyLoc()));
BuildScopeInformation(AF, Scopes.size()-1);
}
-
+
continue;
}
-
+
// Disallow jumps into the protected statement of an @synchronized, but
// allow jumps into the object expression it protects.
if (ObjCAtSynchronizedStmt *AS = dyn_cast<ObjCAtSynchronizedStmt>(SubStmt)){
// Recursively walk the AST for the @synchronized object expr, it is
// evaluated in the normal scope.
BuildScopeInformation(AS->getSynchExpr(), ParentScope);
-
+
// Recursively walk the AST for the @synchronized part, protected by a new
// scope.
Scopes.push_back(GotoScope(ParentScope,
@@ -196,7 +196,7 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
BuildScopeInformation(TryBlock, Scopes.size()-1);
// Jump from the catch into the try is not allowed either.
- for(unsigned I = 0, E = TS->getNumHandlers(); I != E; ++I) {
+ for (unsigned I = 0, E = TS->getNumHandlers(); I != E; ++I) {
CXXCatchStmt *CS = TS->getHandler(I);
Scopes.push_back(GotoScope(ParentScope,
diag::note_protected_by_cxx_catch,
@@ -217,14 +217,14 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) {
void JumpScopeChecker::VerifyJumps() {
while (!Jumps.empty()) {
Stmt *Jump = Jumps.pop_back_val();
-
- // With a goto,
+
+ // With a goto,
if (GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
CheckJump(GS, GS->getLabel(), GS->getGotoLoc(),
diag::err_goto_into_protected_scope);
continue;
}
-
+
if (SwitchStmt *SS = dyn_cast<SwitchStmt>(Jump)) {
for (SwitchCase *SC = SS->getSwitchCaseList(); SC;
SC = SC->getNextSwitchCase()) {
@@ -236,7 +236,7 @@ void JumpScopeChecker::VerifyJumps() {
}
unsigned DiagnosticScope;
-
+
// We don't know where an indirect goto goes, require that it be at the
// top level of scoping.
if (IndirectGotoStmt *IG = dyn_cast<IndirectGotoStmt>(Jump)) {
@@ -254,12 +254,12 @@ void JumpScopeChecker::VerifyJumps() {
// indirectly jumping to the label.
assert(isa<AddrLabelExpr>(Jump) && "Unknown jump type");
LabelStmt *TheLabel = cast<AddrLabelExpr>(Jump)->getLabel();
-
+
assert(LabelAndGotoScopes.count(TheLabel) &&
"Referenced label didn't get added to scopes?");
unsigned LabelScope = LabelAndGotoScopes[TheLabel];
if (LabelScope == 0) continue; // Addr of label is ok.
-
+
S.Diag(Jump->getLocStart(), diag::err_addr_of_label_in_protected_scope);
DiagnosticScope = LabelScope;
}
@@ -282,10 +282,10 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To,
assert(LabelAndGotoScopes.count(To) && "Jump didn't get added to scopes?");
unsigned ToScope = LabelAndGotoScopes[To];
-
+
// Common case: exactly the same scope, which is fine.
if (FromScope == ToScope) return;
-
+
// The only valid mismatch jump case happens when the jump is more deeply
// nested inside the jump target. Do a quick scan to see if the jump is valid
// because valid code is more common than invalid code.
@@ -294,11 +294,11 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To,
// If we found the jump target, then we're jumping out of our current scope,
// which is perfectly fine.
if (TestScope == ToScope) return;
-
+
// Otherwise, scan up the hierarchy.
TestScope = Scopes[TestScope].ParentScope;
}
-
+
// If we get here, then we know we have invalid code. Diagnose the bad jump,
// and then emit a note at each VLA being jumped out of.
S.Diag(DiagLoc, JumpDiag);
@@ -318,7 +318,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To,
FromScopes.pop_back();
ToScopes.pop_back();
}
-
+
// Emit diagnostics for whatever is left in ToScopes.
for (unsigned i = 0, e = ToScopes.size(); i != e; ++i)
S.Diag(Scopes[ToScopes[i]].Loc, Scopes[ToScopes[i]].Diag);
diff --git a/lib/Sema/ParseAST.cpp b/lib/Sema/ParseAST.cpp
index b6e52570ea..196c1c1b85 100644
--- a/lib/Sema/ParseAST.cpp
+++ b/lib/Sema/ParseAST.cpp
@@ -43,17 +43,17 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit);
Parser P(PP, S);
PP.EnterMainSourceFile();
-
+
// Initialize the parser.
P.Initialize();
-
+
Consumer->Initialize(Ctx);
-
+
if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer))
SC->InitializeSema(S);
if (ExternalASTSource *External = Ctx.getExternalSource()) {
- if (ExternalSemaSource *ExternalSema =
+ if (ExternalSemaSource *ExternalSema =
dyn_cast<ExternalSemaSource>(External))
ExternalSema->InitializeSema(S);
@@ -61,7 +61,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
}
Parser::DeclGroupPtrTy ADecl;
-
+
while (!P.ParseTopLevelDecl(ADecl)) { // Not end of file.
// If we got a null return and something *was* parsed, ignore it. This
// is due to a top-level semicolon, an action override, or a parse error
@@ -69,7 +69,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
if (ADecl)
Consumer->HandleTopLevelDecl(ADecl.getAsVal<DeclGroupRef>());
};
-
+
// process any TopLevelDecls generated by #pragma weak
for (llvm::SmallVector<Decl*,2>::iterator
I = S.WeakTopLevelDecls().begin(),
@@ -85,7 +85,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
Decl::PrintStats();
Stmt::PrintStats();
Consumer->PrintStats();
-
+
Decl::CollectingStats(false);
Stmt::CollectingStats(false);
}
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 2d72c3e1be..b158c85414 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -23,7 +23,7 @@
#include "clang/Basic/TargetInfo.h"
using namespace clang;
-/// ConvertQualTypeToStringFn - This function is used to pretty print the
+/// ConvertQualTypeToStringFn - This function is used to pretty print the
/// specified QualType as a string in diagnostics.
static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
const char *Modifier, unsigned ModLen,
@@ -31,7 +31,7 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
llvm::SmallVectorImpl<char> &Output,
void *Cookie) {
ASTContext &Context = *static_cast<ASTContext*>(Cookie);
-
+
std::string S;
if (Kind == Diagnostic::ak_qualtype) {
assert(ModLen == 0 && ArgLen == 0 &&
@@ -41,7 +41,7 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
// FIXME: Playing with std::string is really slow.
S = Ty.getAsString(Context.PrintingPolicy);
-
+
// If this is a sugared type (like a typedef, typeof, etc), then unwrap one
// level of the sugar so that the type is more obvious to the user.
QualType DesugaredTy = Ty->getDesugaredType(true);
@@ -56,13 +56,13 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
// Don't aka just because we saw an elaborated type.
(!isa<ElaboratedType>(Ty) ||
cast<ElaboratedType>(Ty)->getUnderlyingType() != DesugaredTy) &&
-
+
// Don't desugar magic Objective-C types.
Ty.getUnqualifiedType() != Context.getObjCIdType() &&
Ty.getUnqualifiedType() != Context.getObjCClassType() &&
Ty.getUnqualifiedType() != Context.getObjCSelType() &&
Ty.getUnqualifiedType() != Context.getObjCProtoType() &&
-
+
// Not va_list.
Ty.getUnqualifiedType() != Context.getBuiltinVaListType()) {
S = "'"+S+"' (aka '";
@@ -71,12 +71,12 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
Output.append(S.begin(), S.end());
return;
}
-
+
} else if (Kind == Diagnostic::ak_declarationname) {
-
+
DeclarationName N = DeclarationName::getFromOpaqueInteger(Val);
S = N.getAsString();
-
+
if (ModLen == 9 && !memcmp(Modifier, "objcclass", 9) && ArgLen == 0)
S = '+' + S;
else if (ModLen == 12 && !memcmp(Modifier, "objcinstance", 12) && ArgLen==0)
@@ -87,7 +87,7 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
} else if (Kind == Diagnostic::ak_nameddecl) {
if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0)
S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString();
- else {
+ else {
assert(ModLen == 0 && ArgLen == 0 &&
"Invalid modifier for NamedDecl* argument");
S = reinterpret_cast<NamedDecl*>(Val)->getNameAsString();
@@ -95,10 +95,10 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
} else {
llvm::raw_string_ostream OS(S);
assert(Kind == Diagnostic::ak_nestednamespec);
- reinterpret_cast<NestedNameSpecifier*> (Val)->print(OS,
+ reinterpret_cast<NestedNameSpecifier*> (Val)->print(OS,
Context.PrintingPolicy);
}
-
+
Output.push_back('\'');
Output.append(S.begin(), S.end());
Output.push_back('\'');
@@ -107,11 +107,11 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
static inline RecordDecl *CreateStructDecl(ASTContext &C, const char *Name) {
if (C.getLangOptions().CPlusPlus)
- return CXXRecordDecl::Create(C, TagDecl::TK_struct,
+ return CXXRecordDecl::Create(C, TagDecl::TK_struct,
C.getTranslationUnitDecl(),
SourceLocation(), &C.Idents.get(Name));
- return RecordDecl::Create(C, TagDecl::TK_struct,
+ return RecordDecl::Create(C, TagDecl::TK_struct,
C.getTranslationUnitDecl(),
SourceLocation(), &C.Idents.get(Name));
}
@@ -119,7 +119,7 @@ static inline RecordDecl *CreateStructDecl(ASTContext &C, const char *Name) {
void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
TUScope = S;
PushDeclContext(S, Context.getTranslationUnitDecl());
-
+
if (PP.getTargetInfo().getPointerWidth(0) >= 64) {
// Install [u]int128_t for 64-bit targets.
PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
@@ -131,16 +131,16 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
&Context.Idents.get("__uint128_t"),
Context.UnsignedInt128Ty), TUScope);
}
-
-
+
+
if (!PP.getLangOptions().ObjC1) return;
-
+
// Built-in ObjC types may already be set by PCHReader (hence isNull checks).
if (Context.getObjCSelType().isNull()) {
// Synthesize "typedef struct objc_selector *SEL;"
RecordDecl *SelTag = CreateStructDecl(Context, "objc_selector");
PushOnScopeChains(SelTag, TUScope);
-
+
QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag));
TypedefDecl *SelTypedef = TypedefDecl::Create(Context, CurContext,
SourceLocation(),
@@ -154,15 +154,15 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
if (Context.getObjCProtoType().isNull()) {
ObjCInterfaceDecl *ProtocolDecl =
ObjCInterfaceDecl::Create(Context, CurContext, SourceLocation(),
- &Context.Idents.get("Protocol"),
+ &Context.Idents.get("Protocol"),
SourceLocation(), true);
Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl));
PushOnScopeChains(ProtocolDecl, TUScope);
}
// Create the built-in typedef for 'id'.
if (Context.getObjCIdType().isNull()) {
- TypedefDecl *IdTypedef =
- TypedefDecl::Create(
+ TypedefDecl *IdTypedef =
+ TypedefDecl::Create(
Context, CurContext, SourceLocation(), &Context.Idents.get("id"),
Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy)
);
@@ -172,8 +172,8 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
}
// Create the built-in typedef for 'Class'.
if (Context.getObjCClassType().isNull()) {
- TypedefDecl *ClassTypedef =
- TypedefDecl::Create(
+ TypedefDecl *ClassTypedef =
+ TypedefDecl::Create(
Context, CurContext, SourceLocation(), &Context.Idents.get("Class"),
Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy)
);
@@ -186,36 +186,36 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
bool CompleteTranslationUnit)
: LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer),
- Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
+ Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
ExternalSource(0), CurContext(0), PreDeclaratorDC(0),
CurBlock(0), PackContext(0), IdResolver(pp.getLangOptions()),
GlobalNewDeleteDeclared(false), ExprEvalContext(PotentiallyEvaluated),
CompleteTranslationUnit(CompleteTranslationUnit),
NumSFINAEErrors(0), CurrentInstantiationScope(0) {
-
+
StdNamespace = 0;
TUScope = 0;
if (getLangOptions().CPlusPlus)
FieldCollector.reset(new CXXFieldCollector());
-
+
// Tell diagnostics how to render things from the AST library.
PP.getDiagnostics().SetArgToStringFn(ConvertArgToStringFn, &Context);
}
-/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
+/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
/// If there is already an implicit cast, merge into the existing one.
/// If isLvalue, the result of the cast is an lvalue.
-void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
+void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
const CastExpr::CastInfo &Info, bool isLvalue) {
QualType ExprTy = Context.getCanonicalType(Expr->getType());
QualType TypeTy = Context.getCanonicalType(Ty);
-
+
if (ExprTy == TypeTy)
return;
-
+
if (Expr->getType().getTypePtr()->isPointerType() &&
Ty.getTypePtr()->isPointerType()) {
- QualType ExprBaseType =
+ QualType ExprBaseType =
cast<PointerType>(ExprTy.getUnqualifiedType())->getPointeeType();
QualType BaseType =
cast<PointerType>(TypeTy.getUnqualifiedType())->getPointeeType();
@@ -224,12 +224,12 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
<< Expr->getSourceRange();
}
}
-
+
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
ImpCast->setType(Ty);
ImpCast->setLvalueCast(isLvalue);
- } else
- Expr = new (Context) ImplicitCastExpr(Ty, Info, Expr,
+ } else
+ Expr = new (Context) ImplicitCastExpr(Ty, Info, Expr,
isLvalue);
}
@@ -250,12 +250,12 @@ void Sema::ActOnEndOfTranslationUnit() {
// keep track of the point of instantiation (C++ [temp.point]). This means
// that name lookup that occurs within the template instantiation will
// always happen at the end of the translation unit, so it will find
- // some names that should not be found. Although this is common behavior
+ // some names that should not be found. Although this is common behavior
// for C++ compilers, it is technically wrong. In the future, we either need
// to be able to filter the results of name lookup or we need to perform
// template instantiations earlier.
PerformPendingImplicitInstantiations();
-
+
// Check for #pragma weak identifiers that were never declared
// FIXME: This will cause diagnostics to be emitted in a non-determinstic
// order! Iterating over a densemap like this is bad.
@@ -263,7 +263,7 @@ void Sema::ActOnEndOfTranslationUnit() {
I = WeakUndeclaredIdentifiers.begin(),
E = WeakUndeclaredIdentifiers.end(); I != E; ++I) {
if (I->second.getUsed()) continue;
-
+
Diag(I->second.getLocation(), diag::warn_weak_identifier_undeclared)
<< I->first;
}
@@ -284,29 +284,29 @@ void Sema::ActOnEndOfTranslationUnit() {
// translation unit, with an initializer equal to 0.
for (unsigned i = 0, e = TentativeDefinitionList.size(); i != e; ++i) {
VarDecl *VD = TentativeDefinitions.lookup(TentativeDefinitionList[i]);
-
+
// If the tentative definition was completed, it will be in the list, but
// not the map.
if (VD == 0 || VD->isInvalidDecl() || !VD->isTentativeDefinition(Context))
continue;
- if (const IncompleteArrayType *ArrayT
+ if (const IncompleteArrayType *ArrayT
= Context.getAsIncompleteArrayType(VD->getType())) {
- if (RequireCompleteType(VD->getLocation(),
+ if (RequireCompleteType(VD->getLocation(),
ArrayT->getElementType(),
diag::err_tentative_def_incomplete_type_arr)) {
VD->setInvalidDecl();
continue;
}
-
+
// Set the length of the array to 1 (C99 6.9.2p5).
Diag(VD->getLocation(), diag::warn_tentative_incomplete_array);
llvm::APInt One(Context.getTypeSize(Context.getSizeType()), true);
- QualType T
+ QualType T
= Context.getConstantArrayWithoutExprType(ArrayT->getElementType(),
One, ArrayType::Normal, 0);
VD->setType(T);
- } else if (RequireCompleteType(VD->getLocation(), VD->getType(),
+ } else if (RequireCompleteType(VD->getLocation(), VD->getType(),
diag::err_tentative_def_incomplete_type))
VD->setInvalidDecl();
@@ -324,10 +324,10 @@ void Sema::ActOnEndOfTranslationUnit() {
DeclContext *Sema::getFunctionLevelDeclContext() {
DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
-
+
while (isa<BlockDecl>(DC))
DC = DC->getParent();
-
+
return DC;
}
@@ -351,7 +351,7 @@ NamedDecl *Sema::getCurFunctionOrMethodDecl() {
return 0;
}
-void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
+void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
DeclarationName Member,
NestedNameSpecifier *NNS, SourceRange Range) {
switch (NNS->getKind()) {
@@ -379,17 +379,17 @@ void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
if (!this->Emit())
return;
-
+
// If this is not a note, and we're in a template instantiation
// that is different from the last template instantiation where
// we emitted an error, print a template instantiation
// backtrace.
if (!SemaRef.Diags.isBuiltinNote(DiagID) &&
!SemaRef.ActiveTemplateInstantiations.empty() &&
- SemaRef.ActiveTemplateInstantiations.back()
+ SemaRef.ActiveTemplateInstantiations.back()
!= SemaRef.LastTemplateInstantiationErrorContext) {
SemaRef.PrintInstantiationStack();
- SemaRef.LastTemplateInstantiationErrorContext
+ SemaRef.LastTemplateInstantiationErrorContext
= SemaRef.ActiveTemplateInstantiations.back();
}
}
@@ -398,7 +398,7 @@ Sema::SemaDiagnosticBuilder
Sema::Diag(SourceLocation Loc, const PartialDiagnostic& PD) {
SemaDiagnosticBuilder Builder(Diag(Loc, PD.getDiagID()));
PD.Emit(Builder);
-
+
return Builder;
}
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index ee893e2e0d..a73a2b912c 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -100,30 +100,30 @@ struct BlockSemaInfo {
bool hasPrototype;
bool isVariadic;
bool hasBlockDeclRefExprs;
-
+
BlockDecl *TheDecl;
-
+
/// TheScope - This is the scope for the block itself, which contains
/// arguments etc.
Scope *TheScope;
-
+
/// ReturnType - This will get set to block result type, by looking at
/// return types, if any, in the block body.
QualType ReturnType;
-
+
/// LabelMap - This is a mapping from label identifiers to the LabelStmt for
/// it (which acts like the label decl in some ways). Forward referenced
/// labels have a LabelStmt created for them with a null location & SubStmt.
llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
-
+
/// SwitchStack - This is the current set of active switch statements in the
/// block.
llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
-
+
/// SavedFunctionNeedsScopeChecking - This is the value of
/// CurFunctionNeedsScopeChecking at the point when the block started.
bool SavedFunctionNeedsScopeChecking;
-
+
/// PrevBlockInfo - If this is nested inside another block, this points
/// to the outer block.
BlockSemaInfo *PrevBlockInfo;
@@ -138,7 +138,7 @@ struct BlockSemaInfo {
class LocInfoType : public Type {
enum {
// The last number that can fit in Type's TC.
- // Avoids conflict with an existing Type c