Skip to content

[LLVM][tools] Remove unnecessary newline from error message #120037

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

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

sunshaoce
Copy link
Contributor

@sunshaoce sunshaoce commented Dec 16, 2024

The previous missing a newline:

$ llc --mattr=help
llc: error: unable to get target for 'unknown', see --version and --triple.$

@llvmbot llvmbot added the mc Machine (object) code label Dec 16, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-mc

Author: Shao-Ce SUN (sunshaoce)

Changes

This reverts commit 696eb3a.

The previous commit caused missing a newline:

$ llc --mattr=help
llc: error: unable to get target for 'unknown', see --version and --triple.$

Full diff: https://github.com/llvm/llvm-project/pull/120037.diff

1 Files Affected:

  • (modified) llvm/lib/MC/TargetRegistry.cpp (+3-2)
diff --git a/llvm/lib/MC/TargetRegistry.cpp b/llvm/lib/MC/TargetRegistry.cpp
index 3be6f1d4634990..b1c1f93791f679 100644
--- a/llvm/lib/MC/TargetRegistry.cpp
+++ b/llvm/lib/MC/TargetRegistry.cpp
@@ -142,8 +142,9 @@ const Target *TargetRegistry::lookupTarget(StringRef ArchName,
     std::string TempError;
     TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), TempError);
     if (!TheTarget) {
-      Error = "unable to get target for '" + TheTriple.getTriple() +
-              "', see --version and --triple.";
+      Error = "unable to get target for '"
+            + TheTriple.getTriple()
+            + "', see --version and --triple.\n";
       return nullptr;
     }
   }

Copy link

github-actions bot commented Dec 16, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@arichardson
Copy link
Member

I don't think the error should contain a newline, probably better to add it to LLC. I don't think any of the other errors have it.

@sunshaoce
Copy link
Contributor Author

Yes, you are right. I made modifications in llc.

@sunshaoce sunshaoce changed the title Revert "Remove unnecessary newline from error message" [LLVM][tools] Remove unnecessary newline from error message Dec 16, 2024
@arichardson
Copy link
Member

Do any other users of this function need to be updated?

@sunshaoce
Copy link
Contributor Author

I tried searching for the lookupTarget with three arguments, and it seems there is no problem now.

@sunshaoce sunshaoce merged commit aff3e68 into llvm:main Dec 16, 2024
8 checks passed
@sunshaoce sunshaoce deleted the llc branch December 16, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants