diff options
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 32 | ||||
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Lex/MacroArgs.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 178 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Lex/PPExpressions.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 26 | ||||
-rw-r--r-- | clang/lib/Lex/PreprocessingRecord.cpp | 46 | ||||
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 24 | ||||
-rw-r--r-- | clang/lib/Lex/TokenLexer.cpp | 20 |
12 files changed, 191 insertions, 191 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index b1a2ef12128..fbfa54b2fff 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -246,9 +246,9 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName, break; } } - + // FIXME: Figure out how header maps and module maps will work together. - + // Only deal with normal search directories. if (!SearchDirs[Idx].isNormalDir()) continue; @@ -263,7 +263,7 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName, if (Module) break; } - + // Search for a module map in a subdirectory with the same name as the // module. SmallString<128> NestedModuleMapDirName; @@ -530,7 +530,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup( RelativePath->clear(); RelativePath->append(Filename.begin()+SlashPos+1, Filename.end()); } - + // Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h" unsigned OrigSize = FrameworkName.size(); @@ -709,7 +709,7 @@ const FileEntry *HeaderSearch::LookupFile( if (SuggestedModule) *SuggestedModule = ModuleMap::KnownHeader(); - + // If 'Filename' is absolute, check to see if it exists and no searching. if (llvm::sys::path::is_absolute(Filename)) { CurDir = nullptr; @@ -898,7 +898,7 @@ const FileEntry *HeaderSearch::LookupFile( size_t SlashPos = Filename.find('/'); if (SlashPos != StringRef::npos) { HFI.IndexHeaderMapHeader = 1; - HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(), + HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(), SlashPos)); } } @@ -1079,7 +1079,7 @@ LookupSubframeworkHeader(StringRef Filename, /// Merge the header file info provided by \p OtherHFI into the current /// header file info (\p HFI) -static void mergeHeaderFileInfo(HeaderFileInfo &HFI, +static void mergeHeaderFileInfo(HeaderFileInfo &HFI, const HeaderFileInfo &OtherHFI) { assert(OtherHFI.External && "expected to merge external HFI"); @@ -1101,7 +1101,7 @@ static void mergeHeaderFileInfo(HeaderFileInfo &HFI, if (HFI.Framework.empty()) HFI.Framework = OtherHFI.Framework; } - + /// getFileInfo - Return the HeaderFileInfo structure for the specified /// FileEntry. HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) { @@ -1285,14 +1285,14 @@ StringRef HeaderSearch::getUniqueFrameworkName(StringRef Framework) { return FrameworkNames.insert(Framework).first->first(); } -bool HeaderSearch::hasModuleMap(StringRef FileName, +bool HeaderSearch::hasModuleMap(StringRef FileName, const DirectoryEntry *Root, bool IsSystem) { if (!HSOpts->ImplicitModuleMaps) return false; SmallVector<const DirectoryEntry *, 2> FixUpDirectories; - + StringRef DirName = FileName; do { // Get the parent directory name. @@ -1325,7 +1325,7 @@ bool HeaderSearch::hasModuleMap(StringRef FileName, // If we hit the top of our search, we're done. if (Dir == Root) return false; - + // Keep track of all of the directories we checked, so we can mark them as // having module maps if we eventually do find a module map. FixUpDirectories.push_back(Dir); @@ -1385,7 +1385,7 @@ bool HeaderSearch::findUsableModuleForFrameworkHeader( SmallVector<std::string, 4> SubmodulePath; const DirectoryEntry *TopFrameworkDir = ::getTopFrameworkDir(FileMgr, FrameworkName, SubmodulePath); - + // Determine the name of the top-level framework. StringRef ModuleName = llvm::sys::path::stem(TopFrameworkDir->getName()); @@ -1532,16 +1532,16 @@ Module *HeaderSearch::loadFrameworkModule(StringRef Name, return ModMap.findModule(Name); } -HeaderSearch::LoadModuleMapResult +HeaderSearch::LoadModuleMapResult HeaderSearch::loadModuleMapFile(StringRef DirName, bool IsSystem, bool IsFramework) { if (const DirectoryEntry *Dir = FileMgr.getDirectory(DirName)) return loadModuleMapFile(Dir, IsSystem, IsFramework); - + return LMM_NoDirectory; } -HeaderSearch::LoadModuleMapResult +HeaderSearch::LoadModuleMapResult HeaderSearch::loadModuleMapFile(const DirectoryEntry *Dir, bool IsSystem, bool IsFramework) { auto KnownDir = DirectoryHasModuleMap.find(Dir); @@ -1610,7 +1610,7 @@ void HeaderSearch::collectAllModules(SmallVectorImpl<Module *> &Modules) { } // Populate the list of modules. - for (ModuleMap::module_iterator M = ModMap.module_begin(), + for (ModuleMap::module_iterator M = ModMap.module_begin(), MEnd = ModMap.module_end(); M != MEnd; ++M) { Modules.push_back(M->getValue()); diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 966dafca271..3f2af1a74e5 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -30,7 +30,7 @@ #include <algorithm> #include <cassert> #include <cstddef> -#include <cstdint> +#include <cstdint> #include <cstring> #include <string> @@ -274,7 +274,7 @@ void clang::expandUCNs(SmallVectorImpl<char> &Buf, StringRef Input) { static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf, const char *ThisTokEnd, uint32_t &UcnVal, unsigned short &UcnLen, - FullSourceLoc Loc, DiagnosticsEngine *Diags, + FullSourceLoc Loc, DiagnosticsEngine *Diags, const LangOptions &Features, bool in_char_string_literal = false) { const char *UcnBegin = ThisTokBuf; @@ -1539,7 +1539,7 @@ void StringLiteralParser::init(ArrayRef<Token> StringToks){ // that ThisTokBuf points to a buffer that is big enough for the whole token // and 'spelled' tokens can only shrink. bool StringInvalid = false; - unsigned ThisTokLen = + unsigned ThisTokLen = Lexer::getSpelling(StringToks[i], ThisTokBuf, SM, Features, &StringInvalid); if (StringInvalid) diff --git a/clang/lib/Lex/MacroArgs.cpp b/clang/lib/Lex/MacroArgs.cpp index 3b6e2dc2411..dc2ba3074a8 100644 --- a/clang/lib/Lex/MacroArgs.cpp +++ b/clang/lib/Lex/MacroArgs.cpp @@ -29,7 +29,7 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI, "Can't have args for an object-like macro!"); MacroArgs **ResultEnt = nullptr; unsigned ClosestMatch = ~0U; - + // See if we have an entry with a big enough argument list to reuse on the // free list. If so, reuse it. for (MacroArgs **Entry = &PP.MacroArgCache; *Entry; @@ -37,7 +37,7 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI, if ((*Entry)->NumUnexpArgTokens >= UnexpArgTokens.size() && (*Entry)->NumUnexpArgTokens < ClosestMatch) { ResultEnt = Entry; - + // If we have an exact match, use it. if ((*Entry)->NumUnexpArgTokens == UnexpArgTokens.size()) break; @@ -83,7 +83,7 @@ void MacroArgs::destroy(Preprocessor &PP) { // would deallocate the element vectors. for (unsigned i = 0, e = PreExpArgTokens.size(); i != e; ++i) PreExpArgTokens[i].clear(); - + // Add this to the preprocessor's free list. ArgCache = PP.MacroArgCache; PP.MacroArgCache = this; @@ -93,14 +93,14 @@ void MacroArgs::destroy(Preprocessor &PP) { /// its freelist. MacroArgs *MacroArgs::deallocate() { MacroArgs *Next = ArgCache; - + // Run the dtor to deallocate the vectors. this->~MacroArgs(); // Release the memory for the object. static_assert(std::is_trivially_destructible<Token>::value, "assume trivially destructible and forego destructors"); free(this); - + return Next; } @@ -125,7 +125,7 @@ const Token *MacroArgs::getUnexpArgument(unsigned Arg) const { // in memory. const Token *Start = getTrailingObjects<Token>(); const Token *Result = Start; - + // Scan to find Arg. for (; Arg; ++Result) { assert(Result < Start+NumUnexpArgTokens && "Invalid arg #"); @@ -171,7 +171,7 @@ const std::vector<Token> &MacroArgs::getPreExpArgument(unsigned Arg, // If we have already computed this, return it. if (PreExpArgTokens.size() < getNumMacroArguments()) PreExpArgTokens.resize(getNumMacroArguments()); - + std::vector<Token> &Result = PreExpArgTokens[Arg]; if (!Result.empty()) return Result; diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index f048a73a8cc..87749f74734 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -103,8 +103,8 @@ ModuleMap::headerKindToRole(Module::HeaderKind Kind) { llvm_unreachable("unknown header kind"); } -Module::ExportDecl -ModuleMap::resolveExport(Module *Mod, +Module::ExportDecl +ModuleMap::resolveExport(Module *Mod, const Module::UnresolvedExportDecl &Unresolved, bool Complain) const { // We may have just a wildcard. @@ -112,7 +112,7 @@ ModuleMap::resolveExport(Module *Mod, assert(Unresolved.Wildcard && "Invalid unresolved export"); return Module::ExportDecl(nullptr, true); } - + // Resolve the module-id. Module *Context = resolveModuleId(Unresolved.Id, Mod, Complain); if (!Context) @@ -151,7 +151,7 @@ Module *ModuleMap::resolveModuleId(const ModuleId &Id, Module *Mod, return Context; } -/// Append to \p Paths the set of paths needed to get to the +/// Append to \p Paths the set of paths needed to get to the /// subframework in which the given module lives. static void appendSubframeworkPaths(Module *Mod, SmallVectorImpl<char> &Path) { @@ -161,10 +161,10 @@ static void appendSubframeworkPaths(Module *Mod, if (Mod->IsFramework) Paths.push_back(Mod->Name); } - + if (Paths.empty()) return; - + // Add Frameworks/Name.framework for each subframework. for (unsigned I = Paths.size() - 1; I != 0; --I) llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework"); @@ -325,7 +325,7 @@ ModuleMap::~ModuleMap() { } void ModuleMap::setTarget(const TargetInfo &Target) { - assert((!this->Target || this->Target == &Target) && + assert((!this->Target || this->Target == &Target) && "Improper target override"); this->Target = &Target; } @@ -528,7 +528,7 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule, << RequestingModule->getTopLevelModule()->Name << Filename; } else if (RequestingModule && RequestingModuleIsModuleInterface && LangOpts.isCompilingModule()) { - // Do not diagnose when we are not compiling a module. + // Do not diagnose when we are not compiling a module. diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ? diag::warn_non_modular_include_in_framework_module : diag::warn_non_modular_include_in_module; @@ -732,7 +732,7 @@ ModuleMap::isHeaderUnavailableInModule(const FileEntry *Header, if (IsUnavailable(Found)) return true; } - + // Infer a submodule with the same name as this header file. SmallString<32> NameBuf; StringRef Name = sanitizeFilenameAsIdentifier( @@ -745,18 +745,18 @@ ModuleMap::isHeaderUnavailableInModule(const FileEntry *Header, return IsUnavailable(Found); } - + SkippedDirs.push_back(Dir); - + // Retrieve our parent path. DirName = llvm::sys::path::parent_path(DirName); if (DirName.empty()) break; - + // Resolve the parent path to a directory entry. Dir = SourceMgr.getFileManager().getDirectory(DirName); } while (Dir); - + return false; } @@ -774,14 +774,14 @@ Module *ModuleMap::lookupModuleUnqualified(StringRef Name, if (Module *Sub = lookupModuleQualified(Name, Context)) return Sub; } - + return findModule(Name); } Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{ if (!Context) return findModule(Name); - + return Context->findSubmodule(Name); } @@ -892,7 +892,7 @@ Module *ModuleMap::inferFrameworkModule(const DirectoryEntry *FrameworkDir, // Check whether we've already found this module. if (Module *Mod = lookupModuleQualified(ModuleName, Parent)) return Mod; - + FileManager &FileMgr = SourceMgr.getFileManager(); // If the framework has a parent path from which we're allowed to infer @@ -953,7 +953,7 @@ Module *ModuleMap::inferFrameworkModule(const DirectoryEntry *FrameworkDir, SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName()); llvm::sys::path::append(UmbrellaName, "Headers", ModuleName + ".h"); const FileEntry *UmbrellaHeader = FileMgr.getFile(UmbrellaName); - + // FIXME: If there's no umbrella header, we could probably scan the // framework to load *everything*. But, it's not clear that this is a good // idea. @@ -983,14 +983,14 @@ Module *ModuleMap::inferFrameworkModule(const DirectoryEntry *FrameworkDir, // The "Headers/" component of the name is implied because this is // a framework module. setUmbrellaHeader(Result, UmbrellaHeader, ModuleName + ".h"); - + // export * Result->Exports.push_back(Module::ExportDecl(nullptr, true)); // module * { export * } Result->InferSubmodules = true; Result->InferExportWildcard = true; - + // Look for subframeworks. std::error_code EC; SmallString<128> SubframeworksDirName @@ -1200,11 +1200,11 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, const FileEntry *ModMap) { LLVM_DUMP_METHOD void ModuleMap::dump() { llvm::errs() << "Modules:"; - for (llvm::StringMap<Module *>::iterator M = Modules.begin(), - MEnd = Modules.end(); + for (llvm::StringMap<Module *>::iterator M = Modules.begin(), + MEnd = Modules.end(); M != MEnd; ++M) M->getValue()->print(llvm::errs(), 2); - + llvm::errs() << "Headers:"; for (HeadersMap::iterator H = Headers.begin(), HEnd = Headers.end(); H != HEnd; ++H) { @@ -1299,7 +1299,7 @@ namespace clang { LSquare, RSquare } Kind; - + unsigned Location; unsigned StringLength; union { @@ -1309,16 +1309,16 @@ namespace clang { // If Kind == IntegerLiteral. uint64_t IntegerValue; }; - + void clear() { Kind = EndOfFile; Location = 0; StringLength = 0; StringData = nullptr; } - + bool is(TokenKind K) const { return Kind == K; } - + SourceLocation getLocation() const { return SourceLocation::getFromRawEncoding(Location); } @@ -1326,7 +1326,7 @@ namespace clang { uint64_t getInteger() const { return Kind == IntegerLiteral ? IntegerValue : 0; } - + StringRef getString() const { return Kind == IntegerLiteral ? StringRef() : StringRef(StringData, StringLength); @@ -1356,17 +1356,17 @@ namespace clang { /// Whether this module map is in a system header directory. bool IsSystem; - + /// Whether an error occurred. bool HadError = false; - + /// Stores string data for the various string literals referenced /// during parsing. llvm::BumpPtrAllocator StringData; - + /// The current token. MMToken Tok; - + /// The active module. Module *ActiveModule = nullptr; @@ -1413,7 +1413,7 @@ namespace clang { using Attributes = ModuleMap::Attributes; bool parseOptionalAttributes(Attributes &Attrs); - + public: explicit ModuleMapParser(Lexer &L, SourceManager &SourceMgr, const TargetInfo *Target, DiagnosticsEngine &Diags, @@ -1475,7 +1475,7 @@ retry: case tok::eof: Tok.Kind = MMToken::EndOfFile; break; - + case tok::l_brace: Tok.Kind = MMToken::LBrace; break; @@ -1483,27 +1483,27 @@ retry: case tok::l_square: Tok.Kind = MMToken::LSquare; break; - + case tok::period: Tok.Kind = MMToken::Period; break; - + case tok::r_brace: Tok.Kind = MMToken::RBrace; break; - + case tok::r_square: Tok.Kind = MMToken::RSquare; break; - + case tok::star: Tok.Kind = MMToken::Star; break; - + case tok::exclaim: Tok.Kind = MMToken::Exclaim; break; - + case tok::string_literal: { if (LToken.hasUDSuffix()) { Diags.Report(LToken.getLocation(), diag::err_invalid_string_udl); @@ -1516,13 +1516,13 @@ retry: StringLiteralParser StringLiteral(LToken, SourceMgr, LangOpts, *Target); if (StringLiteral.hadError) goto retry; - + // Copy the string literal into our string data allocator. unsigned Length = StringLiteral.GetStringLength(); char *Saved = StringData.Allocate<char>(Length + 1); memcpy(Saved, StringLiteral.GetString().data(), Length); Saved[Length] = 0; - + // Form the token. Tok.Kind = MMToken::StringLiteral; Tok.StringData = Saved; @@ -1548,7 +1548,7 @@ retry: Tok.IntegerValue = Value; break; } - + case tok::comment: goto retry; @@ -1576,7 +1576,7 @@ retry: HadError = true; goto retry; } - + return Result; } @@ -1591,14 +1591,14 @@ void ModuleMapParser::skipUntil(MMToken::TokenKind K) { case MMToken::LBrace: if (Tok.is(K) && braceDepth == 0 && squareDepth == 0) return; - + ++braceDepth; break; case MMToken::LSquare: if (Tok.is(K) && braceDepth == 0 && squareDepth == 0) return; - + ++squareDepth; break; @@ -1621,7 +1621,7 @@ void ModuleMapParser::skipUntil(MMToken::TokenKind K) { return; break; } - + consumeToken(); } while (true); } @@ -1643,13 +1643,13 @@ bool ModuleMapParser::parseModuleId(ModuleId &Id) { Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module_name); return true; } - + if (!Tok.is(MMToken::Period)) break; - + consumeToken(); } while (true); - + return false; } @@ -1740,7 +1740,7 @@ void ModuleMapParser::diagnosePrivateModules(SourceLocation ExplicitLoc, /// /// module-declaration: /// 'extern' 'module' module-id string-literal -/// 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt] +/// 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt] /// { module-member* } /// /// module-member: @@ -1778,8 +1778,8 @@ void ModuleMapParser::parseModuleDecl() { if (Tok.is(MMToken::FrameworkKeyword)) { FrameworkLoc = consumeToken(); Framework = true; - } - + } + // Parse 'module' keyword. if (!Tok.is(MMToken::ModuleKeyword)) { Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module); @@ -1790,10 +1790,10 @@ void ModuleMapParser::parseModuleDecl() { CurrModuleDeclLoc = consumeToken(); // 'module' keyword // If we have a wildcard for the module name, this is an inferred submodule. - // Parse it. + // Parse it. if (Tok.is(MMToken::Star)) return parseInferredModuleDecl(Framework, Explicit); - + // Parse the module name. ModuleId Id; if (parseModuleId(Id)) { @@ -1805,7 +1805,7 @@ void ModuleMapParser::parseModuleDecl() { if (Id.size() > 1) { Diags.Report(Id.front().second, diag::err_mmap_nested_submodule_id) << SourceRange(Id.front().second, Id.back().second); - + HadError = true; return; } @@ -1816,8 +1816,8 @@ void ModuleMapParser::parseModuleDecl() { ExplicitLoc = SourceLocation(); HadError = true; } - - Module *PreviousActiveModule = ActiveModule; + + Module *PreviousActiveModule = ActiveModule; if (Id.size() > 1) { // This module map defines a submodule. Go find the module of which it // is a submodule. @@ -1830,7 +1830,7 @@ void ModuleMapParser::parseModuleDecl() { ActiveModule = Next; continue; } - + if (ActiveModule) { Diags.Report(Id[I].second, diag::err_mmap_missing_module_qualified) << Id[I].first @@ -1849,10 +1849,10 @@ void ModuleMapParser::parseModuleDecl() { Map.addAdditionalModuleMapFile(TopLevelModule, ModuleMapFile); } } - + StringRef ModuleName = Id.back().first; SourceLocation ModuleNameLoc = Id.back().second; - + // Parse the optional attribute list. Attributes Attrs; if (parseOptionalAttributes(Attrs)) @@ -1864,9 +1864,9 @@ void ModuleMapParser::parseModuleDecl() { << ModuleName; HadError = true; return; - } + } SourceLocation LBraceLoc = consumeToken(); - + // Determine whether this (sub)module has already been defined. Module *ShadowingModule = nullptr; if (Module *Existing = Map.lookupModuleQualified(ModuleName, ActiveModule)) { @@ -1890,7 +1890,7 @@ void ModuleMapParser::parseModuleDecl() { else { Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace); Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match); - HadError = true; + HadError = true; } return; } @@ -1986,7 +1986,7 @@ void ModuleMapParser::parseModuleDecl() { case MMToken::UseKeyword: parseUseDecl(); break; - + case MMToken::RequiresKeyword: parseRequiresDecl(); break; @@ -2023,7 +2023,7 @@ void ModuleMapParser::parseModuleDecl() { default: Diags.Report(Tok.getLocation(), diag::err_mmap_expected_member); consumeToken(); - break; + break; } } while (!Done); @@ -2233,7 +2233,7 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, // Parse the header name. if (!Tok.is(MMToken::StringLiteral)) { - Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header) + Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header) << "header"; HadError = true; return; @@ -2330,7 +2330,7 @@ static int compareModuleHeaders(const Module::Header *A, void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { // Parse the directory name. if (!Tok.is(MMToken::StringLiteral)) { - Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header) + Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header) << "umbrella"; HadError = true; return; @@ -2338,7 +2338,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { std::string DirName = Tok.getString(); SourceLocation DirNameLoc = consumeToken(); - + // Check whether we already have an umbrella. if (ActiveModule->Umbrella) { Diags.Report(DirNameLoc, diag::err_mmap_umbrella_clash) @@ -2357,7 +2357,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { llvm::sys::path::append(PathName, DirName); Dir = SourceMgr.getFileManager().getDirectory(PathName); } - + if (!Dir) { Diags.Report(DirNameLoc, diag::warn_mmap_umbrella_dir_not_found) << DirName; @@ -2413,38 +2413,38 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { void ModuleMapParser::parseExportDecl() { assert(Tok.is(MMToken::ExportKeyword)); SourceLocation ExportLoc = consumeToken(); - + // Parse the module-id with an optional wildcard at the end. ModuleId ParsedModuleId; bool Wildcard = false; do { // FIXME: Support string-literal module names here. if (Tok.is(MMToken::Identifier)) { - ParsedModuleId.push_back(std::make_pair(Tok.getString(), + ParsedModuleId.push_back(std::make_pair(Tok.getString(), Tok.getLocation())); consumeToken(); - + if (Tok.is(MMToken::Period)) { consumeToken(); continue; - } - + } + break; } - + if(Tok.is(MMToken::Star)) { Wildcard = true; consumeToken(); break; } - + Diags.Report(Tok.getLocation(), diag::err_mmap_module_id); HadError = true; return; } while (true); - - Module::UnresolvedExportDecl Unresolved = { - ExportLoc, ParsedModuleId, Wildcard + + Module::UnresolvedExportDecl Unresolved = { + ExportLoc, ParsedModuleId, Wildcard }; ActiveModule->UnresolvedExports.push_back(Unresolved); } @@ -2468,7 +2468,7 @@ void ModuleMapParser::parseExportAsDecl() { consumeToken(); return; } - + if (!ActiveModule->ExportAsModule.empty()) { if (ActiveModule->ExportAsModule == Tok.getString()) { Diags.Report(Tok.getLocation(), diag::warn_mmap_redundant_export_as) @@ -2479,7 +2479,7 @@ void ModuleMapParser::parseExportAsDecl() { << Tok.getString(); } } - + ActiveModule->ExportAsModule = Tok.getString(); Map.addLinkAsDependency(ActiveModule); @@ -2666,7 +2666,7 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { Diags.Report(StarLoc, diag::err_mmap_inferred_no_umbrella); Failed = true; } - + // Check for redefinition of an inferred module. if (!Failed && ActiveModule->InferSubmodules) { Diags.Report(StarLoc, diag::err_mmap_inferred_redef); @@ -2721,7 +2721,7 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { Diags.Report(Tok.getLocation(), diag::err_mmap_expected_lbrace_wildcard); HadError = true; return; - } + } SourceLocation LBraceLoc = consumeToken(); // Parse the body of the inferred submodule. @@ -2762,10 +2762,10 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { } consumeToken(); - if (Tok.is(MMToken::Star)) + if (Tok.is(MMToken::Star)) ActiveModule->InferExportWildcard = true; else - Diags.Report(Tok.getLocation(), + Diags.Report(Tok.getLocation(), diag::err_mmap_expected_export_wildcard); consumeToken(); break; @@ -2779,10 +2779,10 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { Diags.Report(Tok.getLocation(), diag::err_mmap_expected_inferred_member) << (ActiveModule != nullptr); consumeToken(); - break; + break; } } while (!Done); - + if (Tok.is(MMToken::RBrace)) consumeToken(); else { @@ -2806,7 +2806,7 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) { /// \returns true if an error occurred, false otherwise. bool ModuleMapParser::parseOptionalAttributes(Attributes &Attrs) { bool HadError = false; - + while (Tok.is(MMToken::LSquare)) { // Consume the '['. SourceLocation LSquareLoc = consumeToken(); @@ -2876,7 +2876,7 @@ bool ModuleMapParser::parseModuleMapFile() { switch (Tok.Kind) { case MMToken::EndOfFile: return HadError; - + case MMToken::ExplicitKeyword: case MMToken::ExternKeyword: case MMToken::ModuleKeyword: diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index d8dae73037a..66a9faa6e60 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2597,13 +2597,13 @@ void Preprocessor::HandleDefineDirective( MacroInfo *const MI = ReadOptionalMacroParameterListAndBody( MacroNameTok, ImmediatelyAfterHeaderGuard); - + if (!MI) return; if (MacroShadowsKeyword && !isConfigurationPattern(MacroNameTok, MI, getLangOpts())) { Diag(MacroNameTok, diag::warn_pp_macro_hides_keyword); - } + } // Check that there is no paste (##) operator at the beginning or end of the // replacement list. unsigned NumTokens = MI->getNumTokens(); @@ -2716,7 +2716,7 @@ void Preprocessor::HandleUndefDirective() { auto *II = MacroNameTok.getIdentifierInfo(); auto MD = getMacroDefinition(II); UndefMacroDirective *Undef = nullptr; - + // If the macro is not defined, this is a noop undef. if (const MacroInfo *MI = MD.getMacroInfo()) { if (!MI->isUsed() && MI->isWarnIfUnused()) diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp index b1ed0e10c6f..ac01efad9bf 100644 --- a/clang/lib/Lex/PPExpressions.cpp +++ b/clang/lib/Lex/PPExpressions.cpp @@ -273,7 +273,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, case tok::numeric_constant: { SmallString<64> IntegerBuffer; bool NumberInvalid = false; - StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer, + StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer, &NumberInvalid); if (NumberInvalid) return true; // a diagnostic was already reported @@ -832,11 +832,11 @@ Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) { // expression. bool DisableMacroExpansionAtStartOfDirective = DisableMacroExpansion; DisableMacroExpansion = false; - + // Peek ahead one token. Token Tok; LexNonComment(Tok); - + // C99 6.10.1p3 - All expressions are evaluated as intmax_t or uintmax_t. unsigned BitWidth = getTargetInfo().getIntMaxTWidth(); @@ -846,7 +846,7 @@ Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) { // Parse error, skip the rest of the macro line. if (Tok.isNot(tok::eod)) DiscardUntilEndOfDirective(); - + // Restore 'DisableMacroExpansion'. DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective; return {false, DT.IncludedUndefinedIds}; @@ -873,7 +873,7 @@ Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) { // Parse error, skip the rest of the macro line. if (Tok.isNot(tok::eod)) DiscardUntilEndOfDirective(); - + // Restore 'DisableMacroExpansion'. DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective; return {false, DT.IncludedUndefinedIds}; diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 352814d715f..6631b13b158 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -82,10 +82,10 @@ bool Preprocessor::EnterSourceFile(FileID FID, const DirectoryLookup *CurDir, return false; } } - + // Get the MemoryBuffer for this FID, if it fails, we fail. bool Invalid = false; - const llvm::MemoryBuffer *InputFile = + const llvm::MemoryBuffer *InputFile = getSourceManager().getBuffer(FID, Loc, &Invalid); if (Invalid) { SourceLocation FileStart = SourceMgr.getLocForStartOfFile(FID); @@ -145,7 +145,7 @@ void Preprocessor::EnterSourceFileWithPTH(PTHLexer *PL, CurLexerSubmodule = nullptr; if (CurLexerKind != CLK_LexAfterModuleImport) CurLexerKind = CLK_PTHLexer; - + // Notify the client, if desired, that we are in a new source file. if (Callbacks) { FileID FID = CurPPLexer->getFileID(); @@ -240,15 +240,15 @@ static void computeRelativePath(FileManager &FM, const DirectoryEntry *Dir, if (const DirectoryEntry *CurDir = FM.getDirectory(Path)) { if (CurDir == Dir) { Result = FilePath.substr(Path.size()); - llvm::sys::path::append(Result, + llvm::sys::path::append(Result, llvm::sys::path::filename(File->getName())); return; } } - + Path = llvm::sys::path::parent_path(Path); } - + Result = File->getName(); } @@ -553,7 +553,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { CurPTHLexer->getEOF(Result); CurPTHLexer.reset(); } - + if (!isIncrementalProcessingEnabled()) CurPPLexer = nullptr; diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index d9992e00f8c..346dd947c02 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -1186,7 +1186,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok, SmallString<128> FilenameBuffer; StringRef Filename; SourceLocation EndLoc; - + switch (Tok.getKind()) { case tok::eod: // If the token kind is EOD, the error has already been diagnosed. @@ -1260,7 +1260,7 @@ static bool EvaluateHasIncludeNext(Token &Tok, // __has_include_next is like __has_include, except that we start // searching after the current found directory. If we can't do this, // issue a diagnostic. - // FIXME: Factor out duplication with + // FIXME: Factor out duplication with // Preprocessor::HandleIncludeNextDirective. const DirectoryLookup *Lookup = PP.GetCurDirLookup(); const FileEntry *LookupFromFile = nullptr; @@ -1510,7 +1510,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { PLoc = SourceMgr.getPresumedLoc(NextLoc); if (PLoc.isInvalid()) break; - + NextLoc = PLoc.getIncludeLoc(); } } diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 930c5f6b069..37c0a23646c 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -64,7 +64,7 @@ PragmaHandler::~PragmaHandler() = default; EmptyPragmaHandler::EmptyPragmaHandler(StringRef Name) : PragmaHandler(Name) {} -void EmptyPragmaHandler::HandlePragma(Preprocessor &PP, +void EmptyPragmaHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, Token &FirstToken) {} @@ -99,7 +99,7 @@ void PragmaNamespace::RemovePragmaHandler(PragmaHandler *Handler) { Handlers.erase(Handler->getName()); } -void PragmaNamespace::HandlePragma(Preprocessor &PP, +void PragmaNamespace::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, Token &Tok) { // Read the 'namespace' that the directive is in, e.g. STDC. Do not macro @@ -141,7 +141,7 @@ void Preprocessor::HandlePragmaDirective(SourceLocation IntroducerLoc, PragmaHandlers->HandlePragma(*this, Introducer, Tok); // If the pragma handler didn't read the rest of the line, consume it now. - if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective()) + if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective()) || (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective)) DiscardUntilEndOfDirective(); } @@ -468,7 +468,7 @@ void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) { PresumedLoc PLoc = SourceMgr.getPresumedLoc(SysHeaderTok.getLocation()); if (PLoc.isInvalid()) return; - + unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename()); // Notify the client, if desired, that we are in a new source file. @@ -601,7 +601,7 @@ void Preprocessor::HandlePragmaPushMacro(Token &PushMacroTok) { // Get the MacroInfo associated with IdentInfo. MacroInfo *MI = getMacroInfo(IdentInfo); - + if (MI) { // Allow the original MacroInfo to be redefined later. MI->setIsAllowRedefinitionsWithoutWarning(true); @@ -653,7 +653,7 @@ void Preprocessor::HandlePragmaPopMacro(Token &PopMacroTok) { } void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) { - // We will either get a quoted filename or a bracketed filename, and we + // We will either get a quoted filename or a bracketed filename, and we // have to track which we got. The first filename is the source name, // and the second name is the mapped filename. If the first is quoted, // the second must be as well (cannot mix and match quotes and brackets). @@ -675,7 +675,7 @@ void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) { StringRef SourceFileName; SmallString<128> FileNameBuffer; - if (SourceFilenameTok.is(tok::string_literal) || + if (SourceFilenameTok.is(tok::string_literal) || SourceFilenameTok.is(tok::angle_string_literal)) { SourceFileName = getSpelling(SourceFilenameTok, FileNameBuffer); } else if (SourceFilenameTok.is(tok::less)) { @@ -706,7 +706,7 @@ void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) { } StringRef ReplaceFileName; - if (ReplaceFilenameTok.is(tok::string_literal) || + if (ReplaceFilenameTok.is(tok::string_literal) || ReplaceFilenameTok.is(tok::angle_string_literal)) { ReplaceFileName = getSpelling(ReplaceFilenameTok, FileNameBuffer); } else if (ReplaceFilenameTok.is(tok::less)) { @@ -732,8 +732,8 @@ void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) { // they're both of the same type (angled vs non-angled) StringRef OriginalSource = SourceFileName; - bool SourceIsAngled = - GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(), + bool SourceIsAngled = + GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(), SourceFileName); bool ReplaceIsAngled = GetIncludeFilenameSpelling(ReplaceFilenameTok.getLocation(), @@ -747,7 +747,7 @@ void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) { DiagID = diag::warn_pragma_include_alias_mismatch_quote; Diag(SourceFilenameTok.getLocation(), DiagID) - << SourceFileName + << SourceFileName << ReplaceFileName; return; @@ -1615,7 +1615,7 @@ struct PragmaPopMacroHandler : public PragmaHandler { } }; -/// PragmaARCCFCodeAuditedHandler - +/// PragmaARCCFCodeAuditedHandler - /// \#pragma clang arc_cf_code_audited begin/end struct PragmaARCCFCodeAuditedHandler : public PragmaHandler { PragmaARCCFCodeAuditedHandler() : PragmaHandler("arc_cf_code_audited") {} @@ -1790,7 +1790,7 @@ void Preprocessor::RegisterBuiltinPragmas() { ModuleHandler->AddPragma(new PragmaModuleEndHandler()); ModuleHandler->AddPragma(new PragmaModuleBuildHandler()); ModuleHandler->AddPragma(new PragmaModuleLoadHandler()); - + // Add region pragmas. AddPragmaHandler(new PragmaRegionHandler("region")); AddPragmaHandler(new PragmaRegionHandler("endregion")); diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index b59820003b5..b37a8cf1ced 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -67,7 +67,7 @@ PreprocessingRecord::getPreprocessedEntitiesInRange(SourceRange Range) { } std::pair<int, int> Res = getPreprocessedEntitiesInRangeSlow(Range); - + CachedRangeQuery.Range = Range; CachedRangeQuery.Result = Res; @@ -138,28 +138,28 @@ std::pair<int, int> PreprocessingRecord::getPreprocessedEntitiesInRangeSlow(SourceRange Range) { assert(Range.isValid()); assert(!SourceMgr.isBeforeInTranslationUnit(Range.getEnd(),Range.getBegin())); - + std::pair<unsigned, unsigned> Local = findLocalPreprocessedEntitiesInRange(Range); - + // Check if range spans local entities. if (!ExternalSource || SourceMgr.isLocalSourceLocation(Range.getBegin())) return std::make_pair(Local.first, Local.second); - + std::pair<unsigned, unsigned> Loaded = ExternalSource->findPreprocessedEntitiesInRange(Range); - + // Check if range spans local entities. if (Loaded.first == Loaded.second) return std::make_pair(Local.first, Local.second); - + unsigned TotalLoaded = LoadedPreprocessedEntities.size(); - + // Check if range spans loaded entities. if (Local.first == Local.second) return std::make_pair(int(Loaded.first)-TotalLoaded, int(Loaded.second)-TotalLoaded); - + // Range spands loaded and local entities. return std::make_pair(int(Loaded.first)-TotalLoaded, Local.second); } @@ -324,7 +324,7 @@ void PreprocessingRecord::SetExternalSource( unsigned PreprocessingRecord::allocateLoadedEntities(unsigned NumEntities) { unsigned Result = LoadedPreprocessedEntities.size(); - LoadedPreprocessedEntities.resize(LoadedPreprocessedEntities.size() + LoadedPreprocessedEntities.resize(LoadedPreprocessedEntities.size() + NumEntities); return Result; } @@ -371,7 +371,7 @@ PreprocessedEntity *PreprocessingRecord::getPreprocessedEntity(PPEntityID PPID){ /// Retrieve the loaded preprocessed entity at the given index. PreprocessedEntity * PreprocessingRecord::getLoadedPreprocessedEntity(unsigned Index) { - assert(Index < LoadedPreprocessedEntities.size() && + assert(Index < LoadedPreprocessedEntities.size() && "Out-of bounds loaded preprocessed entity"); assert(ExternalSource && "No external source to load from"); PreprocessedEntity *&Entity = LoadedPreprocessedEntities[Index]; @@ -471,27 +471,27 @@ void PreprocessingRecord::InclusionDirective( const FileEntry *File, StringRef SearchPath, StringRef RelativePath, - const Module *Imported, + const Module *Imported, SrcMgr::CharacteristicKind FileType) { InclusionDirective::InclusionKind Kind = InclusionDirective::Include; - + switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) { - case tok::pp_include: - Kind = InclusionDirective::Include; + case tok::pp_include: + Kind = InclusionDirective::Include; break; - - case tok::pp_import: - Kind = InclusionDirective::Import; + + case tok::pp_import: + Kind = InclusionDirective::Import; break; - - case tok::pp_include_next: - Kind = InclusionDirective::IncludeNext; + + case tok::pp_include_next: + Kind = InclusionDirective::IncludeNext; break; - - case tok::pp___include_macros: + + case tok::pp___include_macros: Kind = InclusionDirective::IncludeMacros; break; - + default: llvm_unreachable("Unknown include directive kind"); } diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 0217a2e60ed..def47b2f109 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -95,12 +95,12 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts, TUKind(TUKind), SkipMainFilePreamble(0, true), CurSubmoduleState(&NullSubmoduleState) { OwnsHeaderSearch = OwnsHeaders; - + // Default to discarding comments. KeepComments = false; KeepMacroComments = false; SuppressIncludeNotFoundError = false; - + // Macro expansion is enabled. DisableMacroExpansion = false; MacroExpansionInDirectivesOverride = false; @@ -127,10 +127,10 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts, // Initialize the pragma handlers. RegisterBuiltinPragmas(); - + // Initialize builtin macros like __LINE__ and friends. RegisterBuiltinMacros(); - + if(LangOpts.Borland) { Ident__exception_info = getIdentifierInfo("_exception_info"); Ident___exception_info = getIdentifierInfo("__exception_info"); @@ -379,7 +379,7 @@ void Preprocessor::recomputeCurLexerKind() { CurLexerKind = CLK_PTHLexer; else if (CurTokenLexer) CurLexerKind = CLK_TokenLexer; - else + else CurLexerKind = CLK_CachingLexer; } @@ -772,7 +772,7 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) { if (IsSpecialVariadicMacro) II.setIsPoisoned(CurrentIsPoisoned); } - + // If this identifier was poisoned, and if it was not produced from a macro // expansion, emit an error. if (II.isPoisoned() && CurPPLexer) { @@ -818,7 +818,7 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) { // like "#define TY typeof", "TY(1) x". if (II.isExtensionToken() && !DisableMacroExpansion) Diag(Identifier, diag::ext_token_used); - + // If this is the 'import' contextual keyword following an '@', note // that the next token indicates a module name. // @@ -881,15 +881,15 @@ void Preprocessor::Lex(Token &Result) { void Preprocessor::LexAfterModuleImport(Token &Result) { // Figure out what kind of lexer we actually have. recomputeCurLexerKind(); - + // Lex the next token. Lex(Result); - // The token sequence + // The token sequence // // import identifier (. identifier)* // - // indicates a module import directive. We already saw the 'import' + // indicates a module import directive. We already saw the 'import' // contextual keyword, so now we're looking for the identifiers. if (ModuleImportExpectsIdentifier && Result.getKind() == tok::identifier) { // We expected to see an identifier here, and we did; continue handling @@ -900,7 +900,7 @@ void Preprocessor::LexAfterModuleImport(Token &Result) { CurLexerKind = CLK_LexAfterModuleImport; return; } - + // If we're expecting a '.' or a ';', and we got a '.', then wait until we // see the next identifier. (We can also see a '[[' that begins an // attribute-specifier-seq here under the C++ Modules TS.) @@ -1056,7 +1056,7 @@ CodeCompletionHandler::~CodeCompletionHandler() = default; void Preprocessor::createPreprocessingRecord() { if (Record) return; - + Record = new PreprocessingRecord(getSourceManager()); addPPCallbacks(std::unique_ptr<PPCallbacks>(Record)); } diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 184b1b39028..608e0dedebb 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -248,7 +248,7 @@ void TokenLexer::ExpandFunctionArguments() { ActualArgs->invokedWithVariadicArgument(Macro); VAOptExpansionContext VCtx(PP); - + for (unsigned I = 0, E = NumTokens; I != E; ++I) { const Token &CurTok = Tokens[I]; // We don't want a space for the next token after a paste @@ -268,7 +268,7 @@ void TokenLexer::ExpandFunctionArguments() { ++I; // Skip the l_paren VCtx.sawVAOptFollowedByOpeningParens(CurTok.getLocation(), ResultToks.size()); - + continue; } @@ -336,14 +336,14 @@ void TokenLexer::ExpandFunctionArguments() { } // If we found the stringify operator, get the argument stringified. The - // preprocessor already verified that the following token is a macro + // preprocessor already verified that the following token is a macro // parameter or __VA_OPT__ when the #define was lexed. - + if (CurTok.isOneOf(tok::hash, tok::hashat)) { int ArgNo = Macro->getParameterNum(Tokens[I+1].getIdentifierInfo()); assert((ArgNo != -1 || VCtx.isVAOptToken(Tokens[I + 1])) && "Token following # is not an argument or __VA_OPT__!"); - + if (ArgNo == -1) { // Handle the __VA_OPT__ case. VCtx.sawHashOrHashAtBefore(NextTokGetsSpace, @@ -706,7 +706,7 @@ bool TokenLexer::pasteTokens(Token &LHSTok, ArrayRef<Token> TokenStream, if (PP.getLangOpts().MicrosoftExt && (CurIdx >= 2) && TokenStream[CurIdx - 2].is(tok::hashhash)) LHSTok.clearFlag(Token::LeadingSpace); - + SmallString<128> Buffer; const char *ResultTokStrPtr = nullptr; SourceLocation StartLoc = LHSTok.getLocation(); @@ -845,7 +845,7 @@ bool TokenLexer::pasteTokens(Token &LHSTok, ArrayRef<Token> TokenStream, // Transfer properties of the LHS over the Result. Result.setFlagValue(Token::StartOfLine , LHSTok.isAtStartOfLine()); Result.setFlagValue(Token::LeadingSpace, LHSTok.hasLeadingSpace()); - + // Finally, replace LHS with the result, consume the RHS, and iterate. ++CurIdx; LHSTok = Result; @@ -868,7 +868,7 @@ bool TokenLexer::pasteTokens(Token &LHSTok, ArrayRef<Token> TokenStream, StartLoc = SM.getImmediateExpansionRange(StartLoc).getBegin(); while (SM.getFileID(EndLoc) != MacroFID) EndLoc = SM.getImmediateExpansionRange(EndLoc).getEnd(); - + LHSTok.setLocation(SM.createExpansionLoc(LHSTok.getLocation(), StartLoc, EndLoc, LHSTok.getLength())); @@ -927,7 +927,7 @@ TokenLexer::getExpansionLocForMacroDefLoc(SourceLocation loc) const { assert(ExpandLocStart.isValid() && MacroExpansionStart.isValid() && "Not appropriate for token streams"); assert(loc.isValid() && loc.isFileID()); - + SourceManager &SM = PP.getSourceManager(); assert(SM.isInSLocAddrSpace(loc, MacroDefStart, MacroDefLength) && "Expected loc to come from the macro definition"); @@ -1019,7 +1019,7 @@ void TokenLexer::updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc, SourceLocation InstLoc = getExpansionLocForMacroDefLoc(ArgIdSpellLoc); - + while (begin_tokens < end_tokens) { // If there's only one token just create a SLocEntry for it. if (end_tokens - begin_tokens == 1) { |