Skip to content
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2d5d310
[flang]Add new intrinsic function backtrace and complete the TODO of …
dty2 Nov 25, 2024
6b57193
commit some suggestions
dty2 Nov 25, 2024
0862afd
Merge branch 'main' into dty2
dty2 Nov 25, 2024
d28136f
[flang]Import the header file config.h in flang/runtime/stop.cpp and …
dty2 Nov 26, 2024
bf60ffe
Merge branch 'dty2' of github.com:dty2/llvm-project into dty2
dty2 Nov 26, 2024
594c2b3
Merge branch 'main' into dty2
dty2 Nov 26, 2024
ca2ceb5
[flang]Handle the case when a backtrace is not available
dty2 Nov 27, 2024
156e434
Merge branch 'dty2' of github.com:dty2/llvm-project into dty2
dty2 Nov 27, 2024
6c22384
Merge branch 'main' into dty2
dty2 Nov 27, 2024
c2e4cca
[flang]update format
dty2 Nov 27, 2024
0270969
Merge branch 'dty2' of github.com:dty2/llvm-project into dty2
dty2 Nov 27, 2024
d3df426
Merge branch 'main' into dty2
dty2 Nov 27, 2024
96a861c
Merge branch 'main' into dty2
dty2 Nov 27, 2024
30e5858
[flang]Fix missing file issue
dty2 Nov 30, 2024
d7af048
[flang]format
dty2 Nov 30, 2024
f2fdf26
[flang]Solved the build problem in window environment
dty2 Nov 30, 2024
6e6c1a5
[flang]format
dty2 Nov 30, 2024
1e59e61
use FORTRAN_PROCEDURE_NAME
dty2 Dec 8, 2024
441eede
update Intrinstic doc
dty2 Dec 8, 2024
624a42a
change ABORT
dty2 Dec 9, 2024
24d293a
Merge branch 'llvm:main' into dty2
dty2 Dec 19, 2024
35f3eb2
Merge branch 'main' of github.com:llvm/llvm-project into dty2
dty2 Dec 19, 2024
521fa78
[Clang] Repair the functionrParenEndsCast to make incorrect judgments…
dty2 Dec 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"

#define DEBUG_TYPE "format-token-annotator"
Expand All @@ -38,6 +40,9 @@ static bool mustBreakAfterAttributes(const FormatToken &Tok,

namespace {

SmallVector<llvm::StringRef, 100> castIdentifiers{"__type_identity_t",
"remove_reference_t"};

/// Returns \c true if the line starts with a token that can start a statement
/// with an initializer.
static bool startsWithInitStatement(const AnnotatedLine &Line) {
Expand Down Expand Up @@ -2474,6 +2479,9 @@ class AnnotatingParser {
Current.getNextNonComment()->isOneOf(tok::comma, tok::r_brace)) {
Current.setType(TT_StringInConcatenation);
}
} else if (Current.is(tok::kw_using)) {
if (Current.Next->Next->Next->isTypeName(LangOpts))
castIdentifiers.push_back(Current.Next->TokenText);
} else if (Current.is(tok::l_paren)) {
if (lParenStartsCppCast(Current))
Current.setType(TT_CppCastLParen);
Expand Down Expand Up @@ -2831,8 +2839,18 @@ class AnnotatingParser {
IsQualifiedPointerOrReference(BeforeRParen, LangOpts);
bool ParensCouldEndDecl =
AfterRParen->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater);
if (ParensAreType && !ParensCouldEndDecl)
if (ParensAreType && !ParensCouldEndDecl) {
if (BeforeRParen->is(TT_TemplateCloser)) {
auto *Prev = BeforeRParen->MatchingParen->getPreviousNonComment();
if (Prev) {
for (auto &name : castIdentifiers)
if (Prev->TokenText == name)
return true;
return false;
}
}
return true;
}

// At this point, we heuristically assume that there are no casts at the
// start of the line. We assume that we have found most cases where there
Expand Down
Loading