Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alignas(xxx) is repeated #456

Closed
nickhuang99 opened this issue Mar 24, 2022 · 1 comment
Closed

alignas(xxx) is repeated #456

nickhuang99 opened this issue Mar 24, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@nickhuang99
Copy link

Taking tests/AlignAsTest.cpp as an example, the expression "alignas(128)" is repeated because it is not treated as part of global variable. To me, alignas is more or less like a sort of "assert" statement. Therefore "GetSourceRangeAfterSemi" does NOT include "alignas(128)" at all.

issue description:
original: alignas(128) char alignedArray[128];
transformed: alignas(128) alignas(128) char alignedArray[128];

suggested fix:


diff --git a/GlobalVariableHandler.cpp b/GlobalVariableHandler.cpp
index 6d3547b..49823f8 100644
--- a/GlobalVariableHandler.cpp
+++ b/GlobalVariableHandler.cpp
@@ -94,7 +94,7 @@ void GlobalVariableHandler::run(const MatchFinder::MatchResult& result)
                                  outputFormatHelper.GetString());
 
         } else {
-            mRewrite.ReplaceText(sr, outputFormatHelper.GetString());
+            //mRewrite.ReplaceText(sr, outputFormatHelper.GetString());
         }
     }
 }
@andreasfertig andreasfertig added the bug Something isn't working label May 1, 2022
@andreasfertig
Copy link
Owner

Hello @nickhuang99,

thanks for spotting and reporting this. A fix is on its way.

Andreas

andreasfertig added a commit that referenced this issue May 1, 2022
Fixed #456: Correct replacement of a `VarDecl` with attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants