[clang][index] Fix cast warning
authorJan Svoboda <jan_svoboda@apple.com>
Tue, 20 Jun 2023 10:21:59 +0000 (12:21 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Tue, 20 Jun 2023 10:22:18 +0000 (12:22 +0200)
This is a follow-up to D151938 that should fix GCC's -Wcast-qual warning.

clang/tools/libclang/CXFile.h

index 8cb28a7..888593b 100644 (file)
@@ -15,7 +15,8 @@
 namespace clang {
 namespace cxfile {
 inline CXFile makeCXFile(OptionalFileEntryRef FE) {
-  return CXFile(FE ? &FE->getMapEntry() : nullptr);
+  return CXFile(FE ? const_cast<FileEntryRef::MapEntry *>(&FE->getMapEntry())
+                   : nullptr);
 }
 
 inline OptionalFileEntryRef getFileEntryRef(CXFile File) {