File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,15 @@ class PragmaOnceCallbacks : public PPCallbacks {
2222 void PragmaDirective (SourceLocation Loc,
2323 PragmaIntroducerKind Introducer) override {
2424 auto Str = llvm::StringRef (SM.getCharacterData (Loc));
25- if (!Str.consume_front (" #" )) {
25+ if (!Str.consume_front (" #" ))
2626 return ;
27- }
2827 Str = Str.trim ();
29- if (!Str.consume_front (" pragma" )) {
28+ if (!Str.consume_front (" pragma" ))
3029 return ;
31- }
3230 Str = Str.trim ();
33- if (Str.starts_with (" once" )) {
31+ if (Str.starts_with (" once" ))
3432 Check->diag (Loc,
3533 " avoid 'pragma once' directive; use include guards instead" );
36- }
3734 }
3835
3936private:
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include guards (``#ifndef``/``#define``/``#endif``) for improved portability.
88
99``#pragma once `` is a non-standard extension, despite being widely supported
1010by modern compilers. Relying on it can lead to portability issues in
11- environments.
11+ some environments.
1212
1313Some older or specialized C/C++ compilers, particularly in embedded systems,
1414may not fully support ``#pragma once ``.
You can’t perform that action at this time.
0 commit comments