This is an archive of the discontinued LLVM Phabricator instance.

[clang][ASTImporter][NFC]: Move clang::ImportError into own header.
ClosedPublic

Authored by phyBrackets on May 2 2022, 8:53 AM.

Diff Detail

Event Timeline

phyBrackets created this revision.May 2 2022, 8:53 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: martong. · View Herald Transcript
phyBrackets requested review of this revision.May 2 2022, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 8:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
phyBrackets retitled this revision from [AST][FIXME]: trying to fixed a fixme in ASTImporterSharedState.h to [AST][FIXME]: Address a fixme in ASTImporterSharedState.h.May 2 2022, 9:54 AM
phyBrackets retitled this revision from [AST][FIXME]: Address a fixme in ASTImporterSharedState.h to [ASTImporter][NFC]: Address a fixme in ASTImporterSharedState.h.May 2 2022, 12:05 PM
phyBrackets edited the summary of this revision. (Show Details)
phyBrackets added a reviewer: shafik.
phyBrackets retitled this revision from [ASTImporter][NFC]: Address a fixme in ASTImporterSharedState.h to [clang][ASTImporter][NFC]: Address a fixme in ASTImporterSharedState.h.May 2 2022, 12:15 PM

The ASTImporterLookupTable was not dependent on the ImportError so the header should not be included in that file. It is better in ASTImporterSharedState.h. Alternative solution is to add class ASTImportError into ASTImporterSharedState.h (no new header is needed) and use this file from ASTImporter.h.

clang/include/clang/AST/ASTImportError.h
2
23

Rename to ASTImportError.

clang/include/clang/AST/ASTImporter.h
17

Include ASTImportError.h.

clang/include/clang/AST/ASTImporterLookupTable.h
17 ↗(On Diff #426429)

This include is not needed here.

A better title: "Move clang::ImportError into own header and rename it (NFC)."

phyBrackets retitled this revision from [clang][ASTImporter][NFC]: Address a fixme in ASTImporterSharedState.h to [clang][ASTImporter][NFC]: Move clang::ImportError into own header and rename it ..May 3 2022, 12:17 PM
phyBrackets edited the summary of this revision. (Show Details)
phyBrackets added inline comments.May 3 2022, 12:21 PM
clang/include/clang/AST/ASTImporterLookupTable.h
17 ↗(On Diff #426429)

Hey thanks for reviewing , I have a doubt if I remove this include it from here , then I need to include this header in the ASTImporterSharedState.h , now the ASTImporterSharedState.h and ASTImporter.h both have ASTImportError.h included , isn't this affect on ASTImporter.cpp file on conflicting over ASTImportError ? Strangely it builds fine on my system tho .

balazske added inline comments.May 4 2022, 12:34 AM
clang/include/clang/AST/ASTImportError.h
18

This header is probably not needed.

23

The rename to ASTImportError is better in a separate patch. The rename would touch code in much more places and there is a rule to make independent changes in separate patches. Still I think this class should not be called just ImportError if it has an own header (it is not an internal-like class of ASTImporter as is used to be).

clang/include/clang/AST/ASTImporterLookupTable.h
17 ↗(On Diff #426429)

isn't this affect on ASTImporter.cpp file on conflicting over ASTImportError ?

This is no problem, this is why the include guard #ifndef LLVM_CLANG_AST_ASTIMPORTERROR_H is there.

phyBrackets added inline comments.May 4 2022, 12:48 AM
clang/include/clang/AST/ASTImportError.h
23

So, what do you suggest , for this patch should I go with name ImportError only ? And rename it as ASTImportError in a separate patch ?

phyBrackets added inline comments.May 4 2022, 12:49 AM
clang/include/clang/AST/ASTImporterLookupTable.h
17 ↗(On Diff #426429)

ahh yes! Thanks

balazske added inline comments.May 4 2022, 1:05 AM
clang/include/clang/AST/ASTImportError.h
2
23

Yes: Do not change the class name here (but header should be called ASTImportError.h). In a next patch make only a rename.

51

Please add newline. I do not know if this can cause buildbot failures.

Address inline comments

phyBrackets marked 6 inline comments as done.May 4 2022, 6:53 AM
phyBrackets retitled this revision from [clang][ASTImporter][NFC]: Move clang::ImportError into own header and rename it . to [clang][ASTImporter][NFC]: Move clang::ImportError into own header..

It looks mostly good now, apart from the line 1 comment problem. Usually in a review all phabricator diffs are created against the original commit or at least against an existing (in the current github repository) commit, here the last diff seems to be against an other commit. The next diff should be based on an existing commit (can be same as the original base). Otherwise the arc patch command may not work (I do not know if you use it) and it is difficult to compare changes related to the original code.

clang/include/clang/AST/ASTImportError.h
2

One small problem: This line 2 is the end of line 1, this should be part of line 1. Line 1 should be exactly 80 characters long.

address inline comment

I'm having a problem , this patch expected to address the previous inline comment but after making the specific change and committing it , when I'm creating the patch using arc diff --update <revisionId> , the changes were suddenly gone and I thought that maybe the changes were there in the commit atleast but I think commit got reverted and there is nothing for diff but suddenly the patch were created .

address inline comment

I'm having a problem , this patch expected to address the previous inline comment but after making the specific change and committing it , when I'm creating the patch using arc diff --update <revisionId> , the changes were suddenly gone and I thought that maybe the changes were there in the commit atleast but I think commit got reverted and there is nothing for diff but suddenly the patch were created .

I think there was the problem with number of the character in line 1 , Now it seems correct .

Correct the number of character in line 1

address the buildbot failing issue

is there still any problem ? I'm not sure ?

The code looks correct but the diff is not OK. I think that you have separate commits for every change (instead of changing the first with git commit --amend when a new change is made). In this case arc diff --update <ID> main may work (if you have a separate branch for the changes). (I did not found a place in LLVM docs where this part of the process is exactly described.)

The code looks correct but the diff is not OK. I think that you have separate commits for every change (instead of changing the first with git commit --amend when a new change is made). In this case arc diff --update <ID> main may work (if you have a separate branch for the changes). (I did not found a place in LLVM docs where this part of the process is exactly described.)

Yes, you should see that your baseline is valid. Below, the highlighted commit does not exists in the remote (in the upstream repository).

I suggest the following.

git remote add llvm git@github.com:llvm/llvm-project.git
git fetch llvm
git rebase -i llvm/main //choose your relevant commits
arc diff --update D124774 llvm/main

Rebase several commits

martong accepted this revision.May 5 2022, 8:35 AM

LGTM

This revision is now accepted and ready to land.May 5 2022, 8:35 AM

Thanks @martong @balazske for the Review .