github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- dedup-test/a.h 
dedup-test/b.h dedup-test/shared.h dedup-test/use.cpp dedup-test/use_err.cpp 
clang/include/clang/Basic/SourceManager.h clang/lib/Basic/SourceManager.cpp 
clang/lib/Serialization/ASTReader.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/Basic/SourceManager.h 
b/clang/include/clang/Basic/SourceManager.h
index 733574d41..553bc3b94 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -752,7 +752,8 @@ class SourceManager : public RefCountedBase<SourceManager> {
   /// The first global offset at which each file's SLoc entry was loaded.
   /// Lets us recognize when a later module re-loads a file already present in
   /// the loaded address space (e.g. a header included by several modules).
-  llvm::DenseMap<const FileEntry *, SourceLocation::UIntTy> 
LoadedFileFirstOffset;
+  llvm::DenseMap<const FileEntry *, SourceLocation::UIntTy>
+      LoadedFileFirstOffset;
   /// Number of loaded file SLoc entries that duplicated an already-loaded 
file.
   unsigned NumDuplicateLoadedFiles = 0;
   /// SLoc address-space bytes occupied by those duplicate entries (the prize
diff --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index bb99376c8..f76e2835d 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4254,8 +4254,8 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F,
       // Eagerly scan this module's SLoc file
       // entries to detect ones that duplicate a file already loaded by an
       // earlier module, and measure the reusable address space.
-      // 
-      // Gated by an env var so normal builds and the test suite 
+      //
+      // Gated by an env var so normal builds and the test suite
       // are unaffected.
       static const bool DedupDetect = ::getenv("CLANG_SLOC_DEDUP") != nullptr;
       if (DedupDetect) {
@@ -4272,12 +4272,23 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F,
             break;
           }
           Expected<llvm::BitstreamEntry> E = F.SLocEntryCursor.advance();
-          if (!E) { consumeError(E.takeError()); ScanOK = false; break; }
-          if (E->Kind != llvm::BitstreamEntry::Record) { ScanOK = false; 
break; }
+          if (!E) {
+            consumeError(E.takeError());
+            ScanOK = false;
+            break;
+          }
+          if (E->Kind != llvm::BitstreamEntry::Record) {
+            ScanOK = false;
+            break;
+          }
           RecordData R;
           StringRef B;
           Expected<unsigned> C = F.SLocEntryCursor.readRecord(E->ID, R, &B);
-          if (!C) { consumeError(C.takeError()); ScanOK = false; break; }
+          if (!C) {
+            consumeError(C.takeError());
+            ScanOK = false;
+            break;
+          }
           Offs[i] = (uint32_t)R[0];
           if (C.get() == SM_SLOC_FILE_ENTRY)
             if (OptionalFileEntryRef File = getInputFile(F, R[4]).getFile())
diff --git a/dedup-test/use_err.cpp b/dedup-test/use_err.cpp
index ea949c54d..8b6d33db9 100644
--- a/dedup-test/use_err.cpp
+++ b/dedup-test/use_err.cpp
@@ -1,7 +1,7 @@
 #include "a.h"
 #include "b.h"
 int main() {
-  int x = a_entry("wrong");   // error -> forces resolving A's shared.h 
location
-  int y = b_entry("wrong");   // error -> forces resolving B's shared.h 
location
+  int x = a_entry("wrong"); // error -> forces resolving A's shared.h location
+  int y = b_entry("wrong"); // error -> forces resolving B's shared.h location
   return x + y;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/203154
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to