[clang] Add `pragma clang scope [push|pop]` (PR #121025)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 23 20:17:21 PST 2024
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 2c95e60df53ba1a5765b3fad9e8ddaff70f21994 5433a9134beb8faf1e2b662c96f76d7e8bc814de --extensions h,c,cpp -- clang/test/Lexer/Inputs/SomeHeaderThatDefinesAwfulThings.h clang/test/Lexer/pragma-scope.c clang/include/clang/Lex/Preprocessor.h clang/lib/Lex/PPMacroExpansion.cpp clang/lib/Lex/Pragma.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 96240533de..7d9292d072 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -1059,7 +1059,8 @@ private:
/// Warning information for macro annotations.
llvm::DenseMap<const IdentifierInfo *, MacroAnnotations> AnnotationInfos;
- using MacroScopeVec = llvm::SmallVector<std::pair<IdentifierInfo *, MacroDirective *> >;
+ using MacroScopeVec =
+ llvm::SmallVector<std::pair<IdentifierInfo *, MacroDirective *>>;
MacroScopeVec *CurScope = nullptr;
llvm::SmallVector<MacroScopeVec> MacroScopeStack;
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index f47a2eb1a3..ecc37bbd01 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -80,9 +80,9 @@ void Preprocessor::popMacroScope(SourceLocation Loc) {
for (auto It = CurScope->rbegin(); It != CurScope->rend(); ++It) {
MacroDirective *Prev = It->second->getPrevious();
if (Prev && Prev->getKind() == MacroDirective::MD_Define) {
- DefMacroDirective *MD =
- AllocateDefMacroDirective(Prev->getMacroInfo(), Loc);
- appendMacroDirective(It->first, MD);
+ DefMacroDirective *MD =
+ AllocateDefMacroDirective(Prev->getMacroInfo(), Loc);
+ appendMacroDirective(It->first, MD);
} else {
UndefMacroDirective *Undef = AllocateUndefMacroDirective(Loc);
appendMacroDirective(It->first, Undef);
@@ -105,7 +105,7 @@ void Preprocessor::appendMacroDirective(IdentifierInfo *II,
StoredMD.overrideActiveModuleMacros(*this, II);
if (CurScope)
- CurScope->push_back(std::make_pair(II,MD));
+ CurScope->push_back(std::make_pair(II, MD));
if (needModuleMacros()) {
// Track that we created a new macro directive, so we know we should
@@ -1192,8 +1192,8 @@ static bool HasExtension(const Preprocessor &PP, StringRef Extension) {
Extension.size() >= 4)
Extension = Extension.substr(2, Extension.size() - 4);
- // Because we inherit the feature list from HasFeature, this string switch
- // must be less restrictive than HasFeature's.
+ // Because we inherit the feature list from HasFeature, this string switch
+ // must be less restrictive than HasFeature's.
#define EXTENSION(Name, Predicate) .Case(#Name, Predicate)
return llvm::StringSwitch<bool>(Extension)
#include "clang/Basic/Features.def"
``````````
</details>
https://github.com/llvm/llvm-project/pull/121025
More information about the cfe-commits
mailing list