From: Chris Lattner Date: Mon, 27 Oct 2008 01:19:25 +0000 (+0000) Subject: Rename Characteristic_t to CharacteristicKind X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d72851fec9e9c62570a027d42701562bbf29751;p=clang Rename Characteristic_t to CharacteristicKind git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/DependencyFile.cpp b/Driver/DependencyFile.cpp index cd26079f89..e559edf4d2 100644 --- a/Driver/DependencyFile.cpp +++ b/Driver/DependencyFile.cpp @@ -36,7 +36,7 @@ class VISIBILITY_HIDDEN DependencyFileCallback : public PPCallbacks { private: bool FileMatchesDepCriteria(const char *Filename, - SrcMgr::Characteristic_t FileType); + SrcMgr::CharacteristicKind FileType); void OutputDependencyFile(); public: @@ -47,7 +47,7 @@ public: const char *&ErrStr); ~DependencyFileCallback(); virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::Characteristic_t FileType); + SrcMgr::CharacteristicKind FileType); }; } @@ -148,7 +148,7 @@ bool clang::CreateDependencyFileGen(Preprocessor *PP, /// FileMatchesDepCriteria - Determine whether the given Filename should be /// considered as a dependency. bool DependencyFileCallback::FileMatchesDepCriteria(const char *Filename, - SrcMgr::Characteristic_t FileType) { + SrcMgr::CharacteristicKind FileType) { if (strcmp(InputFile.c_str(), Filename) != 0 && strcmp("", Filename) != 0) { if (GenerateDependencyFileNoSysHeaders) @@ -162,7 +162,7 @@ bool DependencyFileCallback::FileMatchesDepCriteria(const char *Filename, void DependencyFileCallback::FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::Characteristic_t FileType) { + SrcMgr::CharacteristicKind FileType) { if (Reason != PPCallbacks::EnterFile) return; diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index 570b36b694..fd150ae3c7 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -48,7 +48,7 @@ public: private: unsigned CurLine; bool EmittedTokensOnThisLine; - SrcMgr::Characteristic_t FileType; + SrcMgr::CharacteristicKind FileType; llvm::SmallString<512> CurFilename; bool Initialized; public: @@ -65,7 +65,7 @@ public: bool hasEmittedTokensOnThisLine() const { return EmittedTokensOnThisLine; } virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::Characteristic_t FileType); + SrcMgr::CharacteristicKind FileType); virtual void Ident(SourceLocation Loc, const std::string &str); @@ -143,7 +143,7 @@ bool PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) { /// position. void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::Characteristic_t NewFileType) { + SrcMgr::CharacteristicKind NewFileType) { // Unless we are exiting a #include, make sure to skip ahead to the line the // #include directive was at. SourceManager &SourceMgr = PP.getSourceManager(); diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 407f193e31..be3483ea95 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -116,6 +116,7 @@ DE39857B0CB8ADCB00223765 /* ASTConsumers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE39857A0CB8ADCB00223765 /* ASTConsumers.cpp */; }; DE3986F00CB8D4B300223765 /* IdentifierTable.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE3986EF0CB8D4B300223765 /* IdentifierTable.h */; }; DE3986F40CB8D50C00223765 /* IdentifierTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE3986F30CB8D50C00223765 /* IdentifierTable.cpp */; }; + DE3B92810EB54E6000D01046 /* DependencyFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE3B92800EB54E6000D01046 /* DependencyFile.cpp */; }; DE4121350D7F1C1C0080F80A /* SymbolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121270D7F1C1C0080F80A /* SymbolManager.cpp */; }; DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */; }; DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */; }; @@ -442,6 +443,7 @@ DE3B90DE0EAC5EF200D01046 /* ExtensionRAIIObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExtensionRAIIObject.h; path = lib/Parse/ExtensionRAIIObject.h; sourceTree = ""; }; DE3B921C0EB1A81400D01046 /* SemaInherit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SemaInherit.h; path = lib/Sema/SemaInherit.h; sourceTree = ""; }; DE3B92230EB5152000D01046 /* Designator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Designator.h; path = clang/Parse/Designator.h; sourceTree = ""; }; + DE3B92800EB54E6000D01046 /* DependencyFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DependencyFile.cpp; path = Driver/DependencyFile.cpp; sourceTree = ""; }; DE41211D0D7F1BBE0080F80A /* GRWorkList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRWorkList.h; path = clang/Analysis/PathSensitive/GRWorkList.h; sourceTree = ""; }; DE41211E0D7F1BBE0080F80A /* SymbolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SymbolManager.h; path = clang/Analysis/PathSensitive/SymbolManager.h; sourceTree = ""; }; DE41211F0D7F1BBE0080F80A /* GRBlockCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRBlockCounter.h; path = clang/Analysis/PathSensitive/GRBlockCounter.h; sourceTree = ""; }; @@ -908,6 +910,7 @@ DE3985780CB8ADC800223765 /* ASTConsumers.h */, DE39857A0CB8ADCB00223765 /* ASTConsumers.cpp */, 35A057E60EAE2DDD0069249F /* CacheTokens.cpp */, + DE3B92800EB54E6000D01046 /* DependencyFile.cpp */, DE38CF150D8C9DE000A273B6 /* DiagChecker.cpp */, 72D16C210D9975EA00E6DA4A /* HTMLPrint.cpp */, DE5932CF0AD60FF400BC794C /* PrintParserCallbacks.cpp */, @@ -1063,7 +1066,6 @@ DED7D78C0A5242E6003AD0FB /* Lex */ = { isa = PBXGroup; children = ( - 3552E7540E520D80003A8CA5 /* PPCaching.cpp */, DE704DD10D1668A4009C7762 /* HeaderMap.cpp */, DE344B530AE5E46C00DBC861 /* HeaderSearch.cpp */, DED7D79E0A5242E6003AD0FB /* Lexer.cpp */, @@ -1071,6 +1073,7 @@ DE85CD9E0D8382DD0070E26E /* MacroArgs.h */, DE85CDA20D8383B20070E26E /* MacroArgs.cpp */, DED7D7A00A5242E6003AD0FB /* MacroInfo.cpp */, + 3552E7540E520D80003A8CA5 /* PPCaching.cpp */, DE85CDAF0D838C390070E26E /* PPDirectives.cpp */, DED7D7A20A5242E6003AD0FB /* PPExpressions.cpp */, DE85CDB50D839BAE0070E26E /* PPLexerChange.cpp */, @@ -1297,6 +1300,7 @@ 35585DC30EAFBC5F00D0A97A /* Backend.cpp in Sources */, 3557D1A90EB136B100C59739 /* InheritViz.cpp in Sources */, 3557D1F00EB13BB700C59739 /* SemaInherit.cpp in Sources */, + DE3B92810EB54E6000D01046 /* DependencyFile.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index b41d708784..4f58334f2e 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -36,13 +36,13 @@ class IdentifierTokenInfo; /// SourceManager implementation. /// namespace SrcMgr { - /// Characteristic_t - This is used to represent whether a file or directory + /// CharacteristicKind - This is used to represent whether a file or directory /// holds normal user code, system code, or system code which is implicitly /// 'extern "C"' in C++ mode. Entire directories can be tagged with this /// (this is maintained by DirectoryLookup and friends) as can specific /// FileIDInfos when a #pragma system_header is seen or various other cases. /// - enum Characteristic_t { + enum CharacteristicKind { C_User, C_System, C_ExternCSystem }; @@ -125,7 +125,7 @@ namespace SrcMgr { /// chunk number of this FileID. unsigned ChunkNo : 30; - /// FileCharacteristic - This is an instance of Characteristic_t, + /// FileCharacteristic - This is an instance of CharacteristicKind, /// indicating whether this is a system header dir or not. unsigned FileCharacteristic : 2; @@ -136,7 +136,7 @@ namespace SrcMgr { /// get - Return a FileIDInfo object. static FileIDInfo get(SourceLocation IL, unsigned CN, const ContentCache *Con, - Characteristic_t FileCharacter) { + CharacteristicKind FileCharacter) { FileIDInfo X; X.IncludeLoc = IL; X.ChunkNo = CN; @@ -150,8 +150,8 @@ namespace SrcMgr { const ContentCache* getContentCache() const { return Content; } /// getCharacteristic - Return whether this is a system header or not. - Characteristic_t getFileCharacteristic() const { - return (Characteristic_t)FileCharacteristic; + CharacteristicKind getFileCharacteristic() const { + return (CharacteristicKind)FileCharacteristic; } /// Emit - Emit this FileIDInfo to Bitcode. @@ -267,7 +267,7 @@ public: /// being #included from the specified IncludePosition. This returns 0 on /// error and translates NULL into standard input. unsigned createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, - SrcMgr::Characteristic_t FileCharacter) { + SrcMgr::CharacteristicKind FileCharacter) { const SrcMgr::ContentCache *IR = getContentCache(SourceFile); if (IR == 0) return 0; // Error opening file? return createFileID(IR, IncludePos, FileCharacter); @@ -450,7 +450,7 @@ public: bool isInSystemHeader(SourceLocation Loc) const { return getFileCharacteristic(Loc) != SrcMgr::C_User; } - SrcMgr::Characteristic_t getFileCharacteristic(SourceLocation Loc) const { + SrcMgr::CharacteristicKind getFileCharacteristic(SourceLocation Loc) const { return getFIDInfo(getPhysicalLoc(Loc).getFileID())->getFileCharacteristic(); } @@ -498,7 +498,7 @@ private: /// corresponds to a file or some other input source. unsigned createFileID(const SrcMgr::ContentCache* File, SourceLocation IncludePos, - SrcMgr::Characteristic_t DirCharacter); + SrcMgr::CharacteristicKind DirCharacter); /// getContentCache - Create or return a cached ContentCache for the specified /// file. This returns null on failure. diff --git a/include/clang/Lex/DirectoryLookup.h b/include/clang/Lex/DirectoryLookup.h index e5171cd7fe..618de39233 100644 --- a/include/clang/Lex/DirectoryLookup.h +++ b/include/clang/Lex/DirectoryLookup.h @@ -45,7 +45,7 @@ private: } u; /// DirCharacteristic - The type of directory this is: this is an instance of - /// SrcMgr::Characteristic_t. + /// SrcMgr::CharacteristicKind. unsigned DirCharacteristic : 2; /// UserSupplied - True if this is a user-supplied directory. @@ -58,7 +58,7 @@ private: public: /// DirectoryLookup ctor - Note that this ctor *does not take ownership* of /// 'dir'. - DirectoryLookup(const DirectoryEntry *dir, SrcMgr::Characteristic_t DT, + DirectoryLookup(const DirectoryEntry *dir, SrcMgr::CharacteristicKind DT, bool isUser, bool isFramework) : DirCharacteristic(DT), UserSupplied(isUser), LookupType(isFramework ? LT_Framework : LT_NormalDir) { @@ -67,7 +67,7 @@ public: /// DirectoryLookup ctor - Note that this ctor *does not take ownership* of /// 'map'. - DirectoryLookup(const HeaderMap *map, SrcMgr::Characteristic_t DT, + DirectoryLookup(const HeaderMap *map, SrcMgr::CharacteristicKind DT, bool isUser) : DirCharacteristic(DT), UserSupplied(isUser), LookupType(LT_HeaderMap) { u.Map = map; @@ -107,8 +107,8 @@ public: /// DirCharacteristic - The type of directory this is, one of the DirType enum /// values. - SrcMgr::Characteristic_t getDirCharacteristic() const { - return (SrcMgr::Characteristic_t)DirCharacteristic; + SrcMgr::CharacteristicKind getDirCharacteristic() const { + return (SrcMgr::CharacteristicKind)DirCharacteristic; } /// isUserSupplied - True if this is a user-supplied directory. diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index fc0321b3aa..ef860c589e 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -48,7 +48,7 @@ class HeaderSearch { /// DirInfo - Keep track of whether this is a system header, and if so, /// whether it is C++ clean or not. This can be set by the include paths or /// by #pragma gcc system_header. This is an instance of - /// SrcMgr::Characteristic_t. + /// SrcMgr::CharacteristicKind. unsigned DirInfo : 2; /// NumIncludes - This is the number of times the file has been included @@ -155,8 +155,8 @@ public: /// getFileDirFlavor - Return whether the specified file is a normal header, /// a system header, or a C++ friendly system header. - SrcMgr::Characteristic_t getFileDirFlavor(const FileEntry *File) { - return (SrcMgr::Characteristic_t)getFileInfo(File).DirInfo; + SrcMgr::CharacteristicKind getFileDirFlavor(const FileEntry *File) { + return (SrcMgr::CharacteristicKind)getFileInfo(File).DirInfo; } /// MarkFileIncludeOnce - Mark the specified file as a "once only" file, e.g. diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index d8bcdeb098..792c6c41f7 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -38,7 +38,7 @@ public: /// #include'd file (when true) or whether we're exiting one because we ran /// off the end (when false). virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, - SrcMgr::Characteristic_t FileType) { + SrcMgr::CharacteristicKind FileType) { } /// Ident - This callback is invoked when a #ident or #sccs directive is read. diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 1eed0bc143..b8b72878f5 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -76,7 +76,7 @@ SourceManager::createMemBufferContentCache(const MemoryBuffer *Buffer) { /// corresponds to a file or some other input source. unsigned SourceManager::createFileID(const ContentCache *File, SourceLocation IncludePos, - SrcMgr::Characteristic_t FileCharacter) { + SrcMgr::CharacteristicKind FileCharacter) { // If FileEnt is really large (e.g. it's a large .i file), we may not be able // to fit an arbitrary position in the file in the FilePos field. To handle // this, we create one FileID for each chunk of the file that fits in a diff --git a/lib/Driver/InitHeaderSearch.cpp b/lib/Driver/InitHeaderSearch.cpp index a2fa826d0c..b76c99d55d 100644 --- a/lib/Driver/InitHeaderSearch.cpp +++ b/lib/Driver/InitHeaderSearch.cpp @@ -43,7 +43,7 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group, MappedPath.append(Path.begin(), Path.end()); // Compute the DirectoryLookup type. - SrcMgr::Characteristic_t Type; + SrcMgr::CharacteristicKind Type; if (Group == Quoted || Group == Angled) Type = SrcMgr::C_User; else if (isCXXAware) diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 44558e19f9..3d077e1a38 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -675,7 +675,7 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok, // The #included file will be considered to be a system header if either it is // in a system include directory, or if the #includer is a system include // header. - SrcMgr::Characteristic_t FileCharacter = + SrcMgr::CharacteristicKind FileCharacter = std::max(HeaderInfo.getFileDirFlavor(File), SourceMgr.getFileCharacteristic(getCurrentFileLexer()->getFileLoc())); diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index b7e9132baa..1ba33b58a7 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -95,7 +95,7 @@ void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer, // Notify the client, if desired, that we are in a new source file. if (Callbacks && !CurLexer->Is_PragmaLexer) { - SrcMgr::Characteristic_t FileType = + SrcMgr::CharacteristicKind FileType = SourceMgr.getFileCharacteristic(CurLexer->getFileLoc()); Callbacks->FileChanged(CurLexer->getFileLoc(), @@ -178,7 +178,7 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { // Notify the client, if desired, that we are in a new source file. if (Callbacks && !isEndOfMacro && CurLexer) { - SrcMgr::Characteristic_t FileType = + SrcMgr::CharacteristicKind FileType = SourceMgr.getFileCharacteristic(CurLexer->getFileLoc()); Callbacks->FileChanged(CurLexer->getSourceLocation(CurLexer->BufferPtr),