From: Michael Gottesman Date: Sun, 20 Jan 2013 01:04:14 +0000 (+0000) Subject: Fixed trailing whitespace. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0116a40116616701282e12f3d92cf2949102d76a;p=clang Fixed trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172939 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 82d2811f3a..19da55cd25 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -50,12 +50,12 @@ PrintingPolicy Sema::getPrintingPolicy(const ASTContext &Context, Policy.Bool = Context.getLangOpts().Bool; if (!Policy.Bool) { if (MacroInfo *BoolMacro = PP.getMacroInfo(&Context.Idents.get("bool"))) { - Policy.Bool = BoolMacro->isObjectLike() && + Policy.Bool = BoolMacro->isObjectLike() && BoolMacro->getNumTokens() == 1 && BoolMacro->getReplacementToken(0).is(tok::kw__Bool); } } - + return Policy; } @@ -69,7 +69,7 @@ void Sema::ActOnTranslationUnitScope(Scope *S) { Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind, CodeCompleteConsumer *CodeCompleter) - : TheTargetAttributesSema(0), ExternalSource(0), + : TheTargetAttributesSema(0), ExternalSource(0), isMultiplexExternalSource(false), FPFeatures(pp.getLangOpts()), LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()), @@ -83,7 +83,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, NSStringDecl(0), StringWithUTF8StringMethod(0), NSArrayDecl(0), ArrayWithObjectsMethod(0), NSDictionaryDecl(0), DictionaryWithObjectsMethod(0), - GlobalNewDeleteDeclared(false), + GlobalNewDeleteDeclared(false), TUKind(TUKind), NumSFINAEErrors(0), InFunctionDeclarator(0), AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false), @@ -92,7 +92,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, AnalysisWarnings(*this) { TUScope = 0; - + LoadedExternalKnownNamespaces = false; for (unsigned I = 0; I != NSAPI::NumNSNumberLiteralMethods; ++I) NSNumberLiteralMethods[I] = 0; @@ -104,7 +104,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, FieldCollector.reset(new CXXFieldCollector()); // Tell diagnostics how to render things from the AST library. - PP.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument, + PP.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &Context); ExprEvalContexts.push_back( @@ -117,11 +117,11 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, void Sema::Initialize() { // Tell the AST consumer about this Sema object. Consumer.Initialize(Context); - + // FIXME: Isn't this redundant with the initialization above? if (SemaConsumer *SC = dyn_cast(&Consumer)) SC->InitializeSema(*this); - + // Tell the external Sema source about this Sema object. if (ExternalSemaSource *ExternalSema = dyn_cast_or_null(Context.getExternalSource())) @@ -139,7 +139,7 @@ void Sema::Initialize() { if (IdResolver.begin(UInt128) == IdResolver.end()) PushOnScopeChains(Context.getUInt128Decl(), TUScope); } - + // Initialize predefined Objective-C types: if (PP.getLangOpts().ObjC1) { @@ -154,7 +154,7 @@ void Sema::Initialize() { DeclarationName Id = &Context.Idents.get("id"); if (IdResolver.begin(Id) == IdResolver.end()) PushOnScopeChains(Context.getObjCIdDecl(), TUScope); - + // Create the built-in typedef for 'Class'. DeclarationName Class = &Context.Idents.get("Class"); if (IdResolver.begin(Class) == IdResolver.end()) @@ -181,7 +181,7 @@ Sema::~Sema() { delete FunctionScopes[I]; if (FunctionScopes.size() == 1) delete FunctionScopes[0]; - + // Tell the SemaConsumer to forget about us; we're going out of scope. if (SemaConsumer *SC = dyn_cast(&Consumer)) SC->ForgetSema(); @@ -209,7 +209,7 @@ bool Sema::makeUnavailableInSystemHeader(SourceLocation loc, // If we're in template instantiation, it's an error. if (!ActiveTemplateInstantiations.empty()) return false; - + // If that function's not in a system header, it's an error. if (!Context.getSourceManager().isInSystemHeader(loc)) return false; @@ -288,13 +288,13 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, // If this is a derived-to-base cast to a through a virtual base, we // need a vtable. - if (Kind == CK_DerivedToBase && + if (Kind == CK_DerivedToBase && BasePathInvolvesVirtualBase(*BasePath)) { QualType T = E->getType(); if (const PointerType *Pointer = T->getAs()) T = Pointer->getPointeeType(); if (const RecordType *RecordTy = T->getAs()) - MarkVTableUsed(E->getLocStart(), + MarkVTableUsed(E->getLocStart(), cast(RecordTy->getDecl())); } @@ -348,7 +348,7 @@ static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) { if (const VarDecl *VD = dyn_cast(D)) { // UnusedFileScopedDecls stores the first declaration. // The declaration may have become definition so check again. - const VarDecl *DeclToCheck = VD->getDefinition(); + const VarDecl *DeclToCheck = VD->getDefinition(); if (DeclToCheck) return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); @@ -430,7 +430,7 @@ static void checkUndefinedInternals(Sema &S) { void Sema::LoadExternalWeakUndeclaredIdentifiers() { if (!ExternalSource) return; - + SmallVector, 4> WeakIDs; ExternalSource->ReadWeakUndeclaredIdentifiers(WeakIDs); for (unsigned I = 0, N = WeakIDs.size(); I != N; ++I) { @@ -438,7 +438,7 @@ void Sema::LoadExternalWeakUndeclaredIdentifiers() { = WeakUndeclaredIdentifiers.find(WeakIDs[I].first); if (Pos != WeakUndeclaredIdentifiers.end()) continue; - + WeakUndeclaredIdentifiers.insert(WeakIDs[I]); } } @@ -567,9 +567,9 @@ void Sema::ActOnEndOfTranslationUnit() { // or we need to perform template instantiations earlier. PerformPendingInstantiations(); } - + // Remove file scoped decls that turned out to be used. - UnusedFileScopedDecls.erase(std::remove_if(UnusedFileScopedDecls.begin(0, + UnusedFileScopedDecls.erase(std::remove_if(UnusedFileScopedDecls.begin(0, true), UnusedFileScopedDecls.end(), std::bind1st(std::ptr_fun(ShouldRemoveFromUnused), @@ -600,19 +600,19 @@ void Sema::ActOnEndOfTranslationUnit() { // now. if (Module *CurrentModule = PP.getCurrentModule()) { ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap(); - + SmallVector Stack; Stack.push_back(CurrentModule); while (!Stack.empty()) { Module *Mod = Stack.back(); Stack.pop_back(); - + // Resolve the exported declarations. // FIXME: Actually complain, once we figure out how to teach the // diagnostic client to deal with complains in the module map at this // point. ModMap.resolveExports(Mod, /*Complain=*/false); - + // Queue the submodules, so their exports will also be resolved. for (Module::submodule_iterator Sub = Mod->submodule_begin(), SubEnd = Mod->submodule_end(); @@ -621,12 +621,12 @@ void Sema::ActOnEndOfTranslationUnit() { } } } - + // Modules don't need any of the checking below. TUScope = 0; return; } - + // C99 6.9.2p2: // A declaration of an identifier for an object that has file // scope without an initializer, and without a storage-class @@ -639,10 +639,10 @@ void Sema::ActOnEndOfTranslationUnit() { // identifier, with the composite type as of the end of the // translation unit, with an initializer equal to 0. llvm::SmallSet Seen; - for (TentativeDefinitionsType::iterator + for (TentativeDefinitionsType::iterator T = TentativeDefinitions.begin(ExternalSource), TEnd = TentativeDefinitions.end(); - T != TEnd; ++T) + T != TEnd; ++T) { VarDecl *VD = (*T)->getActingDefinition(); @@ -694,7 +694,7 @@ void Sema::ActOnEndOfTranslationUnit() { E = UnusedFileScopedDecls.end(); I != E; ++I) { if (ShouldRemoveFromUnused(this, *I)) continue; - + if (const FunctionDecl *FD = dyn_cast(*I)) { const FunctionDecl *DiagD; if (!FD->hasBody(DiagD)) @@ -821,7 +821,7 @@ void Sema::EmitCurrentDiagnostic(unsigned DiagID) { case DiagnosticIDs::SFINAE_Report: // We'll report the diagnostic below. break; - + case DiagnosticIDs::SFINAE_SubstitutionFailure: // Count this failure so that we know that template argument deduction // has failed. @@ -838,7 +838,7 @@ void Sema::EmitCurrentDiagnostic(unsigned DiagID) { Diags.setLastDiagnosticIgnored(); Diags.Clear(); return; - + case DiagnosticIDs::SFINAE_AccessControl: { // Per C++ Core Issue 1170, access control is part of SFINAE. // Additionally, the AccessCheckingSFINAE flag can be used to temporarily @@ -888,10 +888,10 @@ void Sema::EmitCurrentDiagnostic(unsigned DiagID) { return; } } - + // Set up the context's printing policy based on our current state. Context.setPrintingPolicy(getPrintingPolicy()); - + // Emit the diagnostic. if (!Diags.EmitCurrentDiagnostic()) return; @@ -950,10 +950,10 @@ bool Sema::findMacroSpelling(SourceLocation &locref, StringRef name) { /// \returns The scope corresponding to the given declaraion context, or NULL /// if no such scope is open. Scope *Sema::getScopeForContext(DeclContext *Ctx) { - + if (!Ctx) return 0; - + Ctx = Ctx->getPrimaryContext(); for (Scope *S = getCurScope(); S; S = S->getParent()) { // Ignore scopes that cannot have declarations. This is important for @@ -963,7 +963,7 @@ Scope *Sema::getScopeForContext(DeclContext *Ctx) { if (Ctx == Entity->getPrimaryContext()) return S; } - + return 0; } @@ -976,7 +976,7 @@ void Sema::PushFunctionScope() { FunctionScopes.push_back(FunctionScopes.back()); return; } - + FunctionScopes.push_back(new FunctionScopeInfo(getDiagnostics())); } @@ -985,7 +985,7 @@ void Sema::PushBlockScope(Scope *BlockScope, BlockDecl *Block) { BlockScope, Block)); } -void Sema::PushLambdaScope(CXXRecordDecl *Lambda, +void Sema::PushLambdaScope(CXXRecordDecl *Lambda, CXXMethodDecl *CallOperator) { FunctionScopes.push_back(new LambdaScopeInfo(getDiagnostics(), Lambda, CallOperator)); @@ -993,9 +993,9 @@ void Sema::PushLambdaScope(CXXRecordDecl *Lambda, void Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP, const Decl *D, const BlockExpr *blkExpr) { - FunctionScopeInfo *Scope = FunctionScopes.pop_back_val(); + FunctionScopeInfo *Scope = FunctionScopes.pop_back_val(); assert(!FunctionScopes.empty() && "mismatched push/pop!"); - + // Issue any analysis-based warnings. if (WP && D) AnalysisWarnings.IssueWarnings(*WP, Scope, D, blkExpr); @@ -1034,15 +1034,15 @@ bool Sema::hasAnyUnrecoverableErrorsInThisFunction() const { BlockScopeInfo *Sema::getCurBlock() { if (FunctionScopes.empty()) return 0; - - return dyn_cast(FunctionScopes.back()); + + return dyn_cast(FunctionScopes.back()); } LambdaScopeInfo *Sema::getCurLambda() { if (FunctionScopes.empty()) return 0; - - return dyn_cast(FunctionScopes.back()); + + return dyn_cast(FunctionScopes.back()); } void Sema::ActOnComment(SourceRange Comment) { @@ -1077,7 +1077,7 @@ ExternalSemaSource::~ExternalSemaSource() {} void ExternalSemaSource::ReadMethodPool(Selector Sel) { } void ExternalSemaSource::ReadKnownNamespaces( - SmallVectorImpl &Namespaces) { + SmallVectorImpl &Namespaces) { } void PrettyDeclStackTraceEntry::print(raw_ostream &OS) const { @@ -1254,7 +1254,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, // actually a CallExpr. SourceLocation ParenInsertionLoc = PP.getLocForEndOfToken(Range.getEnd()); - Diag(Loc, PD) + Diag(Loc, PD) << /*zero-arg*/ 1 << Range << (IsCallableWithAppend(E.get()) ? FixItHint::CreateInsertion(ParenInsertionLoc, "()")