aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2011-10-08 11:31:46 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2011-10-08 11:31:46 +0000
commita789ca9b967abe47b84df83bcf4afb150856a8d9 (patch)
treea9ff7b698ef1bc365a260212746f673a12c75075
parent49de5289acea91c9d224c9aadd4d527e8f9fdaff (diff)
Whitespace
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141486 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChains.cpp2
-rw-r--r--lib/Frontend/CompilerInstance.cpp174
-rw-r--r--lib/Parse/ParseStmt.cpp120
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp406
4 files changed, 351 insertions, 351 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 07481c1ee3..1914fff0dd 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -536,7 +536,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
if (char *env = ::getenv("IOS_SIMULATOR_DEPLOYMENT_TARGET"))
iOSSimTarget = env;
- // If no '-miphoneos-version-min' specified on the command line and
+ // If no '-miphoneos-version-min' specified on the command line and
// IPHONEOS_DEPLOYMENT_TARGET is not defined, see if we can set the default
// based on isysroot.
if (iOSTarget.empty()) {
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 408ebbee43..c413a42f44 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -79,7 +79,7 @@ void CompilerInstance::setFileManager(FileManager *Value) {
FileMgr = Value;
}
-void CompilerInstance::setSourceManager(SourceManager *Value) {
+void CompilerInstance::setSourceManager(SourceManager *Value) {
SourceMgr = Value;
}
@@ -162,7 +162,7 @@ void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv,
&getCodeGenOpts());
}
-llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
+llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
int Argc, const char* const *Argv,
DiagnosticConsumer *Client,
@@ -184,13 +184,13 @@ CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
Diags->setClient(new TextDiagnosticPrinter(llvm::errs(), Opts));
// Chain in -verify checker, if requested.
- if (Opts.VerifyDiagnostics)
+ if (Opts.VerifyDiagnostics)
Diags->setClient(new VerifyDiagnosticConsumer(*Diags));
// Chain in -diagnostic-log-file dumper, if requested.
if (!Opts.DiagnosticLogFile.empty())
SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
-
+
if (!Opts.DumpBuildInformation.empty())
SetUpBuildDumpLog(Opts, Argc, Argv, *Diags);
@@ -216,18 +216,18 @@ void CompilerInstance::createSourceManager(FileManager &FileMgr) {
void CompilerInstance::createPreprocessor() {
const PreprocessorOptions &PPOpts = getPreprocessorOpts();
-
+
// Create a PTH manager if we are using some form of a token cache.
PTHManager *PTHMgr = 0;
if (!PPOpts.TokenCache.empty())
PTHMgr = PTHManager::Create(PPOpts.TokenCache, getDiagnostics());
-
+
// Create the Preprocessor.
HeaderSearch *HeaderInfo = new HeaderSearch(getFileManager());
PP = new Preprocessor(getDiagnostics(), getLangOpts(), &getTarget(),
getSourceManager(), *HeaderInfo, *this, PTHMgr,
/*OwnsHeaderSearch=*/true);
-
+
// Note that this is different then passing PTHMgr to Preprocessor's ctor.
// That argument is used as the IdentifierInfoLookup argument to
// IdentifierTable's ctor.
@@ -235,30 +235,30 @@ void CompilerInstance::createPreprocessor() {
PTHMgr->setPreprocessor(&*PP);
PP->setPTHManager(PTHMgr);
}
-
+
if (PPOpts.DetailedRecord)
PP->createPreprocessingRecord(
PPOpts.DetailedRecordIncludesNestedMacroExpansions);
-
+
InitializePreprocessor(*PP, PPOpts, getHeaderSearchOpts(), getFrontendOpts());
-
+
// Set up the module path, including the hash for the
// module-creation options.
llvm::SmallString<256> SpecificModuleCache(
getHeaderSearchOpts().ModuleCachePath);
if (!getHeaderSearchOpts().DisableModuleHash)
- llvm::sys::path::append(SpecificModuleCache,
+ llvm::sys::path::append(SpecificModuleCache,
getInvocation().getModuleHash());
PP->getHeaderSearchInfo().configureModules(SpecificModuleCache,
getPreprocessorOpts().ModuleBuildPath.empty()
- ? std::string()
+ ? std::string()
: getPreprocessorOpts().ModuleBuildPath.back());
-
+
// Handle generating dependencies, if requested.
const DependencyOutputOptions &DepOpts = getDependencyOutputOpts();
if (!DepOpts.OutputFile.empty())
AttachDependencyFileGen(*PP, DepOpts);
-
+
// Handle generating header include information, if requested.
if (DepOpts.ShowHeaderIncludes)
AttachHeaderIncludeGen(*PP);
@@ -290,7 +290,7 @@ void CompilerInstance::createPCHExternalASTSource(StringRef Path,
llvm::OwningPtr<ExternalASTSource> Source;
bool Preamble = getPreprocessorOpts().PrecompiledPreambleBytes.first != 0;
Source.reset(createPCHExternalASTSource(Path, getHeaderSearchOpts().Sysroot,
- DisablePCHValidation,
+ DisablePCHValidation,
DisableStatCache,
getPreprocessor(), getASTContext(),
DeserializationListener,
@@ -315,8 +315,8 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
Reader->setDeserializationListener(
static_cast<ASTDeserializationListener *>(DeserializationListener));
- switch (Reader->ReadAST(Path,
- Preamble ? serialization::MK_Preamble
+ switch (Reader->ReadAST(Path,
+ Preamble ? serialization::MK_Preamble
: serialization::MK_PCH)) {
case ASTReader::Success:
// Set the predefines buffer as suggested by the PCH reader. Typically, the
@@ -338,7 +338,7 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path,
// Code Completion
-static bool EnableCodeCompletion(Preprocessor &PP,
+static bool EnableCodeCompletion(Preprocessor &PP,
const std::string &Filename,
unsigned Line,
unsigned Column) {
@@ -398,7 +398,7 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
return 0;
// Set up the creation routine for code-completion.
- return new PrintingCodeCompleteConsumer(ShowMacros, ShowCodePatterns,
+ return new PrintingCodeCompleteConsumer(ShowMacros, ShowCodePatterns,
ShowGlobals, OS);
}
@@ -440,7 +440,7 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
}
} else if (!it->Filename.empty() && EraseFiles)
llvm::sys::Path(it->Filename).eraseFromDisk();
-
+
}
OutputFiles.clear();
}
@@ -619,7 +619,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
if (getFrontendOpts().ShowStats)
llvm::EnableStatistics();
-
+
for (unsigned i = 0, e = getFrontendOpts().Inputs.size(); i != e; ++i) {
const std::string &InFile = getFrontendOpts().Inputs[i].second;
@@ -638,7 +638,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
// Get the total number of warnings/errors from the client.
unsigned NumWarnings = getDiagnostics().getClient()->getNumWarnings();
unsigned NumErrors = getDiagnostics().getClient()->getNumErrors();
-
+
if (NumWarnings)
OS << NumWarnings << " warning" << (NumWarnings == 1 ? "" : "s");
if (NumWarnings && NumErrors)
@@ -687,7 +687,7 @@ namespace {
/// \brief Class that manages the creation of a lock file to aid
/// implicit coordination between different processes.
///
- /// The implicit coordination works by creating a ".lock" file alongside
+ /// The implicit coordination works by creating a ".lock" file alongside
/// the file that we're coordinating for, using the atomicity of the file
/// system to ensure that only a single process can create that ".lock" file.
/// When the lock file is removed, the owning process has finished the
@@ -710,28 +710,28 @@ namespace {
private:
llvm::SmallString<128> LockFileName;
llvm::SmallString<128> UniqueLockFileName;
-
+
llvm::Optional<std::pair<std::string, int> > Owner;
llvm::Optional<llvm::error_code> Error;
-
+
LockFileManager(const LockFileManager &);
LockFileManager &operator=(const LockFileManager &);
-
- static llvm::Optional<std::pair<std::string, int> >
+
+ static llvm::Optional<std::pair<std::string, int> >
readLockFile(StringRef LockFileName);
-
+
static bool processStillExecuting(StringRef Hostname, int PID);
-
+
public:
-
+
LockFileManager(StringRef FileName);
~LockFileManager();
/// \brief Determine the state of the lock file.
LockFileState getState() const;
-
+
operator LockFileState() const { return getState(); }
-
+
/// \brief For a shared lock, wait until the owner releases the lock.
void waitForUnlock();
};
@@ -742,14 +742,14 @@ namespace {
/// \param LockFileName The name of the lock file to read.
///
/// \returns The process ID of the process that owns this lock file
-llvm::Optional<std::pair<std::string, int> >
+llvm::Optional<std::pair<std::string, int> >
LockFileManager::readLockFile(StringRef LockFileName) {
// Check whether the lock file exists. If not, clearly there's nothing
// to read, so we just return.
bool Exists = false;
if (llvm::sys::fs::exists(LockFileName, Exists) || !Exists)
return llvm::Optional<std::pair<std::string, int> >();
-
+
// Read the owning host and PID out of the lock file. If it appears that the
// owning process is dead, the lock file is invalid.
int PID = 0;
@@ -770,42 +770,42 @@ bool LockFileManager::processStillExecuting(StringRef Hostname, int PID) {
char MyHostname[256];
MyHostname[255] = 0;
MyHostname[0] = 0;
- gethostname(MyHostname, 255);
+ gethostname(MyHostname, 255);
// Check whether the process is dead. If so, we're done.
if (MyHostname == Hostname && getsid(PID) == -1 && errno == ESRCH)
return false;
#endif
-
+
return true;
}
-LockFileManager::LockFileManager(StringRef FileName)
+LockFileManager::LockFileManager(StringRef FileName)
{
LockFileName = FileName;
LockFileName += ".lock";
-
+
// If the lock file already exists, don't bother to try to create our own
// lock file; it won't work anyway. Just figure out who owns this lock file.
if ((Owner = readLockFile(LockFileName)))
return;
-
+
// Create a lock file that is unique to this instance.
UniqueLockFileName = LockFileName;
UniqueLockFileName += "-%%%%%%%%";
int UniqueLockFileID;
- if (llvm::error_code EC
- = llvm::sys::fs::unique_file(UniqueLockFileName.str(),
+ if (llvm::error_code EC
+ = llvm::sys::fs::unique_file(UniqueLockFileName.str(),
UniqueLockFileID,
- UniqueLockFileName,
+ UniqueLockFileName,
/*makeAbsolute=*/false)) {
Error = EC;
return;
}
-
+
// Write our process ID to our unique lock file.
{
llvm::raw_fd_ostream Out(UniqueLockFileID, /*shouldClose=*/true);
-
+
#if LLVM_ON_UNIX
// FIXME: move getpid() call into LLVM
char hostname[256];
@@ -817,7 +817,7 @@ LockFileManager::LockFileManager(StringRef FileName)
Out << "localhost 1";
#endif
Out.close();
-
+
if (Out.has_error()) {
// We failed to write out PID, so make up an excuse, remove the
// unique lock file, and fail.
@@ -827,16 +827,16 @@ LockFileManager::LockFileManager(StringRef FileName)
return;
}
}
-
+
// Create a hard link from the lock file name. If this succeeds, we're done.
- llvm::error_code EC
- = llvm::sys::fs::create_hard_link(UniqueLockFileName.str(),
+ llvm::error_code EC
+ = llvm::sys::fs::create_hard_link(UniqueLockFileName.str(),
LockFileName.str());
if (EC == llvm::errc::success)
return;
- // Creating the hard link failed.
-
+ // Creating the hard link failed.
+
#ifdef LLVM_ON_UNIX
// The creation of the hard link may appear to fail, but if stat'ing the
// unique file returns a link count of 2, then we can still declare success.
@@ -847,12 +847,12 @@ LockFileManager::LockFileManager(StringRef FileName)
#endif
// Someone else managed to create the lock file first. Wipe out our unique
- // lock file (it's useless now) and read the process ID from the lock file.
+ // lock file (it's useless now) and read the process ID from the lock file.
bool Existed;
llvm::sys::fs::remove(UniqueLockFileName.str(), Existed);
if ((Owner = readLockFile(LockFileName)))
return;
-
+
// There is a lock file that nobody owns; try to clean it up and report
// an error.
llvm::sys::fs::remove(LockFileName.str(), Existed);
@@ -865,14 +865,14 @@ LockFileManager::LockFileState LockFileManager::getState() const {
if (Error)
return LFS_Error;
-
+
return LFS_Owned;
}
LockFileManager::~LockFileManager() {
if (getState() != LFS_Owned)
return;
-
+
// Since we own the lock, remove the lock file and our own unique lock file.
bool Existed;
llvm::sys::fs::remove(LockFileName.str(), Existed);
@@ -882,7 +882,7 @@ LockFileManager::~LockFileManager() {
void LockFileManager::waitForUnlock() {
if (getState() != LFS_Shared)
return;
-
+
#if LLVM_ON_WIN32
unsigned long Interval = 1;
#else
@@ -894,7 +894,7 @@ void LockFileManager::waitForUnlock() {
const unsigned MaxSeconds = 3600;
do {
// Sleep for the designated interval, to allow the owning process time to
- // finish up and
+ // finish up and
// FIXME: Should we hook in to system APIs to get a notification when the
// lock file is deleted?
#if LLVM_ON_WIN32
@@ -909,7 +909,7 @@ void LockFileManager::waitForUnlock() {
if (!processStillExecuting((*Owner).first, (*Owner).second))
return;
-
+
// Exponentially increase the time we wait for the lock to be removed.
#if LLVM_ON_WIN32
Interval *= 2;
@@ -928,7 +928,7 @@ void LockFileManager::waitForUnlock() {
Interval.tv_sec < MaxSeconds
#endif
);
-
+
// Give up.
}
@@ -943,31 +943,31 @@ static void compileModule(CompilerInstance &ImportingInstance,
switch (Locked) {
case LockFileManager::LFS_Error:
return;
-
+
case LockFileManager::LFS_Owned:
// We're responsible for building the module ourselves. Do so below.
break;
-
+
case LockFileManager::LFS_Shared:
// Someone else is responsible for building the module. Wait for them to
// finish.
Locked.waitForUnlock();
break;
}
-
+
// Construct a compiler invocation for creating this module.
llvm::IntrusiveRefCntPtr<CompilerInvocation> Invocation
(new CompilerInvocation(ImportingInstance.getInvocation()));
-
+
// For any options that aren't intended to affect how a module is built,
// reset them to their default values.
Invocation->getLangOpts().resetNonModularOptions();
Invocation->getPreprocessorOpts().resetNonModularOptions();
-
- // Note that this module is part of the module build path, so that we
+
+ // Note that this module is part of the module build path, so that we
// can detect cycles in the module graph.
Invocation->getPreprocessorOpts().ModuleBuildPath.push_back(ModuleName);
-
+
// Set up the inputs/outputs so that we build the module from its umbrella
// header.
FrontendOptions &FrontendOpts = Invocation->getFrontendOpts();
@@ -975,38 +975,38 @@ static void compileModule(CompilerInstance &ImportingInstance,
FrontendOpts.DisableFree = false;
FrontendOpts.Inputs.clear();
FrontendOpts.Inputs.push_back(
- std::make_pair(getSourceInputKindFromOptions(Invocation->getLangOpts()),
+ std::make_pair(getSourceInputKindFromOptions(Invocation->getLangOpts()),
UmbrellaHeader));
-
+
Invocation->getDiagnosticOpts().VerifyDiagnostics = 0;
-
-
+
+
assert(ImportingInstance.getInvocation().getModuleHash() ==
Invocation->getModuleHash() && "Module hash mismatch!");
-
+
// Construct a compiler instance that will be used to actually create the
// module.
CompilerInstance Instance;
Instance.setInvocation(&*Invocation);
- Instance.createDiagnostics(/*argc=*/0, /*argv=*/0,
+ Instance.createDiagnostics(/*argc=*/0, /*argv=*/0,
&ImportingInstance.getDiagnosticClient(),
/*ShouldOwnClient=*/true,
/*ShouldCloneClient=*/true);
// Construct a module-generating action.
GeneratePCHAction CreateModuleAction(true);
-
+
// Execute the action to actually build the module in-place. Use a separate
// thread so that we get a stack large enough.
const unsigned ThreadStackSize = 8 << 20;
llvm::CrashRecoveryContext CRC;
CompileModuleData Data = { Instance, CreateModuleAction };
CRC.RunSafelyOnThread(&doCompileModule, &Data, ThreadStackSize);
-}
+}
-ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
+ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
IdentifierInfo &ModuleName,
- SourceLocation ModuleNameLoc) {
+ SourceLocation ModuleNameLoc) {
// Determine what file we're searching from.
SourceManager &SourceMgr = getSourceManager();
SourceLocation ExpandedImportLoc = SourceMgr.getExpansionLoc(ImportLoc);
@@ -1022,17 +1022,17 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
= PP->getHeaderSearchInfo().lookupModule(ModuleName.getName(),
&ModuleFileName,
&UmbrellaHeader);
-
+
bool BuildingModule = false;
if (!ModuleFile && !UmbrellaHeader.empty()) {
// We didn't find the module, but there is an umbrella header that
// can be used to create the module file. Create a separate compilation
// module to do so.
-
+
// Check whether there is a cycle in the module graph.
SmallVectorImpl<std::string> &ModuleBuildPath
= getPreprocessorOpts().ModuleBuildPath;
- SmallVectorImpl<std::string>::iterator Pos
+ SmallVectorImpl<std::string>::iterator Pos
= std::find(ModuleBuildPath.begin(), ModuleBuildPath.end(),
ModuleName.getName());
if (Pos != ModuleBuildPath.end()) {
@@ -1042,28 +1042,28 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
CyclePath += " -> ";
}
CyclePath += ModuleName.getName();
-
+
getDiagnostics().Report(ModuleNameLoc, diag::err_module_cycle)
<< ModuleName.getName() << CyclePath;
return 0;
}
-
+
getDiagnostics().Report(ModuleNameLoc, diag::warn_module_build)
<< ModuleName.getName();
BuildingModule = true;
compileModule(*this, ModuleName.getName(), ModuleFileName, UmbrellaHeader);
ModuleFile = PP->getHeaderSearchInfo().lookupModule(ModuleName.getName());
}
-
+
if (!ModuleFile) {
- getDiagnostics().Report(ModuleNameLoc,
+ getDiagnostics().Report(ModuleNameLoc,
BuildingModule? diag::err_module_not_built
: diag::err_module_not_found)
<< ModuleName.getName()
<< SourceRange(ImportLoc, ModuleNameLoc);
return 0;
}
-
+
// If we don't already have an ASTReader, create one now.
if (!ModuleManager) {
if (!hasASTContext())
@@ -1073,7 +1073,7 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
const PreprocessorOptions &PPOpts = getPreprocessorOpts();
ModuleManager = new ASTReader(getPreprocessor(), *Context,
Sysroot.empty() ? "" : Sysroot.c_str(),
- PPOpts.DisablePCHValidation,
+ PPOpts.DisablePCHValidation,
PPOpts.DisableStatCache);
if (hasASTConsumer()) {
ModuleManager->setDeserializationListener(
@@ -1089,7 +1089,7 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
if (hasASTConsumer())
ModuleManager->StartTranslationUnit(&getASTConsumer());
}
-
+
// Try to load the module we found.
switch (ModuleManager->ReadAST(ModuleFile->getName(),
serialization::MK_Module)) {
@@ -1100,12 +1100,12 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
// FIXME: The ASTReader will already have complained, but can we showhorn
// that diagnostic information into a more useful form?
return 0;
-
+
case ASTReader::Failure:
// Already complained.
return 0;
}
-
+
// FIXME: The module file's FileEntry makes a poor key indeed!
return (ModuleKey)ModuleFile;
}
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 489ceab950..7754c9855d 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -79,7 +79,7 @@ StmtResult
Parser::ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement) {
const char *SemiError = 0;
StmtResult Res;
-
+
ParenBraceBracketBalancer BalancerRAIIObj(*this);
ParsedAttributesWithRange attrs(AttrFactory);
@@ -102,14 +102,14 @@ Retry:
Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Statement);
cutOffParsing();
return StmtError();
-
+
case tok::identifier: {
Token Next = NextToken();
if (Next.is(tok::colon)) { // C99 6.8.1: labeled-statement
// identifier ':' statement
return ParseLabeledStatement(attrs);
}
-
+
if (Next.isNot(tok::coloncolon)) {
CXXScopeSpec SS;
IdentifierInfo *Name = Tok.getIdentifierInfo();
@@ -130,11 +130,11 @@ Retry:
Tok.setKind(Name->getTokenID());
goto Retry;
}
-
+
// Fall through via the normal error path.
// FIXME: This seems like it could only happen for context-sensitive
// keywords.
-
+
case Sema::NC_Error:
// Handle errors here by skipping up to the next semicolon or '}', and
// eat the semicolon if that's what stopped us.
@@ -142,33 +142,33 @@ Retry:
if (Tok.is(tok::semi))
ConsumeToken();
return StmtError();
-
+
case Sema::NC_Unknown:
// Either we don't know anything about this identifier, or we know that
- // we're in a syntactic context we haven't handled yet.
- break;
-
+ // we're in a syntactic context we haven't handled yet.
+ break;
+
case Sema::NC_Type:
Tok.setKind(tok::annot_typename);
setTypeAnnotation(Tok, Classification.getType());
Tok.setAnnotationEndLoc(NameLoc);
PP.AnnotateCachedTokens(Tok);
break;
-
+
case Sema::NC_Expression:
Tok.setKind(tok::annot_primary_expr);
setExprAnnotation(Tok, Classification.getExpression());
Tok.setAnnotationEndLoc(NameLoc);
PP.AnnotateCachedTokens(Tok);
break;
-
+
case Sema::NC_TypeTemplate:
case Sema::NC_FunctionTemplate: {
ConsumeToken(); // the identifier
UnqualifiedId Id;
Id.setIdentifier(Name, NameLoc);
if (AnnotateTemplateIdToken(
- TemplateTy::make(Classification.getTemplateName()),
+ TemplateTy::make(Classification.getTemplateName()),
Classification.getTemplateNameKind(),
SS, Id, SourceLocation(),
/*AllowTypeAnnotation=*/false)) {
@@ -177,10 +177,10 @@ Retry:
SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
if (Tok.is(tok::semi))
ConsumeToken();
- return StmtError();
+ return StmtError();
}
-
- // If the next token is '::', jump right into parsing a
+
+ // If the next token is '::', jump right into parsing a
// nested-name-specifier. We don't want to leave the template-id
// hanging.
if (NextToken().is(tok::coloncolon) && TryAnnotateCXXScopeToken(false)){
@@ -189,22 +189,22 @@ Retry:
SkipUntil(tok::r_brace, /*StopAtSemi=*/true, /*DontConsume=*/true);
if (Tok.is(tok::semi))
ConsumeToken();
- return StmtError();
+ return StmtError();
}
-
+
// We've annotated a template-id, so try again now.
goto Retry;
}
-
+
case Sema::NC_NestedNameSpecifier:
// FIXME: Implement this!
break;
}
}
-
+
// Fall through
}
-
+
default: {
if ((getLang().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) {
SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
@@ -300,7 +300,7 @@ Retry:
StmtResult Parser::ParseExprStatement(ParsedAttributes &Attrs) {
// If a case keyword is missing, this is where it should be inserted.
Token OldToken = Tok;
-
+
// FIXME: Use the attributes
// expression[opt] ';'
ExprResult Expr(ParseExpression());
@@ -313,18 +313,18 @@ StmtResult Parser::ParseExprStatement(ParsedAttributes &Attrs) {
ConsumeToken();
return StmtError();
}
-
+
if (Tok.is(tok::colon) && getCurScope()->isSwitchScope() &&
Actions.CheckCaseExpression(Expr.get())) {
// If a constant expression is followed by a colon inside a switch block,
// suggest a missing case keyword.
Diag(OldToken, diag::err_expected_case_before_expression)
<< FixItHint::CreateInsertion(OldToken.getLocation(), "case ");
-
+
// Recover parsing as a case statement.
return ParseCaseStatement(Attrs, /*MissingCase=*/true, Expr);
}
-
+
// Otherwise, eat the semicolon.
ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
return Actions.ActOnExprStmt(Actions.MakeFullExpr(Expr.get()));
@@ -461,12 +461,12 @@ StmtResult Parser::ParseLabeledStatement(ParsedAttributes &attrs) {
// Broken substmt shouldn't prevent the label from being added to the AST.
if (SubStmt.isInvalid())
SubStmt = Actions.ActOnNullStmt(ColonLoc);
-
+
LabelDecl *LD = Actions.LookupOrCreateLabel(IdentTok.getIdentifierInfo(),
IdentTok.getLocation());
if (AttributeList *Attrs = attrs.getList())
Actions.ProcessDeclAttributeList(Actions.CurScope, LD, Attrs);
-
+
return Actions.ActOnLabelStmt(IdentTok.getLocation(), LD, ColonLoc,
SubStmt.get());
}
@@ -515,12 +515,12 @@ StmtResult Parser::ParseCaseStatement(ParsedAttributes &attrs, bool MissingCase,
cutOffParsing();
return StmtError();
}
-
+
/// We don't want to treat 'case x : y' as a potential typo for 'case x::y'.
/// Disable this form of error recovery while we're parsing the case
/// expression.
ColonProtectionRAIIObject ColonProtection(*this);
-
+
ExprResult LHS(MissingCase ? Expr : ParseConstantExpression());
MissingCase = false;
if (LHS.isInvalid()) {
@@ -541,7 +541,7 @@ StmtResult Parser::ParseCaseStatement(ParsedAttributes &attrs, bool MissingCase,
return StmtError();
}
}
-
+
ColonProtection.restore();
if (Tok.is(tok::colon)) {
@@ -558,7 +558,7 @@ StmtResult Parser::ParseCaseStatement(ParsedAttributes &attrs, bool MissingCase,
<< FixItHint::CreateInsertion(ExpectedLoc, ":");
ColonLoc = ExpectedLoc;
}
-
+
StmtResult Case =
Actions.ActOnCaseStmt(CaseLoc, LHS.get(), DotDotDotLoc,
RHS.get(), ColonLoc);
@@ -635,7 +635,7 @@ StmtResult Parser::ParseDefaultStatement(ParsedAttributes &attrs) {
<< FixItHint::CreateInsertion(ExpectedLoc, ":");
ColonLoc = ExpectedLoc;
}
-
+
// Diagnose the common error "switch (X) {... default: }", which is not valid.
if (Tok.is(tok::r_brace)) {
SourceLocation AfterColonLoc = PP.getLocForEndOfToken(ColonLoc);
@@ -708,7 +708,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
Tok.getLocation(),
"in compound statement ('{}')");
InMessageExpressionRAIIObject InMessage(*this, false);
-
+
SourceLocation LBraceLoc = ConsumeBrace(); // eat the '{'.
StmtVector Stmts(Actions);
@@ -718,33 +718,33 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
while (Tok.is(tok::kw___label__)) {
SourceLocation LabelLoc = ConsumeToken();
Diag(LabelLoc, diag::ext_gnu_local_label);
-
+
SmallVector<Decl *, 8> DeclsInGroup;
while (1) {
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
break;
}
-
+
IdentifierInfo *II = Tok.getIdentifierInfo();
SourceLocation IdLoc = ConsumeToken();
DeclsInGroup.push_back(Actions.LookupOrCreateLabel(II, IdLoc, LabelLoc));
-
+
if (!Tok.is(tok::comma))
break;
ConsumeToken();
}
-
+
DeclSpec DS(AttrFactory);
DeclGroupPtrTy Res = Actions.FinalizeDeclaratorGroup(getCurScope(), DS,
DeclsInGroup.data(), DeclsInGroup.size());
StmtResult R = Actions.ActOnDeclStmt(Res, LabelLoc, Tok.getLocation());
-
+
ExpectAndConsume(tok::semi, diag::err_expected_semi_declaration);
if (R.isUsable())
Stmts.push_back(R.release());
}
-
+
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
if (Tok.is(tok::annot_pragma_unused)) {
HandlePragmaUnused();
@@ -832,12 +832,12 @@ bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult,
SourceLocation Loc,
bool ConvertToBoolean) {
SourceLocation LParenLoc = ConsumeParen();
- if (getLang().CPlusPlus)
+ if (getLang().CPlusPlus)
ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean);
else {
ExprResult = ParseExpression();
DeclResult = 0;
-
+
// If required, convert to a boolean value.
if (!ExprResult.isInvalid() && ConvertToBoolean)
ExprResult
@@ -954,7 +954,7 @@ StmtResult Parser::ParseIfStatement(ParsedAttributes &attrs) {
C99orCXX && Tok.isNot(tok::l_brace));
ElseStmt = ParseStatement();
-
+
// Pop the 'else' scope if needed.
InnerScope.Exit();
} else if (Tok.is(tok::code_completion)) {
@@ -1035,7 +1035,7 @@ StmtResult Parser::ParseSwitchStatement(ParsedAttributes &attrs) {
= Actions.ActOnStartOfSwitchStmt(SwitchLoc, Cond.get(), CondVar);
if (Switch.isInvalid()) {
- // Skip the switch body.
+ // Skip the switch body.
// FIXME: This is not optimal recovery, but parsing the body is more
// dangerous due to the presence of case and default statements, which
// will have no place to connect back with the switch.
@@ -1046,7 +1046,7 @@ StmtResult Parser::ParseSwitchStatement(ParsedAttributes &attrs) {
SkipUntil(tok::semi);
return move(Switch);
}
-
+
// C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
// if the body isn't a compound statement to avoid push/pop in common cases.
@@ -1071,7 +1071,7 @@ StmtResult Parser::ParseSwitchStatement(ParsedAttributes &attrs) {
if (Body.isInvalid())
// FIXME: Remove the case statement list from the Switch statement.
Body = Actions.ActOnNullStmt(Tok.getLocation());
-
+
return Actions.ActOnFinishSwitchStmt(SwitchLoc, Switch.get(), Body.get());
}
@@ -1284,15 +1284,15 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
ForRangeInit ForRangeInit;
FullExprArg ThirdPart(Actions);
Decl *SecondVar = 0;
-
+
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(),
+ Actions.CodeCompleteOrdinaryName(getCurScope(),
C99orCXXorObjC? Sema::PCC_ForInit
: Sema::PCC_Expression);
cutOffParsing();
return StmtError();
}
-
+
// Parse the first part of the for specifier.
if (Tok.is(tok::semi)) { // for (;
// no first part, eat the ';'.
@@ -1311,7 +1311,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
StmtVector Stmts(Actions);
- DeclGroupPtrTy DG = ParseSimpleDeclaration(Stmts, Declarator::ForContext,
+ DeclGroupPtrTy DG = ParseSimpleDeclaration(Stmts, Declarator::ForContext,
DeclEnd, attrs, false,
MightBeForRangeStmt ?
&ForRangeInit : 0);
@@ -1328,7 +1328,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
Actions.ActOnForEachDeclStmt(DG);
// ObjC: for (id x in expr)
ConsumeToken(); // consume 'in'
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCForCollection(getCurScope(), DG);
cutOffParsing();
@@ -1355,7 +1355,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
ConsumeToken();
} else if (ForEach) {
ConsumeToken(); // consume 'in'
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCForCollection(getCurScope(), DeclGroupPtrTy());
cutOffParsing();
@@ -1387,7 +1387,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
else {
Second = ParseExpression();
if (!Second.isInvalid())
- Second = Actions.ActOnBooleanCondition(getCurScope(), ForLoc,
+ Second = Actions.ActOnBooleanCondition(getCurScope(), ForLoc,
Second.get());
}
SecondPartIsInvalid = Second.isInvalid();
@@ -1464,7 +1464,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs) {
if (ForEach)
return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
FirstPart.take(),
- Collection.take(), RParenLoc,
+ Collection.take(), RParenLoc,
Body.take());
if (ForRange)
@@ -1553,7 +1553,7 @@ StmtResult Parser::ParseReturnStatement(ParsedAttributes &attrs) {
cutOffParsing();
return StmtError();
}
-
+
// FIXME: This is a hack to allow something like C++0x's generalized
// initializer lists, but only enough of this feature to allow Clang to
// parse libstdc++ 4.5's headers.
@@ -1757,7 +1757,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
// We have a simple asm expression like 'asm("foo")'.
SourceLocation RParenLoc = ConsumeParen();
return Actions.ActOnAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile,
- /*NumOutputs*/ 0, /*NumInputs*/ 0, 0,
+ /*NumOutputs