[clang] fca2109 - [clang][NFC] Make HeaderSearch::suggestPathToFileForDiagnostics method const.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 05:42:28 PDT 2023


Author: Haojian Wu
Date: 2023-06-01T14:42:16+02:00
New Revision: fca2109047964ea884fcd86efe24bc4c4bfb940e

URL: https://github.com/llvm/llvm-project/commit/fca2109047964ea884fcd86efe24bc4c4bfb940e
DIFF: https://github.com/llvm/llvm-project/commit/fca2109047964ea884fcd86efe24bc4c4bfb940e.diff

LOG: [clang][NFC] Make HeaderSearch::suggestPathToFileForDiagnostics method const.

Added: 
    

Modified: 
    clang/include/clang/Lex/HeaderSearch.h
    clang/lib/Lex/HeaderSearch.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index d3ee4963fced9..e2d7f64c360f2 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -867,7 +867,7 @@ class HeaderSearch {
   ///        path is relative to a system header directory.
   std::string suggestPathToFileForDiagnostics(const FileEntry *File,
                                               llvm::StringRef MainFile,
-                                              bool *IsSystem = nullptr);
+                                              bool *IsSystem = nullptr) const;
 
   /// Suggest a path by which the specified file could be found, for use in
   /// diagnostics to suggest a #include. Returned path will only contain forward
@@ -881,7 +881,7 @@ class HeaderSearch {
   std::string suggestPathToFileForDiagnostics(llvm::StringRef File,
                                               llvm::StringRef WorkingDir,
                                               llvm::StringRef MainFile,
-                                              bool *IsSystem = nullptr);
+                                              bool *IsSystem = nullptr) const;
 
   void PrintStats();
 

diff  --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index db7e531ed3137..33b25928cc04a 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -1919,7 +1919,7 @@ void HeaderSearch::loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir) {
 }
 
 std::string HeaderSearch::suggestPathToFileForDiagnostics(
-    const FileEntry *File, llvm::StringRef MainFile, bool *IsSystem) {
+    const FileEntry *File, llvm::StringRef MainFile, bool *IsSystem) const {
   // FIXME: We assume that the path name currently cached in the FileEntry is
   // the most appropriate one for this analysis (and that it's spelled the
   // same way as the corresponding header search path).
@@ -1929,7 +1929,7 @@ std::string HeaderSearch::suggestPathToFileForDiagnostics(
 
 std::string HeaderSearch::suggestPathToFileForDiagnostics(
     llvm::StringRef File, llvm::StringRef WorkingDir, llvm::StringRef MainFile,
-    bool *IsSystem) {
+    bool *IsSystem) const {
   using namespace llvm::sys;
 
   llvm::SmallString<32> FilePath = File;


        


More information about the cfe-commits mailing list